summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-04-16 23:57:24 +0000
committerAnders Carlsson <andersca@mac.com>2009-04-16 23:57:24 +0000
commite8eeffdf163732eda5bb45761862aa8b71810635 (patch)
treec5999d84c3b6da03ad5e7a1e16ecc5e11cc75303
parent2f3278bc09c54dcadc065d93da2cd18da9d70673 (diff)
downloadbcm5719-llvm-e8eeffdf163732eda5bb45761862aa8b71810635.tar.gz
bcm5719-llvm-e8eeffdf163732eda5bb45761862aa8b71810635.zip
Add GetAddrOfCXXConstructor and use it.
llvm-svn: 69328
-rw-r--r--clang/lib/CodeGen/CGCXX.cpp16
-rw-r--r--clang/lib/CodeGen/CodeGenModule.h5
2 files changed, 16 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp
index 2e48ebec001..f76bd122a05 100644
--- a/clang/lib/CodeGen/CGCXX.cpp
+++ b/clang/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/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index e7a587fc8c0..17a9a9f907e 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/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);
OpenPOWER on IntegriCloud