diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-08-11 18:12:00 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-08-11 18:12:00 +0000 |
commit | 8d480594cf8405215f888454141dce10f84748db (patch) | |
tree | f5a701e7b295a59ad88a4fb548e4a76262f5f225 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | f69d13b60af2a8b43acf453fa0f9dcc8e01b3203 (diff) | |
download | bcm5719-llvm-8d480594cf8405215f888454141dce10f84748db.tar.gz bcm5719-llvm-8d480594cf8405215f888454141dce10f84748db.zip |
Change CodeGenModule to only create ObjC runtime for ObjC files
- Changed CodeGenModule::getObjCRuntime to return reference.
- Added CodeGenModule::hasObjCRuntime predicate.
llvm-svn: 54645
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index b3e721308d6..347f4d24f90 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -33,13 +33,16 @@ CodeGenModule::CodeGenModule(ASTContext &C, const LangOptions &LO, Diagnostic &diags, bool GenerateDebugInfo, bool UseMacObjCRuntime) : Context(C), Features(LO), TheModule(M), TheTargetData(TD), Diags(diags), - Types(C, M, TD), MemCpyFn(0), MemMoveFn(0), MemSetFn(0), + Types(C, M, TD), Runtime(0), MemCpyFn(0), MemMoveFn(0), MemSetFn(0), CFConstantStringClassRef(0) { - //TODO: Make this selectable at runtime - if (UseMacObjCRuntime) { - Runtime = CreateMacObjCRuntime(*this); - } else { - Runtime = CreateGNUObjCRuntime(*this); + + if (Features.ObjC1) { + // TODO: Make this selectable at runtime + if (UseMacObjCRuntime) { + Runtime = CreateMacObjCRuntime(*this); + } else { + Runtime = CreateGNUObjCRuntime(*this); + } } // If debug info generation is enabled, create the CGDebugInfo object. @@ -53,9 +56,9 @@ CodeGenModule::~CodeGenModule() { void CodeGenModule::Release() { EmitStatics(); - llvm::Function *ObjCInitFunction = Runtime->ModuleInitFunction(); - if (ObjCInitFunction) - AddGlobalCtor(ObjCInitFunction); + if (Runtime) + if (llvm::Function *ObjCInitFunction = Runtime->ModuleInitFunction()) + AddGlobalCtor(ObjCInitFunction); EmitCtorList(GlobalCtors, "llvm.global_ctors"); EmitCtorList(GlobalDtors, "llvm.global_dtors"); EmitAnnotations(); |