@@ -74,7 +74,7 @@ class AllocationCheckerHelper {
7474 if (type_->category () == DeclTypeSpec::Category::Character) {
7575 hasDeferredTypeParameter_ =
7676 type_->characterTypeSpec ().length ().isDeferred ();
77- } else if (const DerivedTypeSpec * derivedTypeSpec{type_->AsDerived ()}) {
77+ } else if (const DerivedTypeSpec *derivedTypeSpec{type_->AsDerived ()}) {
7878 for (const auto &pair : derivedTypeSpec->parameters ()) {
7979 hasDeferredTypeParameter_ |= pair.second .isDeferred ();
8080 }
@@ -114,7 +114,7 @@ static std::optional<AllocateCheckerInfo> CheckAllocateOptions(
114114 }
115115 info.gotTypeSpec = true ;
116116 info.typeSpecLoc = parser::FindSourceLocation (*typeSpec);
117- if (const DerivedTypeSpec * derived{info.typeSpec ->AsDerived ()}) {
117+ if (const DerivedTypeSpec *derived{info.typeSpec ->AsDerived ()}) {
118118 // C937
119119 if (auto it{FindCoarrayUltimateComponent (*derived)}) {
120120 context
@@ -224,8 +224,8 @@ static std::optional<AllocateCheckerInfo> CheckAllocateOptions(
224224 }
225225 info.sourceExprRank = expr->Rank ();
226226 info.sourceExprLoc = parserSourceExpr->source ;
227- if (const DerivedTypeSpec *
228- derived{ evaluate::GetDerivedTypeSpec (info.sourceExprType )}) {
227+ if (const DerivedTypeSpec *derived{
228+ evaluate::GetDerivedTypeSpec (info.sourceExprType )}) {
229229 // C949
230230 if (auto it{FindCoarrayUltimateComponent (*derived)}) {
231231 context
@@ -279,13 +279,13 @@ static std::optional<AllocateCheckerInfo> CheckAllocateOptions(
279279// in this test.
280280static bool IsTypeCompatible (
281281 const DeclTypeSpec &type1, const DerivedTypeSpec &derivedType2) {
282- if (const DerivedTypeSpec * derivedType1{type1.AsDerived ()}) {
282+ if (const DerivedTypeSpec *derivedType1{type1.AsDerived ()}) {
283283 if (type1.category () == DeclTypeSpec::Category::TypeDerived) {
284284 return evaluate::AreSameDerivedTypeIgnoringTypeParameters (
285285 *derivedType1, derivedType2);
286286 } else if (type1.category () == DeclTypeSpec::Category::ClassDerived) {
287287 for (const DerivedTypeSpec *parent{&derivedType2}; parent;
288- parent = parent->typeSymbol ().GetParentTypeSpec ()) {
288+ parent = parent->typeSymbol ().GetParentTypeSpec ()) {
289289 if (evaluate::AreSameDerivedTypeIgnoringTypeParameters (
290290 *derivedType1, *parent)) {
291291 return true ;
@@ -303,13 +303,13 @@ static bool IsTypeCompatible(
303303 // cannot be allocatable (C709)
304304 return true ;
305305 }
306- if (const IntrinsicTypeSpec * intrinsicType2{type2.AsIntrinsic ()}) {
307- if (const IntrinsicTypeSpec * intrinsicType1{type1.AsIntrinsic ()}) {
306+ if (const IntrinsicTypeSpec *intrinsicType2{type2.AsIntrinsic ()}) {
307+ if (const IntrinsicTypeSpec *intrinsicType1{type1.AsIntrinsic ()}) {
308308 return intrinsicType1->category () == intrinsicType2->category ();
309309 } else {
310310 return false ;
311311 }
312- } else if (const DerivedTypeSpec * derivedType2{type2.AsDerived ()}) {
312+ } else if (const DerivedTypeSpec *derivedType2{type2.AsDerived ()}) {
313313 return IsTypeCompatible (type1, *derivedType2);
314314 }
315315 return false ;
@@ -323,7 +323,7 @@ static bool IsTypeCompatible(
323323 return true ;
324324 }
325325 if (type2.category () != evaluate::TypeCategory::Derived) {
326- if (const IntrinsicTypeSpec * intrinsicType1{type1.AsIntrinsic ()}) {
326+ if (const IntrinsicTypeSpec *intrinsicType1{type1.AsIntrinsic ()}) {
327327 return intrinsicType1->category () == type2.category ();
328328 } else {
329329 return false ;
@@ -348,16 +348,16 @@ static bool HaveSameAssumedTypeParameters(
348348 }
349349 // It is possible to reach this if type1 is unlimited polymorphic
350350 return !type2LengthIsAssumed;
351- } else if (const DerivedTypeSpec * derivedType2{type2.AsDerived ()}) {
351+ } else if (const DerivedTypeSpec *derivedType2{type2.AsDerived ()}) {
352352 int type2AssumedParametersCount{0 };
353353 int type1AssumedParametersCount{0 };
354354 for (const auto &pair : derivedType2->parameters ()) {
355355 type2AssumedParametersCount += pair.second .isAssumed ();
356356 }
357357 // type1 may be unlimited polymorphic
358- if (const DerivedTypeSpec * derivedType1{type1.AsDerived ()}) {
358+ if (const DerivedTypeSpec *derivedType1{type1.AsDerived ()}) {
359359 for (auto it{derivedType1->parameters ().begin ()};
360- it != derivedType1->parameters ().end (); ++it) {
360+ it != derivedType1->parameters ().end (); ++it) {
361361 if (it->second .isAssumed ()) {
362362 ++type1AssumedParametersCount;
363363 const ParamValue *param{derivedType2->FindParameter (it->first )};
@@ -378,8 +378,8 @@ static bool HaveSameAssumedTypeParameters(
378378
379379static std::optional<std::int64_t > GetTypeParameterInt64Value (
380380 const Symbol ¶meterSymbol, const DerivedTypeSpec &derivedType) {
381- if (const ParamValue *
382- paramValue{ derivedType.FindParameter (parameterSymbol.name ())}) {
381+ if (const ParamValue *paramValue{
382+ derivedType.FindParameter (parameterSymbol.name ())}) {
383383 return evaluate::ToInt64 (paramValue->GetExplicit ());
384384 }
385385 return std::nullopt ;
@@ -403,11 +403,11 @@ static bool HaveCompatibleTypeParameters(
403403 if (type1.category () == DeclTypeSpec::Category::ClassStar) {
404404 return true ;
405405 }
406- if (const IntrinsicTypeSpec * intrinsicType1{type1.AsIntrinsic ()}) {
406+ if (const IntrinsicTypeSpec *intrinsicType1{type1.AsIntrinsic ()}) {
407407 return evaluate::ToInt64 (intrinsicType1->kind ()).value () == type2.kind ();
408408 } else if (type2.IsUnlimitedPolymorphic ()) {
409409 return false ;
410- } else if (const DerivedTypeSpec * derivedType1{type1.AsDerived ()}) {
410+ } else if (const DerivedTypeSpec *derivedType1{type1.AsDerived ()}) {
411411 return HaveCompatibleTypeParameters (
412412 *derivedType1, type2.GetDerivedTypeSpec ());
413413 } else {
@@ -419,10 +419,10 @@ static bool HaveCompatibleTypeParameters(
419419 const DeclTypeSpec &type1, const DeclTypeSpec &type2) {
420420 if (type1.category () == DeclTypeSpec::Category::ClassStar) {
421421 return true ;
422- } else if (const IntrinsicTypeSpec * intrinsicType1{type1.AsIntrinsic ()}) {
422+ } else if (const IntrinsicTypeSpec *intrinsicType1{type1.AsIntrinsic ()}) {
423423 const IntrinsicTypeSpec *intrinsicType2{type2.AsIntrinsic ()};
424424 return !intrinsicType2 || intrinsicType1->kind () == intrinsicType2->kind ();
425- } else if (const DerivedTypeSpec * derivedType1{type1.AsDerived ()}) {
425+ } else if (const DerivedTypeSpec *derivedType1{type1.AsDerived ()}) {
426426 const DerivedTypeSpec *derivedType2{type2.AsDerived ()};
427427 return !derivedType2 ||
428428 HaveCompatibleTypeParameters (*derivedType1, *derivedType2);
@@ -699,8 +699,7 @@ bool AllocationCheckerHelper::RunCoarrayRelatedChecks(
699699 if (evaluate::IsCoarray (*ultimate_)) {
700700 if (allocateInfo_.gotTypeSpec ) {
701701 // C938
702- if (const DerivedTypeSpec *
703- derived{allocateInfo_.typeSpec ->AsDerived ()}) {
702+ if (const DerivedTypeSpec *derived{allocateInfo_.typeSpec ->AsDerived ()}) {
704703 if (IsTeamType (derived)) {
705704 context
706705 .Say (allocateInfo_.typeSpecLoc .value (),
@@ -784,8 +783,8 @@ bool AllocationCheckerHelper::RunCoarrayRelatedChecks(
784783 return false ;
785784 }
786785 }
787- if (const parser::CoindexedNamedObject *
788- coindexedObject{ parser::GetCoindexedNamedObject (allocateObject_)}) {
786+ if (const parser::CoindexedNamedObject *coindexedObject{
787+ parser::GetCoindexedNamedObject (allocateObject_)}) {
789788 // C950
790789 context.Say (parser::FindSourceLocation (*coindexedObject),
791790 " Allocatable object must not be coindexed in ALLOCATE" _err_en_US);
0 commit comments