[PATCH] D41254: [analyzer] WIP: trackNullOrUndefValue: peel off ParenImpCasts before tracking.
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 14 12:43:29 PST 2017
NoQ created this revision.
NoQ added reviewers: dcoughlin, xazax.hun, a.sidorin, george.karpenkov, szepet.
Herald added subscribers: cfe-commits, rnkovacs, eraman.
Continuing experiments in https://reviews.llvm.org/D41253, i'm looking into unwrapping parentheses and implicit casts from the tracked expression. The `peelOffOuterExpr` method already does more, so the current situation where we're not doing this when there's no explicit outer expression looks like an accidental omission; i'd try to provide actual justification for this stuff.
This gives a lot of fancy improvements in the diagnostics and suppressions:
- `uninit-const.cpp`: We unwrap an implicit `LValueToRValue` cast around a reference, which allows us to track the undefined value through the pass-by-reference function call back to the original uninitialized variable.
- `false-positive-suppression.m`: `ARCReclaimReturnedObject` is unwrapped, so the respective suppression now works correctly under Objective-C automatic reference counting.
- `inlining/path-notes.m`: By unwrapping another `LValueToRValueCast`, we display the specific diagnostic for the interesting value, instead of the generic diagnostic. It's still surprising that we don't display the same diagnostic in the non-interesting value case, so this remains to be fixed.
- `inlining/path-notes.cpp`: A **regression** here! This one is similar to `uninit-const.cpp`, but here when we unwrap `LValueToRValueCast` and dive into the function we suddenly get a //duplicate// diagnostic. Here `FindLastStoreBRVisitor` is not de-duplicated correctly. I'd explain what's going on in a follow-up patch that works around the problem, and for now i mark this test as FIXME so that all changes remain tested.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 136456 bytes
Desc: not available
More information about the cfe-commits