diff options
author | Yuchen Wu <yuchenericwu@hotmail.com> | 2013-12-03 01:35:31 +0000 |
---|---|---|
committer | Yuchen Wu <yuchenericwu@hotmail.com> | 2013-12-03 01:35:31 +0000 |
commit | d25d7a5cd50b1db99252ed76d4fc6f3fc64fb5cf (patch) | |
tree | 5f8cdbefc14767b47fbe9755cbf7b7661a2dc268 /lib/IR/GCOV.cpp | |
parent | bbc450c5cfbe025e32e3feed956e79d4400bb7c7 (diff) | |
download | llvm-d25d7a5cd50b1db99252ed76d4fc6f3fc64fb5cf.tar.gz llvm-d25d7a5cd50b1db99252ed76d4fc6f3fc64fb5cf.tar.bz2 llvm-d25d7a5cd50b1db99252ed76d4fc6f3fc64fb5cf.tar.xz |
llvm-cov: Cleaned up print() function slightly.
Changed while to for loop. Removed unnecessary if statement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196194 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/GCOV.cpp')
-rw-r--r-- | lib/IR/GCOV.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/IR/GCOV.cpp b/lib/IR/GCOV.cpp index 394c683cee..8ce93675e4 100644 --- a/lib/IR/GCOV.cpp +++ b/lib/IR/GCOV.cpp @@ -340,11 +340,12 @@ void FileInfo::print(StringRef gcnoFile, StringRef gcdaFile) const { OS << " -: 0:Runs:" << RunCount << "\n"; OS << " -: 0:Programs:" << ProgramCount << "\n"; - const LineData &L = I->second; - uint32_t i = 0; - while (!AllLines.empty()) { - LineData::const_iterator BlocksIt = L.find(i); - if (BlocksIt != L.end()) { + const LineData &Line = I->second; + for (uint32_t i = 0; !AllLines.empty(); ++i) { + LineData::const_iterator BlocksIt = Line.find(i); + + // Add up the block counts to form line counts. + if (BlocksIt != Line.end()) { const BlockVector &Blocks = BlocksIt->second; uint64_t LineCount = 0; for (BlockVector::const_iterator I = Blocks.begin(), E = Blocks.end(); @@ -359,11 +360,8 @@ void FileInfo::print(StringRef gcnoFile, StringRef gcdaFile) const { OS << " -:"; } std::pair<StringRef, StringRef> P = AllLines.split('\n'); - if (AllLines != P.first) - OS << format("%5u:", i+1) << P.first; - OS << "\n"; + OS << format("%5u:", i+1) << P.first << "\n"; AllLines = P.second; - ++i; } } } |