[clangd] Find implementors only when index is present.
authorUtkarsh Saxena <usx@google.com>
Mon, 3 May 2021 09:41:24 +0000 (11:41 +0200)
committerUtkarsh Saxena <usx@google.com>
Mon, 3 May 2021 15:16:33 +0000 (17:16 +0200)
Differential Revision: https://reviews.llvm.org/D101750

clang-tools-extra/clangd/XRefs.cpp

index bb51b4a..c21d3c3 100644 (file)
@@ -299,7 +299,7 @@ std::vector<LocatedSymbol> findImplementors(llvm::DenseSet<SymbolID> IDs,
                                             RelationKind Predicate,
                                             const SymbolIndex *Index,
                                             llvm::StringRef MainFilePath) {
-  if (IDs.empty())
+  if (IDs.empty() || !Index)
     return {};
   static constexpr trace::Metric FindImplementorsMetric(
       "find_implementors", trace::Metric::Counter, "case");