Skip to content

Commit

Permalink
[analyzer] MacOSKeychainAPIChecker: Retrieve the memory region which …
Browse files Browse the repository at this point in the history
…we are tracking even when it's no longer a SymbolicRegion, for example, when it is cast to char*.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138415 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
AnnaZaks committed Aug 23, 2011
1 parent dd6060e commit 31e1028
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
Expand Up @@ -167,8 +167,14 @@ unsigned MacOSKeychainAPIChecker::getTrackedFunctionIndex(StringRef Name,

static SymbolRef getSymbolForRegion(CheckerContext &C,
const MemRegion *R) {
if (!isa<SymbolicRegion>(R))
return 0;
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();
else
return 0;
}
return cast<SymbolicRegion>(R)->getSymbol();
}

Expand Down

0 comments on commit 31e1028

Please sign in to comment.