diff options
author | Anders Carlsson <andersca@mac.com> | 2009-04-16 23:57:24 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-04-16 23:57:24 +0000 |
commit | 363c184139e26ea38223b477ad64ee67b22bb9a7 (patch) | |
tree | 68ea71885254c3d2867292b1c84e34304a776e70 /lib/CodeGen | |
parent | d87a5012d174ae5aa076b3fa800aecf55d70bac4 (diff) |
Add GetAddrOfCXXConstructor and use it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69328 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGCXX.cpp | 16 | ||||
-rw-r--r-- | lib/CodeGen/CodeGenModule.h | 5 |
2 files changed, 16 insertions, 5 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index 2e48ebec00..f76bd122a0 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -136,12 +136,8 @@ const char *CodeGenModule::getMangledCXXCtorName(const CXXConstructorDecl *D, 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); @@ -176,3 +172,13 @@ void CodeGenModule::EmitCXXConstructors(const CXXConstructorDecl *D) { 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)); +} diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index e7a587fc8c..17a9a9f907 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -236,6 +236,11 @@ public: 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); |