[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.

llvm-svn: 285043
This commit is contained in:
Vedant Kumar 2016-10-25 00:08:33 +00:00
parent 566a51d193
commit 5c61c70387
15 changed files with 25 additions and 56 deletions

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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>

View File

@ -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",

View File

@ -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() {}

View File

@ -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, int argc, const char **argv) {
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, const char **argv,
return 1;
}
exportCoverageDataToJson(ObjectFilename, *Coverage.get(), outs());
exportCoverageDataToJson(*Coverage.get(), outs());
return 0;
}

View File

@ -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();
}

View File

@ -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.

View File

@ -149,11 +149,6 @@ std::string SourceCoverageView::getSourceName() const {
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) {

View File

@ -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.

View File

@ -406,11 +406,8 @@ void SourceCoverageViewHTML::renderViewFooter(raw_ostream &OS) {
}
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) {

View File

@ -70,8 +70,8 @@ void SourceCoverageViewText::renderViewHeader(raw_ostream &) {}
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,