[PATCH] D55377: Allow forwarding -fdebug-compilation-dir to cc1as
Nico Weber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 6 10:34:18 PST 2018
thakis created this revision.
thakis added a reviewer: rnk.
The flag -fdebug-compilation-dir is useful to make generated .o files independent of the path of the build directory, without making the compile command-line dependent on the path of the build directory, like -fdebug-prefix-map requires. This change makes it so that the driver can forward the flag to -cc1as, like it already can for -cc1. We might want to consider making -fdebug-compilation-dir a driver flag in a follow-up.
(Since -fdebug-compilation-dir defaults to PWD, it's already possible to get this effect by setting PWD, but explicit compiler flags are better than env vars, because e.g. ninja tracks command lines and reruns commands that change.)
Somewhat related to PR14625.
https://reviews.llvm.org/D55377
Files:
lib/Driver/ToolChains/Clang.cpp
test/Driver/integrated-as.s
Index: test/Driver/integrated-as.s
===================================================================
--- test/Driver/integrated-as.s
+++ test/Driver/integrated-as.s
@@ -50,3 +50,9 @@
// RUN: %clang -### -target x86_64--- -x assembler -c -fPIC -integrated-as %s 2>&1 | FileCheck --check-prefix=PIC %s
// PIC: "-mrelocation-model" "pic"
+
+// RUN: %clang -### -target x86_64--- -c -integrated-as %s -Wa,-fdebug-compilation-dir,. 2>&1 | FileCheck --check-prefix=WA_DEBUGDIR %s
+// WA_DEBUGDIR: "-fdebug-compilation-dir" "."
+
+// RUN: %clang -### -target x86_64--- -c -integrated-as %s -Xassembler -fdebug-compilation-dir -Xassembler . 2>&1 | FileCheck --check-prefix=XA_DEBUGDIR %s
+// XA_DEBUGDIR: "-fdebug-compilation-dir" "."
Index: lib/Driver/ToolChains/Clang.cpp
===================================================================
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -2152,6 +2152,9 @@
}
CmdArgs.push_back(Value.data());
TakeNextArg = true;
+ } else if (Value == "-fdebug-compilation-dir") {
+ CmdArgs.push_back("-fdebug-compilation-dir");
+ TakeNextArg = true;
} else {
D.Diag(diag::err_drv_unsupported_option_argument)
<< A->getOption().getName() << Value;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55377.177004.patch
Type: text/x-patch
Size: 1288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181206/bb3274ec/attachment.bin>
More information about the cfe-commits
mailing list