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

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 18 11:06:24 PDT 2018


dblaikie added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp:115-119
+DWARFUnit *DWARFUnitVector::addUnit(std::unique_ptr<DWARFUnit> Unit) {
+  this->push_back(std::move(Unit));
+  return this->back().get();
+}
+
----------------
This probably needs to ensure the newly added unit is added such that the vector remains in sorted order (so getUnitForOffset, etc, can rely on that sorted order for offset searches).

It could assert this (if the caller(s) you've added ensure this is true) or do a search/insert to keep things sorted.

Or, if you know you won't be using getUnitForOffset, etc, I guess it doesn't need to. Or if you have a phase where you're building the vector then a separate phase where you're using getUnitForOffset - you could add them all, then sort, then query - that's a bit more efficient that maintaining sorted order when you don't need it.


https://reviews.llvm.org/D38719





More information about the llvm-commits mailing list