[cfe-commits] r39503 - /cfe/cfe/trunk/Driver/LLVMCodegen.cpp

clattner at cs.uiuc.edu clattner at cs.uiuc.edu
Wed Jul 11 09:45:03 PDT 2007


Author: clattner
Date: Wed Jul 11 11:45:03 2007
New Revision: 39503

URL: http://llvm.org/viewvc/llvm-project?rev=39503&view=rev
Log:
Stop generating code after the first error is emitted.

Modified:
    cfe/cfe/trunk/Driver/LLVMCodegen.cpp

Modified: cfe/cfe/trunk/Driver/LLVMCodegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Driver/LLVMCodegen.cpp?rev=39503&r1=39502&r2=39503&view=diff

==============================================================================
--- cfe/cfe/trunk/Driver/LLVMCodegen.cpp (original)
+++ cfe/cfe/trunk/Driver/LLVMCodegen.cpp Wed Jul 11 11:45:03 2007
@@ -16,6 +16,7 @@
 #include "clang/Sema/ASTStreamer.h"
 #include "clang/AST/AST.h"
 #include "clang/Lex/Preprocessor.h"
+#include "clang/Basic/Diagnostic.h"
 #include "llvm/Module.h"
 #include <iostream>
 using namespace llvm;
@@ -38,7 +39,10 @@
   CodeGen::BuilderTy *Builder = CodeGen::Init(Context, M);
   
   while (Decl *D = ASTStreamer_ReadTopLevelDecl(Streamer)) {
-    // FIXME:  if (Diags.error ever occurred) continue;
+    // If an error occurred, stop code generation, but continue parsing and
+    // semantic analysis (to ensure all warnings and errors are emitted).
+    if (Diags.hasErrorOccurred())
+      continue;
     
     if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
       CodeGen::CodeGenFunction(Builder, FD);





More information about the cfe-commits mailing list