summaryrefslogtreecommitdiffstats
path: root/clang/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
commit4a9ec7b59d1ebbb046987dbde2bd0372c6d66170 (patch)
tree8f275aafba15976546c1c735aebfb16df893dfab /clang/lib/CodeGen/ModuleBuilder.cpp
parent39587672b8261cf1356f4ca8156a93cef5f8cc92 (diff)
downloadbcm5719-llvm-4a9ec7b59d1ebbb046987dbde2bd0372c6d66170.tar.gz
bcm5719-llvm-4a9ec7b59d1ebbb046987dbde2bd0372c6d66170.zip
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. llvm-svn: 188707
Diffstat (limited to 'clang/lib/CodeGen/ModuleBuilder.cpp')
-rw-r--r--clang/lib/CodeGen/ModuleBuilder.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/ModuleBuilder.cpp b/clang/lib/CodeGen/ModuleBuilder.cpp
index a33b3a38fb5..bc7acbc39ca 100644
--- a/clang/lib/CodeGen/ModuleBuilder.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud