summaryrefslogtreecommitdiff
path: root/lib/IR/GCOV.cpp
diff options
context:
space:
mode:
authorYuchen Wu <yuchenericwu@hotmail.com>2013-12-03 00:57:11 +0000
committerYuchen Wu <yuchenericwu@hotmail.com>2013-12-03 00:57:11 +0000
commit6cd7a3fa797dc9b337c60cced2321da2d65884fb (patch)
tree25fe5e83cd8c46ef4b2a473fac1617af4c0d4a69 /lib/IR/GCOV.cpp
parenteae8ef479d2c6c81b2ff19d2f721e7273642bc40 (diff)
downloadllvm-6cd7a3fa797dc9b337c60cced2321da2d65884fb.tar.gz
llvm-6cd7a3fa797dc9b337c60cced2321da2d65884fb.tar.bz2
llvm-6cd7a3fa797dc9b337c60cced2321da2d65884fb.tar.xz
llvm-cov: Removed output to STDOUT/specified file.
Instead of asking the user to specify a single file to output coverage info and defaulting to STDOUT, llvm-cov now creates files for each source file with a naming system of: <source filename> + ".llcov". This is what gcov does and although it can clutter the working directory with numerous coverage files, it will be easier to hook the llvm-cov output to tools which operate on this assumption (such as lcov). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196184 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/GCOV.cpp')
-rw-r--r--lib/IR/GCOV.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/IR/GCOV.cpp b/lib/IR/GCOV.cpp
index bcc62b11d5..394c683cee 100644
--- a/lib/IR/GCOV.cpp
+++ b/lib/IR/GCOV.cpp
@@ -317,8 +317,7 @@ void GCOVBlock::dump() const {
// FileInfo implementation.
/// print - Print source files with collected line count information.
-void FileInfo::print(raw_fd_ostream &OS, StringRef gcnoFile,
- StringRef gcdaFile) const {
+void FileInfo::print(StringRef gcnoFile, StringRef gcdaFile) const {
for (StringMap<LineData>::const_iterator I = LineInfo.begin(),
E = LineInfo.end(); I != E; ++I) {
StringRef Filename = I->first();
@@ -329,6 +328,12 @@ void FileInfo::print(raw_fd_ostream &OS, StringRef gcnoFile,
}
StringRef AllLines = Buff->getBuffer();
+ std::string CovFilename = Filename.str() + ".llcov";
+ std::string ErrorInfo;
+ raw_fd_ostream OS(CovFilename.c_str(), ErrorInfo);
+ if (!ErrorInfo.empty())
+ errs() << ErrorInfo << "\n";
+
OS << " -: 0:Source:" << Filename << "\n";
OS << " -: 0:Graph:" << gcnoFile << "\n";
OS << " -: 0:Data:" << gcdaFile << "\n";