summaryrefslogtreecommitdiff
path: root/lib/CodeGen/ModuleBuilder.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-08-19 21:02:26 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-08-19 21:02:26 +0000
commit0a1c862914664029e3b6693e134cf3ccbf423844 (patch)
tree8fed0b89b0e0b934d2fcf02f726f0bae4ccfda04 /lib/CodeGen/ModuleBuilder.cpp
parentc895f4d411152b08365cac48f330a8a7898fb382 (diff)
downloadclang-0a1c862914664029e3b6693e134cf3ccbf423844.tar.gz
clang-0a1c862914664029e3b6693e134cf3ccbf423844.tar.bz2
clang-0a1c862914664029e3b6693e134cf3ccbf423844.tar.xz
PR16933: Don't try to codegen things after we've seen errors.
Refactor the underlying code a bit to remove unnecessary calls to "hasErrorOccurred" & make them consistently at all the entry points to the IRGen ASTConsumer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188707 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ModuleBuilder.cpp')
-rw-r--r--lib/CodeGen/ModuleBuilder.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/CodeGen/ModuleBuilder.cpp b/lib/CodeGen/ModuleBuilder.cpp
index a33b3a38fb..bc7acbc39c 100644
--- a/lib/CodeGen/ModuleBuilder.cpp
+++ b/lib/CodeGen/ModuleBuilder.cpp
@@ -66,10 +66,16 @@ namespace {
}
virtual void HandleCXXStaticMemberVarInstantiation(VarDecl *VD) {
+ if (Diags.hasErrorOccurred())
+ return;
+
Builder->HandleCXXStaticMemberVarInstantiation(VD);
}
virtual bool HandleTopLevelDecl(DeclGroupRef DG) {
+ if (Diags.hasErrorOccurred())
+ return true;
+
// Make sure to emit all elements of a Decl.
for (DeclGroupRef::iterator I = DG.begin(), E = DG.end(); I != E; ++I)
Builder->EmitTopLevelDecl(*I);
@@ -81,6 +87,9 @@ namespace {
/// client hack on the type, which can occur at any point in the file
/// (because these can be defined in declspecs).
virtual void HandleTagDeclDefinition(TagDecl *D) {
+ if (Diags.hasErrorOccurred())
+ return;
+
Builder->UpdateCompletedType(D);
// In C++, we may have member functions that need to be emitted at this
@@ -98,6 +107,9 @@ namespace {
}
virtual void HandleTagDeclRequiredDefinition(const TagDecl *D) LLVM_OVERRIDE {
+ if (Diags.hasErrorOccurred())
+ return;
+
if (CodeGen::CGDebugInfo *DI = Builder->getModuleDebugInfo())
if (const RecordDecl *RD = dyn_cast<RecordDecl>(D))
DI->completeRequiredType(RD);