]> granicus.if.org Git - llvm/commitdiff
[llvm-cov] Fix two warnings
authorVedant Kumar <vsk@apple.com>
Fri, 24 Jun 2016 02:33:01 +0000 (02:33 +0000)
committerVedant Kumar <vsk@apple.com>
Fri, 24 Jun 2016 02:33:01 +0000 (02:33 +0000)
They were using output streams inconsistently. One also had a grammar
bug.

I noticed these while trying to pare down D18278.

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

test/tools/llvm-cov/warnings.h [new file with mode: 0644]
tools/llvm-cov/CodeCoverage.cpp

diff --git a/test/tools/llvm-cov/warnings.h b/test/tools/llvm-cov/warnings.h
new file mode 100644 (file)
index 0000000..0517b6a
--- /dev/null
@@ -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 '{{.*}}'.
index aa2156180a46d5b2dc67ef171dc8a772841a5792..a59860b957aafb748a8892db16be701486f424a1 100644 (file)
@@ -423,9 +423,9 @@ int CodeCoverageTool::show(int argc, const char **argv,
 
       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, const char **argv,
   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;
     }