@@ -347,23 +347,21 @@ static const char *GetTypeStr(ISO::CFI_type_t type, bool dumpRawType) {
347347 CASE (CFI_type_uint32_t)
348348 CASE (CFI_type_uint64_t)
349349 CASE (CFI_type_uint128_t)
350+ default :
351+ return nullptr ;
350352 }
351353#undef CASE
352- return nullptr ;
353354 }
354355 TypeCode code{type};
355-
356- if (!code.IsValid ())
356+ if (!code.IsValid ()) {
357357 return " invalid" ;
358-
359- common::optional<std::pair<TypeCategory, int >> categoryAndKind =
360- code.GetCategoryAndKind ();
361- if (!categoryAndKind)
358+ }
359+ auto categoryAndKind{code.GetCategoryAndKind ()};
360+ if (!categoryAndKind) {
362361 return nullptr ;
363-
364- TypeCategory tcat;
365- int kind;
366- std::tie (tcat, kind) = *categoryAndKind;
362+ }
363+ TypeCategory tcat{categoryAndKind->first };
364+ int kind{categoryAndKind->second };
367365
368366#define CASE (cat, k ) \
369367 case (k): \
@@ -434,26 +432,21 @@ void Descriptor::Dump(FILE *f, bool dumpRawType) const {
434432 std::fprintf (f, " base_addr %p\n " , raw_.base_addr );
435433 std::fprintf (f, " elem_len %zd\n " , ElementBytes ());
436434 std::fprintf (f, " version %d\n " , static_cast <int >(raw_.version ));
437- if (rank () > 0 ) {
438- std::fprintf (f, " rank %d\n " , rank ());
439- } else {
440- std::fprintf (f, " scalar\n " );
441- }
442- int ty = static_cast <int >(raw_.type );
443- if (const char *tyStr = GetTypeStr (raw_.type , dumpRawType)) {
435+ std::fprintf (f, " rank %d%s\n " , rank (), rank () ? " " : " (scalar)" );
436+ int ty{static_cast <int >(raw_.type )};
437+ if (const char *tyStr{GetTypeStr (raw_.type , dumpRawType)}) {
444438 std::fprintf (f, " type %d \" %s\"\n " , ty, tyStr);
445439 } else {
446440 std::fprintf (f, " type %d\n " , ty);
447441 }
448- int attr = static_cast <int >(raw_.attribute );
442+ int attr{ static_cast <int >(raw_.attribute )} ;
449443 if (IsPointer ()) {
450444 std::fprintf (f, " attribute %d (pointer) \n " , attr);
451445 } else if (IsAllocatable ()) {
452446 std::fprintf (f, " attribute %d (allocatable)\n " , attr);
453447 } else {
454448 std::fprintf (f, " attribute %d\n " , attr);
455449 }
456-
457450 std::fprintf (f, " extra %d\n " , static_cast <int >(raw_.extra ));
458451 std::fprintf (f, " addendum %d\n " , static_cast <int >(HasAddendum ()));
459452 std::fprintf (f, " alloc_idx %d\n " , static_cast <int >(GetAllocIdx ()));
0 commit comments