<div class="gmail_quote">On 29 July 2011 11:04, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com">clattner@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im"><br>
On Jul 28, 2011, at 9:42 PM, Nick Lewycky wrote:<br>
<br>
> Author: nicholas<br>
> Date: Thu Jul 28 23:42:39 2011<br>
> New Revision: 136459<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=136459&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=136459&view=rev</a><br>
> Log:<br>
> Teach Path::GetCurrentDirectory to use $PWD, to support users who like to do<br>
> screwy things by setting PWD != getcwd(). For example, some developers I know<br>
> will use this to control the value in gcc's DW_AT_comp_dir value in debug<br>
> output. With this patch, that trick will now work on clang too.<br>
><br>
> The only other effect of this change is that the static analysis will now<br>
> respect $PWD when reporting the directory of the files in its HTML output. I<br>
> think that's fine.<br>
<br>
</div>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.<br></blockquote><div><br></div><div>Reverted in r136477. I honestly don't see how it's any more or less correct than using getcwd, since $PWD is the current directory per definition.</div>

<div><br></div><div>Do you want me to add a platform specific #define to clang debug info codegen? Or should I add a new method to Support that does what I need and call that?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">


<br>
Please revert,<br>
<font color="#888888"><br>
-Chris<br>
</font><div><div></div><div class="h5"><br>
<br>
><br>
> Modified:<br>
>    llvm/trunk/lib/Support/Unix/Path.inc<br>
><br>
> Modified: llvm/trunk/lib/Support/Unix/Path.inc<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=136459&r1=136458&r2=136459&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=136459&r1=136458&r2=136459&view=diff</a><br>


> ==============================================================================<br>
> --- llvm/trunk/lib/Support/Unix/Path.inc (original)<br>
> +++ llvm/trunk/lib/Support/Unix/Path.inc Thu Jul 28 23:42:39 2011<br>
> @@ -251,9 +251,12 @@<br>
><br>
> Path<br>
> Path::GetCurrentDirectory() {<br>
> +  if (char *pwd = getenv("PWD"))<br>
> +    return Path(pwd);<br>
> +<br>
>   char pathname[MAXPATHLEN];<br>
> -  if (!getcwd(pathname,MAXPATHLEN)) {<br>
> -    assert (false && "Could not query current working directory.");<br>
> +  if (!getcwd(pathname, MAXPATHLEN)) {<br>
> +    assert(false && "Could not query current working directory.");<br>
>     return Path();<br>
>   }<br>
><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br>