diff options
| -rw-r--r-- | clang-tools-extra/clangd/index/SymbolCollector.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp b/clang-tools-extra/clangd/index/SymbolCollector.cpp index 73728df28eb..75f0eff7801 100644 --- a/clang-tools-extra/clangd/index/SymbolCollector.cpp +++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp @@ -480,9 +480,6 @@ void SymbolCollector::finish() { auto GetURI = [&](FileID FID) -> llvm::Optional<std::string> { auto Found = URICache.find(FID); if (Found == URICache.end()) { - // Ignore cases where we can not find a corresponding file entry - // for the loc, thoses are not interesting, e.g. symbols formed - // via macro concatenation. if (auto *FileEntry = SM.getFileEntryForID(FID)) { auto FileURI = toURI(SM, FileEntry->getName(), Opts); if (!FileURI) { @@ -490,6 +487,11 @@ void SymbolCollector::finish() { FileURI = ""; // reset to empty as we also want to cache this case. } Found = URICache.insert({FID, *FileURI}).first; + } else { + // Ignore cases where we can not find a corresponding file entry + // for the loc, thoses are not interesting, e.g. symbols formed + // via macro concatenation. + return llvm::None; } } return Found->second; |

