manojgupta created this revision.

If a .h file is specifed as input, it gets compiled to a PCH file.
Handle the PCH Action and do not throw the error:
"cannot specify -o when generating multiple output files"

This fixes PR33533.


https://reviews.llvm.org/D34426

Files:
  lib/Driver/Driver.cpp


Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -76,6 +76,7 @@
 #if LLVM_ON_UNIX
 #include <unistd.h> // getpid
 #endif
+#include <iostream>
 
 using namespace clang::driver;
 using namespace clang;
@@ -2759,7 +2760,7 @@
   if (FinalOutput) {
     unsigned NumOutputs = 0;
     for (const Action *A : C.getActions())
-      if (A->getType() != types::TY_Nothing)
+      if (A->getType() != types::TY_Nothing && A->getType() != types::TY_PCH)
         ++NumOutputs;
 
     if (NumOutputs > 1) {


Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -76,6 +76,7 @@
 #if LLVM_ON_UNIX
 #include <unistd.h> // getpid
 #endif
+#include <iostream>
 
 using namespace clang::driver;
 using namespace clang;
@@ -2759,7 +2760,7 @@
   if (FinalOutput) {
     unsigned NumOutputs = 0;
     for (const Action *A : C.getActions())
-      if (A->getType() != types::TY_Nothing)
+      if (A->getType() != types::TY_Nothing && A->getType() != types::TY_PCH)
         ++NumOutputs;
 
     if (NumOutputs > 1) {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to