[cfe-commits] r67425 - in /cfe/trunk: include/clang/Driver/Driver.h lib/Driver/Compilation.cpp tools/driver/driver.cpp

Daniel Dunbar daniel at zuster.org
Fri Mar 20 17:40:54 PDT 2009


Author: ddunbar
Date: Fri Mar 20 19:40:53 2009
New Revision: 67425

URL: http://llvm.org/viewvc/llvm-project?rev=67425&view=rev
Log:
Driver: Give Compilation::Execute total control over the Driver result
code; and don't return an error code when -### is present, even if
errors occur.

Modified:
    cfe/trunk/include/clang/Driver/Driver.h
    cfe/trunk/lib/Driver/Compilation.cpp
    cfe/trunk/tools/driver/driver.cpp

Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=67425&r1=67424&r2=67425&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Fri Mar 20 19:40:53 2009
@@ -109,6 +109,8 @@
 
   const OptTable &getOpts() const { return *Opts; }
 
+  const Diagnostic &getDiags() const { return Diags; }
+
   /// @}
   /// @name Primary Functionality
   /// @{

Modified: cfe/trunk/lib/Driver/Compilation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=67425&r1=67424&r2=67425&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Compilation.cpp (original)
+++ cfe/trunk/lib/Driver/Compilation.cpp Fri Mar 20 19:40:53 2009
@@ -160,6 +160,10 @@
     return 0;
   }
 
+  // If there were errors building the compilation, quit now.
+  if (getDriver().getDiags().getNumErrors())
+    return 1;
+
   int Res = ExecuteJob(Jobs);
   
   // Remove temp files.

Modified: cfe/trunk/tools/driver/driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=67425&r1=67424&r2=67425&view=diff

==============================================================================
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Fri Mar 20 19:40:53 2009
@@ -87,15 +87,11 @@
                                                
   llvm::OwningPtr<Compilation> C(TheDriver->BuildCompilation(argc, argv));
 
-  // If there were errors building the compilation, quit now.
-  if (Diags.getNumErrors())
-    return 1;
-  if (!C.get())
-    return 0;
-
-  int res = C->Execute();
+  int Res = 0;
+  if (C.get())
+    Res = C->Execute();
 
   llvm::llvm_shutdown();
 
-  return res;
+  return Res;
 }





More information about the cfe-commits mailing list