]> granicus.if.org Git - clang/commitdiff
[driver] Don't generate diagnostics (i.e., preprocessed source) if reading
authorChad Rosier <mcrosier@apple.com>
Thu, 18 Aug 2011 00:22:25 +0000 (00:22 +0000)
committerChad Rosier <mcrosier@apple.com>
Thu, 18 Aug 2011 00:22:25 +0000 (00:22 +0000)
from stdin.  This allows Eli and the like to continue with their debugging
trickery without loss of limb (or car) on my part. :)

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

lib/Driver/Driver.cpp

index 84321139ff2544e9b4a55d16d9804be52af2df66..fee601de73625c97ae76a5ffbf54d6ef01f52250 100644 (file)
@@ -392,15 +392,27 @@ void Driver::generateCompilationDiagnostics(Compilation &C,
   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.";