diff options
| author | Erich Keane <erich.keane@intel.com> | 2017-10-20 19:18:30 +0000 |
|---|---|---|
| committer | Erich Keane <erich.keane@intel.com> | 2017-10-20 19:18:30 +0000 |
| commit | 87baae2162ed7d67629d66bfb775a89bc5e6b738 (patch) | |
| tree | a62760f14a4c777b0de3f495b773c032f92808fc | |
| parent | f7596ece76570794f4fc89a65b49857b8c8570f1 (diff) | |
| download | bcm5719-llvm-87baae2162ed7d67629d66bfb775a89bc5e6b738.tar.gz bcm5719-llvm-87baae2162ed7d67629d66bfb775a89bc5e6b738.zip | |
Allow /showIncludes with /P
r213589 was checked in as a solution to
https://bugs.llvm.org/show_bug.cgi?id=20336.
However, it is possible to use /EP with /P
to suppress #line directives AND output to
a file. There is no reason in that case to
suppress /showIncludes.
This was reported here:
https://bugs.llvm.org/show_bug.cgi?id=34997
Differential Revision: https://reviews.llvm.org/D39104
llvm-svn: 316225
| -rw-r--r-- | clang/lib/Driver/ToolChains/Clang.cpp | 4 | ||||
| -rw-r--r-- | clang/test/Driver/cl-options.c | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 12713f8be2f..8e5f3b95735 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4873,7 +4873,9 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType, // Both /showIncludes and /E (and /EP) write to stdout. Allowing both // would produce interleaved output, so ignore /showIncludes in such cases. - if (!Args.hasArg(options::OPT_E) && !Args.hasArg(options::OPT__SLASH_EP)) + if ((!Args.hasArg(options::OPT_E) && !Args.hasArg(options::OPT__SLASH_EP)) || + (Args.hasArg(options::OPT__SLASH_P) && + Args.hasArg(options::OPT__SLASH_EP) && !Args.hasArg(options::OPT_E))) if (Arg *A = Args.getLastArg(options::OPT_show_includes)) A->render(Args, CmdArgs); diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c index b78bb9d8b5e..115b21963b3 100644 --- a/clang/test/Driver/cl-options.c +++ b/clang/test/Driver/cl-options.c @@ -197,8 +197,12 @@ // RUN: %clang_cl /E /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s // RUN: %clang_cl /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s +// RUN: %clang_cl /E /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s // showIncludes_E: warning: argument unused during compilation: '--show-includes' +// RUN: %clang_cl /EP /P /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E_And_P %s +// showIncludes_E_And_P-NOT: warning: argument unused during compilation: '--show-includes' + // /source-charset: should warn on everything except UTF-8. // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=source-charset-utf-16 %s // source-charset-utf-16: invalid value 'utf-16' |

