[PATCH] D44575: [clangd][nfc] Give name to a magic constant

2018-03-20 Thread Jan Korous via Phabricator via cfe-commits
jkorous-apple added a comment.

I commited the patch but forgot to quote this review.

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@327901 
91177308-0d34-0410-b5e6-96231b3b80d8


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D44575



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D44575: [clangd][nfc] Give name to a magic constant

2018-03-16 Thread Jan Korous via Phabricator via cfe-commits
jkorous-apple created this revision.
jkorous-apple added a project: clang-tools-extra.
Herald added subscribers: cfe-commits, ioeric, ilya-biryukov.

Since I was reading this code I decided I might just as well polish it a 
little. It is just preliminary commit for a bug-fix.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D44575

Files:
  clangd/index/Index.h


Index: clangd/index/Index.h
===
--- clangd/index/Index.h
+++ clangd/index/Index.h
@@ -54,16 +54,18 @@
   }
 
 private:
+  static constexpr unsigned HashByteLength = 20;
+
   friend llvm::hash_code hash_value(const SymbolID ) {
 // We already have a good hash, just return the first bytes.
-static_assert(sizeof(size_t) <= 20, "size_t longer than SHA1!");
+static_assert(sizeof(size_t) <= HashByteLength, "size_t longer than 
SHA1!");
 return *reinterpret_cast(ID.HashValue.data());
   }
   friend llvm::raw_ostream <<(llvm::raw_ostream ,
const SymbolID );
   friend void operator>>(llvm::StringRef Str, SymbolID );
 
-  std::array HashValue;
+  std::array HashValue;
 };
 
 // Write SymbolID into the given stream. SymbolID is encoded as a 40-bytes


Index: clangd/index/Index.h
===
--- clangd/index/Index.h
+++ clangd/index/Index.h
@@ -54,16 +54,18 @@
   }
 
 private:
+  static constexpr unsigned HashByteLength = 20;
+
   friend llvm::hash_code hash_value(const SymbolID ) {
 // We already have a good hash, just return the first bytes.
-static_assert(sizeof(size_t) <= 20, "size_t longer than SHA1!");
+static_assert(sizeof(size_t) <= HashByteLength, "size_t longer than SHA1!");
 return *reinterpret_cast(ID.HashValue.data());
   }
   friend llvm::raw_ostream <<(llvm::raw_ostream ,
const SymbolID );
   friend void operator>>(llvm::StringRef Str, SymbolID );
 
-  std::array HashValue;
+  std::array HashValue;
 };
 
 // Write SymbolID into the given stream. SymbolID is encoded as a 40-bytes
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits