Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 1 | //===- SourceCoverageView.h - Code coverage view for source code ----------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
Vedant Kumar | a6154f9 | 2016-06-25 05:48:54 +0000 | [diff] [blame] | 9 | /// |
| 10 | /// \file This class implements rendering for code coverage of source code. |
| 11 | /// |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_COV_SOURCECOVERAGEVIEW_H |
| 15 | #define LLVM_COV_SOURCECOVERAGEVIEW_H |
| 16 | |
| 17 | #include "CoverageViewOptions.h" |
Vedant Kumar | 1ef0d5a | 2017-09-19 02:00:12 +0000 | [diff] [blame] | 18 | #include "CoverageSummaryInfo.h" |
Easwaran Raman | a96d5370 | 2016-04-29 18:53:05 +0000 | [diff] [blame] | 19 | #include "llvm/ProfileData/Coverage/CoverageMapping.h" |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 20 | #include "llvm/Support/MemoryBuffer.h" |
| 21 | #include <vector> |
| 22 | |
| 23 | namespace llvm { |
| 24 | |
Vedant Kumar | 34ea0de | 2017-10-18 23:58:27 +0000 | [diff] [blame] | 25 | using namespace coverage; |
| 26 | |
Sean Eveson | b863c40 | 2017-10-03 11:05:28 +0000 | [diff] [blame] | 27 | class CoverageFiltersMatchAll; |
Justin Bogner | d1b4e60 | 2014-09-17 05:33:20 +0000 | [diff] [blame] | 28 | class SourceCoverageView; |
| 29 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 30 | /// A view that represents a macro or include expansion. |
Justin Bogner | d1b4e60 | 2014-09-17 05:33:20 +0000 | [diff] [blame] | 31 | struct ExpansionView { |
Vedant Kumar | 34ea0de | 2017-10-18 23:58:27 +0000 | [diff] [blame] | 32 | CounterMappingRegion Region; |
Justin Bogner | d1b4e60 | 2014-09-17 05:33:20 +0000 | [diff] [blame] | 33 | std::unique_ptr<SourceCoverageView> View; |
| 34 | |
Vedant Kumar | 34ea0de | 2017-10-18 23:58:27 +0000 | [diff] [blame] | 35 | ExpansionView(const CounterMappingRegion &Region, |
Justin Bogner | d1b4e60 | 2014-09-17 05:33:20 +0000 | [diff] [blame] | 36 | std::unique_ptr<SourceCoverageView> View) |
| 37 | : Region(Region), View(std::move(View)) {} |
Justin Bogner | cc0c4e7 | 2014-09-17 06:32:48 +0000 | [diff] [blame] | 38 | ExpansionView(ExpansionView &&RHS) |
| 39 | : Region(std::move(RHS.Region)), View(std::move(RHS.View)) {} |
| 40 | ExpansionView &operator=(ExpansionView &&RHS) { |
| 41 | Region = std::move(RHS.Region); |
| 42 | View = std::move(RHS.View); |
| 43 | return *this; |
| 44 | } |
Justin Bogner | d1b4e60 | 2014-09-17 05:33:20 +0000 | [diff] [blame] | 45 | |
| 46 | unsigned getLine() const { return Region.LineStart; } |
| 47 | unsigned getStartCol() const { return Region.ColumnStart; } |
| 48 | unsigned getEndCol() const { return Region.ColumnEnd; } |
| 49 | |
| 50 | friend bool operator<(const ExpansionView &LHS, const ExpansionView &RHS) { |
| 51 | return LHS.Region.startLoc() < RHS.Region.startLoc(); |
| 52 | } |
| 53 | }; |
| 54 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 55 | /// A view that represents a function instantiation. |
Justin Bogner | d1b4e60 | 2014-09-17 05:33:20 +0000 | [diff] [blame] | 56 | struct InstantiationView { |
| 57 | StringRef FunctionName; |
| 58 | unsigned Line; |
| 59 | std::unique_ptr<SourceCoverageView> View; |
| 60 | |
| 61 | InstantiationView(StringRef FunctionName, unsigned Line, |
| 62 | std::unique_ptr<SourceCoverageView> View) |
| 63 | : FunctionName(FunctionName), Line(Line), View(std::move(View)) {} |
| 64 | |
| 65 | friend bool operator<(const InstantiationView &LHS, |
| 66 | const InstantiationView &RHS) { |
| 67 | return LHS.Line < RHS.Line; |
| 68 | } |
| 69 | }; |
| 70 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 71 | /// A file manager that handles format-aware file creation. |
Vedant Kumar | 028d73c | 2016-06-28 16:12:24 +0000 | [diff] [blame] | 72 | class CoveragePrinter { |
Vedant Kumar | 028d73c | 2016-06-28 16:12:24 +0000 | [diff] [blame] | 73 | public: |
| 74 | struct StreamDestructor { |
| 75 | void operator()(raw_ostream *OS) const; |
| 76 | }; |
| 77 | |
| 78 | using OwnedStream = std::unique_ptr<raw_ostream, StreamDestructor>; |
| 79 | |
| 80 | protected: |
Vedant Kumar | 6aa68be | 2016-07-21 23:26:15 +0000 | [diff] [blame] | 81 | const CoverageViewOptions &Opts; |
| 82 | |
Vedant Kumar | 028d73c | 2016-06-28 16:12:24 +0000 | [diff] [blame] | 83 | CoveragePrinter(const CoverageViewOptions &Opts) : Opts(Opts) {} |
| 84 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 85 | /// Return `OutputDir/ToplevelDir/Path.Extension`. If \p InToplevel is |
Vedant Kumar | d378d97 | 2016-06-29 21:55:46 +0000 | [diff] [blame] | 86 | /// false, skip the ToplevelDir component. If \p Relative is false, skip the |
| 87 | /// OutputDir component. |
Vedant Kumar | 028d73c | 2016-06-28 16:12:24 +0000 | [diff] [blame] | 88 | std::string getOutputPath(StringRef Path, StringRef Extension, |
Vedant Kumar | 85e096d | 2016-09-09 01:32:51 +0000 | [diff] [blame] | 89 | bool InToplevel, bool Relative = true) const; |
Vedant Kumar | 028d73c | 2016-06-28 16:12:24 +0000 | [diff] [blame] | 90 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 91 | /// If directory output is enabled, create a file in that directory |
Vedant Kumar | 028d73c | 2016-06-28 16:12:24 +0000 | [diff] [blame] | 92 | /// at the path given by getOutputPath(). Otherwise, return stdout. |
| 93 | Expected<OwnedStream> createOutputStream(StringRef Path, StringRef Extension, |
Vedant Kumar | 85e096d | 2016-09-09 01:32:51 +0000 | [diff] [blame] | 94 | bool InToplevel) const; |
Vedant Kumar | 028d73c | 2016-06-28 16:12:24 +0000 | [diff] [blame] | 95 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 96 | /// Return the sub-directory name for file coverage reports. |
Vedant Kumar | 028d73c | 2016-06-28 16:12:24 +0000 | [diff] [blame] | 97 | static StringRef getCoverageDir() { return "coverage"; } |
| 98 | |
| 99 | public: |
| 100 | static std::unique_ptr<CoveragePrinter> |
| 101 | create(const CoverageViewOptions &Opts); |
| 102 | |
| 103 | virtual ~CoveragePrinter() {} |
| 104 | |
| 105 | /// @name File Creation Interface |
| 106 | /// @{ |
| 107 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 108 | /// Create a file to print a coverage view into. |
Vedant Kumar | 028d73c | 2016-06-28 16:12:24 +0000 | [diff] [blame] | 109 | virtual Expected<OwnedStream> createViewFile(StringRef Path, |
| 110 | bool InToplevel) = 0; |
| 111 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 112 | /// Close a file which has been used to print a coverage view. |
Vedant Kumar | 028d73c | 2016-06-28 16:12:24 +0000 | [diff] [blame] | 113 | virtual void closeViewFile(OwnedStream OS) = 0; |
| 114 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 115 | /// Create an index which lists reports for the given source files. |
Vedant Kumar | fd06635 | 2016-09-23 18:57:32 +0000 | [diff] [blame] | 116 | virtual Error createIndexFile(ArrayRef<std::string> SourceFiles, |
Vedant Kumar | 34ea0de | 2017-10-18 23:58:27 +0000 | [diff] [blame] | 117 | const CoverageMapping &Coverage, |
Sean Eveson | b863c40 | 2017-10-03 11:05:28 +0000 | [diff] [blame] | 118 | const CoverageFiltersMatchAll &Filters) = 0; |
Vedant Kumar | 028d73c | 2016-06-28 16:12:24 +0000 | [diff] [blame] | 119 | |
| 120 | /// @} |
| 121 | }; |
| 122 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 123 | /// A code coverage view of a source file or function. |
Vedant Kumar | a6154f9 | 2016-06-25 05:48:54 +0000 | [diff] [blame] | 124 | /// |
| 125 | /// A source coverage view and its nested sub-views form a file-oriented |
| 126 | /// representation of code coverage data. This view can be printed out by a |
Vedant Kumar | 028d73c | 2016-06-28 16:12:24 +0000 | [diff] [blame] | 127 | /// renderer which implements the Rendering Interface. |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 128 | class SourceCoverageView { |
Vedant Kumar | cc9ef12 | 2016-06-24 00:34:51 +0000 | [diff] [blame] | 129 | /// A function or file name. |
| 130 | StringRef SourceName; |
| 131 | |
| 132 | /// A memory buffer backing the source on display. |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 133 | const MemoryBuffer &File; |
Vedant Kumar | cc9ef12 | 2016-06-24 00:34:51 +0000 | [diff] [blame] | 134 | |
| 135 | /// Various options to guide the coverage renderer. |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 136 | const CoverageViewOptions &Options; |
Vedant Kumar | cc9ef12 | 2016-06-24 00:34:51 +0000 | [diff] [blame] | 137 | |
| 138 | /// Complete coverage information about the source on display. |
Vedant Kumar | 34ea0de | 2017-10-18 23:58:27 +0000 | [diff] [blame] | 139 | CoverageData CoverageInfo; |
Vedant Kumar | cc9ef12 | 2016-06-24 00:34:51 +0000 | [diff] [blame] | 140 | |
| 141 | /// A container for all expansions (e.g macros) in the source on display. |
Justin Bogner | d1b4e60 | 2014-09-17 05:33:20 +0000 | [diff] [blame] | 142 | std::vector<ExpansionView> ExpansionSubViews; |
Vedant Kumar | cc9ef12 | 2016-06-24 00:34:51 +0000 | [diff] [blame] | 143 | |
| 144 | /// A container for all instantiations (e.g template functions) in the source |
| 145 | /// on display. |
Justin Bogner | d1b4e60 | 2014-09-17 05:33:20 +0000 | [diff] [blame] | 146 | std::vector<InstantiationView> InstantiationSubViews; |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 147 | |
Ying Yi | f73cd14 | 2016-09-06 19:31:18 +0000 | [diff] [blame] | 148 | /// Get the first uncovered line number for the source file. |
| 149 | unsigned getFirstUncoveredLineNo(); |
| 150 | |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 151 | protected: |
| 152 | struct LineRef { |
| 153 | StringRef Line; |
| 154 | int64_t LineNo; |
| 155 | |
| 156 | LineRef(StringRef Line, int64_t LineNo) : Line(Line), LineNo(LineNo) {} |
| 157 | }; |
| 158 | |
Vedant Kumar | 34ea0de | 2017-10-18 23:58:27 +0000 | [diff] [blame] | 159 | using CoverageSegmentArray = ArrayRef<const CoverageSegment *>; |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 160 | |
| 161 | /// @name Rendering Interface |
| 162 | /// @{ |
| 163 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 164 | /// Render a header for the view. |
Vedant Kumar | cd29c6b | 2016-06-29 00:38:21 +0000 | [diff] [blame] | 165 | virtual void renderViewHeader(raw_ostream &OS) = 0; |
| 166 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 167 | /// Render a footer for the view. |
Vedant Kumar | cd29c6b | 2016-06-29 00:38:21 +0000 | [diff] [blame] | 168 | virtual void renderViewFooter(raw_ostream &OS) = 0; |
| 169 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 170 | /// Render the source name for the view. |
Vedant Kumar | a8edd76 | 2016-09-10 19:37:26 +0000 | [diff] [blame] | 171 | virtual void renderSourceName(raw_ostream &OS, bool WholeFile) = 0; |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 172 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 173 | /// Render the line prefix at the given \p ViewDepth. |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 174 | virtual void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) = 0; |
| 175 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 176 | /// Render the line suffix at the given \p ViewDepth. |
Vedant Kumar | cd29c6b | 2016-06-29 00:38:21 +0000 | [diff] [blame] | 177 | virtual void renderLineSuffix(raw_ostream &OS, unsigned ViewDepth) = 0; |
| 178 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 179 | /// Render a view divider at the given \p ViewDepth. |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 180 | virtual void renderViewDivider(raw_ostream &OS, unsigned ViewDepth) = 0; |
| 181 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 182 | /// Render a source line with highlighting. |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 183 | virtual void renderLine(raw_ostream &OS, LineRef L, |
Vedant Kumar | d35bb38 | 2017-10-18 18:52:28 +0000 | [diff] [blame] | 184 | const LineCoverageStats &LCS, unsigned ExpansionCol, |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 185 | unsigned ViewDepth) = 0; |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 186 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 187 | /// Render the line's execution count column. |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 188 | virtual void renderLineCoverageColumn(raw_ostream &OS, |
| 189 | const LineCoverageStats &Line) = 0; |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 190 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 191 | /// Render the line number column. |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 192 | virtual void renderLineNumberColumn(raw_ostream &OS, unsigned LineNo) = 0; |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 193 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 194 | /// Render all the region's execution counts on a line. |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 195 | virtual void renderRegionMarkers(raw_ostream &OS, |
Vedant Kumar | d35bb38 | 2017-10-18 18:52:28 +0000 | [diff] [blame] | 196 | const LineCoverageStats &Line, |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 197 | unsigned ViewDepth) = 0; |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 198 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 199 | /// Render the site of an expansion. |
Vedant Kumar | d35bb38 | 2017-10-18 18:52:28 +0000 | [diff] [blame] | 200 | virtual void renderExpansionSite(raw_ostream &OS, LineRef L, |
| 201 | const LineCoverageStats &LCS, |
| 202 | unsigned ExpansionCol, |
| 203 | unsigned ViewDepth) = 0; |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 204 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 205 | /// Render an expansion view and any nested views. |
Vedant Kumar | e435661 | 2016-06-26 02:45:13 +0000 | [diff] [blame] | 206 | virtual void renderExpansionView(raw_ostream &OS, ExpansionView &ESV, |
| 207 | unsigned ViewDepth) = 0; |
| 208 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 209 | /// Render an instantiation view and any nested views. |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 210 | virtual void renderInstantiationView(raw_ostream &OS, InstantiationView &ISV, |
| 211 | unsigned ViewDepth) = 0; |
| 212 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 213 | /// Render \p Title, a project title if one is available, and the |
Vedant Kumar | 7551d48 | 2016-09-15 04:45:59 +0000 | [diff] [blame] | 214 | /// created time. |
| 215 | virtual void renderTitle(raw_ostream &OS, StringRef CellText) = 0; |
Ying Yi | 1461e99 | 2016-08-24 14:27:23 +0000 | [diff] [blame] | 216 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 217 | /// Render the table header for a given source file. |
Vedant Kumar | a8edd76 | 2016-09-10 19:37:26 +0000 | [diff] [blame] | 218 | virtual void renderTableHeader(raw_ostream &OS, unsigned FirstUncoveredLineNo, |
| 219 | unsigned IndentLevel) = 0; |
Ying Yi | 1461e99 | 2016-08-24 14:27:23 +0000 | [diff] [blame] | 220 | |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 221 | /// @} |
| 222 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 223 | /// Format a count using engineering notation with 3 significant |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 224 | /// digits. |
| 225 | static std::string formatCount(uint64_t N); |
| 226 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 227 | /// Check if region marker output is expected for a line. |
Vedant Kumar | 5a74fe7 | 2017-11-09 02:33:44 +0000 | [diff] [blame] | 228 | bool shouldRenderRegionMarkers(const LineCoverageStats &LCS) const; |
Vedant Kumar | cd29c6b | 2016-06-29 00:38:21 +0000 | [diff] [blame] | 229 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 230 | /// Check if there are any sub-views attached to this view. |
Vedant Kumar | cd29c6b | 2016-06-29 00:38:21 +0000 | [diff] [blame] | 231 | bool hasSubViews() const; |
| 232 | |
Vedant Kumar | cc9ef12 | 2016-06-24 00:34:51 +0000 | [diff] [blame] | 233 | SourceCoverageView(StringRef SourceName, const MemoryBuffer &File, |
Justin Bogner | 9eb3816 | 2014-09-20 15:31:56 +0000 | [diff] [blame] | 234 | const CoverageViewOptions &Options, |
Vedant Kumar | 34ea0de | 2017-10-18 23:58:27 +0000 | [diff] [blame] | 235 | CoverageData &&CoverageInfo) |
Vedant Kumar | cc9ef12 | 2016-06-24 00:34:51 +0000 | [diff] [blame] | 236 | : SourceName(SourceName), File(File), Options(Options), |
Vedant Kumar | d2e36ca | 2016-09-08 00:56:48 +0000 | [diff] [blame] | 237 | CoverageInfo(std::move(CoverageInfo)) {} |
Vedant Kumar | cc9ef12 | 2016-06-24 00:34:51 +0000 | [diff] [blame] | 238 | |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 239 | public: |
| 240 | static std::unique_ptr<SourceCoverageView> |
| 241 | create(StringRef SourceName, const MemoryBuffer &File, |
Vedant Kumar | 34ea0de | 2017-10-18 23:58:27 +0000 | [diff] [blame] | 242 | const CoverageViewOptions &Options, CoverageData &&CoverageInfo); |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 243 | |
| 244 | virtual ~SourceCoverageView() {} |
| 245 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 246 | /// Return the source name formatted for the host OS. |
Vedant Kumar | d2e36ca | 2016-09-08 00:56:48 +0000 | [diff] [blame] | 247 | std::string getSourceName() const; |
Ying Yi | 84f34c0 | 2016-09-06 21:41:38 +0000 | [diff] [blame] | 248 | |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 249 | const CoverageViewOptions &getOptions() const { return Options; } |
| 250 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 251 | /// Add an expansion subview to this view. |
Vedant Kumar | 34ea0de | 2017-10-18 23:58:27 +0000 | [diff] [blame] | 252 | void addExpansion(const CounterMappingRegion &Region, |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 253 | std::unique_ptr<SourceCoverageView> View); |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 254 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 255 | /// Add a function instantiation subview to this view. |
Justin Bogner | d1b4e60 | 2014-09-17 05:33:20 +0000 | [diff] [blame] | 256 | void addInstantiation(StringRef FunctionName, unsigned Line, |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 257 | std::unique_ptr<SourceCoverageView> View); |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 258 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 259 | /// Print the code coverage information for a specific portion of a |
Vedant Kumar | a9bf312 | 2016-06-25 02:58:30 +0000 | [diff] [blame] | 260 | /// source file to the output stream. |
| 261 | void print(raw_ostream &OS, bool WholeFile, bool ShowSourceName, |
Sean Eveson | 078c2c3 | 2017-09-28 10:07:30 +0000 | [diff] [blame] | 262 | bool ShowTitle, unsigned ViewDepth = 0); |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 263 | }; |
| 264 | |
| 265 | } // namespace llvm |
| 266 | |
| 267 | #endif // LLVM_COV_SOURCECOVERAGEVIEW_H |