[llvm] r285043 - [llvm-cov] Do not print out the filename of the object file
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 24 17:08:34 PDT 2016
Author: vedantk
Date: Mon Oct 24 19:08:33 2016
New Revision: 285043
URL: http://llvm.org/viewvc/llvm-project?rev=285043&view=rev
Log:
[llvm-cov] Do not print out the filename of the object file
When we load coverage data from multiple objects, we don't have a way to
attribute a source object to a function record. Printing out the object
filename next to the source filename is already not very useful: soon,
it'll actually become misleading. Stop printing out the filename now.
Modified:
llvm/trunk/test/tools/llvm-cov/Inputs/binary-formats.canonical.json
llvm/trunk/test/tools/llvm-cov/Inputs/highlightedRanges.json
llvm/trunk/test/tools/llvm-cov/Inputs/lineExecutionCounts.json
llvm/trunk/test/tools/llvm-cov/Inputs/regionMarkers.json
llvm/trunk/test/tools/llvm-cov/Inputs/showExpansions.json
llvm/trunk/test/tools/llvm-cov/Inputs/showProjectSummary.test
llvm/trunk/test/tools/llvm-cov/Inputs/universal-binary.json
llvm/trunk/test/tools/llvm-cov/native_separators.c
llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
llvm/trunk/tools/llvm-cov/CoverageExporterJson.cpp
llvm/trunk/tools/llvm-cov/CoverageViewOptions.h
llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp
llvm/trunk/tools/llvm-cov/SourceCoverageView.h
llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp
llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp
Modified: llvm/trunk/test/tools/llvm-cov/Inputs/binary-formats.canonical.json
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/Inputs/binary-formats.canonical.json?rev=285043&r1=285042&r2=285043&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/Inputs/binary-formats.canonical.json (original)
+++ llvm/trunk/test/tools/llvm-cov/Inputs/binary-formats.canonical.json Mon Oct 24 19:08:33 2016
@@ -1,8 +1,8 @@
// Metadata section
-// CHECK: {"version":"1.1.0","type":"llvm.coverage.json.export","data":[
+// CHECK: {"version":"{{[0-9]\.[0-9]\.[0-9]}}","type":"llvm.coverage.json.export","data":[
// Open Export
-// CHECK-SAME: {"object":"{{[^"]+}}","files":[
+// CHECK-SAME: {"files":[
// File Object
// CHECK-SAME: {"filename":"{{[^"]+}}binary-formats.c",
Modified: llvm/trunk/test/tools/llvm-cov/Inputs/highlightedRanges.json
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/Inputs/highlightedRanges.json?rev=285043&r1=285042&r2=285043&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/Inputs/highlightedRanges.json (original)
+++ llvm/trunk/test/tools/llvm-cov/Inputs/highlightedRanges.json Mon Oct 24 19:08:33 2016
@@ -1,8 +1,8 @@
// Metadata section
-// CHECK: {"version":"1.1.0","type":"llvm.coverage.json.export","data":[
+// CHECK: {"version":"{{[0-9]\.[0-9]\.[0-9]}}","type":"llvm.coverage.json.export","data":[
// Open Export
-// CHECK-SAME: {"object":"{{[^"]+}}","files":[
+// CHECK-SAME: {"files":[
// File Object
// CHECK-SAME: {"filename":"{{[^"]+}}showHighlightedRanges.cpp",
Modified: llvm/trunk/test/tools/llvm-cov/Inputs/lineExecutionCounts.json
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/Inputs/lineExecutionCounts.json?rev=285043&r1=285042&r2=285043&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/Inputs/lineExecutionCounts.json (original)
+++ llvm/trunk/test/tools/llvm-cov/Inputs/lineExecutionCounts.json Mon Oct 24 19:08:33 2016
@@ -1,8 +1,8 @@
// Metadata section
-// CHECK: {"version":"1.1.0","type":"llvm.coverage.json.export","data":[
+// CHECK: {"version":"{{[0-9]\.[0-9]\.[0-9]}}","type":"llvm.coverage.json.export","data":[
// Open Export
-// CHECK-SAME: {"object":"{{[^"]+}}","files":[
+// CHECK-SAME: {"files":[
// File Object
// CHECK-SAME: {"filename":"{{[^"]+}}showLineExecutionCounts.cpp",
Modified: llvm/trunk/test/tools/llvm-cov/Inputs/regionMarkers.json
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/Inputs/regionMarkers.json?rev=285043&r1=285042&r2=285043&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/Inputs/regionMarkers.json (original)
+++ llvm/trunk/test/tools/llvm-cov/Inputs/regionMarkers.json Mon Oct 24 19:08:33 2016
@@ -1,8 +1,8 @@
// Metadata section
-// CHECK: {"version":"1.1.0","type":"llvm.coverage.json.export","data":[
+// CHECK: {"version":"{{[0-9]\.[0-9]\.[0-9]}}","type":"llvm.coverage.json.export","data":[
// Open Export
-// CHECK-SAME: {"object":"{{[^"]+}}","files":[
+// CHECK-SAME: {"files":[
// File Object
// CHECK-SAME: {"filename":"{{[^"]+}}showRegionMarkers.cpp",
Modified: llvm/trunk/test/tools/llvm-cov/Inputs/showExpansions.json
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/Inputs/showExpansions.json?rev=285043&r1=285042&r2=285043&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/Inputs/showExpansions.json (original)
+++ llvm/trunk/test/tools/llvm-cov/Inputs/showExpansions.json Mon Oct 24 19:08:33 2016
@@ -1,8 +1,8 @@
// Metadata section
-// CHECK: {"version":"1.1.0","type":"llvm.coverage.json.export","data":[
+// CHECK: {"version":"{{[0-9]\.[0-9]\.[0-9]}}","type":"llvm.coverage.json.export","data":[
// Open Export
-// CHECK-SAME: {"object":"{{[^"]+}}","files":[
+// CHECK-SAME: {"files":[
// File Object
// CHECK-SAME: {"filename":"{{[^"]+}}showExpansions.cpp",
Modified: llvm/trunk/test/tools/llvm-cov/Inputs/showProjectSummary.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/Inputs/showProjectSummary.test?rev=285043&r1=285042&r2=285043&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/Inputs/showProjectSummary.test (original)
+++ llvm/trunk/test/tools/llvm-cov/Inputs/showProjectSummary.test Mon Oct 24 19:08:33 2016
@@ -1,14 +1,13 @@
TEXT-TITLE: Test Suite
TEXT-NOT: Coverage Report
TEXT-NOT: Created:
-TEXT-FILE-NOT: (Binary: showProjectSummary.covmapping)
TEXT-FUNCTION: main:
TEXT-FOOTER: Generated by llvm-cov
HTML-TITLE: <h1>Test Suite</h1>
HTML: <h2>Coverage Report</h2>
HTML: <h4>Created:{{.*}}</h4>
-HTML-FILE: <pre>{{.*}}showProjectSummary.cpp (Binary: showProjectSummary.covmapping)</pre>
+HTML-FILE: <pre>{{.*}}showProjectSummary.cpp</pre>
HTML-FUNCTION: <pre>main</pre>
HTML-HEADER: <td><pre>Line</pre></td>
HTML-HEADER: <td><pre>Count</pre></td>
Modified: llvm/trunk/test/tools/llvm-cov/Inputs/universal-binary.json
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/Inputs/universal-binary.json?rev=285043&r1=285042&r2=285043&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/Inputs/universal-binary.json (original)
+++ llvm/trunk/test/tools/llvm-cov/Inputs/universal-binary.json Mon Oct 24 19:08:33 2016
@@ -1,8 +1,8 @@
// Metadata section
-// CHECK: {"version":"1.1.0","type":"llvm.coverage.json.export","data":[
+// CHECK: {"version":"{{[0-9]\.[0-9]\.[0-9]}}","type":"llvm.coverage.json.export","data":[
// Open Export
-// CHECK-SAME: {"object":"{{[^"]+}}","files":[
+// CHECK-SAME: {"files":[
// File Object
// CHECK-SAME: {"filename":"{{[^"]+}}universal-binary.c",
Modified: llvm/trunk/test/tools/llvm-cov/native_separators.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/native_separators.c?rev=285043&r1=285042&r2=285043&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/native_separators.c (original)
+++ llvm/trunk/test/tools/llvm-cov/native_separators.c Mon Oct 24 19:08:33 2016
@@ -15,6 +15,6 @@
// TEXT-INDEX: \tmp\native_separators.c
// HTML-INDEX: >tmp\native_separators.c</a>
-// HTML: <pre>\tmp\native_separators.c (Binary: native_separators.covmapping)</pre>
+// HTML: <pre>\tmp\native_separators.c</pre>
int main() {}
Modified: llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CodeCoverage.cpp?rev=285043&r1=285042&r2=285043&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CodeCoverage.cpp (original)
+++ llvm/trunk/tools/llvm-cov/CodeCoverage.cpp Mon Oct 24 19:08:33 2016
@@ -39,8 +39,7 @@
using namespace llvm;
using namespace coverage;
-void exportCoverageDataToJson(StringRef ObjectFilename,
- const coverage::CoverageMapping &CoverageMapping,
+void exportCoverageDataToJson(const coverage::CoverageMapping &CoverageMapping,
raw_ostream &OS);
namespace {
@@ -570,13 +569,6 @@ int CodeCoverageTool::run(Command Cmd, i
CompareFilenamesOnly = FilenameEquivalence;
ViewOpts.Format = Format;
- SmallString<128> ObjectFilePath(this->ObjectFilename);
- if (std::error_code EC = sys::fs::make_absolute(ObjectFilePath)) {
- error(EC.message(), this->ObjectFilename);
- return 1;
- }
- sys::path::native(ObjectFilePath);
- ViewOpts.ObjectFilename = ObjectFilePath.c_str();
switch (ViewOpts.Format) {
case CoverageViewOptions::OutputFormat::Text:
ViewOpts.Colors = UseColor == cl::BOU_UNSET
@@ -843,7 +835,7 @@ int CodeCoverageTool::export_(int argc,
return 1;
}
- exportCoverageDataToJson(ObjectFilename, *Coverage.get(), outs());
+ exportCoverageDataToJson(*Coverage.get(), outs());
return 0;
}
Modified: llvm/trunk/tools/llvm-cov/CoverageExporterJson.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CoverageExporterJson.cpp?rev=285043&r1=285042&r2=285043&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CoverageExporterJson.cpp (original)
+++ llvm/trunk/tools/llvm-cov/CoverageExporterJson.cpp Mon Oct 24 19:08:33 2016
@@ -48,7 +48,7 @@
#include <stack>
/// \brief The semantic version combined as a string.
-#define LLVM_COVERAGE_EXPORT_JSON_STR "1.1.0"
+#define LLVM_COVERAGE_EXPORT_JSON_STR "2.0.0"
/// \brief Unique type identifier for JSON coverage export.
#define LLVM_COVERAGE_EXPORT_JSON_TYPE_STR "llvm.coverage.json.export"
@@ -57,9 +57,6 @@ using namespace llvm;
using namespace coverage;
class CoverageExporterJson {
- /// \brief A Name of the object file coverage is for.
- StringRef ObjectFilename;
-
/// \brief Output stream to print JSON to.
raw_ostream &OS;
@@ -72,9 +69,6 @@ class CoverageExporterJson {
/// \brief Tracks state of the JSON output.
std::stack<JsonState> State;
- /// \brief Get the object filename.
- StringRef getObjectFilename() const { return ObjectFilename; }
-
/// \brief Emit a serialized scalar.
void emitSerialized(const int64_t Value) { OS << Value; }
@@ -170,7 +164,6 @@ class CoverageExporterJson {
// Start Export.
emitDictStart();
- emitDictElement("object", getObjectFilename());
emitDictKey("files");
@@ -410,9 +403,8 @@ class CoverageExporterJson {
}
public:
- CoverageExporterJson(StringRef ObjectFilename,
- const CoverageMapping &CoverageMapping, raw_ostream &OS)
- : ObjectFilename(ObjectFilename), OS(OS), Coverage(CoverageMapping) {
+ CoverageExporterJson(const CoverageMapping &CoverageMapping, raw_ostream &OS)
+ : OS(OS), Coverage(CoverageMapping) {
State.push(JsonState::None);
}
@@ -421,10 +413,9 @@ public:
};
/// \brief Export the given CoverageMapping to a JSON Format.
-void exportCoverageDataToJson(StringRef ObjectFilename,
- const CoverageMapping &CoverageMapping,
+void exportCoverageDataToJson(const CoverageMapping &CoverageMapping,
raw_ostream &OS) {
- auto Exporter = CoverageExporterJson(ObjectFilename, CoverageMapping, OS);
+ auto Exporter = CoverageExporterJson(CoverageMapping, OS);
Exporter.print();
}
Modified: llvm/trunk/tools/llvm-cov/CoverageViewOptions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CoverageViewOptions.h?rev=285043&r1=285042&r2=285043&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CoverageViewOptions.h (original)
+++ llvm/trunk/tools/llvm-cov/CoverageViewOptions.h Mon Oct 24 19:08:33 2016
@@ -36,7 +36,6 @@ struct CoverageViewOptions {
std::vector<std::string> DemanglerOpts;
uint32_t TabSize;
std::string ProjectTitle;
- std::string ObjectFilename;
std::string CreatedTimeStr;
/// \brief Change the output's stream color if the colors are enabled.
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp?rev=285043&r1=285042&r2=285043&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp Mon Oct 24 19:08:33 2016
@@ -149,11 +149,6 @@ std::string SourceCoverageView::getSourc
return SourceText.str();
}
-std::string SourceCoverageView::getVerboseSourceName() const {
- return getSourceName() + " (Binary: " +
- sys::path::filename(getOptions().ObjectFilename).str() + ")";
-}
-
void SourceCoverageView::addExpansion(
const coverage::CounterMappingRegion &Region,
std::unique_ptr<SourceCoverageView> View) {
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageView.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageView.h?rev=285043&r1=285042&r2=285043&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageView.h (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageView.h Mon Oct 24 19:08:33 2016
@@ -277,10 +277,6 @@ public:
/// \brief Return the source name formatted for the host OS.
std::string getSourceName() const;
- /// \brief Return a verbose description of the source name and the binary it
- /// corresponds to.
- std::string getVerboseSourceName() const;
-
const CoverageViewOptions &getOptions() const { return Options; }
/// \brief Add an expansion subview to this view.
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp?rev=285043&r1=285042&r2=285043&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp Mon Oct 24 19:08:33 2016
@@ -406,11 +406,8 @@ void SourceCoverageViewHTML::renderViewF
}
void SourceCoverageViewHTML::renderSourceName(raw_ostream &OS, bool WholeFile) {
- OS << BeginSourceNameDiv;
- std::string ViewInfo = escape(
- WholeFile ? getVerboseSourceName() : getSourceName(), getOptions());
- OS << tag("pre", ViewInfo);
- OS << EndSourceNameDiv;
+ OS << BeginSourceNameDiv << tag("pre", escape(getSourceName(), getOptions()))
+ << EndSourceNameDiv;
}
void SourceCoverageViewHTML::renderLinePrefix(raw_ostream &OS, unsigned) {
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp?rev=285043&r1=285042&r2=285043&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp Mon Oct 24 19:08:33 2016
@@ -70,8 +70,8 @@ void SourceCoverageViewText::renderViewH
void SourceCoverageViewText::renderViewFooter(raw_ostream &) {}
void SourceCoverageViewText::renderSourceName(raw_ostream &OS, bool WholeFile) {
- std::string ViewInfo = WholeFile ? getVerboseSourceName() : getSourceName();
- getOptions().colored_ostream(OS, raw_ostream::CYAN) << ViewInfo << ":\n";
+ getOptions().colored_ostream(OS, raw_ostream::CYAN) << getSourceName()
+ << ":\n";
}
void SourceCoverageViewText::renderLinePrefix(raw_ostream &OS,
More information about the llvm-commits
mailing list