From 24e91bd05fec332b73a991fa1f59160ea1c1e18e Mon Sep 17 00:00:00 2001 From: Ying Yi Date: Tue, 6 Sep 2016 21:41:38 +0000 Subject: [llvm-cov] Add the project summary to the text coverage report for each source file. This patch is a spin-off from https://reviews.llvm.org/D23922. It extends the text view to preserve the same feature as the html view. Differential Revision: https://reviews.llvm.org/D24241 llvm-svn: 280756 --- llvm/tools/llvm-cov/SourceCoverageView.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (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 323352a..47980ab 100644 --- a/llvm/tools/llvm-cov/SourceCoverageView.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageView.cpp @@ -142,6 +142,15 @@ SourceCoverageView::create(StringRef SourceName, const MemoryBuffer &File, llvm_unreachable("Unknown coverage output format!"); } +std::string SourceCoverageView::getNativeSourceName() const { + std::string SourceFile = isFunctionView() ? "Function: " : "Source: "; + SourceFile += getSourceName().str(); + SmallString<128> SourceText(SourceFile); + sys::path::remove_dots(SourceText, /*remove_dot_dots=*/true); + sys::path::native(SourceText); + return SourceText.c_str(); +} + void SourceCoverageView::addExpansion( const coverage::CounterMappingRegion &Region, std::unique_ptr View) { -- cgit v1.1