diff options
author | Vedant Kumar <vsk@apple.com> | 2016-06-28 00:18:57 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2016-06-28 00:18:57 +0000 |
commit | 02507c435ca6957468cbaac76e8135494a0266c0 (patch) | |
tree | a7a644f55f9995e21e7de77da5e8cbf73c58a5f4 /llvm/tools/llvm-cov/SourceCoverageView.h | |
parent | dcbf4d68b2cc64319e65696b3bb09be1612605e9 (diff) | |
download | llvm-02507c435ca6957468cbaac76e8135494a0266c0.zip llvm-02507c435ca6957468cbaac76e8135494a0266c0.tar.gz llvm-02507c435ca6957468cbaac76e8135494a0266c0.tar.bz2 |
[llvm-cov] Add an -output-dir option for the show sub-command
Passing -output-dir path/to/dir to llvm-cov show creates path/to/dir if
it doesn't already exist, and prints reports into that directory.
In function view mode, all views are written into
path/to/dir/functions.$EXTENSION. In file view mode, all views are
written into path/to/dir/coverage/$PATH.$EXTENSION.
llvm-svn: 273971
Diffstat (limited to 'llvm/tools/llvm-cov/SourceCoverageView.h')
-rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageView.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/llvm/tools/llvm-cov/SourceCoverageView.h b/llvm/tools/llvm-cov/SourceCoverageView.h index 03c0742..57b5d94 100644 --- a/llvm/tools/llvm-cov/SourceCoverageView.h +++ b/llvm/tools/llvm-cov/SourceCoverageView.h @@ -101,7 +101,7 @@ struct LineCoverageStats { /// /// A source coverage view and its nested sub-views form a file-oriented /// representation of code coverage data. This view can be printed out by a -/// renderer which implements the Rendering Interface. +/// renderer which implements both the File Creation and Rendering interfaces. class SourceCoverageView { /// A function or file name. StringRef SourceName; @@ -122,6 +122,19 @@ class SourceCoverageView { /// on display. std::vector<InstantiationView> InstantiationSubViews; +public: + /// @name File Creation Interface + /// @{ + + /// \brief Create a file to print a coverage view into. + virtual Expected<std::unique_ptr<raw_ostream>> + createOutputFile(StringRef Path, bool InToplevel) = 0; + + /// \brief Close a file which has been used to print a coverage view. + virtual void closeOutputFile(std::unique_ptr<raw_ostream> OS) = 0; + + /// @} + protected: struct LineRef { StringRef Line; @@ -183,6 +196,12 @@ protected: /// digits. static std::string formatCount(uint64_t N); + /// \brief If directory output is enabled, create a file with \p Path as the + /// suffix. Otherwise, return stdout. + static Expected<std::unique_ptr<raw_ostream>> + createOutputStream(const CoverageViewOptions &Opts, StringRef Path, + StringRef Extension, bool InToplevel); + SourceCoverageView(StringRef SourceName, const MemoryBuffer &File, const CoverageViewOptions &Options, coverage::CoverageData &&CoverageInfo) |