Skip to content

Commit 5ed31c3

Browse files
committed
[lldb] Use canonical QualTypes to determine SwiftOptionSet formatter eligibility
When we lookup a clang type from DWARF by name, we use the first one we find. In this test we have two entities with the name `ComparisonResult`, en enum and a typedef to the enum. So if we happened to find the typedef first, we would fail to apply the `OptionSet` formatter to it because it explicitly wants a QualType whose type-class is an enum. This fixes `lang/swift/enum_objc/TestEnumObjC.py` when applying using the new `FindTypes` `TypeQuery` APIs (see #7885) The fix simply gets the canonical type before we check its type-class. (cherry picked from commit f7364b56732abeddb35082ba6002f75f26d795d0)
1 parent 7b576ba commit 5ed31c3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ GetAsEnumDecl(CompilerType swift_type) {
5050
if (!clang_ts)
5151
return {nullptr, nullptr};
5252

53-
auto qual_type =
54-
clang::QualType::getFromOpaquePtr(clang_type.GetOpaqueQualType());
53+
auto qual_type = clang::QualType::getFromOpaquePtr(
54+
clang_type.GetCanonicalType().GetOpaqueQualType());
5555
if (qual_type->getTypeClass() != clang::Type::TypeClass::Enum)
5656
return {nullptr, nullptr};
5757

0 commit comments

Comments
 (0)