[clang-tools-extra] 3725142 - [clangd] Make sure working directory is set during preamble validation
Kadir Cetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 16 02:06:57 PDT 2020
Author: Kadir Cetinkaya
Date: 2020-06-16T11:06:41+02:00
New Revision: 3725142449af1b061b81cbacf81f64aaa5428250
URL: https://github.com/llvm/llvm-project/commit/3725142449af1b061b81cbacf81f64aaa5428250
DIFF: https://github.com/llvm/llvm-project/commit/3725142449af1b061b81cbacf81f64aaa5428250.diff
LOG: [clangd] Make sure working directory is set during preamble validation
Added:
Modified:
clang-tools-extra/clangd/Preamble.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/Preamble.cpp b/clang-tools-extra/clangd/Preamble.cpp
index 837ae7e5a5bb..c32dc8c66b2f 100644
--- a/clang-tools-extra/clangd/Preamble.cpp
+++ b/clang-tools-extra/clangd/Preamble.cpp
@@ -397,10 +397,12 @@ bool isPreambleCompatible(const PreambleData &Preamble,
llvm::MemoryBuffer::getMemBuffer(Inputs.Contents, FileName);
auto Bounds =
ComputePreambleBounds(*CI.getLangOpts(), ContentsBuffer.get(), 0);
+ auto VFS = Inputs.FSProvider->getFileSystem();
+ VFS->setCurrentWorkingDirectory(Inputs.CompileCommand.Directory);
return compileCommandsAreEqual(Inputs.CompileCommand,
Preamble.CompileCommand) &&
Preamble.Preamble.CanReuse(CI, ContentsBuffer.get(), Bounds,
- Inputs.FSProvider->getFileSystem().get());
+ VFS.get());
}
void escapeBackslashAndQuotes(llvm::StringRef Text, llvm::raw_ostream &OS) {
More information about the cfe-commits
mailing list