From 0053c0b679b516af48086346e38f6c87017a7ca5 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Thu, 8 Sep 2016 00:56:48 +0000 Subject: [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 --- llvm/tools/llvm-cov/SourceCoverageView.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'llvm/tools/llvm-cov/SourceCoverageView.cpp') diff --git a/llvm/tools/llvm-cov/SourceCoverageView.cpp b/llvm/tools/llvm-cov/SourceCoverageView.cpp index 47980ab..cfcaf2e 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::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( - SourceName, File, Options, std::move(CoverageInfo), FunctionView); + SourceName, File, Options, std::move(CoverageInfo)); case CoverageViewOptions::OutputFormat::HTML: return llvm::make_unique( - 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( -- cgit v1.1