[PATCH] D45645: Remove faulty assertion in llvm-pdbutil
Adrian McCarthy via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 13 16:41:42 PDT 2018
amccarth created this revision.
amccarth added a reviewer: zturner.
Herald added a subscriber: sanjoy.
If a class's first data member is an instance of an empty class, then an assertion in the `PrettyClassLayoutGraphicalDumper` would fail. The storage is reserved, but it's not marked as in use.
As far as I understand, it's the assertion that's faulty, so I removed it and updated the nearby comment. If you think the `MapUse` is computed wrong in this case, let me know and I'll investigate further.
Found by running llvm-pdbutil against its own PDB, and this assertion would fail on `HashAdjusters`, which is a HashTable whose first data member is a `TraitsT`, which is a `PdbHashTraits<T>`, which is an empty struct. (The struct has a specialization for `uint32_t`, but that specialization doesn't apply here because the `T` is actually `ulittle32_t`.)
https://reviews.llvm.org/D45645
Files:
llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp
Index: llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp
===================================================================
--- llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp
+++ llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp
@@ -50,12 +50,9 @@
uint32_t RelativeOffset = Item->getOffsetInParent();
CurrentAbsoluteOffset = ClassOffsetZero + RelativeOffset;
- // Since there is storage there, it should be set! However, this might
- // be an empty base, in which case it could extend outside the bounds of
- // the parent class.
+ // This might be an empty base, in which case it could extend outside the
+ // bounds of the parent class.
if (RelativeOffset < UseMap.size() && (Item->getSize() > 0)) {
- assert(UseMap.test(RelativeOffset));
-
// If there is any remaining padding in this class, and the offset of the
// new item is after the padding, then we must have just jumped over some
// padding. Print a padding row and then look for where the next block
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45645.142489.patch
Type: text/x-patch
Size: 1059 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180413/b36d1fba/attachment.bin>
More information about the llvm-commits
mailing list