@@ -75,17 +75,17 @@ class APINotesWriter::Implementation {
75
75
76
76
// / Information about global variables.
77
77
// /
78
- // / Indexed by the context ID, contextKind, identifier ID.
78
+ // / Indexed by the context ID, identifier ID.
79
79
llvm::DenseMap<
80
- ContextTableKey ,
80
+ SingleDeclTableKey ,
81
81
llvm::SmallVector<std::pair<VersionTuple, GlobalVariableInfo>, 1 >>
82
82
GlobalVariables;
83
83
84
84
// / Information about global functions.
85
85
// /
86
- // / Indexed by the context ID, contextKind, identifier ID.
86
+ // / Indexed by the context ID, identifier ID.
87
87
llvm::DenseMap<
88
- ContextTableKey ,
88
+ SingleDeclTableKey ,
89
89
llvm::SmallVector<std::pair<VersionTuple, GlobalFunctionInfo>, 1 >>
90
90
GlobalFunctions;
91
91
@@ -98,15 +98,15 @@ class APINotesWriter::Implementation {
98
98
99
99
// / Information about tags.
100
100
// /
101
- // / Indexed by the context ID, contextKind, identifier ID.
102
- llvm::DenseMap<ContextTableKey ,
101
+ // / Indexed by the context ID, identifier ID.
102
+ llvm::DenseMap<SingleDeclTableKey ,
103
103
llvm::SmallVector<std::pair<VersionTuple, TagInfo>, 1 >>
104
104
Tags;
105
105
106
106
// / Information about typedefs.
107
107
// /
108
- // / Indexed by the context ID, contextKind, identifier ID.
109
- llvm::DenseMap<ContextTableKey ,
108
+ // / Indexed by the context ID, identifier ID.
109
+ llvm::DenseMap<SingleDeclTableKey ,
110
110
llvm::SmallVector<std::pair<VersionTuple, TypedefInfo>, 1 >>
111
111
Typedefs;
112
112
@@ -865,18 +865,17 @@ void APINotesWriter::Implementation::writeObjCSelectorBlock(
865
865
namespace {
866
866
// / Used to serialize the on-disk global variable table.
867
867
class GlobalVariableTableInfo
868
- : public VersionedTableInfo<GlobalVariableTableInfo, ContextTableKey ,
868
+ : public VersionedTableInfo<GlobalVariableTableInfo, SingleDeclTableKey ,
869
869
GlobalVariableInfo> {
870
870
public:
871
871
unsigned getKeyLength (key_type_ref) {
872
- return sizeof (uint32_t ) + sizeof (uint8_t ) + sizeof ( uint32_t );
872
+ return sizeof (uint32_t ) + sizeof (uint32_t );
873
873
}
874
874
875
875
void EmitKey (raw_ostream &OS, key_type_ref Key, unsigned ) {
876
876
llvm::support::endian::Writer writer (OS, llvm::endianness::little);
877
877
writer.write <uint32_t >(Key.parentContextID );
878
- writer.write <uint8_t >(Key.contextKind );
879
- writer.write <uint32_t >(Key.contextID );
878
+ writer.write <uint32_t >(Key.nameID );
880
879
}
881
880
882
881
hash_value_type ComputeHash (key_type_ref Key) {
@@ -979,18 +978,17 @@ void emitFunctionInfo(raw_ostream &OS, const FunctionInfo &FI) {
979
978
980
979
// / Used to serialize the on-disk global function table.
981
980
class GlobalFunctionTableInfo
982
- : public VersionedTableInfo<GlobalFunctionTableInfo, ContextTableKey ,
981
+ : public VersionedTableInfo<GlobalFunctionTableInfo, SingleDeclTableKey ,
983
982
GlobalFunctionInfo> {
984
983
public:
985
984
unsigned getKeyLength (key_type_ref) {
986
- return sizeof (uint32_t ) + sizeof (uint8_t ) + sizeof ( uint32_t );
985
+ return sizeof (uint32_t ) + sizeof (uint32_t );
987
986
}
988
987
989
988
void EmitKey (raw_ostream &OS, key_type_ref Key, unsigned ) {
990
989
llvm::support::endian::Writer writer (OS, llvm::endianness::little);
991
990
writer.write <uint32_t >(Key.parentContextID );
992
- writer.write <uint8_t >(Key.contextKind );
993
- writer.write <uint32_t >(Key.contextID );
991
+ writer.write <uint32_t >(Key.nameID );
994
992
}
995
993
996
994
hash_value_type ComputeHash (key_type_ref Key) {
@@ -1091,20 +1089,20 @@ void APINotesWriter::Implementation::writeEnumConstantBlock(
1091
1089
namespace {
1092
1090
template <typename Derived, typename UnversionedDataType>
1093
1091
class CommonTypeTableInfo
1094
- : public VersionedTableInfo<Derived, ContextTableKey, UnversionedDataType> {
1092
+ : public VersionedTableInfo<Derived, SingleDeclTableKey,
1093
+ UnversionedDataType> {
1095
1094
public:
1096
1095
using key_type_ref = typename CommonTypeTableInfo::key_type_ref;
1097
1096
using hash_value_type = typename CommonTypeTableInfo::hash_value_type;
1098
1097
1099
1098
unsigned getKeyLength (key_type_ref) {
1100
- return sizeof (uint32_t ) + sizeof (uint8_t ) + sizeof ( IdentifierID);
1099
+ return sizeof (uint32_t ) + sizeof (IdentifierID);
1101
1100
}
1102
1101
1103
1102
void EmitKey (raw_ostream &OS, key_type_ref Key, unsigned ) {
1104
1103
llvm::support::endian::Writer writer (OS, llvm::endianness::little);
1105
1104
writer.write <uint32_t >(Key.parentContextID );
1106
- writer.write <uint8_t >(Key.contextKind );
1107
- writer.write <IdentifierID>(Key.contextID );
1105
+ writer.write <IdentifierID>(Key.nameID );
1108
1106
}
1109
1107
1110
1108
hash_value_type ComputeHash (key_type_ref Key) {
@@ -1351,7 +1349,7 @@ void APINotesWriter::addGlobalVariable(std::optional<Context> Ctx,
1351
1349
const GlobalVariableInfo &Info,
1352
1350
VersionTuple SwiftVersion) {
1353
1351
IdentifierID VariableID = Implementation->getIdentifier (Name);
1354
- ContextTableKey Key (Ctx, VariableID);
1352
+ SingleDeclTableKey Key (Ctx, VariableID);
1355
1353
Implementation->GlobalVariables [Key].push_back ({SwiftVersion, Info});
1356
1354
}
1357
1355
@@ -1360,7 +1358,7 @@ void APINotesWriter::addGlobalFunction(std::optional<Context> Ctx,
1360
1358
const GlobalFunctionInfo &Info,
1361
1359
VersionTuple SwiftVersion) {
1362
1360
IdentifierID NameID = Implementation->getIdentifier (Name);
1363
- ContextTableKey Key (Ctx, NameID);
1361
+ SingleDeclTableKey Key (Ctx, NameID);
1364
1362
Implementation->GlobalFunctions [Key].push_back ({SwiftVersion, Info});
1365
1363
}
1366
1364
@@ -1374,15 +1372,15 @@ void APINotesWriter::addEnumConstant(llvm::StringRef Name,
1374
1372
void APINotesWriter::addTag (std::optional<Context> Ctx, llvm::StringRef Name,
1375
1373
const TagInfo &Info, VersionTuple SwiftVersion) {
1376
1374
IdentifierID TagID = Implementation->getIdentifier (Name);
1377
- ContextTableKey Key (Ctx, TagID);
1375
+ SingleDeclTableKey Key (Ctx, TagID);
1378
1376
Implementation->Tags [Key].push_back ({SwiftVersion, Info});
1379
1377
}
1380
1378
1381
1379
void APINotesWriter::addTypedef (std::optional<Context> Ctx,
1382
1380
llvm::StringRef Name, const TypedefInfo &Info,
1383
1381
VersionTuple SwiftVersion) {
1384
1382
IdentifierID TypedefID = Implementation->getIdentifier (Name);
1385
- ContextTableKey Key (Ctx, TypedefID);
1383
+ SingleDeclTableKey Key (Ctx, TypedefID);
1386
1384
Implementation->Typedefs [Key].push_back ({SwiftVersion, Info});
1387
1385
}
1388
1386
} // namespace api_notes
0 commit comments