HomePhabricator

[analyzer] Invalidate placement args; return the pointer given to placement new

Authored by jordan_rose on Jun 19 2012, 6:32 PM.

Description

[analyzer] Invalidate placement args; return the pointer given to placement new

The default global placement new just returns the pointer it is given.
Note that other custom 'new' implementations with placement args are not
guaranteed to do this.

In addition, we need to invalidate placement args, since they may be updated by
the allocator function. (Also, right now we don't properly handle the
constructor inside a CXXNewExpr, so we need to invalidate the placement args
just so that callers know something changed!)

This invalidation is not perfect because CallOrObjCMessage doesn't support
CXXNewExpr, and all of our invalidation callbacks expect that if there's no
CallOrObjCMessage, the invalidation is happening manually (e.g. by a direct
assignment) and shouldn't affect checker-specific metadata (like malloc state);
hence the malloc test case in new-fail.cpp. But region values are now
properly invalidated, at least.

The long-term solution to this problem is to rework CallOrObjCMessage into
something more general, rather than the morass of branches it is today.

rdar://problem/11679031

llvm-svn: 158784

Details

Committed
jordan_roseJun 19 2012, 6:32 PM
Parents
rG927a437ac743: [objcmt] Have the modern objc migration warning change from:
Branches
Unknown
Tags
Unknown