Skip to content

Commit 9821f46

Browse files
committed
[rebranch] Do not serialize unstable hashes
llvm/llvm-project#96282 changed `get_execution_seed` to be non-deterministic. Use stable hashes instead.
1 parent 0a6e587 commit 9821f46

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

include/swift/Localization/LocalizationFormat.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class LocalizationWriterInfo {
6969
using hash_value_type = uint32_t;
7070
using offset_type = uint32_t;
7171

72-
hash_value_type ComputeHash(key_type_ref key) { return llvm::hash_code(key); }
72+
hash_value_type ComputeHash(key_type_ref key) { return key; }
7373

7474
std::pair<offset_type, offset_type> EmitKeyDataLength(llvm::raw_ostream &out,
7575
key_type_ref key,
@@ -113,7 +113,7 @@ class LocalizationReaderInfo {
113113
}
114114

115115
hash_value_type ComputeHash(internal_key_type key) {
116-
return llvm::hash_code(key);
116+
return key;
117117
}
118118

119119
static std::pair<offset_type, offset_type>

lib/ClangImporter/SwiftLookupTable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ namespace {
11421142
}
11431143

11441144
hash_value_type ComputeHash(key_type_ref key) {
1145-
return llvm::DenseMapInfo<SerializedSwiftName>::getHashValue(key);
1145+
return static_cast<unsigned>(key.Kind) + llvm::djbHash(key.Name);
11461146
}
11471147

11481148
std::pair<unsigned, unsigned> EmitKeyDataLength(raw_ostream &out,
@@ -1421,7 +1421,7 @@ namespace {
14211421
}
14221422

14231423
hash_value_type ComputeHash(internal_key_type key) {
1424-
return llvm::DenseMapInfo<SerializedSwiftName>::getHashValue(key);
1424+
return static_cast<unsigned>(key.Kind) + llvm::djbHash(key.Name);
14251425
}
14261426

14271427
static bool EqualKey(internal_key_type lhs, internal_key_type rhs) {

lib/Serialization/ModuleFileCoreTableInfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ class ModuleFileSharedCore::DeclMembersTableInfo {
318318
}
319319

320320
hash_value_type ComputeHash(internal_key_type key) {
321-
return llvm::hash_value(key);
321+
return key;
322322
}
323323

324324
static bool EqualKey(internal_key_type lhs, internal_key_type rhs) {
@@ -557,7 +557,7 @@ class ModuleFileSharedCore::DeclFingerprintsTableInfo {
557557
internal_key_type GetInternalKey(external_key_type ID) { return ID; }
558558

559559
hash_value_type ComputeHash(internal_key_type key) {
560-
return llvm::hash_value(key);
560+
return key;
561561
}
562562

563563
static bool EqualKey(internal_key_type lhs, internal_key_type rhs) {

lib/Serialization/Serialization.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ namespace {
414414
using offset_type = unsigned;
415415

416416
hash_value_type ComputeHash(key_type_ref key) {
417-
return llvm::hash_value(static_cast<uint32_t>(key));
417+
return static_cast<uint32_t>(key);
418418
}
419419

420420
std::pair<unsigned, unsigned> EmitKeyDataLength(raw_ostream &out,
@@ -459,7 +459,7 @@ namespace {
459459
using offset_type = unsigned;
460460

461461
hash_value_type ComputeHash(key_type_ref key) {
462-
return llvm::hash_value(static_cast<uint32_t>(key));
462+
return static_cast<uint32_t>(key);
463463
}
464464

465465
std::pair<unsigned, unsigned>

0 commit comments

Comments
 (0)