@@ -77,17 +77,17 @@ class APINotesWriter::Implementation {
77
77
78
78
// / Information about global variables.
79
79
// /
80
- // / Indexed by the context ID, contextKind, identifier ID.
80
+ // / Indexed by the context ID, identifier ID.
81
81
llvm::DenseMap<
82
- ContextTableKey ,
82
+ SingleDeclTableKey ,
83
83
llvm::SmallVector<std::pair<VersionTuple, GlobalVariableInfo>, 1 >>
84
84
GlobalVariables;
85
85
86
86
// / Information about global functions.
87
87
// /
88
- // / Indexed by the context ID, contextKind, identifier ID.
88
+ // / Indexed by the context ID, identifier ID.
89
89
llvm::DenseMap<
90
- ContextTableKey ,
90
+ SingleDeclTableKey ,
91
91
llvm::SmallVector<std::pair<VersionTuple, GlobalFunctionInfo>, 1 >>
92
92
GlobalFunctions;
93
93
@@ -100,15 +100,15 @@ class APINotesWriter::Implementation {
100
100
101
101
// / Information about tags.
102
102
// /
103
- // / Indexed by the context ID, contextKind, identifier ID.
104
- llvm::DenseMap<ContextTableKey ,
103
+ // / Indexed by the context ID, identifier ID.
104
+ llvm::DenseMap<SingleDeclTableKey ,
105
105
llvm::SmallVector<std::pair<VersionTuple, TagInfo>, 1 >>
106
106
Tags;
107
107
108
108
// / Information about typedefs.
109
109
// /
110
- // / Indexed by the context ID, contextKind, identifier ID.
111
- llvm::DenseMap<ContextTableKey ,
110
+ // / Indexed by the context ID, identifier ID.
111
+ llvm::DenseMap<SingleDeclTableKey ,
112
112
llvm::SmallVector<std::pair<VersionTuple, TypedefInfo>, 1 >>
113
113
Typedefs;
114
114
@@ -872,18 +872,17 @@ void APINotesWriter::Implementation::writeObjCSelectorBlock(
872
872
namespace {
873
873
// / Used to serialize the on-disk global variable table.
874
874
class GlobalVariableTableInfo
875
- : public VersionedTableInfo<GlobalVariableTableInfo, ContextTableKey ,
875
+ : public VersionedTableInfo<GlobalVariableTableInfo, SingleDeclTableKey ,
876
876
GlobalVariableInfo> {
877
877
public:
878
878
unsigned getKeyLength (key_type_ref) {
879
- return sizeof (uint32_t ) + sizeof (uint8_t ) + sizeof ( uint32_t );
879
+ return sizeof (uint32_t ) + sizeof (uint32_t );
880
880
}
881
881
882
882
void EmitKey (raw_ostream &OS, key_type_ref Key, unsigned ) {
883
883
llvm::support::endian::Writer writer (OS, llvm::endianness::little);
884
884
writer.write <uint32_t >(Key.parentContextID );
885
- writer.write <uint8_t >(Key.contextKind );
886
- writer.write <uint32_t >(Key.contextID );
885
+ writer.write <uint32_t >(Key.nameID );
887
886
}
888
887
889
888
hash_value_type ComputeHash (key_type_ref Key) {
@@ -986,18 +985,17 @@ void emitFunctionInfo(raw_ostream &OS, const FunctionInfo &FI) {
986
985
987
986
// / Used to serialize the on-disk global function table.
988
987
class GlobalFunctionTableInfo
989
- : public VersionedTableInfo<GlobalFunctionTableInfo, ContextTableKey ,
988
+ : public VersionedTableInfo<GlobalFunctionTableInfo, SingleDeclTableKey ,
990
989
GlobalFunctionInfo> {
991
990
public:
992
991
unsigned getKeyLength (key_type_ref) {
993
- return sizeof (uint32_t ) + sizeof (uint8_t ) + sizeof ( uint32_t );
992
+ return sizeof (uint32_t ) + sizeof (uint32_t );
994
993
}
995
994
996
995
void EmitKey (raw_ostream &OS, key_type_ref Key, unsigned ) {
997
996
llvm::support::endian::Writer writer (OS, llvm::endianness::little);
998
997
writer.write <uint32_t >(Key.parentContextID );
999
- writer.write <uint8_t >(Key.contextKind );
1000
- writer.write <uint32_t >(Key.contextID );
998
+ writer.write <uint32_t >(Key.nameID );
1001
999
}
1002
1000
1003
1001
hash_value_type ComputeHash (key_type_ref Key) {
@@ -1098,20 +1096,20 @@ void APINotesWriter::Implementation::writeEnumConstantBlock(
1098
1096
namespace {
1099
1097
template <typename Derived, typename UnversionedDataType>
1100
1098
class CommonTypeTableInfo
1101
- : public VersionedTableInfo<Derived, ContextTableKey, UnversionedDataType> {
1099
+ : public VersionedTableInfo<Derived, SingleDeclTableKey,
1100
+ UnversionedDataType> {
1102
1101
public:
1103
1102
using key_type_ref = typename CommonTypeTableInfo::key_type_ref;
1104
1103
using hash_value_type = typename CommonTypeTableInfo::hash_value_type;
1105
1104
1106
1105
unsigned getKeyLength (key_type_ref) {
1107
- return sizeof (uint32_t ) + sizeof (uint8_t ) + sizeof ( IdentifierID);
1106
+ return sizeof (uint32_t ) + sizeof (IdentifierID);
1108
1107
}
1109
1108
1110
1109
void EmitKey (raw_ostream &OS, key_type_ref Key, unsigned ) {
1111
1110
llvm::support::endian::Writer writer (OS, llvm::endianness::little);
1112
1111
writer.write <uint32_t >(Key.parentContextID );
1113
- writer.write <uint8_t >(Key.contextKind );
1114
- writer.write <IdentifierID>(Key.contextID );
1112
+ writer.write <IdentifierID>(Key.nameID );
1115
1113
}
1116
1114
1117
1115
hash_value_type ComputeHash (key_type_ref Key) {
@@ -1358,7 +1356,7 @@ void APINotesWriter::addGlobalVariable(std::optional<Context> Ctx,
1358
1356
const GlobalVariableInfo &Info,
1359
1357
VersionTuple SwiftVersion) {
1360
1358
IdentifierID VariableID = Implementation->getIdentifier (Name);
1361
- ContextTableKey Key (Ctx, VariableID);
1359
+ SingleDeclTableKey Key (Ctx, VariableID);
1362
1360
Implementation->GlobalVariables [Key].push_back ({SwiftVersion, Info});
1363
1361
}
1364
1362
@@ -1367,7 +1365,7 @@ void APINotesWriter::addGlobalFunction(std::optional<Context> Ctx,
1367
1365
const GlobalFunctionInfo &Info,
1368
1366
VersionTuple SwiftVersion) {
1369
1367
IdentifierID NameID = Implementation->getIdentifier (Name);
1370
- ContextTableKey Key (Ctx, NameID);
1368
+ SingleDeclTableKey Key (Ctx, NameID);
1371
1369
Implementation->GlobalFunctions [Key].push_back ({SwiftVersion, Info});
1372
1370
}
1373
1371
@@ -1381,15 +1379,15 @@ void APINotesWriter::addEnumConstant(llvm::StringRef Name,
1381
1379
void APINotesWriter::addTag (std::optional<Context> Ctx, llvm::StringRef Name,
1382
1380
const TagInfo &Info, VersionTuple SwiftVersion) {
1383
1381
IdentifierID TagID = Implementation->getIdentifier (Name);
1384
- ContextTableKey Key (Ctx, TagID);
1382
+ SingleDeclTableKey Key (Ctx, TagID);
1385
1383
Implementation->Tags [Key].push_back ({SwiftVersion, Info});
1386
1384
}
1387
1385
1388
1386
void APINotesWriter::addTypedef (std::optional<Context> Ctx,
1389
1387
llvm::StringRef Name, const TypedefInfo &Info,
1390
1388
VersionTuple SwiftVersion) {
1391
1389
IdentifierID TypedefID = Implementation->getIdentifier (Name);
1392
- ContextTableKey Key (Ctx, TypedefID);
1390
+ SingleDeclTableKey Key (Ctx, TypedefID);
1393
1391
Implementation->Typedefs [Key].push_back ({SwiftVersion, Info});
1394
1392
}
1395
1393
0 commit comments