forked from OSchip/llvm-project
[analyzer] MacOSKeychainAPIChecker: Retrieve the memory region which we are tracking even when it's no longer a SymbolicRegion, for example, when it is cast to char*.
llvm-svn: 138415
This commit is contained in:
parent
bb167011e3
commit
f9e9c4e9bc
|
@ -167,8 +167,14 @@ unsigned MacOSKeychainAPIChecker::getTrackedFunctionIndex(StringRef Name,
|
||||||
|
|
||||||
static SymbolRef getSymbolForRegion(CheckerContext &C,
|
static SymbolRef getSymbolForRegion(CheckerContext &C,
|
||||||
const MemRegion *R) {
|
const MemRegion *R) {
|
||||||
if (!isa<SymbolicRegion>(R))
|
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 0;
|
||||||
|
}
|
||||||
return cast<SymbolicRegion>(R)->getSymbol();
|
return cast<SymbolicRegion>(R)->getSymbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue