\r
RUN: FileCheck -input-file=%t.text_one_file/coverage/tmp/dir-with-filtering1.cpp.txt %s -check-prefix=TEXT-FILE1\r
\r
+// Test TEXT index file with all functions in one file filtered out\r
+\r
+RUN: llvm-cov show %S/Inputs/dir-with-filtering.covmapping -o %t.text_one_func -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs -name=main\r
+RUN: FileCheck -input-file=%t.text_one_func/index.txt %s -check-prefix=TEXT-INDEX-ONE-FUNC\r
+\r
+TEXT-INDEX-ONE-FUNC-NOT: Files which contain no functions\r
+TEXT-INDEX-ONE-FUNC-NOT: dir-with-filtering2.cpp\r
+\r
// Test HTML both files\r
\r
RUN: llvm-profdata merge %S/Inputs/dir-with-filtering.proftext -o %t.profdata\r
HTML-INDEX-ONE-FILE-NOT: dir-with-filtering2.cpp\r
\r
RUN: FileCheck -input-file=%t.html_one_file/coverage/tmp/dir-with-filtering1.cpp.html %s -check-prefix=HTML-FILE1\r
+\r
+// Test HTML index file with all functions in one file filtered out\r
+\r
+RUN: llvm-cov show %S/Inputs/dir-with-filtering.covmapping -format html -o %t.html_one_func -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs -name=main\r
+RUN: FileCheck -input-file=%t.html_one_func/index.html %s -check-prefix=HTML-INDEX-ONE-FUNC\r
+\r
+HTML-INDEX-ONE-FUNC-NOT: Files which contain no functions\r
+HTML-INDEX-ONE-FUNC-NOT: dir-with-filtering2.cpp\r
renderFileReports(OS, UniqueSourceFiles, CoverageFiltersMatchAll());
}
-void CoverageReport::renderFileReports(raw_ostream &OS,
- ArrayRef<std::string> Files,
- const CoverageFilter &Filters) const {
+void CoverageReport::renderFileReports(
+ raw_ostream &OS, ArrayRef<std::string> Files,
+ const CoverageFiltersMatchAll &Filters) const {
FileCoverageSummary Totals("TOTAL");
auto FileReports =
prepareFileReports(Coverage, Totals, Files, Options, Filters);
EmptyFiles = true;
}
- if (EmptyFiles) {
+ if (EmptyFiles && Filters.empty()) {
OS << "\n"
<< "Files which contain no functions:\n";
/// Render file reports for the files specified in \p Files and the functions
/// in \p Filters.
void renderFileReports(raw_ostream &OS, ArrayRef<std::string> Files,
- const CoverageFilter &Filters) const;
+ const CoverageFiltersMatchAll &Filters) const;
};
} // end namespace llvm
namespace llvm {
-class CoverageFilter;
+class CoverageFiltersMatchAll;
class SourceCoverageView;
/// \brief A view that represents a macro or include expansion.
/// \brief Create an index which lists reports for the given source files.
virtual Error createIndexFile(ArrayRef<std::string> SourceFiles,
const coverage::CoverageMapping &Coverage,
- const CoverageFilter &Filters) = 0;
+ const CoverageFiltersMatchAll &Filters) = 0;
/// @}
};
Error CoveragePrinterHTML::createIndexFile(
ArrayRef<std::string> SourceFiles,
- const coverage::CoverageMapping &Coverage, const CoverageFilter &Filters) {
+ const coverage::CoverageMapping &Coverage,
+ const CoverageFiltersMatchAll &Filters) {
// Emit the default stylesheet.
auto CSSOrErr = createOutputStream("style", "css", /*InToplevel=*/true);
if (Error E = CSSOrErr.takeError())
// Emit links to files which don't contain any functions. These are normally
// not very useful, but could be relevant for code which abuses the
// preprocessor.
- if (EmptyFiles) {
+ if (EmptyFiles && Filters.empty()) {
OSRef << tag("p", "Files which contain no functions. (These "
"files contain code pulled into other files "
"by the preprocessor.)\n");
Error createIndexFile(ArrayRef<std::string> SourceFiles,
const coverage::CoverageMapping &Coverage,
- const CoverageFilter &Filters) override;
+ const CoverageFiltersMatchAll &Filters) override;
CoveragePrinterHTML(const CoverageViewOptions &Opts)
: CoveragePrinter(Opts) {}
Error CoveragePrinterText::createIndexFile(
ArrayRef<std::string> SourceFiles,
- const coverage::CoverageMapping &Coverage, const CoverageFilter &Filters) {
+ const coverage::CoverageMapping &Coverage,
+ const CoverageFiltersMatchAll &Filters) {
auto OSOrErr = createOutputStream("index", "txt", /*InToplevel=*/true);
if (Error E = OSOrErr.takeError())
return E;
Error createIndexFile(ArrayRef<std::string> SourceFiles,
const coverage::CoverageMapping &Coverage,
- const CoverageFilter &Filters) override;
+ const CoverageFiltersMatchAll &Filters) override;
CoveragePrinterText(const CoverageViewOptions &Opts)
: CoveragePrinter(Opts) {}