[llvm] r309903 - [llvm-cov] Respect the value of the -show-instantiations option

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 16:35:24 PDT 2017


Author: vedantk
Date: Wed Aug  2 16:35:24 2017
New Revision: 309903

URL: http://llvm.org/viewvc/llvm-project?rev=309903&view=rev
Log:
[llvm-cov] Respect the value of the -show-instantiations option

Make `-show-instantiations=false` actually skip displaying instantiation
sub-views, instead of simply ignoring the option.

Modified:
    llvm/trunk/docs/CommandGuide/llvm-cov.rst
    llvm/trunk/test/tools/llvm-cov/showTemplateInstantiations.cpp
    llvm/trunk/tools/llvm-cov/CodeCoverage.cpp

Modified: llvm/trunk/docs/CommandGuide/llvm-cov.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-cov.rst?rev=309903&r1=309902&r2=309903&view=diff
==============================================================================
--- llvm/trunk/docs/CommandGuide/llvm-cov.rst (original)
+++ llvm/trunk/docs/CommandGuide/llvm-cov.rst Wed Aug  2 16:35:24 2017
@@ -207,6 +207,7 @@ OPTIONS
 
  For source regions that are instantiated multiple times, such as templates in
  ``C++``, show each instantiation separately as well as the combined summary.
+ This option is enabled by default.
 
 .. option:: -show-regions
 

Modified: llvm/trunk/test/tools/llvm-cov/showTemplateInstantiations.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/showTemplateInstantiations.cpp?rev=309903&r1=309902&r2=309903&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/showTemplateInstantiations.cpp (original)
+++ llvm/trunk/test/tools/llvm-cov/showTemplateInstantiations.cpp Wed Aug  2 16:35:24 2017
@@ -87,3 +87,7 @@ int main() {         // ALL:         [[@
 // RUN: FileCheck -check-prefix=HTML-JUMP -input-file=%t.html.dir/coverage/tmp/showTemplateInstantiations.cpp.html %s
 // HTML-JUMP: <pre>Source (<a href='#L{{[0-9]+}}'>jump to first uncovered line</a>)</pre>
 // HTML-JUMP-NOT: <pre>Source (<a href='#L{{[0-9]+}}'>jump to first uncovered line</a>)</pre>
+
+// RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -show-instantiations=false -filename-equivalence %s | FileCheck -check-prefix=NO_INSTS %s
+// NO_INSTS-NOT: {{^ *}}| _Z4funcIbEiT_:
+// NO_INSTS-NOT: {{^ *}}| _Z4funcIiEiT_:

Modified: llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CodeCoverage.cpp?rev=309903&r1=309902&r2=309903&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CodeCoverage.cpp (original)
+++ llvm/trunk/tools/llvm-cov/CodeCoverage.cpp Wed Aug  2 16:35:24 2017
@@ -288,6 +288,8 @@ CodeCoverageTool::createSourceFileView(S
   auto View = SourceCoverageView::create(SourceFile, SourceBuffer.get(),
                                          ViewOpts, std::move(FileCoverage));
   attachExpansionSubViews(*View, Expansions, Coverage);
+  if (!ViewOpts.ShowFunctionInstantiations)
+    return View;
 
   for (const auto *Function : Coverage.getInstantiations(SourceFile)) {
     std::unique_ptr<SourceCoverageView> SubView{nullptr};
@@ -696,7 +698,7 @@ int CodeCoverageTool::show(int argc, con
 
   cl::opt<bool> ShowInstantiations("show-instantiations", cl::Optional,
                                    cl::desc("Show function instantiations"),
-                                   cl::cat(ViewCategory));
+                                   cl::init(true), cl::cat(ViewCategory));
 
   cl::opt<std::string> ShowOutputDirectory(
       "output-dir", cl::init(""),




More information about the llvm-commits mailing list