[llvm-cov] Move a check into a helper method (NFC)

llvm-svn: 274025
This commit is contained in:
Vedant Kumar 2016-06-28 16:12:12 +00:00
parent 1c7d532cde
commit de717e655b
2 changed files with 4 additions and 1 deletions

View File

@ -37,6 +37,9 @@ struct CoverageViewOptions {
raw_ostream::Colors Color) const {
return llvm::colored_ostream(OS, Color, Colors);
}
/// \brief Check if an output directory has been specified.
bool hasOutputDirectory() const { return ShowOutputDirectory != ""; }
};
}

View File

@ -74,7 +74,7 @@ Expected<SourceCoverageView::OwnedStream>
SourceCoverageView::createOutputStream(const CoverageViewOptions &Opts,
StringRef Path, StringRef Extension,
bool InToplevel) {
if (Opts.ShowOutputDirectory == "")
if (!Opts.hasOutputDirectory())
return OwnedStream(&outs());
return createFileInDirectory(Opts.ShowOutputDirectory,