[clang-tools-extra] f44d242 - [clangd] Set CWD in semaCodeComplete

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 11 14:36:10 PDT 2020


Author: Kadir Cetinkaya
Date: 2020-06-11T23:35:47+02:00
New Revision: f44d2424f8d7735d7ab5ffd96f75300221afd099

URL: https://github.com/llvm/llvm-project/commit/f44d2424f8d7735d7ab5ffd96f75300221afd099
DIFF: https://github.com/llvm/llvm-project/commit/f44d2424f8d7735d7ab5ffd96f75300221afd099.diff

LOG: [clangd] Set CWD in semaCodeComplete

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D81691

Added: 
    

Modified: 
    clang-tools-extra/clangd/CodeComplete.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp
index cf79673d821e..a7a4ede23ea4 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -1116,6 +1116,9 @@ bool semaCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer,
       Input.ParseInput.FSProvider->getFileSystem();
   if (Input.Preamble.StatCache)
     VFS = Input.Preamble.StatCache->getConsumingFS(std::move(VFS));
+  if (VFS->setCurrentWorkingDirectory(
+          Input.ParseInput.CompileCommand.Directory))
+    elog("Couldn't set working directory during code completion");
   auto Clang = prepareCompilerInstance(
       std::move(CI), !CompletingInPreamble ? &Input.Preamble.Preamble : nullptr,
       std::move(ContentsBuffer), std::move(VFS), IgnoreDiags);


        


More information about the cfe-commits mailing list