[llvm] 483ed64 - Hashing - fix uninitialized variable warnings. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 06:47:08 PST 2019


Author: Simon Pilgrim
Date: 2019-11-08T14:46:22Z
New Revision: 483ed6460dedbbfb3582a3fd95d70ea0aade9a74

URL: https://github.com/llvm/llvm-project/commit/483ed6460dedbbfb3582a3fd95d70ea0aade9a74
DIFF: https://github.com/llvm/llvm-project/commit/483ed6460dedbbfb3582a3fd95d70ea0aade9a74.diff

LOG: Hashing - fix uninitialized variable warnings. NFCI.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/Hashing.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/Hashing.h b/llvm/include/llvm/ADT/Hashing.h
index 59659d290495..adcc5cf54da9 100644
--- a/llvm/include/llvm/ADT/Hashing.h
+++ b/llvm/include/llvm/ADT/Hashing.h
@@ -257,7 +257,7 @@ inline uint64_t hash_short(const char *s, size_t length, uint64_t seed) {
 /// Currently, the algorithm for computing hash codes is based on CityHash and
 /// keeps 56 bytes of arbitrary state.
 struct hash_state {
-  uint64_t h0, h1, h2, h3, h4, h5, h6;
+  uint64_t h0 = 0, h1 = 0, h2 = 0, h3 = 0, h4 = 0, h5 = 0, h6 = 0;
 
   /// Create a new hash_state structure and initialize it based on the
   /// seed and the first 64-byte chunk.
@@ -492,7 +492,7 @@ namespace detail {
 /// useful at minimizing the code in the recursive calls to ease the pain
 /// caused by a lack of variadic functions.
 struct hash_combine_recursive_helper {
-  char buffer[64];
+  char buffer[64] = {};
   hash_state state;
   const uint64_t seed;
 


        


More information about the llvm-commits mailing list