mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-07 01:38:26 +00:00
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
This commit is contained in:
parent
33a9132fd4
commit
8b3fad9343
@ -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";
|
||||
}
|
||||
|
@ -56,31 +56,33 @@ public:
|
||||
/// DIEAbbrev - Dwarf abbreviation, describes the organization of a debug
|
||||
/// information object.
|
||||
class DIEAbbrev : public FoldingSetNode {
|
||||
/// Unique number for node.
|
||||
///
|
||||
unsigned Number;
|
||||
|
||||
/// Tag - Dwarf tag code.
|
||||
///
|
||||
dwarf::Tag Tag;
|
||||
|
||||
/// ChildrenFlag - Dwarf children flag.
|
||||
/// Children - Whether or not this node has children.
|
||||
///
|
||||
uint16_t ChildrenFlag;
|
||||
|
||||
/// Unique number for node.
|
||||
///
|
||||
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
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user