]> granicus.if.org Git - llvm/commitdiff
[llvm-cov] Move a check into a helper method (NFC)
authorVedant Kumar <vsk@apple.com>
Tue, 28 Jun 2016 16:12:12 +0000 (16:12 +0000)
committerVedant Kumar <vsk@apple.com>
Tue, 28 Jun 2016 16:12:12 +0000 (16:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274025 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-cov/CoverageViewOptions.h
tools/llvm-cov/SourceCoverageView.cpp

index bde8b82520b7944d7c282b73ce3c22173ff6c10b..ff23a619fdeae5de8be5ff5807b41cc8b9a8cf18 100644 (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 != ""; }
 };
 }
 
index 4170fb44e94d56216883bc0cb4fe02548bee4a3f..b71a35f8db0d6b802b1b8e3d41ee79f7a477bd38 100644 (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,