[PATCH] D107874: [DWARF] Find offset of attribute.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 30 21:51:46 PDT 2021


dblaikie accepted this revision.
dblaikie added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp:170-171
+    uint32_t AttrIndex, uint64_t Offset, const DWARFUnit &U) const {
+  if (AttributeSpecs.size() <= AttrIndex)
+    return None;
 
----------------
I guess this should probably be an assertion.


================
Comment at: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp:1788
+    uint64_t OffsetVal =
+        it->getAttributeOffsetFromIndex(*AttrIndex, /* offset */ 0, *U);
+    EXPECT_TRUE(
----------------
Could probably also test the AttrIndex value before using it to lookup the attribute value.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107874/new/

https://reviews.llvm.org/D107874



More information about the llvm-commits mailing list