Skip to content

Commit fee5bc4

Browse files
committed
ASTDemangler: Make it work from lldb
For some reason, findDeclContext() finds the special ClangImporter module from inside lldb, and then we were skipping the logic in findForeignTypeDecl(). So check for the foreign type case first.
1 parent bcdc9e7 commit fee5bc4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/AST/ASTDemangler.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -802,16 +802,17 @@ ASTBuilder::findDeclContext(const Demangle::NodePointer &node) {
802802
return nullptr;
803803
}
804804

805+
// Do some special logic for foreign type declarations.
806+
if (privateDiscriminator.empty()) {
807+
if (auto foreignModuleKind = getForeignModuleKind(node->getChild(0))) {
808+
return findForeignTypeDecl(name, relatedEntityKind,
809+
foreignModuleKind.getValue(),
810+
node->getKind());
811+
}
812+
}
813+
805814
DeclContext *dc = findDeclContext(node->getChild(0));
806815
if (!dc) {
807-
// Do some backup logic for foreign type declarations.
808-
if (privateDiscriminator.empty()) {
809-
if (auto foreignModuleKind = getForeignModuleKind(node->getChild(0))) {
810-
return findForeignTypeDecl(name, relatedEntityKind,
811-
foreignModuleKind.getValue(),
812-
node->getKind());
813-
}
814-
}
815816
return nullptr;
816817
}
817818

0 commit comments

Comments
 (0)