diff options
| author | Sam McCall <sam.mccall@gmail.com> | 2018-10-25 04:22:52 +0000 |
|---|---|---|
| committer | Sam McCall <sam.mccall@gmail.com> | 2018-10-25 04:22:52 +0000 |
| commit | bc90461818e252ef6a4c276d54c24b2b4f67f27e (patch) | |
| tree | 3d3c16b000f19abd2a07ff30fcedcb08d8dab765 /clang-tools-extra/clangd/Protocol.cpp | |
| parent | 46493ac9b5d6fb632cb10281af922a2158ccf18c (diff) | |
| download | bcm5719-llvm-bc90461818e252ef6a4c276d54c24b2b4f67f27e.tar.gz bcm5719-llvm-bc90461818e252ef6a4c276d54c24b2b4f67f27e.zip | |
[clangd] Clean up LSP structs around configuration. NFC, no protocol changes.
- align struct names/comments with LSP, remove redundant "clangd" prefixes.
- don't map config structs as Optional<> when their presence/absence
doesn't signal anything and all fields must have sensible "absent" values
- be more lax around parsing of 'any'-typed messages
llvm-svn: 345235
Diffstat (limited to 'clang-tools-extra/clangd/Protocol.cpp')
| -rw-r--r-- | clang-tools-extra/clangd/Protocol.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp index d4892682db9..1bb5961a5b4 100644 --- a/clang-tools-extra/clangd/Protocol.cpp +++ b/clang-tools-extra/clangd/Protocol.cpp @@ -663,20 +663,22 @@ bool fromJSON(const json::Value &Params, ClangdCompileCommand &CDbUpdate) { O.map("compilationCommand", CDbUpdate.compilationCommand); } -bool fromJSON(const json::Value &Params, - ClangdConfigurationParamsChange &CCPC) { +bool fromJSON(const json::Value &Params, ConfigurationSettings &S) { json::ObjectMapper O(Params); - return O && - O.map("compilationDatabaseChanges", CCPC.compilationDatabaseChanges); + if (!O) + return true; // 'any' type in LSP. + O.map("compilationDatabaseChanges", S.compilationDatabaseChanges); + return true; } -bool fromJSON(const json::Value &Params, ClangdInitializationOptions &Opts) { - if (!fromJSON(Params, Opts.ParamsChange)) { - return false; - } - +bool fromJSON(const json::Value &Params, InitializationOptions &Opts) { json::ObjectMapper O(Params); - return O && O.map("compilationDatabasePath", Opts.compilationDatabasePath); + if (!O) + return true; // 'any' type in LSP. + + fromJSON(Params, Opts.ConfigSettings); + O.map("compilationDatabasePath", Opts.compilationDatabasePath); + return true; } bool fromJSON(const json::Value &Params, ReferenceParams &R) { |

