Skip to content

[Cherry-pick into next] [lldb] Rename function to GetTypedefedTypeRecursive() (NFC) #10400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,10 @@ void LogUnimplementedTypeKind(const char *function, CompilerType type) {
#endif
}

CompilerType GetCanonicalClangType(CompilerType type) {
for (unsigned i = 0; i < 32; ++i) {
/// Resolve a (chain of) typedefs.
CompilerType GetTypedefedTypeRecursive(CompilerType type) {
// Guard against cycles.
for (unsigned i = 0; i < 128; ++i) {
if (!type.IsTypedefType())
return type;
type = type.GetTypedefedType();
Expand Down Expand Up @@ -730,7 +732,7 @@ SwiftLanguageRuntime::GetNumChildren(CompilerType type,
if (!clang_type)
ts.IsImportedType(type.GetOpaqueQualType(), &clang_type);
if (clang_type) {
clang_type = GetCanonicalClangType(clang_type);
clang_type = GetTypedefedTypeRecursive(clang_type);
bool is_signed;
if (clang_type.IsEnumerationType(is_signed))
return 1;
Expand Down Expand Up @@ -1162,7 +1164,7 @@ SwiftLanguageRuntime::GetIndexOfChildMemberWithName(
case TypeInfoKind::Builtin: {
CompilerType clang_type;
if (ts.IsImportedType(type.GetOpaqueQualType(), &clang_type)) {
clang_type = GetCanonicalClangType(clang_type);
clang_type = GetTypedefedTypeRecursive(clang_type);
bool is_signed;
if (clang_type.IsEnumerationType(is_signed)) {
// Clang enums have an artificial rawValue property.
Expand Down