diff options
| author | Justin Bogner <mail@justinbogner.com> | 2014-03-27 00:06:36 +0000 |
|---|---|---|
| committer | Justin Bogner <mail@justinbogner.com> | 2014-03-27 00:06:36 +0000 |
| commit | 66ddccb16066ae362110af551f30c648a87268b2 (patch) | |
| tree | 4750bfe2def732e18efd8a9858c66f9674daf99b | |
| parent | 72fbde84b819cdeba99cd86e83525743f46e6234 (diff) | |
| download | bcm5719-llvm-66ddccb16066ae362110af551f30c648a87268b2.tar.gz bcm5719-llvm-66ddccb16066ae362110af551f30c648a87268b2.zip | |
llvm-cov: When reading strings in gcov data, skip leading zeros
It seems that gcov, when faced with a string that is apparently zero
length, just keeps reading words until it finds a length it likes
better. I'm not really sure why this is, but it's simple enough to
make llvm-cov follow suit.
llvm-svn: 204881
| -rw-r--r-- | llvm/include/llvm/Support/GCOV.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/include/llvm/Support/GCOV.h b/llvm/include/llvm/Support/GCOV.h index aeac4555cee..902f2dbc83b 100644 --- a/llvm/include/llvm/Support/GCOV.h +++ b/llvm/include/llvm/Support/GCOV.h @@ -204,8 +204,11 @@ public: } bool readString(StringRef &Str) { - uint32_t Len; - if (!readInt(Len)) return false; + uint32_t Len = 0; + // Keep reading until we find a non-zero length. This emulates gcov's + // behaviour, which appears to do the same. + while (Len == 0) + if (!readInt(Len)) return false; Len *= 4; if (Buffer->getBuffer().size() < Cursor+Len) { errs() << "Unexpected end of memory buffer: " << Cursor+Len << ".\n"; |

