[clang-tools-extra] r365288 - [clangd] Encapsulate fields in dex token. NFC

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 7 19:37:06 PDT 2019


Author: sammccall
Date: Sun Jul  7 19:37:06 2019
New Revision: 365288

URL: http://llvm.org/viewvc/llvm-project?rev=365288&view=rev
Log:
[clangd] Encapsulate fields in dex token. NFC

Modified:
    clang-tools-extra/trunk/clangd/index/dex/PostingList.h
    clang-tools-extra/trunk/clangd/index/dex/Token.h

Modified: clang-tools-extra/trunk/clangd/index/dex/PostingList.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/dex/PostingList.h?rev=365288&r1=365287&r2=365288&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/index/dex/PostingList.h (original)
+++ clang-tools-extra/trunk/clangd/index/dex/PostingList.h Sun Jul  7 19:37:06 2019
@@ -32,7 +32,7 @@
 namespace clang {
 namespace clangd {
 namespace dex {
-struct Token;
+class Token;
 
 /// NOTE: This is an implementation detail.
 ///

Modified: clang-tools-extra/trunk/clangd/index/dex/Token.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/dex/Token.h?rev=365288&r1=365287&r2=365288&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/index/dex/Token.h (original)
+++ clang-tools-extra/trunk/clangd/index/dex/Token.h Sun Jul  7 19:37:06 2019
@@ -37,7 +37,8 @@ namespace dex {
 ///
 /// Tokens can be used to perform more sophisticated search queries by
 /// constructing complex iterator trees.
-struct Token {
+class Token {
+public:
   /// Kind specifies Token type which defines semantics for the internal
   /// representation. Each Kind has different representation stored in Data
   /// field.
@@ -76,10 +77,6 @@ struct Token {
     return TokenKind == Other.TokenKind && Data == Other.Data;
   }
 
-  /// Representation which is unique among Token with the same Kind.
-  std::string Data;
-  Kind TokenKind;
-
   friend llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Token &T) {
     switch (T.TokenKind) {
     case Kind::Trigram:
@@ -102,6 +99,10 @@ struct Token {
   }
 
 private:
+  /// Representation which is unique among Token with the same Kind.
+  std::string Data;
+  Kind TokenKind;
+
   friend llvm::hash_code hash_value(const Token &Token) {
     return llvm::hash_combine(static_cast<int>(Token.TokenKind), Token.Data);
   }




More information about the cfe-commits mailing list