[PATCH] D28162: [ADT] Delete RefCountedBaseVPTR.
Justin Lebar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 29 10:37:58 PST 2016
jlebar created this revision.
jlebar added reviewers: compnerd, dblaikie.
jlebar added subscribers: llvm-commits, cfe-commits.
Herald added subscribers: mgorny, klimek.
This class is unnecessary.
Its comment indicated that it was a compile error to allocate an
instance of a class that inherits from RefCountedBaseVPTR on the stack.
This may have been true at one point, but it's not today.
Moreover you really do not want to allocate *any* refcounted object on
the stack, vptrs or not, so if we did have a way to prevent these
objects from being stack-allocated, we'd want to apply it to regular
RefCountedBase too, obviating the need for a separate RefCountedBaseVPTR
It seems that the main way RefCountedBaseVPTR provides safety is by
making its subclass's destructor virtual. This may have been helpful at
one point, but these days clang will emit an error if you define a class
with virtual functions that inherits from RefCountedBase but doesn't
have a virtual destructor.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 7542 bytes
Desc: not available
More information about the cfe-commits