DescriptionCheck and warn if public destructors are found on types that derive from base::RefCounted or base::RefCountedThreadSafe.
Having public destructors is dangerous, as it allows the ref-counted object to be stack allocated and have references that attempt to outlive the stack, or to allow callers to explicitly delete it while references are still held. Both patterns result in use-after-free, hence their prohibition.
In doing so, update the Chromium plugin to be able to scan both headers and implementation files, and enable the public destructor check for both types with an optional flag ( -Xclang -plugin-arg-find-bad-constructs -Xclang skip-refcounted-dtors )
BUG=123295
TEST=none
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=132500
Patch Set 1 #
Total comments: 1
Patch Set 2 : Just RefCounted #
Total comments: 5
Patch Set 3 : Really working - and with tests #Patch Set 4 : Now with moar flags #
Total comments: 6
Patch Set 5 : Nit & Style fixes #Patch Set 6 : Copyright update #
Messages
Total messages: 14 (0 generated)
|