aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-cov/SourceCoverageView.h
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2016-06-24 00:34:51 +0000
committerVedant Kumar <vsk@apple.com>2016-06-24 00:34:51 +0000
commit9d70d0b5ffe1e920ff28d506c8ddaefc5c51bb94 (patch)
treecc96ca39c86e29c58ef437be720034590fb64b3e /llvm/tools/llvm-cov/SourceCoverageView.h
parent60dcb48ad0ecc0b065ca55fdf70f4957518a4cc3 (diff)
downloadllvm-9d70d0b5ffe1e920ff28d506c8ddaefc5c51bb94.zip
llvm-9d70d0b5ffe1e920ff28d506c8ddaefc5c51bb94.tar.gz
llvm-9d70d0b5ffe1e920ff28d506c8ddaefc5c51bb94.tar.bz2
[llvm-cov] Add SourceNames to SourceCoverageViews, NFC
A SourceName can be a file or a function. It makes sense to attach this information to a SourceCoverageView, seeing as views (1) already point to the text corresponding to the relevant source code and (2) are already used to render that text along with the SourceNames. This is a nice cleanup which is independent of the upcoming html patch. While we're at it, document the fields in SourceCoverageView. llvm-svn: 273634
Diffstat (limited to 'llvm/tools/llvm-cov/SourceCoverageView.h')
-rw-r--r--llvm/tools/llvm-cov/SourceCoverageView.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/llvm/tools/llvm-cov/SourceCoverageView.h b/llvm/tools/llvm-cov/SourceCoverageView.h
index 49a5f4a..2e98151 100644
--- a/llvm/tools/llvm-cov/SourceCoverageView.h
+++ b/llvm/tools/llvm-cov/SourceCoverageView.h
@@ -101,10 +101,23 @@ struct LineCoverageStats {
/// It can have embedded coverage views.
class SourceCoverageView {
private:
+ /// A function or file name.
+ StringRef SourceName;
+
+ /// A memory buffer backing the source on display.
const MemoryBuffer &File;
+
+ /// Various options to guide the coverage renderer.
const CoverageViewOptions &Options;
+
+ /// Complete coverage information about the source on display.
coverage::CoverageData CoverageInfo;
+
+ /// A container for all expansions (e.g macros) in the source on display.
std::vector<ExpansionView> ExpansionSubViews;
+
+ /// A container for all instantiations (e.g template functions) in the source
+ /// on display.
std::vector<InstantiationView> InstantiationSubViews;
/// \brief Render a source line with highlighting.
@@ -132,10 +145,13 @@ private:
static const unsigned LineNumberColumnWidth = 5;
public:
- SourceCoverageView(const MemoryBuffer &File,
+ SourceCoverageView(StringRef SourceName, const MemoryBuffer &File,
const CoverageViewOptions &Options,
coverage::CoverageData &&CoverageInfo)
- : File(File), Options(Options), CoverageInfo(std::move(CoverageInfo)) {}
+ : SourceName(SourceName), File(File), Options(Options),
+ CoverageInfo(std::move(CoverageInfo)) {}
+
+ StringRef getSourceName() const { return SourceName; }
const CoverageViewOptions &getOptions() const { return Options; }
@@ -154,6 +170,9 @@ public:
/// \brief Print the code coverage information for a specific
/// portion of a source file to the output stream.
void render(raw_ostream &OS, bool WholeFile, unsigned IndentLevel = 0);
+
+ /// \brief Print the source name corresponding to this view.
+ void renderSourceName(raw_ostream &OS);
};
} // namespace llvm