[clang-tools-extra] r325409 - [clangd] Rename some protocol field to lower case

Marc-Andre Laperle via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 16 15:12:26 PST 2018


Author: malaperle
Date: Fri Feb 16 15:12:26 2018
New Revision: 325409

URL: http://llvm.org/viewvc/llvm-project?rev=325409&view=rev
Log:
[clangd] Rename some protocol field to lower case

Summary:
Also fixes a GCC compilation error.

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle at ericsson.com>

Subscribers: klimek, ilya-biryukov, jkorous-apple, ioeric, cfe-commits

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

Modified:
    clang-tools-extra/trunk/clangd/Protocol.cpp
    clang-tools-extra/trunk/clangd/Protocol.h
    clang-tools-extra/trunk/clangd/XRefs.cpp
    clang-tools-extra/trunk/unittests/clangd/XRefsTests.cpp

Modified: clang-tools-extra/trunk/clangd/Protocol.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Protocol.cpp?rev=325409&r1=325408&r2=325409&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/Protocol.cpp (original)
+++ clang-tools-extra/trunk/clangd/Protocol.cpp Fri Feb 16 15:12:26 2018
@@ -397,20 +397,20 @@ static StringRef toTextKind(MarkupKind K
 }
 
 json::Expr toJSON(const MarkupContent &MC) {
-  if (MC.Value.empty())
+  if (MC.value.empty())
     return nullptr;
 
   return json::obj{
-      {"kind", toTextKind(MC.Kind)},
-      {"value", MC.Value},
+      {"kind", toTextKind(MC.kind)},
+      {"value", MC.value},
   };
 }
 
 json::Expr toJSON(const Hover &H) {
-  json::obj Result{{"contents", toJSON(H.Contents)}};
+  json::obj Result{{"contents", toJSON(H.contents)}};
 
-  if (H.Range.hasValue())
-    Result["range"] = toJSON(*H.Range);
+  if (H.range.hasValue())
+    Result["range"] = toJSON(*H.range);
 
   return std::move(Result);
 }

Modified: clang-tools-extra/trunk/clangd/Protocol.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Protocol.h?rev=325409&r1=325408&r2=325409&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/Protocol.h (original)
+++ clang-tools-extra/trunk/clangd/Protocol.h Fri Feb 16 15:12:26 2018
@@ -486,18 +486,18 @@ enum class MarkupKind {
 };
 
 struct MarkupContent {
-  MarkupKind Kind = MarkupKind::PlainText;
-  std::string Value;
+  MarkupKind kind = MarkupKind::PlainText;
+  std::string value;
 };
 json::Expr toJSON(const MarkupContent &MC);
 
 struct Hover {
   /// The hover's content
-  MarkupContent Contents;
+  MarkupContent contents;
 
   /// An optional range is a range inside a text document
   /// that is used to visualize a hover, e.g. by changing the background color.
-  llvm::Optional<Range> Range;
+  llvm::Optional<Range> range;
 };
 json::Expr toJSON(const Hover &H);
 

Modified: clang-tools-extra/trunk/clangd/XRefs.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/XRefs.cpp?rev=325409&r1=325408&r2=325409&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/XRefs.cpp (original)
+++ clang-tools-extra/trunk/clangd/XRefs.cpp Fri Feb 16 15:12:26 2018
@@ -382,9 +382,9 @@ static Hover getHoverContents(const Decl
   if (NamedScope) {
     assert(!NamedScope->empty());
 
-    H.Contents.Value += "Declared in ";
-    H.Contents.Value += *NamedScope;
-    H.Contents.Value += "\n\n";
+    H.contents.value += "Declared in ";
+    H.contents.value += *NamedScope;
+    H.contents.value += "\n\n";
   }
 
   // We want to include the template in the Hover.
@@ -401,7 +401,7 @@ static Hover getHoverContents(const Decl
 
   OS.flush();
 
-  H.Contents.Value += DeclText;
+  H.contents.value += DeclText;
   return H;
 }
 
@@ -409,8 +409,8 @@ static Hover getHoverContents(const Decl
 static Hover getHoverContents(StringRef MacroName) {
   Hover H;
 
-  H.Contents.Value = "#define ";
-  H.Contents.Value += MacroName;
+  H.contents.value = "#define ";
+  H.contents.value += MacroName;
 
   return H;
 }

Modified: clang-tools-extra/trunk/unittests/clangd/XRefsTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/XRefsTests.cpp?rev=325409&r1=325408&r2=325409&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/XRefsTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/XRefsTests.cpp Fri Feb 16 15:12:26 2018
@@ -559,7 +559,7 @@ TEST(Hover, All) {
     auto AST = build(T.code());
     Hover H = getHover(AST, T.point());
 
-    EXPECT_EQ(H.Contents.Value, Test.ExpectedHover) << Test.Input;
+    EXPECT_EQ(H.contents.value, Test.ExpectedHover) << Test.Input;
   }
 }
 




More information about the cfe-commits mailing list