[PATCH] D151283: [llvm-cov] Support a Hierarchical Structure for HTML Coverage Report Generating

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 9 15:07:10 PDT 2023


phosek added inline comments.


================
Comment at: llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp:519-525
+  // Emit the default stylesheet.
+  auto CSSOrErr = createOutputStream("style", "css", /*InToplevel=*/true);
+  if (Error E = CSSOrErr.takeError())
+    return E;
+
+  OwnedStream CSS = std::move(CSSOrErr.get());
+  CSS->operator<<(CSSForCoverage);
----------------
This code is duplicated between `CoveragePrinterHTML::createIndexFile` and `CoveragePrinterHTMLDirectory::createIndexFile`, could it be extracted into a helper function?


================
Comment at: llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp:581-606
+  auto OSOrErr =
+      createOutputStream(LCPath + "index", "html", /*InToplevel=*/false);
+  if (auto E = OSOrErr.takeError())
+    return E;
+  auto OS = std::move(OSOrErr.get());
+  raw_ostream &OSRef = *OS.get();
+
----------------
This code is duplicated between `CoveragePrinterHTML::createIndexFile` and `CoveragePrinterHTMLDirectory::createSubIndexFile`, could it be extracted into one or more helper functions?


================
Comment at: llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp:674-695
+  // Emit the totals row.
+  emitTableRow(OSRef, Opts, "Totals", CurrentTotals, /*IsTotals=*/false);
+  OSRef << EndTable << EndCenteredDiv;
+
+  // 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.
----------------
This code is duplicated between `CoveragePrinterHTML::createIndexFile` and `CoveragePrinterHTMLDirectory::createSubIndexFile`, could it be extracted into one or more helper functions?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151283/new/

https://reviews.llvm.org/D151283



More information about the llvm-commits mailing list