void CodeGenModule::EmitCXXConstructor(const CXXConstructorDecl *D,
CXXCtorType Type) {
- const llvm::FunctionType *Ty =
- getTypes().GetFunctionType(getTypes().getFunctionInfo(D), false);
- const char *Name = getMangledCXXCtorName(D, Type);
- llvm::Function *Fn =
- cast<llvm::Function>(GetOrCreateLLVMFunction(Name, Ty, D));
+ llvm::Function *Fn = GetAddrOfCXXConstructor(D, Type);
CodeGenFunction(*this).GenerateCode(D, Fn);
EmitCXXConstructor(D, Ctor_Complete);
EmitCXXConstructor(D, Ctor_Base);
}
+
+llvm::Function *
+CodeGenModule::GetAddrOfCXXConstructor(const CXXConstructorDecl *D,
+ CXXCtorType Type) {
+ const llvm::FunctionType *FTy =
+ getTypes().GetFunctionType(getTypes().getFunctionInfo(D), false);
+
+ const char *Name = getMangledCXXCtorName(D, Type);
+ return cast<llvm::Function>(GetOrCreateLLVMFunction(Name, FTy, D));
+}
llvm::Constant *GetAddrOfConstantCString(const std::string &str,
const char *GlobalName=0);
+ /// GetAddrOfCXXConstructor - Return the address of the constructor of the
+ /// given type.
+ llvm::Function *GetAddrOfCXXConstructor(const CXXConstructorDecl *D,
+ CXXCtorType Type);
+
/// getBuiltinLibFunction - Given a builtin id for a function like
/// "__builtin_fabsf", return a Function* for "fabsf".
llvm::Value *getBuiltinLibFunction(unsigned BuiltinID);