diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-10-21 02:32:14 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-10-21 02:32:14 +0000 |
commit | 7c4fd9121f5885096fd3258d20a984e3f08f8603 (patch) | |
tree | 893801c3743e40c6bc4da17e1f4b30bce28c0cc7 /lib/Driver/Tools.cpp | |
parent | 0e9e9814a7f8313c0c02b6afea71f0e4c411873e (diff) |
Take DW_AT_comp_dir from $PWD when it's present and starts with a '/'. This is
closer to what GCC does, except that GCC also checks that the inodes for $PWD
and '.' match.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142633 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r-- | lib/Driver/Tools.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 2dcb61bfb2..ad32bc7d1b 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1625,6 +1625,16 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (ShouldDisableDwarfDirectory(Args, getToolChain())) CmdArgs.push_back("-fno-dwarf-directory-asm"); + if (const char *pwd = ::getenv("PWD")) { + // GCC also verifies that stat(pwd) and stat(".") have the same inode + // number. Not doing those because stats are slow, but we could. + if (pwd[0] == '/') { + std::string CompDir = pwd; + CmdArgs.push_back("-fdebug-compilation-dir"); + CmdArgs.push_back(Args.MakeArgString(CompDir)); + } + } + if (Arg *A = Args.getLastArg(options::OPT_ftemplate_depth_)) { CmdArgs.push_back("-ftemplate-depth"); CmdArgs.push_back(A->getValue(Args)); |