Closed AaronBallman closed 4 years ago
As of bfb3a1e95e699e1ae2fcc62cc45787cd87c6bbb0, protobuf interfaces have all been privatized. In addition, the protobuf library is no longer exported from gtirb.dll.
Clients should only serialize/unserialize using IR's save/load routines. Individual components should not be serialized individually.
During the review for #13, it was observed that serializing or deserializing constituent components requires the user to have intimate knowledge of internal details or else the operations may not behave as the user expected. For instance, the following code has a subtle bug:
The problem here is that the block referent is not serialized out, but the symbol is. When deserializing, the symbol will claim to not have a referent because one could not be located, unless the same
Ctx
instance is passed when deserializing, in which case it will work.I think we should privatize the serialization code and only expose the APIs we want users to call (which is at the IR level, not at the individual component level). We can always expose the individual methods if we come up with use cases for them.