[clang-tools-extra] r325024 - [clangd] Log if CWD could not be changed. NFC.

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 13 09:15:06 PST 2018


Author: ibiryukov
Date: Tue Feb 13 09:15:06 2018
New Revision: 325024

URL: http://llvm.org/viewvc/llvm-project?rev=325024&view=rev
Log:
[clangd] Log if CWD could not be changed. NFC.

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

Modified: clang-tools-extra/trunk/clangd/ClangdUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdUnit.cpp?rev=325024&r1=325023&r2=325024&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangdUnit.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdUnit.cpp Tue Feb 13 09:15:06 2018
@@ -379,7 +379,11 @@ CppFile::rebuild(ParseInputs &&Inputs) {
   for (const auto &S : Inputs.CompileCommand.CommandLine)
     ArgStrs.push_back(S.c_str());
 
-  Inputs.FS->setCurrentWorkingDirectory(Inputs.CompileCommand.Directory);
+  if (Inputs.FS->setCurrentWorkingDirectory(Inputs.CompileCommand.Directory)) {
+    log("Couldn't set working directory");
+    // We run parsing anyway, our lit-tests rely on results for non-existing
+    // working dirs.
+  }
 
   // Prepare CompilerInvocation.
   std::unique_ptr<CompilerInvocation> CI;

Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=325024&r1=325023&r2=325024&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original)
+++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Tue Feb 13 09:15:06 2018
@@ -642,7 +642,11 @@ bool semaCodeComplete(std::unique_ptr<Co
   for (const auto &S : Input.Command.CommandLine)
     ArgStrs.push_back(S.c_str());
 
-  Input.VFS->setCurrentWorkingDirectory(Input.Command.Directory);
+  if (Input.VFS->setCurrentWorkingDirectory(Input.Command.Directory)) {
+    log("Couldn't set working directory");
+    // We run parsing anyway, our lit-tests rely on results for non-existing
+    // working dirs.
+  }
 
   IgnoreDiagnostics DummyDiagsConsumer;
   auto CI = createInvocationFromCommandLine(




More information about the cfe-commits mailing list