[PATCH] D28704: Add a variant of DWARFDie::find() and DWARFDie::findRecursively() that takes a llvm::ArrayRef<dwarf::Attribute>.
Adrian Prantl via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 13 14:36:40 PST 2017
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.
Fine to commit after addressing in-line comments.
================
Comment at: include/llvm/DebugInfo/DWARF/DWARFDie.h:141
+ /// exist in this DIE.
+ Optional<DWARFFormValue> find(const ArrayRef<dwarf::Attribute> &Attrs) const;
----------------
The idiomatic way is to pass an ArrayRef by value. The const is usually omitted, since we also have a MutableArrayRef.
================
Comment at: include/llvm/DebugInfo/DWARF/DWARFDie.h:161
+ Optional<DWARFFormValue>
+ findRecursively(const ArrayRef<dwarf::Attribute> &Attrs) const;
+
----------------
same here.
================
Comment at: lib/DebugInfo/DWARF/DWARFDie.cpp:203
DWARFDie::getRangesBaseAttribute() const {
- auto Result = toSectionOffset(find(DW_AT_rnglists_base));
- if (Result)
- return Result;
- return toSectionOffset(find(DW_AT_GNU_ranges_base));
+ return toSectionOffset(find({DW_AT_rnglists_base, DW_AT_GNU_ranges_base}));
}
----------------
Very nice!
https://reviews.llvm.org/D28704
More information about the llvm-commits
mailing list