[PATCH] D31538: [analyzer] MisusedMovedObjectChecker: Fix a false positive on state-resetting a base-class sub-object.
Peter Szecsi via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 31 10:36:45 PDT 2017
szepet added inline comments.
================
Comment at: lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp:426
+
+ State = State->remove<TrackedRegionMap>(WholeObjectRegion);
C.addTransition(State);
----------------
szepet wrote:
> I am wondering if I made a mistake but I think this should be removeFromState() function call. (We should remove every marked subregions of the object too.)
> So I suspect a code like this would result a false positive:
> ```
> struct A{
> B b;
> void clear();
> };
>
> void test(){
> A a;
> B b = std::move(a.b);
> a.clear();
> b = std::move(a); //report a bug
> }
> ```
>
> I mean it is probably a report we do not want to have.
Shame on the test file writer that he does not covered this, though. ^^
https://reviews.llvm.org/D31538
More information about the cfe-commits
mailing list