Reapply "[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.
Changes since the initial commit:
- Avoid accidentally closing stdout twice.
llvm-svn: 273985
diff --git a/llvm/tools/llvm-cov/SourceCoverageViewText.h b/llvm/tools/llvm-cov/SourceCoverageViewText.h
index 17f2e79..769bfa1 100644
--- a/llvm/tools/llvm-cov/SourceCoverageViewText.h
+++ b/llvm/tools/llvm-cov/SourceCoverageViewText.h
@@ -20,6 +20,13 @@
/// \brief A code coverage view which supports text-based rendering.
class SourceCoverageViewText : public SourceCoverageView {
+public:
+ Expected<OwnedStream> createOutputFile(StringRef Path,
+ bool InToplevel) override;
+
+ void closeOutputFile(OwnedStream OS) override;
+
+private:
void renderSourceName(raw_ostream &OS) override;
void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) override;