Finds temporaries that look like RAII objects.
The canonical example for this is a scoped lock.
The destructor of the scoped_lock is called before the
entered, leaving it unprotected.
We apply a number of heuristics to reduce the false positive count of this check:
Ignore code expanded from macros. Testing frameworks make heavy use of this.
Ignore types with trivial destructors. They are very unlikely to be RAII objects and there’s no difference when they are deleted.
Ignore objects at the end of a compound statement (doesn’t change behavior).
Ignore objects returned from a call.