[analyzer] MoveChecker: Improve invalidation policies.
authorArtem Dergachev <artem.dergachev@gmail.com>
Fri, 14 Dec 2018 20:47:58 +0000 (20:47 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Fri, 14 Dec 2018 20:47:58 +0000 (20:47 +0000)
commit12f7c2baccdfb7da56d018f34f29a954968ead6d
treec84fbe5873ea8630a5679902f710d2f0f03e0c9f
parent3e5d847fa02f63d0026a6771be613e464530bb6f
[analyzer] MoveChecker: Improve invalidation policies.

If a moved-from object is passed into a conservatively evaluated function
by pointer or by reference, we assume that the function may reset its state.

Make sure it doesn't apply to const pointers and const references. Add a test
that demonstrates that it does apply to rvalue references.

Additionally, make sure that the object is invalidated when its contents change
for reasons other than invalidation caused by evaluating a call conservatively.
In particular, when the object's fields are manipulated directly, we should
assume that some sort of reset may be happening.

Differential Revision: https://reviews.llvm.org/D55289

llvm-svn: 349190
clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
clang/test/Analysis/use-after-move.cpp