diff options
author | Yuchen Wu <yuchenericwu@hotmail.com> | 2013-11-02 00:09:17 +0000 |
---|---|---|
committer | Yuchen Wu <yuchenericwu@hotmail.com> | 2013-11-02 00:09:17 +0000 |
commit | daaa8b720b026c83bf6d4307042057665348b222 (patch) | |
tree | 94d1a9ce4d0b47a8b07aa9a11c2decf3770a27f4 /lib/IR | |
parent | bc28e88a2861ab1183e138f19e92e5d862eaa8a6 (diff) | |
download | external_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 'lib/IR')
-rw-r--r-- | lib/IR/GCOV.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/IR/GCOV.cpp b/lib/IR/GCOV.cpp index 7c9cfe3..794ead9 100644 --- a/lib/IR/GCOV.cpp +++ b/lib/IR/GCOV.cpp @@ -250,14 +250,15 @@ void GCOVLines::dump() { // FileInfo implementation. /// print - Print source files with collected line count information. -void FileInfo::print(StringRef gcnoFile, StringRef gcdaFile) { +void FileInfo::print(raw_fd_ostream &OS, StringRef gcnoFile, + StringRef gcdaFile) { for (StringMap<LineCounts>::iterator I = LineInfo.begin(), E = LineInfo.end(); I != E; ++I) { StringRef Filename = I->first(); - outs() << " -: 0:Source:" << Filename << "\n"; - outs() << " -: 0:Graph:" << gcnoFile << "\n"; - outs() << " -: 0:Data:" << gcdaFile << "\n"; - outs() << " -: 0:Programs:" << ProgramCount << "\n"; + OS << " -: 0:Source:" << Filename << "\n"; + OS << " -: 0:Graph:" << gcnoFile << "\n"; + OS << " -: 0:Data:" << gcdaFile << "\n"; + OS << " -: 0:Programs:" << ProgramCount << "\n"; LineCounts &L = LineInfo[Filename]; OwningPtr<MemoryBuffer> Buff; if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename, Buff)) { @@ -269,16 +270,16 @@ void FileInfo::print(StringRef gcnoFile, StringRef gcdaFile) { while (!AllLines.empty()) { if (L.find(i) != L.end()) { if (L[i] == 0) - outs() << " #####:"; + OS << " #####:"; else - outs() << format("%9lu:", L[i]); + OS << format("%9lu:", L[i]); } else { - outs() << " -:"; + OS << " -:"; } std::pair<StringRef, StringRef> P = AllLines.split('\n'); if (AllLines != P.first) - outs() << format("%5u:", i+1) << P.first; - outs() << "\n"; + OS << format("%5u:", i+1) << P.first; + OS << "\n"; AllLines = P.second; ++i; } |