From 2c674f6dbb086a813b32cd66a8be49407ff4f576 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 5 Aug 2008 18:50:11 +0000 Subject: 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 --- clang/lib/CodeGen/CodeGenModule.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 5d85b7a70f44..0c3b872b9a9a 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)); } -- cgit v1.2.3