summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-08-05 18:50:11 +0000
committerTed Kremenek <kremenek@apple.com>2008-08-05 18:50:11 +0000
commit2c674f6dbb086a813b32cd66a8be49407ff4f576 (patch)
tree23daaff5e9b9d53f7f9b0685dfc4d8164af6ca80 /clang/lib/CodeGen/CodeGenModule.cpp
parent568bbf73b247cbebf0cb19ddf629610af3a3c86b (diff)
downloadbcm5719-llvm-2c674f6dbb086a813b32cd66a8be49407ff4f576.tar.gz
bcm5719-llvm-2c674f6dbb086a813b32cd66a8be49407ff4f576.zip
Refactored driver logic for CodeGen into LLVMCodeGenWriter. This ASTConsumer layers on top of LLVMCodeGen (another existing ASTConsumer) to emit bitcode files to disk. This layering takes this logic out of clang.cpp and puts it directly into the ASTConsumer interface. The benefit is that now --emit-llvm works with both serialized ASTs and regular source files.
llvm-svn: 54364
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 5d85b7a70f4..0c3b872b9a9 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -42,13 +42,15 @@ CodeGenModule::CodeGenModule(ASTContext &C, const LangOptions &LO,
Runtime = CreateObjCRuntime(*this);
// If debug info generation is enabled, create the CGDebugInfo object.
- if (GenerateDebugInfo)
- DebugInfo = new CGDebugInfo(this);
- else
- DebugInfo = NULL;
+ DebugInfo = GenerateDebugInfo ? new CGDebugInfo(this) : 0;
}
CodeGenModule::~CodeGenModule() {
+ delete Runtime;
+ delete DebugInfo;
+}
+
+void CodeGenModule::Release() {
EmitStatics();
llvm::Function *ObjCInitFunction = Runtime->ModuleInitFunction();
if (ObjCInitFunction)
@@ -56,8 +58,6 @@ CodeGenModule::~CodeGenModule() {
EmitCtorList(GlobalCtors, "llvm.global_ctors");
EmitCtorList(GlobalDtors, "llvm.global_dtors");
EmitAnnotations();
- delete Runtime;
- delete DebugInfo;
// Run the verifier to check that the generated code is consistent.
assert(!verifyModule(TheModule));
}
OpenPOWER on IntegriCloud