indexer: Resolve the type alias correctly (#988)

The struct derived from an alias is missing from type hierarchy before this fix:
```cpp
struct Base {};
struct Derived : Base {};
using BaseAlias = Base;
struct DerivedAlias : BaseAlias {};
```
```
Derive from
Base
└╸Derived
```
The expected output is:
```
Derive from
Base
├╸Derived
└╸DerivedAlias
```
This commit is contained in:
zhscn 2025-11-09 11:51:45 +08:00 committed by GitHub
parent 5660367c77
commit 5caa190a92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -325,6 +325,9 @@ try_again:
switch (tp->getTypeClass()) { switch (tp->getTypeClass()) {
case Type::Typedef: case Type::Typedef:
d = cast<TypedefType>(tp)->getDecl(); d = cast<TypedefType>(tp)->getDecl();
tp = cast<TypedefType>(tp)->getDecl()->getUnderlyingType().getTypePtrOrNull();
if (tp)
goto try_again;
break; break;
case Type::ObjCObject: case Type::ObjCObject:
d = cast<ObjCObjectType>(tp)->getInterface(); d = cast<ObjCObjectType>(tp)->getInterface();