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

Rafael Espíndola rafael.espindola at gmail.com
Wed Feb 12 15:45:17 PST 2014


> I have no idea what you mean by “clang process”. You don’t actually mean the whole process itself, because FS isn’t thread-safe and therefore isn’t some kind of global singleton. Plus, different invocations of the compiler may have different FS, so making this a global singleton is completely wrong . Any thread-specific “singleton” would be wrong for the same reasons.
>
> I guess we could toss the responsibility for managing the FS instance up to “the client”, but which clients are those? Some clients will want to pre-populate and widely share a FS, while others just want CompilerInvocation to create the FS if the command-line arguments passed through to it require the FS. We want to support the former without complicating the latter. IntrusiveRefCntPtr makes that easy to do with completely acceptable overhead.

OK, if that is the use case, then I agree with IntrusiveRefCntPtr, but
that means I misunderstood how the FS is to be used.

My understanding was that the FS would always be shared, so that it
could be constructed once as close to main as possible. Would you mind
explaining when we would want two different FS alive in the same
process (or thread)?

Now I realize that maybe I just missed that this is to be exposed via
libclang and we can assume nothing about how the clients want to use
FS?

Cheers,
Rafael




More information about the cfe-commits mailing list