Skip to content

Commit 872aadd

Browse files
committed
Revert "Modify dwarfdump verification to allow sub-category counts (#125062)"
This reverts commit 13f6301. Breaks check-llvm.
1 parent f147d67 commit 872aadd

File tree

3 files changed

+11
-222
lines changed

3 files changed

+11
-222
lines changed

llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h

+2-13
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,18 @@ class DWARFDebugAbbrev;
3030
class DataExtractor;
3131
struct DWARFSection;
3232

33-
struct AggregationData {
34-
unsigned OverallCount;
35-
std::map<std::string, unsigned> DetailedCounts;
36-
AggregationData() = default;
37-
};
38-
3933
class OutputCategoryAggregator {
4034
private:
41-
std::map<std::string, AggregationData> Aggregation;
35+
std::map<std::string, unsigned> Aggregation;
4236
bool IncludeDetail;
4337

4438
public:
4539
OutputCategoryAggregator(bool includeDetail = false)
4640
: IncludeDetail(includeDetail) {}
4741
void ShowDetail(bool showDetail) { IncludeDetail = showDetail; }
4842
size_t GetNumCategories() const { return Aggregation.size(); }
49-
void Report(StringRef category, std::function<void()> detailCallback);
50-
void Report(StringRef category, StringRef sub_category,
51-
std::function<void()> detailCallback);
43+
void Report(StringRef s, std::function<void()> detailCallback);
5244
void EnumerateResults(std::function<void(StringRef, unsigned)> handleCounts);
53-
void EnumerateDetailedResultsFor(
54-
StringRef category,
55-
std::function<void(StringRef, unsigned)> handleCounts);
5645
};
5746

5847
/// A class that verifies DWARF debug information given a DWARF Context.

llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp

+9-37
Original file line numberDiff line numberDiff line change
@@ -1941,14 +1941,12 @@ unsigned DWARFVerifier::verifyNameIndexCompleteness(
19411941
if (none_of(NI.equal_range(Name), [&](const DWARFDebugNames::Entry &E) {
19421942
return E.getDIEUnitOffset() == DieUnitOffset;
19431943
})) {
1944-
ErrorCategory.Report(
1945-
"Name Index DIE entry missing name",
1946-
llvm::dwarf::TagString(Die.getTag()), [&]() {
1947-
error() << formatv(
1948-
"Name Index @ {0:x}: Entry for DIE @ {1:x} ({2}) with "
1949-
"name {3} missing.\n",
1950-
NI.getUnitOffset(), Die.getOffset(), Die.getTag(), Name);
1951-
});
1944+
ErrorCategory.Report("Name Index DIE entry missing name", [&]() {
1945+
error() << formatv(
1946+
"Name Index @ {0:x}: Entry for DIE @ {1:x} ({2}) with "
1947+
"name {3} missing.\n",
1948+
NI.getUnitOffset(), Die.getOffset(), Die.getTag(), Name);
1949+
});
19521950
++NumErrors;
19531951
}
19541952
}
@@ -2170,35 +2168,15 @@ bool DWARFVerifier::verifyDebugStrOffsets(
21702168

21712169
void OutputCategoryAggregator::Report(
21722170
StringRef s, std::function<void(void)> detailCallback) {
2173-
this->Report(s, "", detailCallback);
2174-
}
2175-
2176-
void OutputCategoryAggregator::Report(
2177-
StringRef category, StringRef sub_category,
2178-
std::function<void(void)> detailCallback) {
2179-
std::string category_str = std::string(category);
2180-
AggregationData *Agg = &Aggregation[category_str];
2181-
Agg->OverallCount++;
2182-
if (!sub_category.empty()) {
2183-
Agg->DetailedCounts[std::string(sub_category)]++;
2184-
}
2171+
Aggregation[std::string(s)]++;
21852172
if (IncludeDetail)
21862173
detailCallback();
21872174
}
21882175

21892176
void OutputCategoryAggregator::EnumerateResults(
21902177
std::function<void(StringRef, unsigned)> handleCounts) {
2191-
for (auto &&[name, aggData] : Aggregation) {
2192-
handleCounts(name, aggData.OverallCount);
2193-
}
2194-
}
2195-
void OutputCategoryAggregator::EnumerateDetailedResultsFor(
2196-
StringRef category, std::function<void(StringRef, unsigned)> handleCounts) {
2197-
auto Agg = Aggregation.find(std::string(category));
2198-
if (Agg != Aggregation.end()) {
2199-
for (auto &&[name, count] : Agg->second.DetailedCounts) {
2200-
handleCounts(name, count);
2201-
}
2178+
for (auto &&[name, count] : Aggregation) {
2179+
handleCounts(name, count);
22022180
}
22032181
}
22042182

@@ -2225,12 +2203,6 @@ void DWARFVerifier::summarize() {
22252203
ErrorCategory.EnumerateResults([&](StringRef Category, unsigned Count) {
22262204
llvm::json::Object Val;
22272205
Val.try_emplace("count", Count);
2228-
llvm::json::Object Details;
2229-
ErrorCategory.EnumerateDetailedResultsFor(
2230-
Category, [&](StringRef SubCategory, unsigned SubCount) {
2231-
Details.try_emplace(SubCategory, SubCount);
2232-
});
2233-
Val.try_emplace("details", std::move(Details));
22342206
Categories.try_emplace(Category, std::move(Val));
22352207
ErrorCount += Count;
22362208
});

llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-completeness-json-output.s

-172
This file was deleted.

0 commit comments

Comments
 (0)