================
@@ -91,15 +93,35 @@ class UnsafeBufferUsageEntitySummary final : public 
EntitySummary {
       : EntitySummary(), UnsafeBuffers(std::move(UnsafeBuffers)) {}
 
 public:
-  SummaryName getSummaryName() const override {
-    return SummaryName{"UnsafeBufferUsage"};
-  };
+  SummaryName getSummaryName() const override { return summaryName(); };
 
   bool operator==(const EntityPointerLevelSet &Other) const {
     return UnsafeBuffers == Other;
   }
 
+  bool operator==(const UnsafeBufferUsageEntitySummary &Other) const {
+    return UnsafeBuffers == Other.UnsafeBuffers;
+  }
+
   bool empty() const { return UnsafeBuffers.empty(); }
+
+  static llvm::json::Object
+  jsonSerializeFn(const EntitySummary &ES,
+                  JSONFormat::EntityIdToJSONFn EntityId2JSON);
+
+  static llvm::Expected<std::unique_ptr<EntitySummary>>
+  jsonDeserializeFn(const llvm::json::Object &Data, EntityIdTable &,
+                    JSONFormat::EntityIdFromJSONFn EntityIdFromJSON);
----------------
ziqingluo-90 wrote:

I think we could borrow `json`'s API:  each summary serialization code just 
operates Object, Array, Value, etc..   The JSON format implementation uses 
`json::Object, json::Array, ...` while other formats need to implement their 
own `Object, Array, Value ...`.    I changed my code to show this idea. 
Consequently, the serialization test becomes format-independent with a Mock 
implementation of the API.

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

Reply via email to