[PATCH] D30743: enable -save-temps with -finclude-defult-header
Guansong Zhang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 14 07:21:03 PDT 2017
guansong updated this revision to Diff 91718.
guansong added a comment.
Thanks, update as suggested.
https://reviews.llvm.org/D30743
Files:
lib/Driver/Tools.cpp
test/Driver/include-default-header.cl
Index: test/Driver/include-default-header.cl
===================================================================
--- /dev/null
+++ test/Driver/include-default-header.cl
@@ -0,0 +1,4 @@
+// RUN: %clang -v -save-temps -x cl -Xclang -cl-std=CL2.0 -Xclang -finclude-default-header -target amdgcn -S -c %s
+
+void test() {}
+
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5285,7 +5285,20 @@
// Forward -Xclang arguments to -cc1, and -mllvm arguments to the LLVM option
// parser.
- Args.AddAllArgValues(CmdArgs, options::OPT_Xclang);
+ // -finclude-default-header flag is for preprocessor,
+ // do not pass it to other cc1 commands when save-temps is enabled
+ if (C.getDriver().isSaveTempsEnabled() &&
+ !isa<PreprocessJobAction>(JA)) {
+ for (auto Arg : Args.filtered(options::OPT_Xclang)) {
+ Arg->claim();
+ if (StringRef(Arg->getValue()) != "-finclude-default-header")
+ CmdArgs.push_back(Arg->getValue());
+ }
+ }
+ else {
+ Args.AddAllArgValues(CmdArgs, options::OPT_Xclang);
+ }
+
for (const Arg *A : Args.filtered(options::OPT_mllvm)) {
A->claim();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30743.91718.patch
Type: text/x-patch
Size: 1213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170314/f9f3fabb/attachment.bin>
More information about the cfe-commits
mailing list