[clangd] NFC: Resolve Clang-Tidy warnings in Protocol.cpp
authorKirill Bobyrev <kbobyrev@google.com>
Tue, 20 Oct 2020 09:23:36 +0000 (11:23 +0200)
committerKirill Bobyrev <kbobyrev@google.com>
Tue, 20 Oct 2020 09:23:40 +0000 (11:23 +0200)
Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D89771

clang-tools-extra/clangd/Protocol.cpp

index 0b89c62..0103a06 100644 (file)
@@ -179,10 +179,12 @@ bool fromJSON(const llvm::json::Value &E, TraceLevel &Out, llvm::json::Path P) {
     if (*S == "off") {
       Out = TraceLevel::Off;
       return true;
-    } else if (*S == "messages") {
+    }
+    if (*S == "messages") {
       Out = TraceLevel::Messages;
       return true;
-    } else if (*S == "verbose") {
+    }
+    if (*S == "verbose") {
       Out = TraceLevel::Verbose;
       return true;
     }
@@ -319,7 +321,8 @@ bool fromJSON(const llvm::json::Value &Params, ClientCapabilities &R,
       if (auto *Item = Completion->getObject("completionItem")) {
         if (auto SnippetSupport = Item->getBoolean("snippetSupport"))
           R.CompletionSnippets = *SnippetSupport;
-        if (auto DocumentationFormat = Item->getArray("documentationFormat")) {
+        if (const auto *DocumentationFormat =
+                Item->getArray("documentationFormat")) {
           for (const auto &Format : *DocumentationFormat) {
             if (fromJSON(Format, R.CompletionDocumentationFormat, P))
               break;
@@ -645,7 +648,7 @@ bool fromJSON(const llvm::json::Value &Params, ExecuteCommandParams &R,
   if (!O || !O.map("command", R.command))
     return false;
 
-  auto Args = Params.getAsObject()->getArray("arguments");
+  const auto *Args = Params.getAsObject()->getArray("arguments");
   if (R.command == ExecuteCommandParams::CLANGD_APPLY_FIX_COMMAND) {
     return Args && Args->size() == 1 &&
            fromJSON(Args->front(), R.workspaceEdit,