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?
I guess they're low-maintenance enough that it's probably not, but figured I'd ask. On Thu, Dec 6, 2018 at 10:34 AM Nico Weber via Phabricator via cfe-commits < cfe-commits@lists.llvm.org> wrote: > 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; > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits