@@ -1006,12 +1006,9 @@ ProgramStateRef CStringChecker::InvalidateBuffer(CheckerContext &C,
1006
1006
1007
1007
bool CStringChecker::SummarizeRegion (raw_ostream &os, ASTContext &Ctx,
1008
1008
const MemRegion *MR) {
1009
- const TypedValueRegion *TVR = dyn_cast<TypedValueRegion>(MR);
1010
-
1011
1009
switch (MR->getKind ()) {
1012
1010
case MemRegion::FunctionCodeRegionKind: {
1013
- const NamedDecl *FD = cast<FunctionCodeRegion>(MR)->getDecl ();
1014
- if (FD)
1011
+ if (const auto *FD = cast<FunctionCodeRegion>(MR)->getDecl ())
1015
1012
os << " the address of the function '" << *FD << ' \' ' ;
1016
1013
else
1017
1014
os << " the address of a function" ;
@@ -1025,16 +1022,20 @@ bool CStringChecker::SummarizeRegion(raw_ostream &os, ASTContext &Ctx,
1025
1022
return true ;
1026
1023
case MemRegion::CXXThisRegionKind:
1027
1024
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 ();
1029
1027
return true ;
1030
1028
case MemRegion::VarRegionKind:
1031
- os << " a variable of type" << TVR->getValueType ().getAsString ();
1029
+ os << " a variable of type"
1030
+ << cast<TypedValueRegion>(MR)->getValueType ().getAsString ();
1032
1031
return true ;
1033
1032
case MemRegion::FieldRegionKind:
1034
- os << " a field of type " << TVR->getValueType ().getAsString ();
1033
+ os << " a field of type "
1034
+ << cast<TypedValueRegion>(MR)->getValueType ().getAsString ();
1035
1035
return true ;
1036
1036
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 ();
1038
1039
return true ;
1039
1040
default :
1040
1041
return false ;
0 commit comments