summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2017-01-24 08:32:59 +0000
committerpatrick <patrick@openbsd.org>2017-01-24 08:32:59 +0000
commit53d771aafdbe5b919f264f53cba3788e2c4cffd2 (patch)
tree7eca39498be0ff1e3a6daf583cd9ca5886bb2636 /gnu/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
parentIn preparation of compiling our kernels with -ffreestanding, explicitly map (diff)
downloadwireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.tar.xz
wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.zip
Import LLVM 4.0.0 rc1 including clang and lld to help the current
development effort on OpenBSD/arm64.
Diffstat (limited to 'gnu/llvm/tools/llvm-cov/SourceCoverageViewText.cpp')
-rw-r--r--gnu/llvm/tools/llvm-cov/SourceCoverageViewText.cpp36
1 files changed, 31 insertions, 5 deletions
diff --git a/gnu/llvm/tools/llvm-cov/SourceCoverageViewText.cpp b/gnu/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
index ae9d6daed08..4ad120f642e 100644
--- a/gnu/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
+++ b/gnu/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
@@ -11,6 +11,7 @@
///
//===----------------------------------------------------------------------===//
+#include "CoverageReport.h"
#include "SourceCoverageViewText.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallString.h"
@@ -27,15 +28,20 @@ void CoveragePrinterText::closeViewFile(OwnedStream OS) {
OS->operator<<('\n');
}
-Error CoveragePrinterText::createIndexFile(ArrayRef<StringRef> SourceFiles) {
+Error CoveragePrinterText::createIndexFile(
+ ArrayRef<std::string> SourceFiles,
+ const coverage::CoverageMapping &Coverage) {
auto OSOrErr = createOutputStream("index", "txt", /*InToplevel=*/true);
if (Error E = OSOrErr.takeError())
return E;
auto OS = std::move(OSOrErr.get());
raw_ostream &OSRef = *OS.get();
- for (StringRef SF : SourceFiles)
- OSRef << getOutputPath(SF, "txt", /*InToplevel=*/false) << '\n';
+ CoverageReport Report(Opts, Coverage);
+ Report.renderFileReports(OSRef, SourceFiles);
+
+ Opts.colored_ostream(OSRef, raw_ostream::CYAN) << "\n"
+ << Opts.getLLVMVersionString();
return Error::success();
}
@@ -63,7 +69,7 @@ void SourceCoverageViewText::renderViewHeader(raw_ostream &) {}
void SourceCoverageViewText::renderViewFooter(raw_ostream &) {}
-void SourceCoverageViewText::renderSourceName(raw_ostream &OS) {
+void SourceCoverageViewText::renderSourceName(raw_ostream &OS, bool WholeFile) {
getOptions().colored_ostream(OS, raw_ostream::CYAN) << getSourceName()
<< ":\n";
}
@@ -209,5 +215,25 @@ void SourceCoverageViewText::renderInstantiationView(raw_ostream &OS,
unsigned ViewDepth) {
renderLinePrefix(OS, ViewDepth);
OS << ' ';
- ISV.View->print(OS, /*WholeFile=*/false, /*ShowSourceName=*/true, ViewDepth);
+ if (!ISV.View)
+ getOptions().colored_ostream(OS, raw_ostream::RED)
+ << "Unexecuted instantiation: " << ISV.FunctionName << "\n";
+ else
+ ISV.View->print(OS, /*WholeFile=*/false, /*ShowSourceName=*/true,
+ ViewDepth);
+}
+
+void SourceCoverageViewText::renderTitle(raw_ostream &OS, StringRef Title) {
+ if (getOptions().hasProjectTitle())
+ getOptions().colored_ostream(OS, raw_ostream::CYAN)
+ << getOptions().ProjectTitle << "\n";
+
+ getOptions().colored_ostream(OS, raw_ostream::CYAN) << Title << "\n";
+
+ if (getOptions().hasCreatedTime())
+ getOptions().colored_ostream(OS, raw_ostream::CYAN)
+ << getOptions().CreatedTimeStr << "\n";
}
+
+void SourceCoverageViewText::renderTableHeader(raw_ostream &, unsigned,
+ unsigned) {}