Type *TypeInfer::visit(Function *V) { auto FTy = cast<FunctionType>(V->getType()); auto Ty = visit(V->getEntryBlock()); if (isa<UnType>(FTy->getRTy())) { FTy = FunctionType::get(Ty, FTy->getATys(), false); V->setType(FTy); } return FTy; }
std::string Prototype::getMangledName() const { std::ostringstream Scratch; auto FTy = cast<FunctionType>(VTy); Scratch << "std_" << *FTy->returnType() << "_" << Name << "__"; auto ATys = FTy->getATys(); Scratch << *ATys.front(); ATys.erase(ATys.begin()); for (auto ATy : ATys) Scratch << "_" << *ATy; return Scratch.str(); }