#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;
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) {
PrettyStackTraceProgram X(argc, argv);
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
- cl::ParseCommandLineOptions(argc, argv, "llvm cov\n");
+ 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())
FileInfo FI;
GF.collectLineCounts(FI);
- FI.print(InputGCNO, InputGCDA);
+ FI.print(OS, InputGCNO, InputGCDA);
return 0;
}