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 | ba743b75cb555861ba16ae88f728f880bb7fa018 (patch) | |
tree | 4252716c20d652993e66a0c7fc5a0c7724f326ad /clang/lib/Driver/Tools.cpp | |
parent | 8f077161391865d46b05a9a50dffa0eedc3d6deb (diff) | |
download | bcm5719-llvm-ba743b75cb555861ba16ae88f728f880bb7fa018.tar.gz bcm5719-llvm-ba743b75cb555861ba16ae88f728f880bb7fa018.zip |
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.
llvm-svn: 142633
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 2dcb61bfb24..ad32bc7d1b4 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/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)); |