[clang] [Draft] Summary Based Analysis Prototype (PR #144224)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 16 02:25:42 PDT 2025


================
@@ -0,0 +1,23 @@
+#include "clang/Summary/SummaryConsumer.h"
+#include "clang/Summary/SummaryContext.h"
+
+namespace clang {
+void JSONPrintingSummaryConsumer::ProcessFunctionSummary(
+    const FunctionSummary &Summary) {
+  JOS.object([&] {
+    JOS.attribute("id", llvm::json::Value(Summary.getID()));
+    JOS.attributeObject("attrs", [&] {
+      JOS.attributeArray("function", [&] {
+        for (auto &&Attr : Summary.getAttributes()) {
+          JOS.value(llvm::json::Value(Attr->serialize()));
+        }
+      });
+    });
+    JOS.attributeArray("calls", [&] {
+      for (auto &&Call : Summary.getCalls()) {
+        JOS.object([&] { JOS.attribute("id", llvm::json::Value(Call)); });
+      }
+    });
+  });
+}
+} // namespace clang
----------------
Xazax-hun wrote:

Nit: missing new line.

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


More information about the cfe-commits mailing list