[llvm] r273642 - [llvm-cov] Fix two warnings
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 23 19:33:01 PDT 2016
Author: vedantk
Date: Thu Jun 23 21:33:01 2016
New Revision: 273642
URL: http://llvm.org/viewvc/llvm-project?rev=273642&view=rev
Log:
[llvm-cov] Fix two warnings
They were using output streams inconsistently. One also had a grammar
bug.
I noticed these while trying to pare down D18278.
Added:
llvm/trunk/test/tools/llvm-cov/warnings.h
Modified:
llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
Added: llvm/trunk/test/tools/llvm-cov/warnings.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/warnings.h?rev=273642&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/warnings.h (added)
+++ llvm/trunk/test/tools/llvm-cov/warnings.h Thu Jun 23 21:33:01 2016
@@ -0,0 +1,11 @@
+// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -filename-equivalence /dev/null | FileCheck %s -allow-empty -check-prefix=FAKE-FILE-STDOUT
+// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -filename-equivalence /dev/null 2>&1 | FileCheck %s -check-prefix=FAKE-FILE-STDERR
+
+// FAKE-FILE-STDOUT-NOT: warning: The file '{{.*}}' isn't covered.
+// FAKE-FILE-STDERR: warning: The file '{{.*}}' isn't covered.
+
+// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -filename-equivalence -name ".*" /dev/null | FileCheck %s -allow-empty -check-prefix=FAKE-FUNC-STDOUT
+// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -filename-equivalence -name-regex ".*" /dev/null 2>&1 | FileCheck %s -check-prefix=FAKE-FUNC-STDERR
+
+// FAKE-FUNC-STDOUT-NOT: warning: Could not read coverage for '{{.*}}'.
+// FAKE-FUNC-STDERR: Could not read coverage for '{{.*}}'.
Modified: llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CodeCoverage.cpp?rev=273642&r1=273641&r2=273642&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CodeCoverage.cpp (original)
+++ llvm/trunk/tools/llvm-cov/CodeCoverage.cpp Thu Jun 23 21:33:01 2016
@@ -423,9 +423,9 @@ int CodeCoverageTool::show(int argc, con
auto mainView = createFunctionView(Function, *Coverage);
if (!mainView) {
- ViewOpts.colored_ostream(outs(), raw_ostream::RED)
- << "warning: Could not read coverage for '" << Function.Name;
- outs() << "\n";
+ ViewOpts.colored_ostream(errs(), raw_ostream::RED)
+ << "warning: Could not read coverage for '" << Function.Name << "'."
+ << "\n";
continue;
}
mainView->renderSourceName(outs());
@@ -446,9 +446,9 @@ int CodeCoverageTool::show(int argc, con
for (const auto &SourceFile : SourceFiles) {
auto mainView = createSourceFileView(SourceFile, *Coverage);
if (!mainView) {
- ViewOpts.colored_ostream(outs(), raw_ostream::RED)
+ ViewOpts.colored_ostream(errs(), raw_ostream::RED)
<< "warning: The file '" << SourceFile << "' isn't covered.";
- outs() << "\n";
+ errs() << "\n";
continue;
}
More information about the llvm-commits
mailing list