diff --git a/clang-tools-extra/clangd/XRefs.cpp b/clang-tools-extra/clangd/XRefs.cpp --- a/clang-tools-extra/clangd/XRefs.cpp +++ b/clang-tools-extra/clangd/XRefs.cpp @@ -1191,6 +1191,8 @@ RecursionProtectionSet RPSet; Optional Result = getTypeAncestors(*CXXRD, AST.getASTContext(), RPSet); + if (!Result) + return Result; if ((Direction == TypeHierarchyDirection::Children || Direction == TypeHierarchyDirection::Both) &&