aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/SVals.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-12-06 23:12:27 +0000
committerAnna Zaks <ganna@apple.com>2011-12-06 23:12:27 +0000
commitaace9ef279be3dadd53b481aee568bd7701178b4 (patch)
tree9da5657b9b4926b62e1e8fe095d0b844ae4ab923 /lib/StaticAnalyzer/Core/SVals.cpp
parente5ee70d08e62cb6c96a736163204c12c6ef8147a (diff)
[analyzer] Propagate taint through NonLoc to NonLoc casts.
- Created a new SymExpr type - SymbolCast. - SymbolCast is created when we don't know how to simplify a NonLoc to NonLoc casts. - A bit of code refactoring: introduced dispatchCast to have better code reuse, remove a goto. - Updated the test case to showcase the new taint flow. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145985 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/SVals.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/SVals.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/StaticAnalyzer/Core/SVals.cpp b/lib/StaticAnalyzer/Core/SVals.cpp
index 4bdea1d9e1..97e5a1be4c 100644
--- a/lib/StaticAnalyzer/Core/SVals.cpp
+++ b/lib/StaticAnalyzer/Core/SVals.cpp
@@ -91,6 +91,7 @@ SymbolRef SVal::getLocSymbolInBase() const {
return 0;
}
+// TODO: The next 3 functions have to be simplified.
/// getAsSymbol - If this Sval wraps a symbol return that SymbolRef.
/// Otherwise return 0.
// FIXME: should we consider SymbolRef wrapped in CodeTextRegion?
@@ -168,6 +169,10 @@ void SVal::symbol_iterator::expand() {
const SymExpr *SE = itr.back();
itr.pop_back();
+ if (const SymbolCast *SC = dyn_cast<SymbolCast>(SE)) {
+ itr.push_back(SC->getOperand());
+ return;
+ }
if (const SymIntExpr *SIE = dyn_cast<SymIntExpr>(SE)) {
itr.push_back(SIE->getLHS());
return;