[clang] [APINotes] Reduce memory footprint for Obj-C/C++ contexts (PR #99358)

Egor Zhdan via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 11:29:46 PDT 2024


================
@@ -286,6 +280,31 @@ inline bool operator==(const ContextTableKey &lhs, const ContextTableKey &rhs) {
          lhs.contextKind == rhs.contextKind && lhs.contextID == rhs.contextID;
 }
 
+/// A stored Objective-C or C++ declaration, represented by the ID of its parent
+/// context, and the name of the declaration.
+struct SingleDeclTableKey {
+  uint32_t parentContextID;
+  uint32_t nameID;
+
+  SingleDeclTableKey() : parentContextID(-1), nameID(-1) {}
+
+  SingleDeclTableKey(uint32_t ParentContextID, uint32_t NameID)
+      : parentContextID(ParentContextID), nameID(NameID) {}
+
+  SingleDeclTableKey(std::optional<Context> ParentCtx, IdentifierID NameID)
+      : parentContextID(ParentCtx ? ParentCtx->id.Value : (uint32_t)-1),
----------------
egorzhdan wrote:

Done!

https://github.com/llvm/llvm-project/pull/99358


More information about the cfe-commits mailing list