]> granicus.if.org Git - clang/commit
[analyzer] Don't try to simplify mixed Loc/NonLoc expressions.
authorArtem Dergachev <artem.dergachev@gmail.com>
Tue, 31 Jul 2018 19:26:34 +0000 (19:26 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Tue, 31 Jul 2018 19:26:34 +0000 (19:26 +0000)
commitecc772cf03c8ad857dbf51d13b24f44f4da5aebb
treea567a6f6e7b87985e00bf21a006ea13232de3176
parent6ad08ff216cca6c7e44d09a0fb57668eebfd5d16
[analyzer] Don't try to simplify mixed Loc/NonLoc expressions.

This fix is similar to r337769 and addresses a regression caused by r337167.

When an operation between a nonloc::LocAsInteger and a non-pointer symbol
is performed, the LocAsInteger-specific part of information is lost.
When the non-pointer symbol is collapsing into a constant, we cannot easily
re-evaluate the result, because we need to recover the missing
LocAsInteger-specific information (eg., integer type, or the very fact that
this pointer was at some point converted to an integer).

Add one more defensive check to prevent crashes on trying to simplify a
SymSymExpr with different Loc-ness of operands.

Differential Revision:

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338420 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
test/Analysis/casts.c