Skip to content

Commit 5b87f50

Browse files
committed
[lldb] Rename function to GetTypedefedTypeRecursive() (NFC)
and increase the cycle-break limit to 128.
1 parent 9564f05 commit 5b87f50

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,10 @@ void LogUnimplementedTypeKind(const char *function, CompilerType type) {
695695
#endif
696696
}
697697

698-
CompilerType GetCanonicalClangType(CompilerType type) {
699-
for (unsigned i = 0; i < 32; ++i) {
698+
/// Resolve a (chain of) typedefs.
699+
CompilerType GetTypedefedTypeRecursive(CompilerType type) {
700+
// Guard against cycles.
701+
for (unsigned i = 0; i < 128; ++i) {
700702
if (!type.IsTypedefType())
701703
return type;
702704
type = type.GetTypedefedType();
@@ -730,7 +732,7 @@ SwiftLanguageRuntime::GetNumChildren(CompilerType type,
730732
if (!clang_type)
731733
ts.IsImportedType(type.GetOpaqueQualType(), &clang_type);
732734
if (clang_type) {
733-
clang_type = GetCanonicalClangType(clang_type);
735+
clang_type = GetTypedefedTypeRecursive(clang_type);
734736
bool is_signed;
735737
if (clang_type.IsEnumerationType(is_signed))
736738
return 1;
@@ -1162,7 +1164,7 @@ SwiftLanguageRuntime::GetIndexOfChildMemberWithName(
11621164
case TypeInfoKind::Builtin: {
11631165
CompilerType clang_type;
11641166
if (ts.IsImportedType(type.GetOpaqueQualType(), &clang_type)) {
1165-
clang_type = GetCanonicalClangType(clang_type);
1167+
clang_type = GetTypedefedTypeRecursive(clang_type);
11661168
bool is_signed;
11671169
if (clang_type.IsEnumerationType(is_signed)) {
11681170
// Clang enums have an artificial rawValue property.

0 commit comments

Comments
 (0)