diff options
Diffstat (limited to 'clang-tools-extra/clangd/unittests/TestFS.cpp')
| -rw-r--r-- | clang-tools-extra/clangd/unittests/TestFS.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/clang-tools-extra/clangd/unittests/TestFS.cpp b/clang-tools-extra/clangd/unittests/TestFS.cpp index c5b2613f759..5f5c5c21794 100644 --- a/clang-tools-extra/clangd/unittests/TestFS.cpp +++ b/clang-tools-extra/clangd/unittests/TestFS.cpp @@ -6,7 +6,11 @@ // //===----------------------------------------------------------------------===// #include "TestFS.h" +#include "GlobalCompilationDatabase.h" +#include "Path.h" #include "URI.h" +#include "llvm/ADT/None.h" +#include "llvm/ADT/Optional.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Errc.h" #include "llvm/Support/Path.h" @@ -36,9 +40,13 @@ MockCompilationDatabase::MockCompilationDatabase(llvm::StringRef Directory, // -ffreestanding avoids implicit stdc-predef.h. } +llvm::Optional<ProjectInfo> +MockCompilationDatabase::getProjectInfo(PathRef File) const { + return ProjectInfo{Directory}; +}; + llvm::Optional<tooling::CompileCommand> -MockCompilationDatabase::getCompileCommand(PathRef File, - ProjectInfo *Project) const { +MockCompilationDatabase::getCompileCommand(PathRef File) const { if (ExtraClangFlags.empty()) return None; @@ -57,8 +65,6 @@ MockCompilationDatabase::getCompileCommand(PathRef File, CommandLine.push_back(RelativeFilePath.str()); } - if (Project) - Project->SourceRoot = Directory; return {tooling::CompileCommand(Directory != llvm::StringRef() ? Directory : llvm::sys::path::parent_path(File), |

