forked from OSchip/llvm-project
[analyzer] MacOSKeychainAPIChecker: Simplify getSymbolForRegion by using existing API. Thanks Jordy.
llvm-svn: 138765
This commit is contained in:
parent
7113f221e2
commit
50dd696339
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue