aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-cov/SourceCoverageView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-cov/SourceCoverageView.cpp')
-rw-r--r--llvm/tools/llvm-cov/SourceCoverageView.cpp9
1 files changed, 9 insertions, 0 deletions
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<SourceCoverageView> View) {