diff options
author | Mike Rice <michael.p.rice@intel.com> | 2018-09-11 17:10:44 +0000 |
---|---|---|
committer | Mike Rice <michael.p.rice@intel.com> | 2018-09-11 17:10:44 +0000 |
commit | 58df1affedc0d68eda16b87984a31dea217ff930 (patch) | |
tree | 055ccfe2a9023cdc9d883947849814a3d50e3a2d /clang/lib/Driver/Driver.cpp | |
parent | 12fd6bd4ad8f472304dc51120c11125f5627160b (diff) | |
download | bcm5719-llvm-58df1affedc0d68eda16b87984a31dea217ff930.tar.gz bcm5719-llvm-58df1affedc0d68eda16b87984a31dea217ff930.zip |
[clang-cl, PCH] Support for /Yc and /Yu without filename and #pragma hdrstop
With clang-cl, when the user specifies /Yc or /Yu without a filename
the compiler uses a #pragma hdrstop in the main source file to
determine the end of the PCH. If a header is specified with /Yc or
/Yu #pragma hdrstop has no effect.
The optional #pragma hdrstop filename argument is not yet supported.
Differential Revision: https://reviews.llvm.org/D51391
llvm-svn: 341963
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r-- | clang/lib/Driver/Driver.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 14cfc48c8f2..4764d4e38d7 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -2982,22 +2982,9 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args, } } - // Diagnose unsupported forms of /Yc /Yu. Ignore /Yc/Yu for now if: - // * no filename after it - // * both /Yc and /Yu passed but with different filenames - // * corresponding file not also passed as /FI + // Ignore /Yc/Yu if both /Yc and /Yu passed but with different filenames. Arg *YcArg = Args.getLastArg(options::OPT__SLASH_Yc); Arg *YuArg = Args.getLastArg(options::OPT__SLASH_Yu); - if (YcArg && YcArg->getValue()[0] == '\0') { - Diag(clang::diag::warn_drv_ycyu_no_arg_clang_cl) << YcArg->getSpelling(); - Args.eraseArg(options::OPT__SLASH_Yc); - YcArg = nullptr; - } - if (YuArg && YuArg->getValue()[0] == '\0') { - Diag(clang::diag::warn_drv_ycyu_no_arg_clang_cl) << YuArg->getSpelling(); - Args.eraseArg(options::OPT__SLASH_Yu); - YuArg = nullptr; - } if (YcArg && YuArg && strcmp(YcArg->getValue(), YuArg->getValue()) != 0) { Diag(clang::diag::warn_drv_ycyu_different_arg_clang_cl); Args.eraseArg(options::OPT__SLASH_Yc); @@ -4279,11 +4266,11 @@ std::string Driver::GetClPchPath(Compilation &C, StringRef BaseName) const { // extension of .pch is assumed. " if (!llvm::sys::path::has_extension(Output)) Output += ".pch"; - } else if (Arg *YcArg = C.getArgs().getLastArg(options::OPT__SLASH_Yc)) { - Output = YcArg->getValue(); - llvm::sys::path::replace_extension(Output, ".pch"); } else { - Output = BaseName; + if (Arg *YcArg = C.getArgs().getLastArg(options::OPT__SLASH_Yc)) + Output = YcArg->getValue(); + if (Output.empty()) + Output = BaseName; llvm::sys::path::replace_extension(Output, ".pch"); } return Output.str(); |