Skip to content

Commit 3c8aa1c

Browse files
authored
[lldb] Remove limited temporary MultiPayloadEnum handling (#6756)
With recent work being done by @tbkka, this temporary workaround can be removed.
1 parent fc28cf7 commit 3c8aa1c

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,20 +1235,6 @@ findFieldWithName(const std::vector<swift::reflection::FieldInfo> &fields,
12351235
return {true, child_indexes.size()};
12361236
}
12371237

1238-
static llvm::Optional<std::string>
1239-
GetMultiPayloadEnumCaseName(const swift::reflection::EnumTypeInfo *eti,
1240-
const DataExtractor &data) {
1241-
assert(eti->getEnumKind() == swift::reflection::EnumKind::MultiPayloadEnum);
1242-
auto payload_capacity = eti->getPayloadSize();
1243-
if (data.GetByteSize() == payload_capacity + 1) {
1244-
auto tag = data.GetDataStart()[payload_capacity];
1245-
const auto &cases = eti->getCases();
1246-
if (tag >= 0 && tag < cases.size())
1247-
return cases[tag].Name;
1248-
}
1249-
return {};
1250-
}
1251-
12521238
llvm::Optional<std::string> SwiftLanguageRuntimeImpl::GetEnumCaseName(
12531239
CompilerType type, const DataExtractor &data, ExecutionContext *exe_ctx) {
12541240
using namespace swift::reflection;
@@ -1267,12 +1253,6 @@ llvm::Optional<std::string> SwiftLanguageRuntimeImpl::GetEnumCaseName(
12671253
if (eti->projectEnumValue(*GetMemoryReader(), addr, &case_index))
12681254
return eti->getCases()[case_index].Name;
12691255

1270-
// Temporary workaround.
1271-
if (eti->getEnumKind() == EnumKind::MultiPayloadEnum &&
1272-
type.GetMangledTypeName().GetStringRef().startswith(
1273-
"$s10Foundation9IndexPathV7Storage"))
1274-
return GetMultiPayloadEnumCaseName(eti, data);
1275-
12761256
return {};
12771257
}
12781258

lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3795,10 +3795,8 @@ bool TypeSystemSwiftTypeRef::DumpTypeValue(
37953795
}
37963796
}
37973797

3798-
// No result available from the runtime, fallback to the AST.
3799-
// This can happen in two cases:
3800-
// 1. MultiPayloadEnums not currently supported by Swift reflection
3801-
// 2. Some clang imported enums
3798+
// No result available from the runtime, fallback to the AST. This occurs
3799+
// for some Clang imported enums
38023800
if (auto *swift_ast_context = GetSwiftASTContext())
38033801
return swift_ast_context->DumpTypeValue(
38043802
ReconstructType(type), s, format, data, data_offset, data_byte_size,

0 commit comments

Comments
 (0)