ParseAST now conditionally deletes the passed ASTConsumer.

ModuleBuilder now performs llvmgen in HandleTranslationUnit.

This patch follows from the discussion on the following thread on cfe-commits:

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080804/006849.html

llvm-svn: 54486
This commit is contained in:
Ted Kremenek
2008-08-07 19:47:41 +00:00
parent 02ff450f13
commit 7db4f60b26
3 changed files with 15 additions and 11 deletions

View File

@@ -49,13 +49,7 @@ namespace {
virtual ~CodeGeneratorImpl() {}
virtual llvm::Module* ReleaseModule() {
if (Diags.hasErrorOccurred())
return 0;
if (Builder)
Builder->Release();
virtual llvm::Module* ReleaseModule() {
return M.take();
}
@@ -134,7 +128,16 @@ namespace {
virtual void HandleTagDeclDefinition(TagDecl *D) {
Builder->UpdateCompletedType(D);
}
virtual void HandleTranslationUnit(TranslationUnit& TU) {
if (Diags.hasErrorOccurred()) {
M.reset();
return;
}
if (Builder)
Builder->Release();
};
};
}