[cfe-commits] r142633 - in /cfe/trunk: include/clang/Driver/CC1Options.td include/clang/Frontend/CodeGenOptions.h lib/CodeGen/CGDebugInfo.cpp lib/Driver/Tools.cpp lib/Frontend/CompilerInvocation.cpp test/CodeGen/debug-info-compilation-dir.c test/

NAKAMURA Takumi geek4civic at gmail.com
Sat Oct 22 03:08:41 PDT 2011


Nick,

> Author: nicholas
> Date: Thu Oct 20 21:32:14 2011
> New Revision: 142633
>
> URL: http://llvm.org/viewvc/llvm-project?rev=142633&view=rev
> Log:
> 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.
>
> Added:
>    cfe/trunk/test/CodeGen/debug-info-compilation-dir.c
>    cfe/trunk/test/Driver/debug.c
> Modified:
>    cfe/trunk/include/clang/Driver/CC1Options.td
>    cfe/trunk/include/clang/Frontend/CodeGenOptions.h
>    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>    cfe/trunk/lib/Driver/Tools.cpp
>    cfe/trunk/lib/Frontend/CompilerInvocation.cpp

> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=142633&r1=142632&r2=142633&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Thu Oct 20 21:32:14 2011
> @@ -1625,6 +1625,16 @@
>   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));

I don't understand what you would like to do here, though, it must be
bogus to check pwd[0] eq '/' on win32 hosts.

...Takumi




More information about the cfe-commits mailing list