diff options
author | Jordy Rose <jediknil@belkadan.com> | 2010-08-16 01:15:17 +0000 |
---|---|---|
committer | Jordy Rose <jediknil@belkadan.com> | 2010-08-16 01:15:17 +0000 |
commit | df28e8ec4145fbe407f09dc2458d42cd9f12bd99 (patch) | |
tree | e642a5f884f581a38c4de3ff6b190307a83bac63 /clang/lib/Checker/SimpleConstraintManager.cpp | |
parent | cbc55d9dc0b36a49ba749cf69c38223785ffa01e (diff) | |
download | bcm5719-llvm-df28e8ec4145fbe407f09dc2458d42cd9f12bd99.tar.gz bcm5719-llvm-df28e8ec4145fbe407f09dc2458d42cd9f12bd99.zip |
- Allow making ElementRegions with complex offsets (expressions or symbols) for the purpose of bounds-checking.
- Rewrite GRState::AssumeInBound to actually do that checking, and to use the normal constraint path.
- Remove ConstraintManager::AssumeInBound.
- Teach RegionStore and FlatStore to ignore those regions for now.
llvm-svn: 111116
Diffstat (limited to 'clang/lib/Checker/SimpleConstraintManager.cpp')
-rw-r--r-- | clang/lib/Checker/SimpleConstraintManager.cpp | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/clang/lib/Checker/SimpleConstraintManager.cpp b/clang/lib/Checker/SimpleConstraintManager.cpp index 321381b045a..cc26a12ea4f 100644 --- a/clang/lib/Checker/SimpleConstraintManager.cpp +++ b/clang/lib/Checker/SimpleConstraintManager.cpp @@ -296,28 +296,4 @@ const GRState *SimpleConstraintManager::AssumeSymRel(const GRState *state, } // end switch } -const GRState *SimpleConstraintManager::AssumeInBound(const GRState *state, - DefinedSVal Idx, - DefinedSVal UpperBound, - bool Assumption) { - - // Only support ConcreteInt for now. - if (!(isa<nonloc::ConcreteInt>(Idx) && isa<nonloc::ConcreteInt>(UpperBound))) - return state; - - const llvm::APSInt& Zero = state->getBasicVals().getZeroWithPtrWidth(false); - llvm::APSInt IdxV = cast<nonloc::ConcreteInt>(Idx).getValue(); - // IdxV might be too narrow. - if (IdxV.getBitWidth() < Zero.getBitWidth()) - IdxV.extend(Zero.getBitWidth()); - // UBV might be too narrow, too. - llvm::APSInt UBV = cast<nonloc::ConcreteInt>(UpperBound).getValue(); - if (UBV.getBitWidth() < Zero.getBitWidth()) - UBV.extend(Zero.getBitWidth()); - - bool InBound = (Zero <= IdxV) && (IdxV < UBV); - bool isFeasible = Assumption ? InBound : !InBound; - return isFeasible ? state : NULL; -} - } // end of namespace clang |