<div dir="ltr">Would it be worth considering whether -fdebug-compilation-dir and -fdebug-prefix-map could be unified, perhaps by having a placeholder that could be used in -fdebug-prefix-map for the current directory?<br><br>I guess they're low-maintenance enough that it's probably not, but figured I'd ask.<br><br><div class="gmail_quote"><div dir="ltr">On Thu, Dec 6, 2018 at 10:34 AM Nico Weber via Phabricator via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">thakis created this revision.<br>
thakis added a reviewer: rnk.<br>
<br>
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.<br>
<br>
(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.)<br>
<br>
Somewhat related to PR14625.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D55377" rel="noreferrer" target="_blank">https://reviews.llvm.org/D55377</a><br>
<br>
Files:<br>
  lib/Driver/ToolChains/Clang.cpp<br>
  test/Driver/integrated-as.s<br>
<br>
<br>
Index: test/Driver/integrated-as.s<br>
===================================================================<br>
--- test/Driver/integrated-as.s<br>
+++ test/Driver/integrated-as.s<br>
@@ -50,3 +50,9 @@<br>
<br>
 // RUN: %clang -### -target x86_64--- -x assembler -c -fPIC -integrated-as %s 2>&1 | FileCheck --check-prefix=PIC %s<br>
 // PIC: "-mrelocation-model" "pic"<br>
+<br>
+// RUN: %clang -### -target x86_64--- -c -integrated-as %s -Wa,-fdebug-compilation-dir,. 2>&1 | FileCheck --check-prefix=WA_DEBUGDIR %s<br>
+// WA_DEBUGDIR: "-fdebug-compilation-dir" "."<br>
+<br>
+// RUN: %clang -### -target x86_64--- -c -integrated-as %s -Xassembler -fdebug-compilation-dir -Xassembler . 2>&1 | FileCheck --check-prefix=XA_DEBUGDIR %s<br>
+// XA_DEBUGDIR: "-fdebug-compilation-dir" "."<br>
Index: lib/Driver/ToolChains/Clang.cpp<br>
===================================================================<br>
--- lib/Driver/ToolChains/Clang.cpp<br>
+++ lib/Driver/ToolChains/Clang.cpp<br>
@@ -2152,6 +2152,9 @@<br>
           }<br>
           CmdArgs.push_back(Value.data());<br>
           TakeNextArg = true;<br>
+      } else if (Value == "-fdebug-compilation-dir") {<br>
+        CmdArgs.push_back("-fdebug-compilation-dir");<br>
+        TakeNextArg = true;<br>
       } else {<br>
         D.Diag(diag::err_drv_unsupported_option_argument)<br>
             << A->getOption().getName() << Value;<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div>