From 4a9ec7b59d1ebbb046987dbde2bd0372c6d66170 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 19 Aug 2013 21:02:26 +0000 Subject: 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 --- clang/lib/CodeGen/CodeGenModule.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index dc0ffc1d852..2ef3f39ea51 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -264,10 +264,7 @@ void CodeGenModule::Error(SourceLocation loc, StringRef error) { /// ErrorUnsupported - Print out an error that codegen doesn't support the /// specified stmt yet. -void CodeGenModule::ErrorUnsupported(const Stmt *S, const char *Type, - bool OmitOnError) { - if (OmitOnError && getDiags().hasErrorOccurred()) - return; +void CodeGenModule::ErrorUnsupported(const Stmt *S, const char *Type) { unsigned DiagID = getDiags().getCustomDiagID(DiagnosticsEngine::Error, "cannot compile this %0 yet"); std::string Msg = Type; @@ -277,10 +274,7 @@ void CodeGenModule::ErrorUnsupported(const Stmt *S, const char *Type, /// ErrorUnsupported - Print out an error that codegen doesn't support the /// specified decl yet. -void CodeGenModule::ErrorUnsupported(const Decl *D, const char *Type, - bool OmitOnError) { - if (OmitOnError && getDiags().hasErrorOccurred()) - return; +void CodeGenModule::ErrorUnsupported(const Decl *D, const char *Type) { unsigned DiagID = getDiags().getCustomDiagID(DiagnosticsEngine::Error, "cannot compile this %0 yet"); std::string Msg = Type; @@ -2796,12 +2790,6 @@ void CodeGenModule::EmitLinkageSpec(const LinkageSpecDecl *LSD) { /// EmitTopLevelDecl - Emit code for a single top level declaration. void CodeGenModule::EmitTopLevelDecl(Decl *D) { - // If an error has occurred, stop code generation, but continue - // parsing and semantic analysis (to ensure all warnings and errors - // are emitted). - if (Diags.hasErrorOccurred()) - return; - // Ignore dependent declarations. if (D->getDeclContext() && D->getDeclContext()->isDependentContext()) return; -- cgit v1.2.3