]> granicus.if.org Git - clang/commitdiff
[driver] When clang crashes, don't try to generate diagnostics (i.e.,
authorChad Rosier <mcrosier@apple.com>
Tue, 6 Sep 2011 23:52:36 +0000 (23:52 +0000)
committerChad Rosier <mcrosier@apple.com>
Tue, 6 Sep 2011 23:52:36 +0000 (23:52 +0000)
preprocessor output) with multiple -arch options.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139207 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Driver.cpp

index bb018595882896f27941682d295dd56878c236e3..0f373b37298f36ee27beb89992eedc29d995a32e 100644 (file)
@@ -396,6 +396,23 @@ void Driver::generateCompilationDiagnostics(Compilation &C,
     }
   }
 
+  // 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.";