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

Nick Lewycky nlewycky at google.com
Fri Jul 29 11:30:58 PDT 2011


On 29 July 2011 11:04, Chris Lattner <clattner at apple.com> wrote:

>
> 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.
>

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.

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?


> 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
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110729/ab851838/attachment.html>


More information about the llvm-commits mailing list