[PATCH] D97528: [Driver] Don't pass -ffile-compilation-dir through to cc1
Petr Hosek via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 25 22:29:21 PST 2021
phosek created this revision.
phosek added a reviewer: MaskRay.
phosek requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
This is a driver only flag so it has to be expanded when invoking cc1.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97528
Files:
clang/lib/Driver/ToolChains/Clang.cpp
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -620,7 +620,11 @@
const llvm::vfs::FileSystem &VFS) {
if (Arg *A = Args.getLastArg(options::OPT_ffile_compilation_dir_EQ,
options::OPT_fdebug_compilation_dir_EQ)) {
- A->render(Args, CmdArgs);
+ if (A->getOption().matches(options::OPT_ffile_compilation_dir_EQ))
+ CmdArgs.push_back(Args.MakeArgString(Twine("-fdebug-compilation-dir=") +
+ A->getValue()));
+ else
+ A->render(Args, CmdArgs);
} else if (llvm::ErrorOr<std::string> CWD =
VFS.getCurrentWorkingDirectory()) {
CmdArgs.push_back(Args.MakeArgString("-fdebug-compilation-dir=" + *CWD));
@@ -862,10 +866,14 @@
if (Arg *A = Args.getLastArg(options::OPT_ffile_compilation_dir_EQ,
options::OPT_fcoverage_compilation_dir_EQ)) {
- A->render(Args, CmdArgs);
+ if (A->getOption().matches(options::OPT_ffile_compilation_dir_EQ))
+ CmdArgs.push_back(Args.MakeArgString(
+ Twine("-fcoverage-compilation-dir=") + A->getValue()));
+ else
+ A->render(Args, CmdArgs);
} else if (llvm::ErrorOr<std::string> CWD =
D.getVFS().getCurrentWorkingDirectory()) {
- Args.MakeArgString("-fcoverage-compilation-dir=" + *CWD);
+ CmdArgs.push_back(Args.MakeArgString("-fcoverage-compilation-dir=" + *CWD));
}
if (Args.hasArg(options::OPT_fprofile_exclude_files_EQ)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97528.326600.patch
Type: text/x-patch
Size: 1652 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210226/249ab870/attachment.bin>
More information about the cfe-commits
mailing list