[PATCH] D59388: Basic: Return a reference from FileManager::getVirtualFileSystem, NFC

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 18 08:50:07 PDT 2019


dexonsmith added a comment.

In D59388#1431314 <https://reviews.llvm.org/D59388#1431314>, @jkorous wrote:

> Hi Duncan, thanks for working on better interfaces in clang!
>
> I am just wondering - is it safe to have the lifetime of a single object on heap managed by two different `IntrusiveRefCntPtr` instances?


Yes, it's safe.  The reference count is "intrusive", meaning it's stored in the object itself (via inheritance from `RefCountedBase`).  As a result, all the instances of `IntrusiveRefCntPtr` that reference at the same object will implicitly share their count.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59388/new/

https://reviews.llvm.org/D59388





More information about the cfe-commits mailing list