[clang-tools-extra] r359866 - [clangd] Minor code style cleanups in Protocol.h. NFC

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Fri May 3 01:03:22 PDT 2019


Author: ibiryukov
Date: Fri May  3 01:03:21 2019
New Revision: 359866

URL: http://llvm.org/viewvc/llvm-project?rev=359866&view=rev
Log:
[clangd] Minor code style cleanups in Protocol.h. NFC

- Remove a parameter name that was misspelled (OS used for non-stream
  parameter)
- Declare operator == (TextEdit, TextEdit) outside the struct, for
  consistency with other user-declared ops in our code.
- Fix naming style of a parameter.

Modified:
    clang-tools-extra/trunk/clangd/Protocol.h

Modified: clang-tools-extra/trunk/clangd/Protocol.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Protocol.h?rev=359866&r1=359865&r2=359866&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/Protocol.h (original)
+++ clang-tools-extra/trunk/clangd/Protocol.h Fri May  3 01:03:21 2019
@@ -206,11 +206,10 @@ struct TextEdit {
   /// The string to be inserted. For delete operations use an
   /// empty string.
   std::string newText;
-
-  bool operator==(const TextEdit &rhs) const {
-    return newText == rhs.newText && range == rhs.range;
-  }
 };
+inline bool operator==(const TextEdit &L, const TextEdit &R) {
+  return std::tie(L.newText, L.range) == std::tie(R.newText, R.range);
+}
 bool fromJSON(const llvm::json::Value &, TextEdit &);
 llvm::json::Value toJSON(const TextEdit &);
 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const TextEdit &);
@@ -294,7 +293,7 @@ using CompletionItemKindBitset = std::bi
 bool fromJSON(const llvm::json::Value &, CompletionItemKindBitset &);
 CompletionItemKind
 adjustKindToCapability(CompletionItemKind Kind,
-                       CompletionItemKindBitset &supportedCompletionItemKinds);
+                       CompletionItemKindBitset &SupportedCompletionItemKinds);
 
 /// A symbol kind.
 enum class SymbolKind {
@@ -352,7 +351,7 @@ enum class OffsetEncoding {
 };
 llvm::json::Value toJSON(const OffsetEncoding &);
 bool fromJSON(const llvm::json::Value &, OffsetEncoding &);
-llvm::raw_ostream &operator<<(llvm::raw_ostream &, OffsetEncoding OS);
+llvm::raw_ostream &operator<<(llvm::raw_ostream &, OffsetEncoding);
 
 // This struct doesn't mirror LSP!
 // The protocol defines deeply nested structures for client capabilities.




More information about the cfe-commits mailing list