From 373e30a2643c6f1ef0981b0f8a1b0d256fbf2ac7 Mon Sep 17 00:00:00 2001 From: Marc-Andre Laperle Date: Fri, 16 Feb 2018 23:12:26 +0000 Subject: [PATCH] [clangd] Rename some protocol field to lower case Summary: Also fixes a GCC compilation error. Signed-off-by: Marc-Andre Laperle Subscribers: klimek, ilya-biryukov, jkorous-apple, ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D43411 llvm-svn: 325409 --- clang-tools-extra/clangd/Protocol.cpp | 12 ++++++------ clang-tools-extra/clangd/Protocol.h | 8 ++++---- clang-tools-extra/clangd/XRefs.cpp | 12 ++++++------ clang-tools-extra/unittests/clangd/XRefsTests.cpp | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp index fb3f05a..57f342b1 100644 --- a/clang-tools-extra/clangd/Protocol.cpp +++ b/clang-tools-extra/clangd/Protocol.cpp @@ -397,20 +397,20 @@ static StringRef toTextKind(MarkupKind Kind) { } 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); } diff --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h index bdbbf62..a3b211d 100644 --- a/clang-tools-extra/clangd/Protocol.h +++ b/clang-tools-extra/clangd/Protocol.h @@ -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; + llvm::Optional range; }; json::Expr toJSON(const Hover &H); diff --git a/clang-tools-extra/clangd/XRefs.cpp b/clang-tools-extra/clangd/XRefs.cpp index 8965881..b6e5192 100644 --- a/clang-tools-extra/clangd/XRefs.cpp +++ b/clang-tools-extra/clangd/XRefs.cpp @@ -382,9 +382,9 @@ static Hover getHoverContents(const Decl *D) { 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 *D) { OS.flush(); - H.Contents.Value += DeclText; + H.contents.value += DeclText; return H; } @@ -409,8 +409,8 @@ static Hover getHoverContents(const Decl *D) { 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; } diff --git a/clang-tools-extra/unittests/clangd/XRefsTests.cpp b/clang-tools-extra/unittests/clangd/XRefsTests.cpp index 0a12f85..a598c33 100644 --- a/clang-tools-extra/unittests/clangd/XRefsTests.cpp +++ b/clang-tools-extra/unittests/clangd/XRefsTests.cpp @@ -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; } } -- 2.7.4