OSDN Git Service

[llvm-cov] Fix showing title when filtering and not outputting to a directory
authorSean Eveson <eveson.sean@gmail.com>
Wed, 4 Oct 2017 08:54:37 +0000 (08:54 +0000)
committerSean Eveson <eveson.sean@gmail.com>
Wed, 4 Oct 2017 08:54:37 +0000 (08:54 +0000)
Differential Revision: https://reviews.llvm.org/D38507

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314885 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-cov/showProjectSummary.cpp
tools/llvm-cov/CodeCoverage.cpp

index 907fccb..cbf029e 100644 (file)
@@ -13,6 +13,7 @@ int main(int argc, char ** argv) {
 
 // Test console output.
 // RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile %t.profdata -path-equivalence=/tmp,%S %s | FileCheck -check-prefixes=TEXT,TEXT-FILE,TEXT-HEADER %S/Inputs/showProjectSummary.test
+// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile %t.profdata -path-equivalence=/tmp,%S -name=main %s | FileCheck -check-prefixes=TEXT,TEXT-FILE,TEXT-HEADER %S/Inputs/showProjectSummary.test
 // RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile %t.profdata -project-title "Test Suite" -path-equivalence=/tmp,%S %s | FileCheck -check-prefixes=TEXT-TITLE,TEXT,TEXT-FILE,TEXT-HEADER %S/Inputs/showProjectSummary.test
 // RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile %t.profdata -project-title "Test Suite" -name=main -path-equivalence=/tmp,%S %s | FileCheck -check-prefixes=TEXT-FUNCTION,TEXT-HEADER %S/Inputs/showProjectSummary.test
 // RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile=%t.profdata -o %t.dir -path-equivalence=/tmp,%S %s
index 1b9f232..8d9f4d0 100644 (file)
@@ -882,7 +882,7 @@ int CodeCoverageTool::show(int argc, const char **argv,
       }
       auto OS = std::move(OSOrErr.get());
 
-      bool ShowTitle = true;
+      bool ShowTitle = ViewOpts.hasOutputDirectory();
       for (const auto *Function : Functions) {
         auto FunctionView = createFunctionView(*Function, *Coverage);
         if (!FunctionView) {