summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-03-30 23:25:33 +0000
committerChris Lattner <sabre@nondot.org>2008-03-30 23:25:33 +0000
commitc00c35a857317ef11d7944567320e586479c186e (patch)
tree6b87b67a91c39979f510708482465312d6982a02 /clang/lib/CodeGen/CodeGenModule.cpp
parent4bd5596d0827ce8d021c8b67fcd9dca041d654ba (diff)
downloadbcm5719-llvm-c00c35a857317ef11d7944567320e586479c186e.tar.gz
bcm5719-llvm-c00c35a857317ef11d7944567320e586479c186e.zip
some cleanups on top of David's patch. There are still two
remaining open issues I've communicated to him: 1) self can be assigned to, and his patch didn't handle it correctly. 2) CollectObjCIvarTypes is N^2 (because each subclass reprocesses all parent class ivars) and flattens classes. If A derives from B, and both have an int, I'd expect to get { {i32}, i32}, not { i32, i32}. David, please review. llvm-svn: 48970
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 8374f2bab6c..21b372b3477 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -41,9 +41,8 @@ CodeGenModule::CodeGenModule(ASTContext &C, const LangOptions &LO,
CodeGenModule::~CodeGenModule() {
llvm::Function *ObjCInitFunction = Runtime->ModuleInitFunction();
- if (ObjCInitFunction) {
+ if (ObjCInitFunction)
AddGlobalCtor(ObjCInitFunction);
- }
EmitGlobalCtors();
delete Runtime;
}
@@ -80,15 +79,15 @@ void CodeGenModule::AddGlobalCtor(llvm::Function * Ctor) {
/// called on module load, if any have been registered with AddGlobalCtor.
void CodeGenModule::EmitGlobalCtors() {
if (GlobalCtors.empty()) return;
+
// Get the type of @llvm.global_ctors
std::vector<const llvm::Type*> CtorFields;
CtorFields.push_back(llvm::IntegerType::get(32));
// Constructor function type
std::vector<const llvm::Type*> VoidArgs;
- llvm::FunctionType* CtorFuncTy = llvm::FunctionType::get(
- llvm::Type::VoidTy,
- VoidArgs,
- false);
+ llvm::FunctionType* CtorFuncTy =
+ llvm::FunctionType::get(llvm::Type::VoidTy, VoidArgs, false);
+
// i32, function type pair
const llvm::Type *FPType = llvm::PointerType::getUnqual(CtorFuncTy);
llvm::StructType* CtorStructTy =
@@ -120,7 +119,6 @@ void CodeGenModule::EmitGlobalCtors() {
GlobalCtorsVal->setInitializer(llvm::ConstantArray::get(GlobalCtorsTy,
CtorValues));
-
}
OpenPOWER on IntegriCloud