================
@@ -29,6 +29,7 @@ class EntityIdTable;
 /// \see EntityIdTable
 class EntityId {
   friend class EntityIdTable;
+  friend class SerializationFormat;
----------------
aviralg wrote:

We need this to enable `SerializationFormat` to directly construct and 
deconstruct `EntityId` objects, instead of going via `EntityIdTable`. First, 
this makes the design consistent; `SerializationFormat` is a friend to all 
other data structures to enable it to directly read and write to their fields, 
it should be able to do the same here. 
Second, going via `EntityIdTable` requires calling the `addEntity` API under 
the assumption that the new id returned by this API will match the id in the 
data being deserialized. Relying on this assumption is wrong since we don't 
explicitly guarantee determinism for this API.
Third, its conceptually simple to prove correctness if we can directly 
serialize and deserialize id objects.

https://github.com/llvm/llvm-project/pull/180021
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to