[llvm-commits] [llvm] r136459 - /llvm/trunk/lib/Support/Unix/Path.inc

Chris Lattner clattner at apple.com
Fri Jul 29 11:04:37 PDT 2011


On Jul 28, 2011, at 9:42 PM, Nick Lewycky wrote:

> Author: nicholas
> Date: Thu Jul 28 23:42:39 2011
> New Revision: 136459
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=136459&view=rev
> Log:
> Teach Path::GetCurrentDirectory to use $PWD, to support users who like to do
> screwy things by setting PWD != getcwd(). For example, some developers I know
> will use this to control the value in gcc's DW_AT_comp_dir value in debug
> output. With this patch, that trick will now work on clang too.
> 
> The only other effect of this change is that the static analysis will now
> respect $PWD when reporting the directory of the files in its HTML output. I
> think that's fine.

Uhm, this *really* doesn't seem like the right thing to do.  This should go into a client of this API that cares, not being in such a low level API.

Please revert,

-Chris


> 
> Modified:
>    llvm/trunk/lib/Support/Unix/Path.inc
> 
> Modified: llvm/trunk/lib/Support/Unix/Path.inc
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=136459&r1=136458&r2=136459&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Support/Unix/Path.inc (original)
> +++ llvm/trunk/lib/Support/Unix/Path.inc Thu Jul 28 23:42:39 2011
> @@ -251,9 +251,12 @@
> 
> Path
> Path::GetCurrentDirectory() {
> +  if (char *pwd = getenv("PWD"))
> +    return Path(pwd);
> +
>   char pathname[MAXPATHLEN];
> -  if (!getcwd(pathname,MAXPATHLEN)) {
> -    assert (false && "Could not query current working directory.");
> +  if (!getcwd(pathname, MAXPATHLEN)) {
> +    assert(false && "Could not query current working directory.");
>     return Path();
>   }
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list