[llvm] [llvm]Add a simple Telemetry framework (PR #102323)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 01:40:39 PST 2024


================
@@ -187,31 +183,31 @@ To use Telemetry in your tool, you need to provide a concrete implementation of
 
   class MyDestination : public telemetry::Destination {
   public:
-    Error receiveEntry(const TelemetryInfo* Entry) override {
-      if (Error err = serializer.init()) {
-        return err;
+    Error receiveEntry(const TelemetryInfo *Entry) override {
+      if (Error Err = Serializer.init()) {
+        return Err;
       }
-      Entry->serialize(serializer);
-      if (Error err = serializer.finalize()) {
-        return err;
+      Entry->serialize(Serializer);
+      if (Error Err = Serializer.finalize()) {
+        return Err;
       }
 
-      json::Object copied = *serializer.getOutputObject();
-      // Send the `copied` object to wherever.
+      json::Object Copied = *Serializer.getOutputObject();
+      // Send the `Copied` object to wherever.
       return Error::success();
     }
 
   private:
-    JsonSerializer serializer;
+    JsonSerializer Serializer;
   };
 
   // This defines a custom TelemetryInfo that has an additional Msg field.
   struct MyTelemetryInfo : public telemetry::TelemetryInfo {
     std::string Msg;
     
-    Error serialize(Serializer& serializer) const override {
+    Error serialize(Serializer& Serializer) const override {
----------------
jh7370 wrote:

```suggestion
    Error serialize(Serializer &Serializer) const override {
```

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


More information about the llvm-commits mailing list