]> granicus.if.org Git - clang/commitdiff
[driver] When generating clang failure diagnostics, don't try to preprocess
authorChad Rosier <mcrosier@apple.com>
Fri, 12 Aug 2011 23:30:05 +0000 (23:30 +0000)
committerChad Rosier <mcrosier@apple.com>
Fri, 12 Aug 2011 23:30:05 +0000 (23:30 +0000)
inputs that aren't preprocessable.

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

lib/Driver/Driver.cpp

index bc25ede7c76d2fe16fd75c06623a435acd160be0..710f7dd86a1a1b160b397d44059de7e0806e943b 100644 (file)
@@ -392,6 +392,20 @@ 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) {
+      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(),