[analyzer] MacOSKeychainAPIChecker: Simplify getSymbolForRegion by using existing API. Thanks Jordy.

llvm-svn: 138765
This commit is contained in:
Anna Zaks 2011-08-29 21:10:00 +00:00
parent 7113f221e2
commit 50dd696339
1 changed files with 3 additions and 7 deletions

View File

@ -198,14 +198,10 @@ unsigned MacOSKeychainAPIChecker::getTrackedFunctionIndex(StringRef Name,
static SymbolRef getSymbolForRegion(CheckerContext &C,
const MemRegion *R) {
// Implicit casts (ex: void* -> char*) can turn Symbolic region into element
// region, if that is the case, get the underlining region.
R = R->StripCasts();
if (!isa<SymbolicRegion>(R)) {
// Implicit casts (ex: void* -> char*) can turn Symbolic region into element
// region, if that is the case, get the underlining region.
if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) {
R = ER->getAsArrayOffset().getRegion();
if (!R || !isa<SymbolicRegion>(R))
return 0;
} else
return 0;
}
return cast<SymbolicRegion>(R)->getSymbol();