From df28e8ec4145fbe407f09dc2458d42cd9f12bd99 Mon Sep 17 00:00:00 2001 From: Jordy Rose Date: Mon, 16 Aug 2010 01:15:17 +0000 Subject: - 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 --- clang/lib/Checker/SimpleConstraintManager.cpp | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'clang/lib/Checker/SimpleConstraintManager.cpp') 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(Idx) && isa(UpperBound))) - return state; - - const llvm::APSInt& Zero = state->getBasicVals().getZeroWithPtrWidth(false); - llvm::APSInt IdxV = cast(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(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 -- cgit v1.2.3