Skip to content

Commit 06707b3

Browse files
Merge pull request #6897 from augusto2112/simd-remove-ast-type
[lldb] Remove direct usage of AST types in SIMDVector_SummaryProvider
2 parents 2e91f3e + 4893a56 commit 06707b3

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lldb/source/Plugins/Language/Swift/SwiftFormatters.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,25 +1121,25 @@ bool lldb_private::formatters::swift::SIMDVector_SummaryProvider(
11211121
// dynamic archetype (and hence its size). Everything follows naturally
11221122
// as the elements are laid out in a contigous buffer without padding.
11231123
CompilerType simd_type = valobj.GetCompilerType().GetCanonicalType();
1124+
auto ts = simd_type.GetTypeSystem().dyn_cast_or_null<TypeSystemSwift>();
1125+
if (!ts)
1126+
return false;
1127+
11241128
ExecutionContext exe_ctx = valobj.GetExecutionContextRef().Lock(true);
11251129
llvm::Optional<uint64_t> opt_type_size =
11261130
simd_type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
11271131
if (!opt_type_size)
11281132
return false;
11291133
uint64_t type_size = *opt_type_size;
11301134

1131-
::swift::TypeBase *swift_type = GetSwiftType(simd_type).getPointer();
1132-
if (!swift_type)
1135+
lldbassert(simd_type.GetNumTemplateArguments() == 1 && "broken SIMD type");
1136+
if (simd_type.GetNumTemplateArguments() != 1)
11331137
return false;
1134-
auto bound_type = dyn_cast<::swift::BoundGenericType>(swift_type);
1135-
if (!bound_type)
1136-
return false;
1137-
auto generic_args = bound_type->getGenericArgs();
1138-
lldbassert(generic_args.size() == 1 && "broken SIMD type");
1139-
if (generic_args.size() != 1)
1138+
1139+
auto arg_type = ts->GetGenericArgumentType(simd_type.GetOpaqueQualType(), 0);
1140+
lldbassert(arg_type && "Unexpected invalid SIMD generic argument type");
1141+
if (!arg_type)
11401142
return false;
1141-
auto swift_arg_type = generic_args[0];
1142-
CompilerType arg_type = ToCompilerType(swift_arg_type);
11431143

11441144
llvm::Optional<uint64_t> opt_arg_size =
11451145
arg_type.GetByteSize(exe_ctx.GetBestExecutionContextScope());

0 commit comments

Comments
 (0)