[PATCH] D38719: [llvm-dwarfdump] Verify compatible TAG for attributes.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 19 21:09:46 PDT 2018


dblaikie added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp:281-282
       case dwarf::DW_UT_split_type: {
-        Unit.reset(new DWARFTypeUnit(
+        std::unique_ptr<DWARFUnit> UnitUP;
+        UnitUP.reset(new DWARFTypeUnit(
             DCtx, S, Header, DCtx.getDebugAbbrev(), &DObj.getRangeSection(),
----------------
  auto UnitUP = llvm::make_unique<DWARFTypeUnit>(...) 

perhaps?

(I'd probably even roll it into the next line:

  Unit = TypeUnitVector.addUnit(llvm::make_unique<DWARFTypeUnit>(...));

(similarly below for CompileUnit)


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp:461-464
+      if (DieTag == DW_TAG_inlined_subroutine && RefTag == DW_TAG_subprogram)
+        break;
+      if (DieTag == DW_TAG_variable && RefTag == DW_TAG_member)
+        break;
----------------
Should there be a positive case for tags are the same? (things like a member subprogram - DieTag and RefTag would both be subprogram?) Or a function defined in a namespace (I think GCC puts the declaration in a namespace, the definition at global scope - I forget what Clang does tehre - maybe it doesn't produce a declaration so there's nothing to check there?)

Have you run this check over a large codebase to see that it doesn't produce false positives?


https://reviews.llvm.org/D38719





More information about the llvm-commits mailing list