[PATCH] [analyzer][Review request] Partial fix for PR19102.

Jordan Rose jordan_rose at apple.com
Mon Jul 21 10:26:12 PDT 2014


Now that I'm paging this back in...I'm not convinced. People who use unassigned new usually know what they're doing. The false positives come when someone uses `new` while storing the result, but they //also// escape the variable into storage somewhere.

For the unused result case, I wonder if a -Wunused-like warning would cover this: warn on un-consumed `new`, silence it by casting to void, and assume any un-consumed new has already escaped (unless we inlined the constructor or can see it is trivial). 

I'd be tempted to ignore the used case except that that's blocking adoption in LLVM. We'd have to get sign-on from llvmdev if we wanted to change the `new Value(module, ...)` idiom they have going on there (e.g. to something like `Value::create(module, ...)`.)

http://reviews.llvm.org/D4025






More information about the cfe-commits mailing list