[cfe-commits] r93281 - /cfe/trunk/tools/driver/cc1_main.cpp

Daniel Dunbar daniel at zuster.org
Tue Jan 12 16:47:51 PST 2010


Author: ddunbar
Date: Tue Jan 12 18:47:51 2010
New Revision: 93281

URL: http://llvm.org/viewvc/llvm-project?rev=93281&view=rev
Log:
cc1: Lift creation of the FrontendAction higher.

Modified:
    cfe/trunk/tools/driver/cc1_main.cpp

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

==============================================================================
--- cfe/trunk/tools/driver/cc1_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1_main.cpp Tue Jan 12 18:47:51 2010
@@ -249,8 +249,11 @@
       Diags.Report(diag::err_fe_unable_to_load_plugin) << Path << Error;
   }
 
+  // Create the frontend action.
+  llvm::OwningPtr<FrontendAction> Act(CreateFrontendAction(Clang));
+
   // If there were any errors in processing arguments, exit now.
-  if (Clang.getDiagnostics().getNumErrors())
+  if (!Act || Clang.getDiagnostics().getNumErrors())
     return 1;
 
   // Create the target instance.
@@ -259,13 +262,13 @@
   if (!Clang.hasTarget())
     return 1;
 
-  // Inform the target of the language options
+  // Inform the target of the language options.
   //
   // FIXME: We shouldn't need to do this, the target should be immutable once
   // created. This complexity should be lifted elsewhere.
   Clang.getTarget().setForcedLangOptions(Clang.getLangOpts());
 
-  // Validate/process some options
+  // Validate/process some options.
   if (Clang.getHeaderSearchOpts().Verbose)
     llvm::errs() << "clang -cc1 version " CLANG_VERSION_STRING
                  << " based upon " << PACKAGE_STRING
@@ -298,10 +301,6 @@
       Clang.createPreprocessor();
     }
 
-    llvm::OwningPtr<FrontendAction> Act(CreateFrontendAction(Clang));
-    if (!Act)
-      break;
-
     if (Act->BeginSourceFile(Clang, InFile, IsAST)) {
       Act->Execute();
       Act->EndSourceFile();





More information about the cfe-commits mailing list