[PATCH] Some infrastructure work for virtual file system (now on phab)

Ben Langmuir blangmuir at apple.com
Mon Mar 3 08:01:25 PST 2014


On Feb 27, 2014, at 6:38 AM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:

>> And even worse, because RealFileSystem is an implementation detail, and
>> getRealFileSystem returns a ref counted pointer by value, I cannot see any
>> way to get me a RealFileSystem without locking.
> 
> Maybe we could use a plain point in here. As Douglas says, that would
> "toss the responsibility for managing the FS instance up to “the
> client”", but the only client that needs reference counting should be
> libclang and it can do it with a non-intrusive counter wrapping the
> pointer (like a shared_ptr).

I prefer the solution that Argyrios proposed, to use a thread-safe ref count.  It has the nice property that we keep management of these pointers homogeneous between internal and external clients.

Ben

> 
> Cheers,
> Rafael





More information about the cfe-commits mailing list