[PATCH] D38280: [llvm-cov] Create HTML directory structure when filtering using -name*= options

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 16:15:50 PDT 2017


vsk added a comment.

Thanks. Could you update the textual coverage logic as well and re-upload the diff with context lines (e.g `git diff -U10000`)?

Also, it would help if you could split out the NFC const-correcting changes (feel free to commit these right away).



================
Comment at: tools/llvm-cov/CodeCoverage.cpp:859
+    // Build the map of filenames to functions.
+    std::map<std::string, std::vector<const FunctionRecord *>>
+        FilenameFunctionMap;
----------------
The key type can be StringRef. Filenames are owned by FunctionRecord, which are in turn owned by the CoverageMapping.


================
Comment at: tools/llvm-cov/CodeCoverage.cpp:862
+    for (const auto &Function : Coverage->getCoveredFunctions()) {
+      for (const auto &File : Function.Filenames) {
+        if (std::find(SourceFiles.begin(), SourceFiles.end(), File) !=
----------------
This isn't quite right because it means that the same function can be rendered more than once. I think you can loop over SourceFiles and use getCoveredFunctions(SourceFileName) instead.


================
Comment at: tools/llvm-cov/CodeCoverage.cpp:863
+      for (const auto &File : Function.Filenames) {
+        if (std::find(SourceFiles.begin(), SourceFiles.end(), File) !=
+                SourceFiles.end() &&
----------------
Stylistic nit: you can use llvm::find(SourceFiles, File)


https://reviews.llvm.org/D38280





More information about the llvm-commits mailing list