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

Chad Rosier mcrosier at apple.com
Mon Feb 13 10:16:28 PST 2012


Author: mcrosier
Date: Mon Feb 13 12:16:28 2012
New Revision: 150403

URL: http://llvm.org/viewvc/llvm-project?rev=150403&view=rev
Log:
When generating diagnostic information due to a clang failure, allow multiple
-arch options if the're all the same.

Patch by Jeremy Huddleston.
rdar://10849701

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=150403&r1=150402&r2=150403&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Mon Feb 13 12:16:28 2012
@@ -410,21 +410,22 @@
   }
 
   // Don't attempt to generate preprocessed files if multiple -arch options are
-  // used.
-  int Archs = 0;
+  // used, unless they're all duplicates.
+  llvm::StringSet<> ArchNames;
   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;
-      }
+      StringRef ArchName = A->getValue(C.getArgs());
+      ArchNames.insert(ArchName);
     }
   }
+  if (ArchNames.size() > 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)





More information about the cfe-commits mailing list