@@ -66,10 +66,6 @@ namespace {
66
66
return key;
67
67
}
68
68
69
- hash_value_type ComputeHash (internal_key_type key) {
70
- return static_cast <size_t >(llvm::hash_value (key));
71
- }
72
-
73
69
static bool EqualKey (internal_key_type lhs, internal_key_type rhs) {
74
70
return lhs == rhs;
75
71
}
@@ -187,8 +183,7 @@ namespace {
187
183
// / Used to deserialize the on-disk Objective-C class table.
188
184
class ObjCContextIDTableInfo {
189
185
public:
190
- // parent context ID, context kind, identifier ID
191
- using internal_key_type = std::tuple<uint32_t , uint8_t , uint32_t >;
186
+ using internal_key_type = ContextTableKey;
192
187
using external_key_type = internal_key_type;
193
188
using data_type = unsigned ;
194
189
using hash_value_type = size_t ;
@@ -203,7 +198,7 @@ namespace {
203
198
}
204
199
205
200
hash_value_type ComputeHash (internal_key_type key) {
206
- return static_cast <size_t >(llvm::hash_value ( key));
201
+ return static_cast <size_t >(key. hashValue ( ));
207
202
}
208
203
209
204
static bool EqualKey (internal_key_type lhs, internal_key_type rhs) {
@@ -241,7 +236,11 @@ namespace {
241
236
static internal_key_type ReadKey (const uint8_t *data, unsigned length) {
242
237
return endian::readNext<uint32_t , little, unaligned>(data);
243
238
}
244
-
239
+
240
+ hash_value_type ComputeHash (internal_key_type key) {
241
+ return static_cast <size_t >(llvm::hash_value (key));
242
+ }
243
+
245
244
static ObjCContextInfo readUnversioned (internal_key_type key,
246
245
const uint8_t *&data) {
247
246
ObjCContextInfo info;
@@ -294,7 +293,11 @@ namespace {
294
293
char isInstance = endian::readNext<uint8_t , little, unaligned>(data);
295
294
return std::make_tuple (classID, nameID, isInstance);
296
295
}
297
-
296
+
297
+ hash_value_type ComputeHash (internal_key_type key) {
298
+ return static_cast <size_t >(llvm::hash_value (key));
299
+ }
300
+
298
301
static ObjCPropertyInfo readUnversioned (internal_key_type key,
299
302
const uint8_t *&data) {
300
303
ObjCPropertyInfo info;
@@ -366,7 +369,11 @@ namespace {
366
369
auto isInstance = endian::readNext<uint8_t , little, unaligned>(data);
367
370
return internal_key_type{ classID, selectorID, isInstance };
368
371
}
369
-
372
+
373
+ hash_value_type ComputeHash (internal_key_type key) {
374
+ return static_cast <size_t >(llvm::hash_value (key));
375
+ }
376
+
370
377
static ObjCMethodInfo readUnversioned (internal_key_type key,
371
378
const uint8_t *&data) {
372
379
ObjCMethodInfo info;
@@ -432,8 +439,7 @@ namespace {
432
439
433
440
// / Used to deserialize the on-disk global variable table.
434
441
class GlobalVariableTableInfo
435
- : public VersionedTableInfo<GlobalVariableTableInfo,
436
- std::tuple<uint32_t , uint8_t , uint32_t >,
442
+ : public VersionedTableInfo<GlobalVariableTableInfo, ContextTableKey,
437
443
GlobalVariableInfo> {
438
444
public:
439
445
static internal_key_type ReadKey (const uint8_t *data, unsigned length) {
@@ -443,6 +449,10 @@ namespace {
443
449
return {contextID, contextKind, nameID};
444
450
}
445
451
452
+ hash_value_type ComputeHash (internal_key_type key) {
453
+ return static_cast <size_t >(key.hashValue ());
454
+ }
455
+
446
456
static GlobalVariableInfo readUnversioned (internal_key_type key,
447
457
const uint8_t *&data) {
448
458
GlobalVariableInfo info;
@@ -453,8 +463,7 @@ namespace {
453
463
454
464
// / Used to deserialize the on-disk global function table.
455
465
class GlobalFunctionTableInfo
456
- : public VersionedTableInfo<GlobalFunctionTableInfo,
457
- std::tuple<uint32_t , uint8_t , uint32_t >,
466
+ : public VersionedTableInfo<GlobalFunctionTableInfo, ContextTableKey,
458
467
GlobalFunctionInfo> {
459
468
public:
460
469
static internal_key_type ReadKey (const uint8_t *data, unsigned length) {
@@ -463,7 +472,11 @@ namespace {
463
472
auto nameID = endian::readNext<uint32_t , little, unaligned>(data);
464
473
return {contextID, contextKind, nameID};
465
474
}
466
-
475
+
476
+ hash_value_type ComputeHash (internal_key_type key) {
477
+ return static_cast <size_t >(key.hashValue ());
478
+ }
479
+
467
480
static GlobalFunctionInfo readUnversioned (internal_key_type key,
468
481
const uint8_t *&data) {
469
482
GlobalFunctionInfo info;
@@ -481,7 +494,11 @@ namespace {
481
494
auto nameID = endian::readNext<uint32_t , little, unaligned>(data);
482
495
return nameID;
483
496
}
484
-
497
+
498
+ hash_value_type ComputeHash (internal_key_type key) {
499
+ return static_cast <size_t >(llvm::hash_value (key));
500
+ }
501
+
485
502
static EnumConstantInfo readUnversioned (internal_key_type key,
486
503
const uint8_t *&data) {
487
504
EnumConstantInfo info;
@@ -492,16 +509,19 @@ namespace {
492
509
493
510
// / Used to deserialize the on-disk tag table.
494
511
class TagTableInfo
495
- : public VersionedTableInfo<
496
- TagTableInfo, std::tuple<uint32_t , uint8_t , uint32_t >, TagInfo> {
512
+ : public VersionedTableInfo<TagTableInfo, ContextTableKey, TagInfo> {
497
513
public:
498
514
static internal_key_type ReadKey (const uint8_t *data, unsigned length) {
499
515
auto contextID = endian::readNext<uint32_t , little, unaligned>(data);
500
516
auto contextKind = endian::readNext<uint8_t , little, unaligned>(data);
501
517
auto nameID = endian::readNext<IdentifierID, little, unaligned>(data);
502
518
return {contextID, contextKind, nameID};
503
519
}
504
-
520
+
521
+ hash_value_type ComputeHash (internal_key_type key) {
522
+ return static_cast <size_t >(key.hashValue ());
523
+ }
524
+
505
525
static TagInfo readUnversioned (internal_key_type key,
506
526
const uint8_t *&data) {
507
527
TagInfo info;
@@ -523,9 +543,7 @@ namespace {
523
543
524
544
// / Used to deserialize the on-disk typedef table.
525
545
class TypedefTableInfo
526
- : public VersionedTableInfo<TypedefTableInfo,
527
- std::tuple<uint32_t , uint8_t , uint32_t >,
528
- TypedefInfo> {
546
+ : public VersionedTableInfo<TypedefTableInfo, ContextTableKey, TypedefInfo> {
529
547
public:
530
548
static internal_key_type ReadKey (const uint8_t *data, unsigned length) {
531
549
auto contextID = endian::readNext<uint32_t , little, unaligned>(data);
@@ -534,6 +552,10 @@ namespace {
534
552
return {contextID, contextKind, nameID};
535
553
}
536
554
555
+ hash_value_type ComputeHash (internal_key_type key) {
556
+ return static_cast <size_t >(key.hashValue ());
557
+ }
558
+
537
559
static TypedefInfo readUnversioned (internal_key_type key,
538
560
const uint8_t *&data) {
539
561
TypedefInfo info;
@@ -1839,7 +1861,7 @@ auto APINotesReader::lookupObjCClassID(StringRef name) -> Optional<ContextID> {
1839
1861
// ObjC classes can't be declared in C++ namespaces, so use -1 as the global
1840
1862
// context.
1841
1863
auto knownID = Impl.ObjCContextIDTable ->find (
1842
- { -1 , (uint8_t )ContextKind::ObjCClass, *classID} );
1864
+ ContextTableKey ( -1 , (uint8_t )ContextKind::ObjCClass, *classID) );
1843
1865
if (knownID == Impl.ObjCContextIDTable ->end ())
1844
1866
return None;
1845
1867
@@ -1874,7 +1896,7 @@ auto APINotesReader::lookupObjCProtocolID(StringRef name)
1874
1896
// ObjC classes can't be declared in C++ namespaces, so use -1 as the global
1875
1897
// context.
1876
1898
auto knownID = Impl.ObjCContextIDTable ->find (
1877
- { -1 , (uint8_t )ContextKind::ObjCProtocol, *classID} );
1899
+ ContextTableKey ( -1 , (uint8_t )ContextKind::ObjCProtocol, *classID) );
1878
1900
if (knownID == Impl.ObjCContextIDTable ->end ())
1879
1901
return None;
1880
1902
@@ -1949,7 +1971,7 @@ auto APINotesReader::lookupGlobalVariable(std::optional<Context> context,
1949
1971
if (!nameID)
1950
1972
return None;
1951
1973
1952
- std::tuple< uint32_t , uint8_t , uint32_t > key = getTableKey (context, *nameID);
1974
+ ContextTableKey key (context, *nameID);
1953
1975
1954
1976
auto known = Impl.GlobalVariableTable ->find (key);
1955
1977
if (known == Impl.GlobalVariableTable ->end ())
@@ -1968,7 +1990,7 @@ auto APINotesReader::lookupGlobalFunction(std::optional<Context> context,
1968
1990
if (!nameID)
1969
1991
return None;
1970
1992
1971
- std::tuple< uint32_t , uint8_t , uint32_t > key = getTableKey (context, *nameID);
1993
+ ContextTableKey key (context, *nameID);
1972
1994
1973
1995
auto known = Impl.GlobalFunctionTable ->find (key);
1974
1996
if (known == Impl.GlobalFunctionTable ->end ())
@@ -2002,7 +2024,7 @@ auto APINotesReader::lookupTag(std::optional<Context> context, StringRef name)
2002
2024
if (!nameID)
2003
2025
return None;
2004
2026
2005
- std::tuple< uint32_t , uint8_t , uint32_t > key = getTableKey (context, *nameID);
2027
+ ContextTableKey key (context, *nameID);
2006
2028
2007
2029
auto known = Impl.TagTable ->find (key);
2008
2030
if (known == Impl.TagTable ->end ())
@@ -2021,7 +2043,7 @@ auto APINotesReader::lookupTypedef(std::optional<Context> context,
2021
2043
if (!nameID)
2022
2044
return None;
2023
2045
2024
- std::tuple< uint32_t , uint8_t , uint32_t > key = getTableKey (context, *nameID);
2046
+ ContextTableKey key (context, *nameID);
2025
2047
2026
2048
auto known = Impl.TypedefTable ->find (key);
2027
2049
if (known == Impl.TypedefTable ->end ())
0 commit comments