]> granicus.if.org Git - clang/commit
[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)
commit87fae78f666cda8a567d98080858cfad013a2589
treee7e6373ae72d0f0270701d3befa258311c193c67
parentb53ab0e23fc3229a6e9815c0602165114591a911
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349190 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Checkers/MoveChecker.cpp
test/Analysis/use-after-move.cpp