[cfe-commits] r139207 - /cfe/trunk/lib/Driver/Driver.cpp

Chad Rosier mcrosier at apple.com
Tue Sep 6 16:52:36 PDT 2011


Author: mcrosier
Date: Tue Sep  6 18:52:36 2011
New Revision: 139207

URL: http://llvm.org/viewvc/llvm-project?rev=139207&view=rev
Log:
[driver] When clang crashes, don't try to generate diagnostics (i.e., 
preprocessor output) with multiple -arch options.

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

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=139207&r1=139206&r2=139207&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Sep  6 18:52:36 2011
@@ -396,6 +396,23 @@
     }
   }
 
+  // Don't attempt to generate preprocessed files if multiple -arch options are
+  // used.
+  int Archs = 0;
+  for (ArgList::const_iterator it = C.getArgs().begin(), ie = C.getArgs().end();
+       it != ie; ++it) {
+    Arg *A = *it;
+    if (A->getOption().matches(options::OPT_arch)) {
+      Archs++;
+      if (Archs > 1) {
+        Diag(clang::diag::note_drv_command_failed_diag_msg)
+          << "Error generating preprocessed source(s) - cannot generate "
+          "preprocessed source with multiple -arch options.";
+        return;
+      }
+    }
+  }
+
   if (Inputs.empty()) {
     Diag(clang::diag::note_drv_command_failed_diag_msg)
       << "Error generating preprocessed source(s) - no preprocessable inputs.";





More information about the cfe-commits mailing list