Skip to content

Commit 28a4371

Browse files
committed
Change getOriginRegion to getSuperRegion
1 parent ba19d73 commit 28a4371

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -427,21 +427,6 @@ static std::optional<NonLoc> getIndex(ProgramStateRef State,
427427
return Offset.castAs<NonLoc>();
428428
}
429429

430-
// Try to get hold of the origin region (e.g. the actual array region from an
431-
// element region).
432-
static const TypedValueRegion *getOriginRegion(const ElementRegion *ER) {
433-
const MemRegion *MR = ER->getSuperRegion();
434-
const MemRegion *Ret = MR;
435-
assert(MR);
436-
if (const auto *sym = MR->getAs<SymbolicRegion>()) {
437-
SymbolRef sym2 = sym->getSymbol();
438-
if (!sym2)
439-
return nullptr;
440-
Ret = sym2->getOriginRegion();
441-
}
442-
return dyn_cast_or_null<TypedValueRegion>(Ret);
443-
}
444-
445430
// Basically 1 -> 1st, 12 -> 12th, etc.
446431
static void printIdxWithOrdinalSuffix(llvm::raw_ostream &Os, unsigned Idx) {
447432
Os << Idx << llvm::getOrdinalSuffix(Idx);
@@ -461,7 +446,7 @@ ProgramStateRef CStringChecker::checkInit(CheckerContext &C,
461446
if (!ER)
462447
return State;
463448

464-
const TypedValueRegion *Orig = getOriginRegion(ER);
449+
const auto *Orig = ER->getSuperRegion()->getAs<TypedValueRegion>();
465450
if (!Orig)
466451
return State;
467452

0 commit comments

Comments
 (0)