@@ -75,17 +75,17 @@ class APINotesWriter::Implementation {
7575
7676 // / Information about global variables.
7777 // /
78- // / Indexed by the context ID, contextKind, identifier ID.
78+ // / Indexed by the context ID, identifier ID.
7979 llvm::DenseMap<
80- ContextTableKey ,
80+ SingleDeclTableKey ,
8181 llvm::SmallVector<std::pair<VersionTuple, GlobalVariableInfo>, 1 >>
8282 GlobalVariables;
8383
8484 // / Information about global functions.
8585 // /
86- // / Indexed by the context ID, contextKind, identifier ID.
86+ // / Indexed by the context ID, identifier ID.
8787 llvm::DenseMap<
88- ContextTableKey ,
88+ SingleDeclTableKey ,
8989 llvm::SmallVector<std::pair<VersionTuple, GlobalFunctionInfo>, 1 >>
9090 GlobalFunctions;
9191
@@ -98,15 +98,15 @@ class APINotesWriter::Implementation {
9898
9999 // / Information about tags.
100100 // /
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 ,
103103 llvm::SmallVector<std::pair<VersionTuple, TagInfo>, 1 >>
104104 Tags;
105105
106106 // / Information about typedefs.
107107 // /
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 ,
110110 llvm::SmallVector<std::pair<VersionTuple, TypedefInfo>, 1 >>
111111 Typedefs;
112112
@@ -865,18 +865,17 @@ void APINotesWriter::Implementation::writeObjCSelectorBlock(
865865namespace {
866866// / Used to serialize the on-disk global variable table.
867867class GlobalVariableTableInfo
868- : public VersionedTableInfo<GlobalVariableTableInfo, ContextTableKey ,
868+ : public VersionedTableInfo<GlobalVariableTableInfo, SingleDeclTableKey ,
869869 GlobalVariableInfo> {
870870public:
871871 unsigned getKeyLength (key_type_ref) {
872- return sizeof (uint32_t ) + sizeof (uint8_t ) + sizeof ( uint32_t );
872+ return sizeof (uint32_t ) + sizeof (uint32_t );
873873 }
874874
875875 void EmitKey (raw_ostream &OS, key_type_ref Key, unsigned ) {
876876 llvm::support::endian::Writer writer (OS, llvm::endianness::little);
877877 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 );
880879 }
881880
882881 hash_value_type ComputeHash (key_type_ref Key) {
@@ -979,18 +978,17 @@ void emitFunctionInfo(raw_ostream &OS, const FunctionInfo &FI) {
979978
980979// / Used to serialize the on-disk global function table.
981980class GlobalFunctionTableInfo
982- : public VersionedTableInfo<GlobalFunctionTableInfo, ContextTableKey ,
981+ : public VersionedTableInfo<GlobalFunctionTableInfo, SingleDeclTableKey ,
983982 GlobalFunctionInfo> {
984983public:
985984 unsigned getKeyLength (key_type_ref) {
986- return sizeof (uint32_t ) + sizeof (uint8_t ) + sizeof ( uint32_t );
985+ return sizeof (uint32_t ) + sizeof (uint32_t );
987986 }
988987
989988 void EmitKey (raw_ostream &OS, key_type_ref Key, unsigned ) {
990989 llvm::support::endian::Writer writer (OS, llvm::endianness::little);
991990 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 );
994992 }
995993
996994 hash_value_type ComputeHash (key_type_ref Key) {
@@ -1091,20 +1089,20 @@ void APINotesWriter::Implementation::writeEnumConstantBlock(
10911089namespace {
10921090template <typename Derived, typename UnversionedDataType>
10931091class CommonTypeTableInfo
1094- : public VersionedTableInfo<Derived, ContextTableKey, UnversionedDataType> {
1092+ : public VersionedTableInfo<Derived, SingleDeclTableKey,
1093+ UnversionedDataType> {
10951094public:
10961095 using key_type_ref = typename CommonTypeTableInfo::key_type_ref;
10971096 using hash_value_type = typename CommonTypeTableInfo::hash_value_type;
10981097
10991098 unsigned getKeyLength (key_type_ref) {
1100- return sizeof (uint32_t ) + sizeof (uint8_t ) + sizeof ( IdentifierID);
1099+ return sizeof (uint32_t ) + sizeof (IdentifierID);
11011100 }
11021101
11031102 void EmitKey (raw_ostream &OS, key_type_ref Key, unsigned ) {
11041103 llvm::support::endian::Writer writer (OS, llvm::endianness::little);
11051104 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 );
11081106 }
11091107
11101108 hash_value_type ComputeHash (key_type_ref Key) {
@@ -1351,7 +1349,7 @@ void APINotesWriter::addGlobalVariable(std::optional<Context> Ctx,
13511349 const GlobalVariableInfo &Info,
13521350 VersionTuple SwiftVersion) {
13531351 IdentifierID VariableID = Implementation->getIdentifier (Name);
1354- ContextTableKey Key (Ctx, VariableID);
1352+ SingleDeclTableKey Key (Ctx, VariableID);
13551353 Implementation->GlobalVariables [Key].push_back ({SwiftVersion, Info});
13561354}
13571355
@@ -1360,7 +1358,7 @@ void APINotesWriter::addGlobalFunction(std::optional<Context> Ctx,
13601358 const GlobalFunctionInfo &Info,
13611359 VersionTuple SwiftVersion) {
13621360 IdentifierID NameID = Implementation->getIdentifier (Name);
1363- ContextTableKey Key (Ctx, NameID);
1361+ SingleDeclTableKey Key (Ctx, NameID);
13641362 Implementation->GlobalFunctions [Key].push_back ({SwiftVersion, Info});
13651363}
13661364
@@ -1374,15 +1372,15 @@ void APINotesWriter::addEnumConstant(llvm::StringRef Name,
13741372void APINotesWriter::addTag (std::optional<Context> Ctx, llvm::StringRef Name,
13751373 const TagInfo &Info, VersionTuple SwiftVersion) {
13761374 IdentifierID TagID = Implementation->getIdentifier (Name);
1377- ContextTableKey Key (Ctx, TagID);
1375+ SingleDeclTableKey Key (Ctx, TagID);
13781376 Implementation->Tags [Key].push_back ({SwiftVersion, Info});
13791377}
13801378
13811379void APINotesWriter::addTypedef (std::optional<Context> Ctx,
13821380 llvm::StringRef Name, const TypedefInfo &Info,
13831381 VersionTuple SwiftVersion) {
13841382 IdentifierID TypedefID = Implementation->getIdentifier (Name);
1385- ContextTableKey Key (Ctx, TypedefID);
1383+ SingleDeclTableKey Key (Ctx, TypedefID);
13861384 Implementation->Typedefs [Key].push_back ({SwiftVersion, Info});
13871385}
13881386} // namespace api_notes
0 commit comments