[PATCH] D35617: [clangd] Allow specifying -resource-dir
Krasimir Georgiev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 19 08:47:43 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL308486: [clangd] Allow specifying -resource-dir (authored by krasimir).
Repository:
rL LLVM
https://reviews.llvm.org/D35617
Files:
clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
clang-tools-extra/trunk/clangd/ClangdLSPServer.h
clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
Index: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
@@ -216,9 +216,10 @@
R"(,"result":[)" + Locations + R"(]})");
}
-ClangdLSPServer::ClangdLSPServer(JSONOutput &Out, bool RunSynchronously)
+ClangdLSPServer::ClangdLSPServer(JSONOutput &Out, bool RunSynchronously,
+ llvm::Optional<StringRef> ResourceDir)
: Out(Out), DiagConsumer(*this),
- Server(CDB, DiagConsumer, FSProvider, RunSynchronously) {}
+ Server(CDB, DiagConsumer, FSProvider, RunSynchronously, ResourceDir) {}
void ClangdLSPServer::run(std::istream &In) {
assert(!IsDone && "Run was called before");
Index: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
@@ -25,6 +25,11 @@
llvm::cl::desc("parse on main thread"),
llvm::cl::init(false), llvm::cl::Hidden);
+static llvm::cl::opt<std::string>
+ ResourceDir("resource-dir",
+ llvm::cl::desc("directory for system clang headers"),
+ llvm::cl::init(""), llvm::cl::Hidden);
+
int main(int argc, char *argv[]) {
llvm::cl::ParseCommandLineOptions(argc, argv, "clangd");
@@ -35,6 +40,9 @@
// Change stdin to binary to not lose \r\n on windows.
llvm::sys::ChangeStdinToBinary();
- ClangdLSPServer LSPServer(Out, RunSynchronously);
+ llvm::Optional<StringRef> ResourceDirRef = None;
+ if (!ResourceDir.empty())
+ ResourceDirRef = ResourceDir;
+ ClangdLSPServer LSPServer(Out, RunSynchronously, ResourceDirRef);
LSPServer.run(std::cin);
}
Index: clang-tools-extra/trunk/clangd/ClangdLSPServer.h
===================================================================
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.h
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.h
@@ -15,6 +15,7 @@
#include "Path.h"
#include "Protocol.h"
#include "clang/Tooling/Core/Replacement.h"
+#include "llvm/ADT/Optional.h"
namespace clang {
namespace clangd {
@@ -25,7 +26,8 @@
/// dispatch and ClangdServer together.
class ClangdLSPServer {
public:
- ClangdLSPServer(JSONOutput &Out, bool RunSynchronously);
+ ClangdLSPServer(JSONOutput &Out, bool RunSynchronously,
+ llvm::Optional<StringRef> ResourceDir);
/// Run LSP server loop, receiving input for it from \p In. \p In must be
/// opened in binary mode. Output will be written using Out variable passed to
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35617.107313.patch
Type: text/x-patch
Size: 2710 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170719/04a4e86d/attachment.bin>
More information about the cfe-commits
mailing list