[llvm] Modify dwarf verification JSON to include detailed counts by sub-category (PR #128018)

Alexander Yermolovich via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 25 15:05:05 PST 2025


================
@@ -2168,15 +2170,35 @@ bool DWARFVerifier::verifyDebugStrOffsets(
 
 void OutputCategoryAggregator::Report(
     StringRef s, std::function<void(void)> detailCallback) {
-  Aggregation[std::string(s)]++;
+  this->Report(s, "", detailCallback);
+}
+
+void OutputCategoryAggregator::Report(
+    StringRef category, StringRef sub_category,
+    std::function<void(void)> detailCallback) {
+  std::string category_str = std::string(category);
+  AggregationData *Agg = &Aggregation[category_str];
+  Agg->OverallCount++;
+  if (!sub_category.empty()) {
+    Agg->DetailedCounts[std::string(sub_category)]++;
+  }
   if (IncludeDetail)
     detailCallback();
 }
 
 void OutputCategoryAggregator::EnumerateResults(
     std::function<void(StringRef, unsigned)> handleCounts) {
-  for (auto &&[name, count] : Aggregation) {
-    handleCounts(name, count);
+  for (auto &&[name, aggData] : Aggregation) {
----------------
ayermolo wrote:

Is there any benefit of && here?

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


More information about the llvm-commits mailing list