[llvm] r217838 - llvm-cov: Make debug output more consistent
Justin Bogner
mail at justinbogner.com
Mon Sep 15 15:23:30 PDT 2014
Author: bogner
Date: Mon Sep 15 17:23:29 2014
New Revision: 217838
URL: http://llvm.org/viewvc/llvm-project?rev=217838&view=rev
Log:
llvm-cov: Make debug output more consistent
This changes the debug output of the llvm-cov tool to consistently
write to stderr, and moves the highlighting output closer to where
it's relevant.
Modified:
llvm/trunk/test/tools/llvm-cov/showExpansions.cpp
llvm/trunk/test/tools/llvm-cov/showHighlightedRanges.cpp
llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp
Modified: llvm/trunk/test/tools/llvm-cov/showExpansions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/showExpansions.cpp?rev=217838&r1=217837&r2=217838&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/showExpansions.cpp (original)
+++ llvm/trunk/test/tools/llvm-cov/showExpansions.cpp Mon Sep 15 17:23:29 2014
@@ -1,4 +1,4 @@
-// RUN: llvm-cov show %S/Inputs/showExpansions.covmapping -instr-profile %S/Inputs/showExpansions.profdata -dump -show-expansions -filename-equivalence %s | FileCheck %s
+// RUN: llvm-cov show %S/Inputs/showExpansions.covmapping -instr-profile %S/Inputs/showExpansions.profdata -dump -show-expansions -filename-equivalence %s 2>&1 | FileCheck %s
#define DO_SOMETHING_ELSE() \
do { \
Modified: llvm/trunk/test/tools/llvm-cov/showHighlightedRanges.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/showHighlightedRanges.cpp?rev=217838&r1=217837&r2=217838&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/showHighlightedRanges.cpp (original)
+++ llvm/trunk/test/tools/llvm-cov/showHighlightedRanges.cpp Mon Sep 15 17:23:29 2014
@@ -1,4 +1,4 @@
-// RUN: llvm-cov show %S/Inputs/highlightedRanges.covmapping -instr-profile %S/Inputs/highlightedRanges.profdata -dump -filename-equivalence %s | FileCheck %s
+// RUN: llvm-cov show %S/Inputs/highlightedRanges.covmapping -instr-profile %S/Inputs/highlightedRanges.profdata -dump -filename-equivalence %s 2>&1 | FileCheck %s
void func() {
return;
Modified: llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CodeCoverage.cpp?rev=217838&r1=217837&r2=217838&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CodeCoverage.cpp (original)
+++ llvm/trunk/tools/llvm-cov/CodeCoverage.cpp Mon Sep 15 17:23:29 2014
@@ -273,7 +273,7 @@ void CodeCoverageTool::createExpansionSu
auto ExpandedLines = findExpandedFileInterestingLineRange(
ExpandedRegion.ExpandedFileID, Function);
if (ViewOpts.Debug)
- llvm::outs() << "Expansion of " << ExpandedRegion.ExpandedFileID << ":"
+ llvm::errs() << "Expansion of " << ExpandedRegion.ExpandedFileID << ":"
<< ExpandedLines.first << " -> " << ExpandedLines.second
<< " @ " << ExpandedRegion.FileID << ", "
<< ExpandedRegion.LineStart << ":"
@@ -397,14 +397,14 @@ bool CodeCoverageTool::load() {
for (const auto &R : I.MappingRegions) {
// Compute the values of mapped regions
if (ViewOpts.Debug) {
- outs() << "File " << R.FileID << "| " << R.LineStart << ":"
+ errs() << "File " << R.FileID << "| " << R.LineStart << ":"
<< R.ColumnStart << " -> " << R.LineEnd << ":" << R.ColumnEnd
<< " = ";
Ctx.dump(R.Count);
if (R.Kind == CounterMappingRegion::ExpansionRegion) {
- outs() << " (Expanded file id = " << R.ExpandedFileID << ") ";
+ errs() << " (Expanded file id = " << R.ExpandedFileID << ") ";
}
- outs() << "\n";
+ errs() << "\n";
}
ErrorOr<int64_t> ExecutionCount = Ctx.evaluate(R.Count);
if (ExecutionCount) {
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp?rev=217838&r1=217837&r2=217838&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp Mon Sep 15 17:23:29 2014
@@ -49,6 +49,18 @@ void SourceCoverageView::renderLine(raw_
// Show the rest of the line
OS << Line.substr(Start - 1, Line.size() - Start + 1);
OS << "\n";
+
+ if (Options.Debug) {
+ for (const auto &Range : Ranges) {
+ errs() << "Highlighted line " << Range.Line << ", " << Range.ColumnStart
+ << " -> ";
+ if (Range.ColumnEnd == std::numeric_limits<unsigned>::max()) {
+ errs() << "?\n";
+ } else {
+ errs() << Range.ColumnEnd << "\n";
+ }
+ }
+ }
}
void SourceCoverageView::renderOffset(raw_ostream &OS, unsigned I) {
@@ -390,18 +402,6 @@ SourceCoverageView::createHighlightRange
}
std::sort(HighlightRanges.begin(), HighlightRanges.end());
-
- if (Options.Debug) {
- for (const auto &Range : HighlightRanges) {
- outs() << "Highlighted line " << Range.Line << ", " << Range.ColumnStart
- << " -> ";
- if (Range.ColumnEnd == std::numeric_limits<unsigned>::max()) {
- outs() << "?\n";
- } else {
- outs() << Range.ColumnEnd << "\n";
- }
- }
- }
}
void SourceCoverageView::createRegionMarkers(SourceCoverageDataManager &Data) {
More information about the llvm-commits
mailing list