@@ -1942,12 +1942,14 @@ unsigned DWARFVerifier::verifyNameIndexCompleteness(
19421942 if (none_of (NI.equal_range (Name), [&](const DWARFDebugNames::Entry &E) {
19431943 return E.getDIEUnitOffset () == DieUnitOffset;
19441944 })) {
1945- ErrorCategory.Report (" Name Index DIE entry missing name" , [&]() {
1946- error () << formatv (
1947- " Name Index @ {0:x}: Entry for DIE @ {1:x} ({2}) with "
1948- " name {3} missing.\n " ,
1949- NI.getUnitOffset (), Die.getOffset (), Die.getTag (), Name);
1950- });
1945+ ErrorCategory.Report (
1946+ " Name Index DIE entry missing name" ,
1947+ llvm::dwarf::TagString (Die.getTag ()), [&]() {
1948+ error () << formatv (
1949+ " Name Index @ {0:x}: Entry for DIE @ {1:x} ({2}) with "
1950+ " name {3} missing.\n " ,
1951+ NI.getUnitOffset (), Die.getOffset (), Die.getTag (), Name);
1952+ });
19511953 ++NumErrors;
19521954 }
19531955 }
@@ -2169,15 +2171,35 @@ bool DWARFVerifier::verifyDebugStrOffsets(
21692171
21702172void OutputCategoryAggregator::Report (
21712173 StringRef s, std::function<void (void )> detailCallback) {
2172- Aggregation[std::string (s)]++;
2174+ this ->Report (s, " " , detailCallback);
2175+ }
2176+
2177+ void OutputCategoryAggregator::Report (
2178+ StringRef category, StringRef sub_category,
2179+ std::function<void (void )> detailCallback) {
2180+ std::string category_str = std::string (category);
2181+ AggregationData *Agg = &Aggregation[category_str];
2182+ Agg->OverallCount ++;
2183+ if (!sub_category.empty ()) {
2184+ Agg->DetailedCounts [std::string (sub_category)]++;
2185+ }
21732186 if (IncludeDetail)
21742187 detailCallback ();
21752188}
21762189
21772190void OutputCategoryAggregator::EnumerateResults (
21782191 std::function<void (StringRef, unsigned )> handleCounts) {
2179- for (auto &&[name, count] : Aggregation) {
2180- handleCounts (name, count);
2192+ for (auto &&[name, aggData] : Aggregation) {
2193+ handleCounts (name, aggData.OverallCount );
2194+ }
2195+ }
2196+ void OutputCategoryAggregator::EnumerateDetailedResultsFor (
2197+ StringRef category, std::function<void (StringRef, unsigned )> handleCounts) {
2198+ auto Agg = Aggregation.find (std::string (category));
2199+ if (Agg != Aggregation.end ()) {
2200+ for (auto &&[name, count] : Agg->second .DetailedCounts ) {
2201+ handleCounts (name, count);
2202+ }
21812203 }
21822204}
21832205
@@ -2204,6 +2226,12 @@ void DWARFVerifier::summarize() {
22042226 ErrorCategory.EnumerateResults ([&](StringRef Category, unsigned Count) {
22052227 llvm::json::Object Val;
22062228 Val.try_emplace (" count" , Count);
2229+ llvm::json::Object Details;
2230+ ErrorCategory.EnumerateDetailedResultsFor (
2231+ Category, [&](StringRef SubCategory, unsigned SubCount) {
2232+ Details.try_emplace (SubCategory, SubCount);
2233+ });
2234+ Val.try_emplace (" details" , std::move (Details));
22072235 Categories.try_emplace (Category, std::move (Val));
22082236 ErrorCount += Count;
22092237 });
0 commit comments