diff options
author | Yuchen Wu <yuchenericwu@hotmail.com> | 2013-12-10 01:02:07 +0000 |
---|---|---|
committer | Yuchen Wu <yuchenericwu@hotmail.com> | 2013-12-10 01:02:07 +0000 |
commit | 30d5ef51e4e20d5114bd80b1ef036d91e4410ae2 (patch) | |
tree | be4749d275aac25267c25edb0161295011197565 /include | |
parent | 06e68434a5fdc33de8a4b704f63c89a45eb2d699 (diff) | |
download | llvm-30d5ef51e4e20d5114bd80b1ef036d91e4410ae2.tar.gz llvm-30d5ef51e4e20d5114bd80b1ef036d91e4410ae2.tar.bz2 llvm-30d5ef51e4e20d5114bd80b1ef036d91e4410ae2.tar.xz |
llvm-cov: Added -a option for block data.
Similar to gcov, llvm-cov will now print out the block count at the end
of each block. Multiple blocks can end on the same line.
One computational difference is by using -a, llvm-cov will no longer
simply add the block counts together to form a line count. Instead, it
will take the maximum of the block counts on that line. This has a
similar effect to what gcov does, but generates more correct counts in
certain scenarios.
Also updated tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196856 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Support/GCOV.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/include/llvm/Support/GCOV.h b/include/llvm/Support/GCOV.h index 5c27316f57..852c0bef45 100644 --- a/include/llvm/Support/GCOV.h +++ b/include/llvm/Support/GCOV.h @@ -34,6 +34,13 @@ namespace GCOV { }; } // end GCOV namespace +/// GCOVOptions - A struct for passing gcov options between functions. +struct GCOVOptions { + GCOVOptions(bool A): AllBlocks(A) {} + + bool AllBlocks; +}; + /// GCOVBuffer - A wrapper around MemoryBuffer to provide GCOV specific /// read operations. class GCOVBuffer { @@ -245,6 +252,7 @@ public: bool readGCNO(GCOVBuffer &Buffer, GCOV::GCOVVersion Version); bool readGCDA(GCOVBuffer &Buffer, GCOV::GCOVVersion Version); StringRef getFilename() const { return Filename; } + size_t getNumBlocks() const { return Blocks.size(); } void dump() const; void collectLineCounts(FileInfo &FI); private: @@ -275,6 +283,7 @@ public: DstEdges.push_back(Edge); } void addLine(uint32_t N) { Lines.push_back(N); } + uint32_t getLastLine() const { return Lines.back(); } void addCount(size_t DstEdgeNo, uint64_t N); uint64_t getCount() const { return Counter; } size_t getNumSrcEdges() const { return SrcEdges.size(); } @@ -305,7 +314,8 @@ public: } void setRunCount(uint32_t Runs) { RunCount = Runs; } void setProgramCount(uint32_t Programs) { ProgramCount = Programs; } - void print(StringRef GCNOFile, StringRef GCDAFile) const; + void print(StringRef GCNOFile, StringRef GCDAFile, + const GCOVOptions &Options) const; private: StringMap<LineData> LineInfo; uint32_t RunCount; |