[PATCH] D34426: [Driver] Do not increment ActionCount for precompiled headers.

Manoj Gupta via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 20 15:32:05 PDT 2017


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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34426.103279.patch
Type: text/x-patch
Size: 598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170620/bd3968a4/attachment.bin>


More information about the cfe-commits mailing list