[llvm-branch-commits] [cfe-branch] r345311 - Merging r340025:
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Oct 25 13:41:01 PDT 2018
Author: tstellar
Date: Thu Oct 25 13:41:01 2018
New Revision: 345311
URL: http://llvm.org/viewvc/llvm-project?rev=345311&view=rev
Log:
Merging r340025:
------------------------------------------------------------------------
r340025 | erichkeane | 2018-08-17 06:43:39 -0700 (Fri, 17 Aug 2018) | 8 lines
Fix for bug 38508 - Don't do PCH processing when only generating preprocessor output
This clang-cl driver change removes the PCH options when we are only generating
preprocessed output. This is similar to the behavior of Y-.
Patch by: mikerice
Differential Revision: https://reviews.llvm.org/D50640
------------------------------------------------------------------------
Added:
cfe/branches/release_70/test/PCH/Inputs/pch-through-use3c.cpp
cfe/branches/release_70/test/PCH/Inputs/pch-through3c.h
cfe/branches/release_70/test/PCH/pch-through3c.cpp
Modified:
cfe/branches/release_70/lib/Driver/Driver.cpp
cfe/branches/release_70/test/Driver/cl-pch.cpp
Modified: cfe/branches/release_70/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_70/lib/Driver/Driver.cpp?rev=345311&r1=345310&r2=345311&view=diff
==============================================================================
--- cfe/branches/release_70/lib/Driver/Driver.cpp (original)
+++ cfe/branches/release_70/lib/Driver/Driver.cpp Thu Oct 25 13:41:01 2018
@@ -2998,9 +2998,10 @@ void Driver::BuildActions(Compilation &C
Args.eraseArg(options::OPT__SLASH_Yc);
YcArg = nullptr;
}
- if (Args.hasArg(options::OPT__SLASH_Y_)) {
- // /Y- disables all pch handling. Rather than check for it everywhere,
- // just remove clang-cl pch-related flags here.
+ if (FinalPhase == phases::Preprocess || Args.hasArg(options::OPT__SLASH_Y_)) {
+ // If only preprocessing or /Y- is used, all pch handling is disabled.
+ // Rather than check for it everywhere, just remove clang-cl pch-related
+ // flags here.
Args.eraseArg(options::OPT__SLASH_Fp);
Args.eraseArg(options::OPT__SLASH_Yc);
Args.eraseArg(options::OPT__SLASH_Yu);
Modified: cfe/branches/release_70/test/Driver/cl-pch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_70/test/Driver/cl-pch.cpp?rev=345311&r1=345310&r2=345311&view=diff
==============================================================================
--- cfe/branches/release_70/test/Driver/cl-pch.cpp (original)
+++ cfe/branches/release_70/test/Driver/cl-pch.cpp Thu Oct 25 13:41:01 2018
@@ -345,3 +345,24 @@
// CHECK-NoSourceTP: pchfile.pch
// CHECK-NoSourceTP: -x
// CHECK-NoSourceTP: "c++"
+
+// If only preprocessing, PCH options are ignored.
+// RUN: %clang_cl /P /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-YC-P %s
+// CHECK-YC-P-NOT: -emit-pch
+// CHECK-YC-P-NOT: -include-pch
+
+// RUN: %clang_cl /E /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-YC-E %s
+// CHECK-YC-E-NOT: -emit-pch
+// CHECK-YC-E-NOT: -include-pch
+
+// RUN: %clang_cl /P /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-YU-P %s
+// CHECK-YU-P-NOT: -emit-pch
+// CHECK-YU-P-NOT: -include-pch
+
+// RUN: %clang_cl /E /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-YU-E %s
+// CHECK-YU-E-NOT: -emit-pch
+// CHECK-YU-E-NOT: -include-pch
Added: cfe/branches/release_70/test/PCH/Inputs/pch-through-use3c.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_70/test/PCH/Inputs/pch-through-use3c.cpp?rev=345311&view=auto
==============================================================================
--- cfe/branches/release_70/test/PCH/Inputs/pch-through-use3c.cpp (added)
+++ cfe/branches/release_70/test/PCH/Inputs/pch-through-use3c.cpp Thu Oct 25 13:41:01 2018
@@ -0,0 +1,2 @@
+int a = A;
+// expected-no-diagnostics
Added: cfe/branches/release_70/test/PCH/Inputs/pch-through3c.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_70/test/PCH/Inputs/pch-through3c.h?rev=345311&view=auto
==============================================================================
--- cfe/branches/release_70/test/PCH/Inputs/pch-through3c.h (added)
+++ cfe/branches/release_70/test/PCH/Inputs/pch-through3c.h Thu Oct 25 13:41:01 2018
@@ -0,0 +1 @@
+#define A 1
Added: cfe/branches/release_70/test/PCH/pch-through3c.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_70/test/PCH/pch-through3c.cpp?rev=345311&view=auto
==============================================================================
--- cfe/branches/release_70/test/PCH/pch-through3c.cpp (added)
+++ cfe/branches/release_70/test/PCH/pch-through3c.cpp Thu Oct 25 13:41:01 2018
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -I %S -emit-pch \
+// RUN: -include Inputs/pch-through3c.h \
+// RUN: -pch-through-header=Inputs/pch-through3c.h -o %t.3c %s
+
+// RUN: %clang_cc1 -verify -I %S -include-pch %t.3c \
+// RUN: -include Inputs/pch-through3c.h \
+// RUN: -pch-through-header=Inputs/pch-through3c.h \
+// RUN: %S/Inputs/pch-through-use3c.cpp 2>&1
More information about the llvm-branch-commits
mailing list