Skip to content

Commit 4043d43

Browse files
committed
Drop the requirement that nested types be clang::TypeDecls
The nested types table contains more than just nested typedefs and aggregate decls, it also contains classes that we've imported under nested names. We were previously falling back to direct lookup to resolve (cross) references to these entities. Instead, relax the preconditions for searching the table. This breaks a few cycles involving re-entrant calls to lookupDirect/lookupQualified through the ClangImporter.
1 parent 9c04d33 commit 4043d43

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2906,12 +2906,11 @@ ClangModuleUnit::lookupNestedType(Identifier name,
29062906
// If the entry is not visible, skip it.
29072907
if (!isVisibleClangEntry(clangCtx, entry)) continue;
29082908

2909-
auto clangDecl = entry.dyn_cast<clang::NamedDecl *>();
2910-
auto clangTypeDecl = dyn_cast_or_null<clang::TypeDecl>(clangDecl);
2911-
if (!clangTypeDecl)
2909+
auto *clangDecl = entry.dyn_cast<clang::NamedDecl *>();
2910+
if (!clangDecl)
29122911
continue;
29132912

2914-
clangTypeDecl = cast<clang::TypeDecl>(clangTypeDecl->getMostRecentDecl());
2913+
const auto *clangTypeDecl = clangDecl->getMostRecentDecl();
29152914

29162915
bool anyMatching = false;
29172916
TypeDecl *originalDecl = nullptr;

0 commit comments

Comments
 (0)