aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-cov/CodeCoverage.cpp
diff options
context:
space:
mode:
authorstma247 <184293860+stma247@users.noreply.github.com>2025-04-24 18:35:09 +0200
committerGitHub <noreply@github.com>2025-04-24 11:35:09 -0500
commit72b2d4d758501ab9bf203e82be5b612f48c863b4 (patch)
tree55917ebfe0acc22dbd78e41a0ba27e52bc7759d9 /llvm/tools/llvm-cov/CodeCoverage.cpp
parent0ab330b344dc6333907542bb6267a9bd13e94b07 (diff)
downloadllvm-72b2d4d758501ab9bf203e82be5b612f48c863b4.zip
llvm-72b2d4d758501ab9bf203e82be5b612f48c863b4.tar.gz
llvm-72b2d4d758501ab9bf203e82be5b612f48c863b4.tar.bz2
[llvm-cov] Fix branch counts of template functions (second attempt) (#135074)
This PR is a second attempt for issue #111743 to finish reverted PR #113925. Added option "--unify-instantiations" to llvm-cov export to combine branch execution counts of C++ template instantiations. Fix non-deterministic behavior.
Diffstat (limited to 'llvm/tools/llvm-cov/CodeCoverage.cpp')
-rw-r--r--llvm/tools/llvm-cov/CodeCoverage.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp
index c828e25..1f2484c 100644
--- a/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -1283,6 +1283,10 @@ int CodeCoverageTool::doExport(int argc, const char **argv,
cl::desc("Don't export branch data (LCOV)"),
cl::cat(ExportCategory));
+ cl::opt<bool> UnifyInstantiations("unify-instantiations", cl::Optional,
+ cl::desc("Unify function instantiations"),
+ cl::init(true), cl::cat(ExportCategory));
+
auto Err = commandLineParser(argc, argv);
if (Err)
return Err;
@@ -1290,6 +1294,7 @@ int CodeCoverageTool::doExport(int argc, const char **argv,
ViewOpts.SkipExpansions = SkipExpansions;
ViewOpts.SkipFunctions = SkipFunctions;
ViewOpts.SkipBranches = SkipBranches;
+ ViewOpts.UnifyFunctionInstantiations = UnifyInstantiations;
if (ViewOpts.Format != CoverageViewOptions::OutputFormat::Text &&
ViewOpts.Format != CoverageViewOptions::OutputFormat::Lcov) {