[analyzer] Add LocationContext information to SymbolMetadata.
authorArtem Dergachev <artem.dergachev@gmail.com>
Wed, 17 Aug 2016 15:37:52 +0000 (15:37 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Wed, 17 Aug 2016 15:37:52 +0000 (15:37 +0000)
commitcbce96c3afbccc0c8b703ca818b6d4d60402f141
treeb7acb3ceeff4951bb1e43660b6a1e7e7c5e6a4f5
parentffb3278e27107d214a76a011c08812934bcf38a0
[analyzer] Add LocationContext information to SymbolMetadata.

Like SymbolConjured, SymbolMetadata also needs to be uniquely
identified by the moment of its birth.

Such moments are coded by the (Statement, LocationContext, Block count) triples.
Each such triple represents the moment of analyzing a statement with a certain
call backtrace, with corresponding CFG block having been entered a given amount
of times during analysis of the current code body.

The LocationContext information was accidentally omitted for SymbolMetadata,
which leads to reincarnation of SymbolMetadata upon re-entering a code body
with a different backtrace; the new symbol is incorrectly unified with
the old symbol, which leads to unsound assumptions.

Patch by Alexey Sidorin!

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

llvm-svn: 278937
clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
clang/lib/StaticAnalyzer/Core/SValBuilder.cpp
clang/lib/StaticAnalyzer/Core/SymbolManager.cpp
clang/test/Analysis/string.c