@@ -1006,12 +1006,9 @@ ProgramStateRef CStringChecker::InvalidateBuffer(CheckerContext &C,
10061006
10071007bool CStringChecker::SummarizeRegion (raw_ostream &os, ASTContext &Ctx,
10081008 const MemRegion *MR) {
1009- const TypedValueRegion *TVR = dyn_cast<TypedValueRegion>(MR);
1010-
10111009 switch (MR->getKind ()) {
10121010 case MemRegion::FunctionCodeRegionKind: {
1013- const NamedDecl *FD = cast<FunctionCodeRegion>(MR)->getDecl ();
1014- if (FD)
1011+ if (const auto *FD = cast<FunctionCodeRegion>(MR)->getDecl ())
10151012 os << " the address of the function '" << *FD << ' \' ' ;
10161013 else
10171014 os << " the address of a function" ;
@@ -1025,16 +1022,20 @@ bool CStringChecker::SummarizeRegion(raw_ostream &os, ASTContext &Ctx,
10251022 return true ;
10261023 case MemRegion::CXXThisRegionKind:
10271024 case MemRegion::CXXTempObjectRegionKind:
1028- os << " a C++ temp object of type " << TVR->getValueType ().getAsString ();
1025+ os << " a C++ temp object of type "
1026+ << cast<TypedValueRegion>(MR)->getValueType ().getAsString ();
10291027 return true ;
10301028 case MemRegion::VarRegionKind:
1031- os << " a variable of type" << TVR->getValueType ().getAsString ();
1029+ os << " a variable of type"
1030+ << cast<TypedValueRegion>(MR)->getValueType ().getAsString ();
10321031 return true ;
10331032 case MemRegion::FieldRegionKind:
1034- os << " a field of type " << TVR->getValueType ().getAsString ();
1033+ os << " a field of type "
1034+ << cast<TypedValueRegion>(MR)->getValueType ().getAsString ();
10351035 return true ;
10361036 case MemRegion::ObjCIvarRegionKind:
1037- os << " an instance variable of type " << TVR->getValueType ().getAsString ();
1037+ os << " an instance variable of type "
1038+ << cast<TypedValueRegion>(MR)->getValueType ().getAsString ();
10381039 return true ;
10391040 default :
10401041 return false ;
0 commit comments