[llvm] r338509 - [DebugInfo] Improve consistency in DWARFDie.h (NFC)
Jonas Devlieghere via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 1 03:30:35 PDT 2018
Author: jdevlieghere
Date: Wed Aug 1 03:30:34 2018
New Revision: 338509
URL: http://llvm.org/viewvc/llvm-project?rev=338509&view=rev
Log:
[DebugInfo] Improve consistency in DWARFDie.h (NFC)
Follow-up for r338506 with some unrelated changes in formatting and
consistency.
Modified:
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDie.h
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDie.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDie.h?rev=338509&r1=338508&r2=338509&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDie.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDie.h Wed Aug 1 03:30:34 2018
@@ -46,7 +46,7 @@ class DWARFDie {
public:
DWARFDie() = default;
- DWARFDie(DWARFUnit *Unit, const DWARFDebugInfoEntry * D) : U(Unit), Die(D) {}
+ DWARFDie(DWARFUnit *Unit, const DWARFDebugInfoEntry *D) : U(Unit), Die(D) {}
bool isValid() const { return U && Die; }
explicit operator bool() const { return isValid(); }
@@ -82,9 +82,7 @@ public:
}
/// Returns true for a valid DIE that terminates a sibling chain.
- bool isNULL() const {
- return getAbbreviationDeclarationPtr() == nullptr;
- }
+ bool isNULL() const { return getAbbreviationDeclarationPtr() == nullptr; }
/// Returns true if DIE represents a subprogram (not inlined).
bool isSubprogramDIE() const;
@@ -129,7 +127,6 @@ public:
void dump(raw_ostream &OS, unsigned indent = 0,
DIDumpOptions DumpOpts = DIDumpOptions()) const;
-
/// Convenience zero-argument overload for debugging.
LLVM_DUMP_METHOD void dump() const;
@@ -282,9 +279,9 @@ public:
iterator_range<iterator> children() const;
};
-class DWARFDie::attribute_iterator :
- public iterator_facade_base<attribute_iterator, std::forward_iterator_tag,
- const DWARFAttribute> {
+class DWARFDie::attribute_iterator
+ : public iterator_facade_base<attribute_iterator, std::forward_iterator_tag,
+ const DWARFAttribute> {
/// The DWARF DIE we are extracting attributes from.
DWARFDie Die;
/// The value vended to clients via the operator*() or operator->().
@@ -292,6 +289,9 @@ class DWARFDie::attribute_iterator :
/// The attribute index within the abbreviation declaration in Die.
uint32_t Index;
+ friend bool operator==(const attribute_iterator &LHS,
+ const attribute_iterator &RHS);
+
/// Update the attribute index and attempt to read the attribute value. If the
/// attribute is able to be read, update AttrValue and the Index member
/// variable. If the attribute value is not able to be read, an appropriate
@@ -307,12 +307,21 @@ public:
attribute_iterator &operator--();
explicit operator bool() const { return AttrValue.isValid(); }
const DWARFAttribute &operator*() const { return AttrValue; }
- bool operator==(const attribute_iterator &X) const { return Index == X.Index; }
};
+inline bool operator==(const DWARFDie::attribute_iterator &LHS,
+ const DWARFDie::attribute_iterator &RHS) {
+ return LHS.Index == RHS.Index;
+}
+
+inline bool operator!=(const DWARFDie::attribute_iterator &LHS,
+ const DWARFDie::attribute_iterator &RHS) {
+ return !(LHS == RHS);
+}
+
inline bool operator==(const DWARFDie &LHS, const DWARFDie &RHS) {
return LHS.getDebugInfoEntry() == RHS.getDebugInfoEntry() &&
- LHS.getDwarfUnit() == RHS.getDwarfUnit();
+ LHS.getDwarfUnit() == RHS.getDwarfUnit();
}
inline bool operator!=(const DWARFDie &LHS, const DWARFDie &RHS) {
@@ -335,8 +344,7 @@ class DWARFDie::iterator
public:
iterator() = default;
- explicit iterator(DWARFDie D) : Die(D) {
- }
+ explicit iterator(DWARFDie D) : Die(D) {}
iterator &operator++() {
Die = Die.getSibling();
More information about the llvm-commits
mailing list