r265238 - clang-cl: Don't skip i_group flags other than -include when building pchs.

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 2 12:10:07 PDT 2016


Author: nico
Date: Sat Apr  2 14:10:07 2016
New Revision: 265238

URL: http://llvm.org/viewvc/llvm-project?rev=265238&view=rev
Log:
clang-cl: Don't skip i_group flags other than -include when building pchs.

Before this change, e.g. -isystem flags in front of the /FI corresponding to the
pch file would be incorrectly ignored.

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/cl-pch-search.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=265238&r1=265237&r2=265238&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sat Apr  2 14:10:07 2016
@@ -416,7 +416,8 @@ void Clang::AddPreprocessingOptions(Comp
   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

Modified: cfe/trunk/test/Driver/cl-pch-search.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-pch-search.cpp?rev=265238&r1=265237&r2=265238&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cl-pch-search.cpp (original)
+++ cfe/trunk/test/Driver/cl-pch-search.cpp Sat Apr  2 14:10:07 2016
@@ -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




More information about the cfe-commits mailing list