diff --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp b/clang-tools-extra/clangd/index/SymbolCollector.cpp --- a/clang-tools-extra/clangd/index/SymbolCollector.cpp +++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp @@ -469,7 +469,10 @@ if (!ObjectID) continue; - // Record the relation. + // In a BaseOf relation we must've seen the definition/declaration of base + // type. + if (!Symbols.find(ID)) + continue; // TODO: There may be cases where the object decl is not indexed for some // reason. Those cases should probably be removed in due course, but for // now there are two possible ways to handle it: