diff options
author | Yuchen Wu <yuchenericwu@hotmail.com> | 2013-11-20 04:15:05 +0000 |
---|---|---|
committer | Yuchen Wu <yuchenericwu@hotmail.com> | 2013-11-20 04:15:05 +0000 |
commit | d23c759c0fa10b7fb244b4d2911b49b95138a7e1 (patch) | |
tree | 4346b143320207b2cc677a34902d7e0ddc697eb8 /include | |
parent | 523d929368829b5157748f46f85b4577b7fd6ca1 (diff) | |
download | llvm-d23c759c0fa10b7fb244b4d2911b49b95138a7e1.tar.gz llvm-d23c759c0fa10b7fb244b4d2911b49b95138a7e1.tar.bz2 llvm-d23c759c0fa10b7fb244b4d2911b49b95138a7e1.tar.xz |
llvm-cov: Added file checksum to gcno and gcda files.
Instead of permanently outputting "MVLL" as the file checksum, clang
will create gcno and gcda checksums by hashing the destination block
numbers of every arc. This allows for llvm-cov to check if the two gcov
files are synchronized.
Regenerated the test files so they contain the checksum. Also added
negative test to ensure error when the checksums don't match.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195191 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Support/GCOV.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/include/llvm/Support/GCOV.h b/include/llvm/Support/GCOV.h index 0fbe86c3c5..7ba4acb1ae 100644 --- a/include/llvm/Support/GCOV.h +++ b/include/llvm/Support/GCOV.h @@ -45,15 +45,15 @@ public: /// readGCOVFormat - Read GCOV signature at the beginning of buffer. GCOV::GCOVFormat readGCOVFormat() { - StringRef Magic = Buffer->getBuffer().slice(0, 12); - Cursor = 12; - if (Magic == "oncg*404MVLL") + StringRef Magic = Buffer->getBuffer().slice(0, 8); + Cursor = 8; + if (Magic == "oncg*404") return GCOV::GCNO_404; - else if (Magic == "oncg*204MVLL") + else if (Magic == "oncg*204") return GCOV::GCNO_402; - else if (Magic == "adcg*404MVLL") + else if (Magic == "adcg*404") return GCOV::GCDA_404; - else if (Magic == "adcg*204MVLL") + else if (Magic == "adcg*204") return GCOV::GCDA_402; Cursor = 0; @@ -193,12 +193,13 @@ private: /// (.gcno and .gcda). class GCOVFile { public: - GCOVFile() : Functions(), RunCount(0), ProgramCount(0) {} + GCOVFile() : Checksum(0), Functions(), RunCount(0), ProgramCount(0) {} ~GCOVFile(); bool read(GCOVBuffer &Buffer); void dump() const; void collectLineCounts(FileInfo &FI); private: + uint32_t Checksum; SmallVector<GCOVFunction *, 16> Functions; uint32_t RunCount; uint32_t ProgramCount; |