[PATCH] D19840: Parse and dump PDB TPI Stream

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon May 2 16:50:52 PDT 2016


rnk added inline comments.

================
Comment at: lib/DebugInfo/PDB/Raw/TpiStream.cpp:96
@@ +95,3 @@
+    codeview::TypeRecordPrefix Prefix;
+    RecordsReader.readObject(&Prefix);
+    Record.Kind =
----------------
zturner wrote:
> rnk wrote:
> > Check for failure here and on the getArrayRef, otherwise there's not much point to std::error_code
> The `std::error_code` is because in the generic case of a `StreamReader` for which you don't know what type of underlying stream backs it (for example a `MappedBlockStream`, you might get an error.  In this case we know it's backed by a `ByteStream` (because that's the type of `RecordsBuffer`) which is guaranteed be contiguous and so `getArrayRef` should never return an error.
The getArrayRef could fail on an invalid type stream or if we get off track accidentally. `Len - sizeof(Prefix.Leaf)` could take us past the end of the stream.


http://reviews.llvm.org/D19840





More information about the llvm-commits mailing list