hokein created this revision.
hokein added a reviewer: sammccall.
Herald added subscribers: kadircet, arphaman.
Herald added a project: All.
hokein requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

Setup a current working directory (the build directoy) when creating a compile
instance. (otherwise clangd may die immediately when the VFS doesn't get input
files e.g. -fsanitize-ignorelist="../ignores.txt").


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140617

Files:
  clang-tools-extra/clangd/index/StdLib.cpp


Index: clang-tools-extra/clangd/index/StdLib.cpp
===================================================================
--- clang-tools-extra/clangd/index/StdLib.cpp
+++ clang-tools-extra/clangd/index/StdLib.cpp
@@ -224,10 +224,11 @@
   IgnoreDiagnostics IgnoreDiags;
   // CompilerInvocation is taken from elsewhere, and may map a dirty buffer.
   CI->getPreprocessorOpts().clearRemappedFiles();
+  std::string CWD = CI->getFileSystemOpts().WorkingDir;
   auto Clang = prepareCompilerInstance(
       std::move(CI), /*Preamble=*/nullptr,
       llvm::MemoryBuffer::getMemBuffer(HeaderSources, Input.getFile()),
-      TFS.view(/*CWD=*/std::nullopt), IgnoreDiags);
+      TFS.view(CWD), IgnoreDiags);
   if (!Clang) {
     elog("Standard Library Index: Couldn't build compiler instance");
     return Symbols;


Index: clang-tools-extra/clangd/index/StdLib.cpp
===================================================================
--- clang-tools-extra/clangd/index/StdLib.cpp
+++ clang-tools-extra/clangd/index/StdLib.cpp
@@ -224,10 +224,11 @@
   IgnoreDiagnostics IgnoreDiags;
   // CompilerInvocation is taken from elsewhere, and may map a dirty buffer.
   CI->getPreprocessorOpts().clearRemappedFiles();
+  std::string CWD = CI->getFileSystemOpts().WorkingDir;
   auto Clang = prepareCompilerInstance(
       std::move(CI), /*Preamble=*/nullptr,
       llvm::MemoryBuffer::getMemBuffer(HeaderSources, Input.getFile()),
-      TFS.view(/*CWD=*/std::nullopt), IgnoreDiags);
+      TFS.view(CWD), IgnoreDiags);
   if (!Clang) {
     elog("Standard Library Index: Couldn't build compiler instance");
     return Symbols;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D140617: [clangd] Fix a... Haojian Wu via Phabricator via cfe-commits

Reply via email to