-
Notifications
You must be signed in to change notification settings - Fork 14.6k
llvm-cov: Show FileCoverageSummary
with getCoverageForFile()
#121192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: users/chapuni/cov/merge/forfile-base
Are you sure you want to change the base?
Changes from 1 commit
c1678ea
71b5be7
2c9593f
00ac189
33f28e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,16 @@ using namespace llvm; | |
|
||
namespace { | ||
|
||
template <class SummaryTy> | ||
bool IsSummaryEmpty(const SummaryTy &Report, const CoverageViewOptions &Opts) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. function name case should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. case should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
return !(Report.FunctionCoverage.getNumFunctions() || | ||
(Opts.ShowInstantiationSummary && | ||
Report.InstantiationCoverage.getNumFunctions()) || | ||
(Opts.ShowRegionSummary && Report.RegionCoverage.getNumRegions()) || | ||
(Opts.ShowBranchSummary && Report.BranchCoverage.getNumBranches()) || | ||
(Opts.ShowMCDCSummary && Report.MCDCCoverage.getNumPairs())); | ||
} | ||
|
||
// Return a string with the special characters in \p Str escaped. | ||
std::string escape(StringRef Str, const CoverageViewOptions &Opts) { | ||
std::string TabExpandedResult; | ||
|
@@ -666,7 +676,7 @@ Error CoveragePrinterHTML::createIndexFile( | |
Coverage, Totals, SourceFiles, Opts, Filters); | ||
bool EmptyFiles = false; | ||
for (unsigned I = 0, E = FileReports.size(); I < E; ++I) { | ||
if (FileReports[I].FunctionCoverage.getNumFunctions()) | ||
if (!IsSummaryEmpty(FileReports[I], Opts)) | ||
emitFileSummary(OSRef, SourceFiles[I], FileReports[I]); | ||
else | ||
EmptyFiles = true; | ||
|
@@ -734,7 +744,7 @@ struct CoveragePrinterHTMLDirectory::Reporter : public DirectoryCoverageReport { | |
// Make directories at the top of the table. | ||
for (auto &&SubDir : SubDirs) { | ||
auto &Report = SubDir.second.first; | ||
if (!Report.FunctionCoverage.getNumFunctions()) | ||
if (IsSummaryEmpty(Report, Printer.Opts)) | ||
EmptyFiles.push_back(&Report); | ||
else | ||
emitTableRow(OSRef, Options, buildRelLinkToFile(Report.Name), Report, | ||
|
@@ -743,7 +753,7 @@ struct CoveragePrinterHTMLDirectory::Reporter : public DirectoryCoverageReport { | |
|
||
for (auto &&SubFile : SubFiles) { | ||
auto &Report = SubFile.second; | ||
if (!Report.FunctionCoverage.getNumFunctions()) | ||
if (IsSummaryEmpty(Report, Printer.Opts)) | ||
EmptyFiles.push_back(&Report); | ||
else | ||
emitTableRow(OSRef, Options, buildRelLinkToFile(Report.Name), Report, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the commit message, it is not obvious to me why we are now filtering out functions. Can you explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The caller, llvm-cov, has the filter. I chose "blacklist" (rather than whitelist) since it is expected empty in usual cases.