summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/Environment.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-04-27 05:34:09 +0000
committerTed Kremenek <kremenek@apple.com>2011-04-27 05:34:09 +0000
commit08b434f4503ec60b351bff9a7aeca26e5b6dfa4b (patch)
tree71e594048a19c2fe8d7232e7c5673912a7f8f3ef /clang/lib/StaticAnalyzer/Core/Environment.cpp
parent938e4a89dd251bbdd514e712f9bbfc36b184bba4 (diff)
downloadbcm5719-llvm-08b434f4503ec60b351bff9a7aeca26e5b6dfa4b.tar.gz
bcm5719-llvm-08b434f4503ec60b351bff9a7aeca26e5b6dfa4b.zip
Allow 'Environment::getSVal()' to allow an optional way for checkers to do a direct lookup to values bound to expressions, without
resulting to lazy logic. This is critical for the OSAtomicChecker that does a simulated load on any arbitrary expression. llvm-svn: 130292
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/Environment.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/Environment.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/Environment.cpp b/clang/lib/StaticAnalyzer/Core/Environment.cpp
index 0d43c37587b..a00f9dc10b6 100644
--- a/clang/lib/StaticAnalyzer/Core/Environment.cpp
+++ b/clang/lib/StaticAnalyzer/Core/Environment.cpp
@@ -27,7 +27,17 @@ SVal Environment::lookupExpr(const Stmt* E) const {
return UnknownVal();
}
-SVal Environment::getSVal(const Stmt *E, SValBuilder& svalBuilder) const {
+SVal Environment::getSVal(const Stmt *E, SValBuilder& svalBuilder,
+ bool useOnlyDirectBindings) const {
+
+ if (useOnlyDirectBindings) {
+ // This branch is rarely taken, but can be exercised by
+ // checkers that explicitly bind values to arbitrary
+ // expressions. It is crucial that we do not ignore any
+ // expression here, and do a direct lookup.
+ return lookupExpr(E);
+ }
+
for (;;) {
switch (E->getStmtClass()) {
case Stmt::AddrLabelExprClass:
OpenPOWER on IntegriCloud