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();