]> granicus.if.org Git - clang/commit
[analyzer] Fix invalidation on C++ const methods with arrow syntax.
authorArtem Dergachev <artem.dergachev@gmail.com>
Mon, 25 Jun 2018 23:43:45 +0000 (23:43 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Mon, 25 Jun 2018 23:43:45 +0000 (23:43 +0000)
commit3176c137ab9ddbe71836d05d482f102a9c3fdee1
tree092009e4b4d61e0ba590e46788edf5833648257f
parentc877647f1b60d295bfea9d984c1c9844aadc4e61
[analyzer] Fix invalidation on C++ const methods with arrow syntax.

Conservative evaluation of a C++ method call would invalidate the object,
as long as the method is not const or the object has mutable fields.

When checking for mutable fields, we need to scan the type of the object on
which the method is called, which may be more specific than the type of the
object on which the method is defined, hence we look up the type from the
this-argument expression.

If arrow syntax or implicit-this syntax is used, this-argument expression
has pointer type, not record type, and lookup accidentally failed for that
reason. Obtain object type correctly.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335555 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Core/CallEvent.cpp
test/Analysis/const-method-call.cpp