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

Chad Rosier mcrosier at apple.com
Wed Aug 17 17:22:25 PDT 2011


Author: mcrosier
Date: Wed Aug 17 19:22:25 2011
New Revision: 137906

URL: http://llvm.org/viewvc/llvm-project?rev=137906&view=rev
Log:
[driver] Don't generate diagnostics (i.e., preprocessed source) if reading 
from stdin.  This allows Eli and the like to continue with their debugging 
trickery without loss of limb (or car) on my part. :)


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=137906&r1=137905&r2=137906&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed Aug 17 19:22:25 2011
@@ -392,15 +392,27 @@
   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) {
+    bool IgnoreInput = false;
+
+    // Ignore input from stdin or any inputs that cannot be preprocessed.
+    if (!strcmp(it->second->getValue(C.getArgs()), "-")) {
+      Diag(clang::diag::note_drv_command_failed_diag_msg)
+        << "Error generating preprocessed source(s) - ignoring input from stdin"
+        ".";
+      IgnoreInput = true;
+    } else if (types::getPreprocessedType(it->first) == types::TY_INVALID) {
+      IgnoreInput = true;
+    }
+
+    if (IgnoreInput) {
       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.";





More information about the cfe-commits mailing list