]> granicus.if.org Git - clang/commitdiff
[analyzer] Remove the "direct bindings only" Environment lookup.
authorJordan Rose <jordan_rose@apple.com>
Sat, 13 Oct 2012 05:05:20 +0000 (05:05 +0000)
committerJordan Rose <jordan_rose@apple.com>
Sat, 13 Oct 2012 05:05:20 +0000 (05:05 +0000)
This was only used by OSAtomicChecker and makes it more
difficult to update values for expressions that the environment
may look through instead (it's not the same as IgnoreParens).
With this gone, we can have bindExpr bind to the inner
expression that getSVal will find.

Groundwork for <rdar://problem/12137950>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165866 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h
include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
lib/StaticAnalyzer/Core/Environment.cpp

index b80213e249a27f52ef16ef2b3e737abc27c8da82..54fce6530b735da783aa514f01d2ce4c323a0a7e 100644 (file)
@@ -76,9 +76,7 @@ public:
 
   /// Fetches the current binding of the expression in the
   /// Environment.
-  SVal getSVal(const EnvironmentEntry &E,
-               SValBuilder &svalBuilder,
-               bool useOnlyDirectBindings = false) const;
+  SVal getSVal(const EnvironmentEntry &E, SValBuilder &svalBuilder) const;
 
   /// Profile - Profile the contents of an Environment object for use
   ///  in a FoldingSet.
index 541078cc89285f4f8f3ff763b9dd564601004a67..86c94deab5e8686c51c193260b30124cd90536ae 100644 (file)
@@ -252,8 +252,7 @@ public:
   SVal getLValue(QualType ElementType, SVal Idx, SVal Base) const;
 
   /// Returns the SVal bound to the statement 'S' in the state's environment.
-  SVal getSVal(const Stmt *S, const LocationContext *LCtx,
-               bool useOnlyDirectBindings = false) const;
+  SVal getSVal(const Stmt *S, const LocationContext *LCtx) const;
   
   SVal getSValAsScalarOrLoc(const Stmt *Ex, const LocationContext *LCtx) const;
 
@@ -666,11 +665,10 @@ inline SVal ProgramState::getLValue(QualType ElementType, SVal Idx, SVal Base) c
   return UnknownVal();
 }
 
-inline SVal ProgramState::getSVal(const Stmt *Ex, const LocationContext *LCtx,
-                                  bool useOnlyDirectBindings) const{
+inline SVal ProgramState::getSVal(const Stmt *Ex,
+                                  const LocationContext *LCtx) const{
   return Env.getSVal(EnvironmentEntry(Ex, LCtx),
-                     *getStateManager().svalBuilder,
-                     useOnlyDirectBindings);
+                     *getStateManager().svalBuilder);
 }
 
 inline SVal
index a8c2da76424f6b00266a305b07a639069c6a86f2..07659cb601cf6a63adf9b3f316c1d096a68bb779 100644 (file)
@@ -30,17 +30,7 @@ SVal Environment::lookupExpr(const EnvironmentEntry &E) const {
 }
 
 SVal Environment::getSVal(const EnvironmentEntry &Entry,
-                          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(Entry);
-  }
-
+                          SValBuilder& svalBuilder) const {
   const Stmt *E = Entry.getStmt();
   const LocationContext *LCtx = Entry.getLocationContext();