summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov/SourceCoverageView.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2016-09-08 00:56:48 +0000
committerVedant Kumar <vsk@apple.com>2016-09-08 00:56:48 +0000
commit0053c0b679b516af48086346e38f6c87017a7ca5 (patch)
tree0d67b6548d8cecd9f877388cb6378494fac5646c /llvm/tools/llvm-cov/SourceCoverageView.cpp
parentfa754371831b1e75c7b39128b8d8cbfe6862ebd9 (diff)
downloadbcm5719-llvm-0053c0b679b516af48086346e38f6c87017a7ca5.tar.gz
bcm5719-llvm-0053c0b679b516af48086346e38f6c87017a7ca5.zip
[llvm-cov] Use less space to describe source names
In r279628, we made SourceCoverageView list the binary associated with a view and started adding labels (e.g "Source: foo" or "Function: bar") to everything. Condense this information a bit to unclutter reports. llvm-svn: 280896
Diffstat (limited to 'llvm/tools/llvm-cov/SourceCoverageView.cpp')
-rw-r--r--llvm/tools/llvm-cov/SourceCoverageView.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/llvm/tools/llvm-cov/SourceCoverageView.cpp b/llvm/tools/llvm-cov/SourceCoverageView.cpp
index 47980ab0952..cfcaf2e042e 100644
--- a/llvm/tools/llvm-cov/SourceCoverageView.cpp
+++ b/llvm/tools/llvm-cov/SourceCoverageView.cpp
@@ -129,26 +129,28 @@ bool SourceCoverageView::hasSubViews() const {
std::unique_ptr<SourceCoverageView>
SourceCoverageView::create(StringRef SourceName, const MemoryBuffer &File,
const CoverageViewOptions &Options,
- coverage::CoverageData &&CoverageInfo,
- bool FunctionView) {
+ coverage::CoverageData &&CoverageInfo) {
switch (Options.Format) {
case CoverageViewOptions::OutputFormat::Text:
return llvm::make_unique<SourceCoverageViewText>(
- SourceName, File, Options, std::move(CoverageInfo), FunctionView);
+ SourceName, File, Options, std::move(CoverageInfo));
case CoverageViewOptions::OutputFormat::HTML:
return llvm::make_unique<SourceCoverageViewHTML>(
- SourceName, File, Options, std::move(CoverageInfo), FunctionView);
+ SourceName, File, Options, std::move(CoverageInfo));
}
llvm_unreachable("Unknown coverage output format!");
}
-std::string SourceCoverageView::getNativeSourceName() const {
- std::string SourceFile = isFunctionView() ? "Function: " : "Source: ";
- SourceFile += getSourceName().str();
- SmallString<128> SourceText(SourceFile);
+std::string SourceCoverageView::getSourceName() const {
+ SmallString<128> SourceText(SourceName);
sys::path::remove_dots(SourceText, /*remove_dot_dots=*/true);
sys::path::native(SourceText);
- return SourceText.c_str();
+ return SourceText.str();
+}
+
+std::string SourceCoverageView::getVerboseSourceName() const {
+ return "Source: " + getSourceName() + " (Binary: " +
+ sys::path::filename(getOptions().ObjectFilename).str() + ")";
}
void SourceCoverageView::addExpansion(
OpenPOWER on IntegriCloud