@@ -446,23 +446,23 @@ ProgramStateRef CStringChecker::checkInit(CheckerContext &C,
446
446
if (!ER)
447
447
return State;
448
448
449
- const auto *Orig = ER->getSuperRegion ()->getAs <TypedValueRegion>();
450
- if (!Orig )
449
+ const auto *SuperR = ER->getSuperRegion ()->getAs <TypedValueRegion>();
450
+ if (!SuperR )
451
451
return State;
452
452
453
453
// FIXME: We ought to able to check objects as well. Maybe
454
454
// UninitializedObjectChecker could help?
455
- if (!Orig ->getValueType ()->isArrayType ())
455
+ if (!SuperR ->getValueType ()->isArrayType ())
456
456
return State;
457
457
458
458
SValBuilder &SVB = C.getSValBuilder ();
459
459
ASTContext &Ctx = SVB.getContext ();
460
460
461
- const QualType ElemTy = Ctx.getBaseElementType (Orig ->getValueType ());
461
+ const QualType ElemTy = Ctx.getBaseElementType (SuperR ->getValueType ());
462
462
const NonLoc Zero = SVB.makeZeroArrayIndex ();
463
463
464
464
Loc FirstElementVal =
465
- State->getLValue (ElemTy, Zero, loc::MemRegionVal (Orig )).castAs <Loc>();
465
+ State->getLValue (ElemTy, Zero, loc::MemRegionVal (SuperR )).castAs <Loc>();
466
466
467
467
// Ensure that we wouldn't read uninitialized value.
468
468
if (Filter.CheckCStringUninitializedRead &&
@@ -516,7 +516,7 @@ ProgramStateRef CStringChecker::checkInit(CheckerContext &C,
516
516
return State;
517
517
518
518
SVal LastElementVal =
519
- State->getLValue (ElemTy, LastIdx, loc::MemRegionVal (Orig ));
519
+ State->getLValue (ElemTy, LastIdx, loc::MemRegionVal (SuperR ));
520
520
if (!isa<Loc>(LastElementVal))
521
521
return State;
522
522
@@ -531,9 +531,9 @@ ProgramStateRef CStringChecker::checkInit(CheckerContext &C,
531
531
}
532
532
llvm::SmallString<258 > Buf;
533
533
llvm::raw_svector_ostream OS (Buf);
534
- OS << " The last ( " ;
535
- printIdxWithOrdinalSuffix (OS, IdxInt->getExtValue () + 1 );
536
- OS << " ) element to access in the " ;
534
+ OS << " The last accessed element (at index " ;
535
+ OS << IdxInt->getExtValue ();
536
+ OS << " ) in the " ;
537
537
printIdxWithOrdinalSuffix (OS, Buffer.ArgumentIndex + 1 );
538
538
OS << " argument is undefined" ;
539
539
emitUninitializedReadBug (C, State, Buffer.Expression , OS.str ());
0 commit comments