Skip to content

Commit b8ff275

Browse files
Kevin Freikevinfrei
Kevin Frei
authored andcommitted
Updated with total error count, and always emitting a json file if requested
1 parent df8c90f commit b8ff275

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

llvm/include/llvm/DebugInfo/DIContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ struct DIDumpOptions {
206206
bool IsEH = false;
207207
bool DumpNonSkeleton = false;
208208
bool ShowAggregateErrors = false;
209-
std::string JsonSummaryFile = "";
209+
std::string JsonSummaryFile;
210210
std::function<llvm::StringRef(uint64_t DwarfRegNum, bool IsEH)>
211211
GetNameForDWARFReg;
212212

llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,9 +2028,7 @@ void OutputCategoryAggregator::EnumerateResults(
20282028
}
20292029

20302030
void DWARFVerifier::summarize() {
2031-
if (!ErrorCategory.GetNumCategories())
2032-
return;
2033-
if (DumpOpts.ShowAggregateErrors) {
2031+
if (DumpOpts.ShowAggregateErrors && ErrorCategory.GetNumCategories()) {
20342032
error() << "Aggregated error counts:\n";
20352033
ErrorCategory.EnumerateResults([&](StringRef s, unsigned count) {
20362034
error() << s << " occurred " << count << " time(s).\n";
@@ -2047,13 +2045,16 @@ void DWARFVerifier::summarize() {
20472045
}
20482046

20492047
llvm::json::Object Categories;
2050-
ErrorCategory.EnumerateResults([&](StringRef category, unsigned count) {
2048+
uint64_t ErrorCount = 0;
2049+
ErrorCategory.EnumerateResults([&](StringRef Category, unsigned Count) {
20512050
llvm::json::Object Val;
2052-
Val.try_emplace("count", count);
2053-
Categories.try_emplace(category, std::move(Val));
2051+
Val.try_emplace("count", Count);
2052+
Categories.try_emplace(Category, std::move(Val));
2053+
ErrorCount += Count;
20542054
});
20552055
llvm::json::Object RootNode;
20562056
RootNode.try_emplace("error-categories", std::move(Categories));
2057+
RootNode.try_emplace("error-count", ErrorCount);
20572058

20582059
JsonStream << llvm::json::Value(std::move(RootNode));
20592060
}

llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ static opt<ErrorDetailLevel> ErrorDetails(
297297
cat(DwarfDumpCategory));
298298
static opt<std::string> JsonSummaryFile(
299299
"json-summary-file", cl::init(""),
300-
cl::desc("When using --verify, output JSON-formatted error summary to the "
301-
"specified file."),
300+
cl::desc("Output JSON-formatted error summary to the specified file. "
301+
"(Implies -verify)"),
302302
cl::value_desc("filename.json"), cat(DwarfDumpCategory));
303303
static opt<bool> Quiet("quiet", desc("Use with -verify to not emit to STDOUT."),
304304
cat(DwarfDumpCategory));

0 commit comments

Comments
 (0)