]> granicus.if.org Git - clang/commitdiff
clang-cl: Don't skip i_group flags other than -include when building pchs.
authorNico Weber <nicolasweber@gmx.de>
Sat, 2 Apr 2016 19:10:07 +0000 (19:10 +0000)
committerNico Weber <nicolasweber@gmx.de>
Sat, 2 Apr 2016 19:10:07 +0000 (19:10 +0000)
Before this change, e.g. -isystem flags in front of the /FI corresponding to the
pch file would be incorrectly ignored.

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

lib/Driver/Tools.cpp
test/Driver/cl-pch-search.cpp

index b7981c045e3c61f7e9d806f8fbbcfd718b5a7087..824ee72dcd241ff76fbd2592dbf3314adfd15f97 100644 (file)
@@ -416,7 +416,8 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
   for (const Arg *A : Args.filtered(options::OPT_clang_i_Group)) {
     ++AI;
 
-    if (getToolChain().getDriver().IsCLMode()) {
+    if (getToolChain().getDriver().IsCLMode() &&
+        A->getOption().matches(options::OPT_include)) {
       // In clang-cl mode, /Ycfoo.h means that all code up to a foo.h
       // include is compiled into foo.h, and everything after goes into
       // the .obj file. /Yufoo.h means that all includes prior to and including
index 118cf19efbd54579cf8cb65b4a45996619d8c254..fd503f1f801971dc780e2181b22ad1f6100f759f 100644 (file)
@@ -4,3 +4,7 @@
 // REQUIRES: x86-registered-target
 // Check that pchfile.h next to to pchfile.cc is found correctly.
 // RUN: %clang_cl -Werror /Ycpchfile.h /FIpchfile.h /c /Fo%t.obj /Fp%t.pch -- %S/Inputs/pchfile.cpp 
+
+// Check that i_group flags other than -include aren't skipped (e.g. -isystem).
+#include "header0.h"
+// RUN: %clang_cl -Werror -isystem%S/Inputs /Yupchfile.h /FIpchfile.h /c /Fo%t.obj /Fp%t.pch -- %s