[llvm-commits] CVS: llvm/include/llvm/System/Path.h

Reid Spencer rspencer at reidspencer.com
Thu Mar 29 23:36:28 PDT 2007


On Thu, 2007-03-29 at 23:28 -0700, Chris Lattner wrote:
> On Mar 29, 2007, at 11:17 PM, Reid Spencer wrote:
> 
> > On Thu, 2007-03-29 at 22:59 -0700, Chris Lattner wrote:
> >>>
> >>> For PR789: http://llvm.org/PR789 :
> >>> * Add a method: bool isAbsolute() const, which determines if the
> >>> path name
> >>>   is absolute or not.
> >>> * Implement caching of file status information in the Path object.
> >>> Allow it
> >>>   to be updated forcefully or lazily re-fetched from the cached  
> >>> value.
> >>
> >> Nice.  Instead of new'ing the status object separately from the Path
> >> object, why not embed it by-value?
> >
> > Because, by far, the common case for Path objects is to copy them  
> > around
> > and not use the FileStatus stuff.  I even hesitated about putting a
> > pointer into the Path object. :)
> 
> Okay, how about an alternate approach, which fixes both problems :),  
> how about something like this:
> 
> class PathWithStatus : public Path {
>    Status S;
>    bool IsStatusValid;
> }
> 
> If you sink the 'status gathering' methods out of Path into  
> PathWithStatus, then you let the client decide whether they want to  
> store a status or not.
> 
> reasonable?

Yes, that's quite reasonable. Could you file an enhancement PR with
this? I won't have time to get to such a large change for a while, and
don't want to forget.

Thanks,

Reid.

> 
> -Chris




More information about the llvm-commits mailing list