summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorYuchen Wu <yuchenericwu@hotmail.com>2013-11-02 00:09:17 +0000
committerYuchen Wu <yuchenericwu@hotmail.com>2013-11-02 00:09:17 +0000
commitdaaa8b720b026c83bf6d4307042057665348b222 (patch)
tree94d1a9ce4d0b47a8b07aa9a11c2decf3770a27f4 /tools
parentbc28e88a2861ab1183e138f19e92e5d862eaa8a6 (diff)
downloadexternal_llvm-daaa8b720b026c83bf6d4307042057665348b222.zip
external_llvm-daaa8b720b026c83bf6d4307042057665348b222.tar.gz
external_llvm-daaa8b720b026c83bf6d4307042057665348b222.tar.bz2
Added command-line option to output llvm-cov to file.
Added -o option to llvm-cov. If no output file is specified, it defaults to STDOUT. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193899 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm-cov/llvm-cov.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/llvm-cov/llvm-cov.cpp b/tools/llvm-cov/llvm-cov.cpp
index 4a69c71..ad6c671 100644
--- a/tools/llvm-cov/llvm-cov.cpp
+++ b/tools/llvm-cov/llvm-cov.cpp
@@ -17,6 +17,7 @@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryObject.h"
#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/system_error.h"
using namespace llvm;
@@ -30,6 +31,9 @@ InputGCNO("gcno", cl::desc("<input gcno file>"), cl::init(""));
static cl::opt<std::string>
InputGCDA("gcda", cl::desc("<input gcda file>"), cl::init(""));
+static cl::opt<std::string>
+OutputFile("o", cl::desc("<output llvm-cov file>"), cl::init("-"));
+
//===----------------------------------------------------------------------===//
int main(int argc, char **argv) {
@@ -40,6 +44,11 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, "llvm coverage tool\n");
+ std::string ErrorInfo;
+ raw_fd_ostream OS(OutputFile.c_str(), ErrorInfo);
+ if (!ErrorInfo.empty())
+ errs() << ErrorInfo << "\n";
+
GCOVFile GF;
if (InputGCNO.empty())
errs() << " " << argv[0] << ": No gcov input file!\n";
@@ -74,6 +83,6 @@ int main(int argc, char **argv) {
FileInfo FI;
GF.collectLineCounts(FI);
- FI.print(InputGCNO, InputGCDA);
+ FI.print(OS, InputGCNO, InputGCDA);
return 0;
}