diff options
author | Eric Christopher <echristo@gmail.com> | 2014-03-05 01:44:58 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2014-03-05 01:44:58 +0000 |
commit | 8b3fad9343111eec5931492fbd812ad578c71089 (patch) | |
tree | 554c171ce6a84febb59911c79bbb47ec13449d3c /lib | |
parent | 33a9132fd45f30a1ff5b68018f8509dcc1d0e29e (diff) | |
download | llvm-8b3fad9343111eec5931492fbd812ad578c71089.tar.gz llvm-8b3fad9343111eec5931492fbd812ad578c71089.tar.bz2 llvm-8b3fad9343111eec5931492fbd812ad578c71089.tar.xz |
Use a bool for whether or not an abbreviation has children rather than
using a full uint16_t with the flag value... which happens to be
0 or 1. Update the class for bool values and rename functions slightly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202921 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DIE.cpp | 8 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DIE.h | 20 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 5 |
3 files changed, 17 insertions, 16 deletions
diff --git a/lib/CodeGen/AsmPrinter/DIE.cpp b/lib/CodeGen/AsmPrinter/DIE.cpp index c989ce75ab..e8be7ad626 100644 --- a/lib/CodeGen/AsmPrinter/DIE.cpp +++ b/lib/CodeGen/AsmPrinter/DIE.cpp @@ -49,7 +49,7 @@ void DIEAbbrevData::Profile(FoldingSetNodeID &ID) const { /// void DIEAbbrev::Profile(FoldingSetNodeID &ID) const { ID.AddInteger(unsigned(Tag)); - ID.AddInteger(ChildrenFlag); + ID.AddInteger(unsigned(Children)); // For each attribute description. for (unsigned i = 0, N = Data.size(); i < N; ++i) @@ -63,7 +63,7 @@ void DIEAbbrev::Emit(AsmPrinter *AP) const { AP->EmitULEB128(Tag, dwarf::TagString(Tag)); // Emit whether it has children DIEs. - AP->EmitULEB128(ChildrenFlag, dwarf::ChildrenString(ChildrenFlag)); + AP->EmitULEB128((unsigned)Children, dwarf::ChildrenString(Children)); // For each attribute description. for (unsigned i = 0, N = Data.size(); i < N; ++i) { @@ -90,7 +90,7 @@ void DIEAbbrev::print(raw_ostream &O) { << " " << dwarf::TagString(Tag) << " " - << dwarf::ChildrenString(ChildrenFlag) + << dwarf::ChildrenString(Children) << '\n'; for (unsigned i = 0, N = Data.size(); i < N; ++i) { @@ -161,7 +161,7 @@ void DIE::print(raw_ostream &O, unsigned IndentCount) const { O << Indent << dwarf::TagString(Abbrev.getTag()) << " " - << dwarf::ChildrenString(Abbrev.getChildrenFlag()) << "\n"; + << dwarf::ChildrenString(Abbrev.hasChildren()) << "\n"; } else { O << "Size: " << Size << "\n"; } diff --git a/lib/CodeGen/AsmPrinter/DIE.h b/lib/CodeGen/AsmPrinter/DIE.h index b04adf53de..c890009567 100644 --- a/lib/CodeGen/AsmPrinter/DIE.h +++ b/lib/CodeGen/AsmPrinter/DIE.h @@ -56,31 +56,33 @@ public: /// DIEAbbrev - Dwarf abbreviation, describes the organization of a debug /// information object. class DIEAbbrev : public FoldingSetNode { - /// Tag - Dwarf tag code. + /// Unique number for node. /// - dwarf::Tag Tag; + unsigned Number; - /// ChildrenFlag - Dwarf children flag. + /// Tag - Dwarf tag code. /// - uint16_t ChildrenFlag; + dwarf::Tag Tag; - /// Unique number for node. + /// Children - Whether or not this node has children. /// - unsigned Number; + // This cheats a bit in all of the uses since the values in the standard + // are 0 and 1 for no children and children respectively. + bool Children; /// Data - Raw data bytes for abbreviation. /// SmallVector<DIEAbbrevData, 12> Data; public: - DIEAbbrev(dwarf::Tag T, uint16_t C) : Tag(T), ChildrenFlag(C), Data() {} + DIEAbbrev(dwarf::Tag T, bool C) : Tag(T), Children(C), Data() {} // Accessors. dwarf::Tag getTag() const { return Tag; } unsigned getNumber() const { return Number; } - uint16_t getChildrenFlag() const { return ChildrenFlag; } + bool hasChildren() const { return Children; } const SmallVectorImpl<DIEAbbrevData> &getData() const { return Data; } - void setChildrenFlag(uint16_t CF) { ChildrenFlag = CF; } + void setChildrenFlag(bool hasChild) { Children = hasChild; } void setNumber(unsigned N) { Number = N; } /// AddAttribute - Adds another set of attribute information to the diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 91aa7639ad..df686581b2 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1892,8 +1892,7 @@ unsigned DwarfFile::computeSizeAndOffset(DIE *Die, unsigned Offset) { // Size the DIE children if any. if (!Children.empty()) { - assert(Abbrev.getChildrenFlag() == dwarf::DW_CHILDREN_yes && - "Children flag not set"); + assert(Abbrev.hasChildren() && "Children flag not set"); for (unsigned j = 0, M = Children.size(); j < M; ++j) Offset = computeSizeAndOffset(Children[j], Offset); @@ -2060,7 +2059,7 @@ void DwarfDebug::emitDIE(DIE *Die) { } // Emit the DIE children if any. - if (Abbrev.getChildrenFlag() == dwarf::DW_CHILDREN_yes) { + if (Abbrev.hasChildren()) { const std::vector<DIE *> &Children = Die->getChildren(); for (unsigned j = 0, M = Children.size(); j < M; ++j) |