• rsleevi@chromium.org's avatar
    Check and warn if public destructors are found on types that derive from... · ff67535f
    rsleevi@chromium.org authored
    Check 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
    
    Review URL: https://chromiumcodereview.appspot.com/10005022
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132500 0039d316-1c4b-4281-b951-d872f2087c98
    ff67535f
base_refcounted.txt 1.2 KB