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

Chad Rosier mcrosier at apple.com
Fri Aug 12 16:30:05 PDT 2011


Author: mcrosier
Date: Fri Aug 12 18:30:05 2011
New Revision: 137532

URL: http://llvm.org/viewvc/llvm-project?rev=137532&view=rev
Log:
[driver] When generating clang failure diagnostics, don't try to preprocess 
inputs that aren't preprocessable.

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=137532&r1=137531&r2=137532&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Aug 12 18:30:05 2011
@@ -392,6 +392,20 @@
   InputList Inputs;
   BuildInputs(C.getDefaultToolChain(), C.getArgs(), Inputs);
 
+  // Remove any inputs from the input list that cannot be preprocessed.
+  for (InputList::iterator it = Inputs.begin(), ie = Inputs.end(); it != ie;) {
+    if (types::getPreprocessedType(it->first) == types::TY_INVALID) {
+      it = Inputs.erase(it);
+      ie = Inputs.end();
+    } else
+      ++it;
+  }
+  if (Inputs.empty()) {
+    Diag(clang::diag::note_drv_command_failed_diag_msg)
+      << "Error generating preprocessed source(s) - no preprocessable inputs.";
+    return;
+  }
+
   // Construct the list of abstract actions to perform for this compilation.
   if (Host->useDriverDriver())
     BuildUniversalActions(C.getDefaultToolChain(), C.getArgs(),





More information about the cfe-commits mailing list