Index: clangd/index/Background.cpp =================================================================== --- clangd/index/Background.cpp +++ clangd/index/Background.cpp @@ -484,7 +484,7 @@ // Goes over each dependency. for (size_t CurrentDependency = 0; CurrentDependency < Dependencies.size(); CurrentDependency++) { - llvm::StringRef CurDependencyPath = Dependencies[CurrentDependency].Path; + std::string CurDependencyPath = Dependencies[CurrentDependency].Path; // If we have already seen this shard before(either loaded or failed) don't // re-try again. Since the information in the shard won't change from one TU // to another. @@ -504,11 +504,18 @@ // These are the edges in the include graph for current dependency. for (const auto &I : *Shard->Sources) { auto U = URI::parse(I.getKey()); - if (!U) + if (!U) { + elog("Failed to parse URI {0}: {1}", I.getKey(), U.takeError()); continue; + } + auto AbsolutePath = URI::resolve(*U, CurDependencyPath); - if (!AbsolutePath) + if (!AbsolutePath) { + elog("Failed to resolve URI {0}: {1}", I.getKey(), + AbsolutePath.takeError()); continue; + } + // Add file as dependency if haven't seen before. if (InQueue.try_emplace(*AbsolutePath).second) Dependencies.emplace_back(*AbsolutePath, true); @@ -527,6 +534,7 @@ // Check if the source needs re-indexing. // Get the digest, skip it if file doesn't exist. auto Buf = FS->getBufferForFile(CurDependencyPath); + if (!Buf) { elog("Couldn't get buffer for file: {0}: {1}", CurDependencyPath, Buf.getError().message());