Skip to content

Commit a7068f1

Browse files
zhscnMaskRay
authored andcommitted
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 ```
1 parent 344e2e6 commit a7068f1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/indexer.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ const Decl *getTypeDecl(QualType t, bool *specialization = nullptr) {
325325
switch (tp->getTypeClass()) {
326326
case Type::Typedef:
327327
d = cast<TypedefType>(tp)->getDecl();
328+
tp = cast<TypedefType>(tp)->getDecl()->getUnderlyingType().getTypePtrOrNull();
329+
if (tp)
330+
goto try_again;
328331
break;
329332
case Type::ObjCObject:
330333
d = cast<ObjCObjectType>(tp)->getInterface();

0 commit comments

Comments
 (0)