1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

[AccelTable] Move print methods to implementation. NFC

This patch moves the implementation of the print methods from the header
to the cpp file.

llvm-svn: 323757
This commit is contained in:
Jonas Devlieghere 2018-01-30 13:36:30 +00:00
parent ca7a5040d1
commit 57885bf890
2 changed files with 93 additions and 78 deletions

View File

@ -111,14 +111,7 @@ class AppleAccelTableHeader {
Header(uint32_t DataLength) : HeaderDataLength(DataLength) {}
#ifndef NDEBUG
void print(raw_ostream &OS) const {
OS << "Magic: " << format("0x%x", Magic) << "\n"
<< "Version: " << Version << "\n"
<< "Hash Function: " << HashFunction << "\n"
<< "Bucket Count: " << BucketCount << "\n"
<< "Header Data Length: " << HeaderDataLength << "\n";
}
void print(raw_ostream &OS) const;
void dump() const { print(dbgs()); }
#endif
};
@ -136,11 +129,7 @@ public:
constexpr Atom(uint16_t Type, uint16_t Form) : Type(Type), Form(Form) {}
#ifndef NDEBUG
void print(raw_ostream &OS) const {
OS << "Type: " << dwarf::AtomTypeString(Type) << "\n"
<< "Form: " << dwarf::FormEncodingString(Form) << "\n";
}
void print(raw_ostream &OS) const;
void dump() const { print(dbgs()); }
#endif
};
@ -167,12 +156,7 @@ private:
#endif
#ifndef NDEBUG
void print(raw_ostream &OS) const {
OS << "DIE Offset Base: " << DieOffsetBase << "\n";
for (auto Atom : Atoms)
Atom.print(OS);
}
void print(raw_ostream &OS) const;
void dump() const { print(dbgs()); }
#endif
};
@ -203,11 +187,7 @@ public:
void emit(AsmPrinter *);
#ifndef NDEBUG
void print(raw_ostream &OS) const {
Header.print(OS);
HeaderData.print(OS);
}
void print(raw_ostream &OS) const;
void dump() const { print(dbgs()); }
#endif
};
@ -252,19 +232,7 @@ protected:
}
#ifndef NDEBUG
void print(raw_ostream &OS) {
OS << "Name: " << Str << "\n";
OS << " Hash Value: " << format("0x%x", HashValue) << "\n";
OS << " Symbol: ";
if (Sym)
OS << *Sym;
else
OS << "<none>";
OS << "\n";
for (auto *Value : Data.Values)
Value->print(OS);
}
void print(raw_ostream &OS);
void dump() { print(dbgs()); }
#endif
};
@ -335,27 +303,7 @@ public:
}
#ifndef NDEBUG
void print(raw_ostream &OS) const {
// Print Header.
Header.print(OS);
// Print Content.
OS << "Entries: \n";
for (const auto &Entry : Entries) {
OS << "Name: " << Entry.first() << "\n";
for (auto *V : Entry.second.Values)
V->print(OS);
}
OS << "Buckets and Hashes: \n";
for (auto &Bucket : Buckets)
for (auto &Hash : Bucket)
Hash->print(OS);
OS << "Data: \n";
for (auto &D : Data)
D->print(OS);
}
void print(raw_ostream &OS) const;
void dump() const { print(dbgs()); }
#endif
};
@ -403,10 +351,7 @@ public:
#endif
#ifndef NDEBUG
void print(raw_ostream &OS) const override {
OS << " Offset: " << Die->getOffset() << "\n";
}
void print(raw_ostream &OS) const override;
#endif
protected:
uint64_t order() const override { return Die->getOffset(); }
@ -435,10 +380,7 @@ public:
#endif
#ifndef NDEBUG
void print(raw_ostream &OS) const override {
OS << " Offset: " << Die->getOffset() << "\n";
OS << " Tag: " << dwarf::TagString(Die->getTag()) << "\n";
}
void print(raw_ostream &OS) const override;
#endif
};
@ -461,10 +403,7 @@ public:
#endif
#ifndef NDEBUG
void print(raw_ostream &OS) const override {
OS << " Static Offset: " << Offset << "\n";
}
void print(raw_ostream &OS) const override;
#endif
protected:
uint64_t order() const override { return Offset; }
@ -499,14 +438,7 @@ public:
#endif
#ifndef NDEBUG
void print(raw_ostream &OS) const override {
OS << " Static Offset: " << Offset << "\n";
OS << " QualifiedNameHash: " << format("%x\n", QualifiedNameHash) << "\n";
OS << " Tag: " << dwarf::TagString(Tag) << "\n";
OS << " ObjCClassIsImplementation: "
<< (ObjCClassIsImplementation ? "true" : "false");
OS << "\n";
}
void print(raw_ostream &OS) const override;
#endif
protected:
uint64_t order() const override { return Offset; }

View File

@ -260,3 +260,86 @@ const SmallVector<AppleAccelTableHeader::Atom, 4>
AppleAccelTableHeader::Atom(5, dwarf::DW_FORM_data1),
AppleAccelTableHeader::Atom(6, dwarf::DW_FORM_data4)};
#endif
#ifndef NDEBUG
void AppleAccelTableHeader::Header::print(raw_ostream &OS) const {
OS << "Magic: " << format("0x%x", Magic) << "\n"
<< "Version: " << Version << "\n"
<< "Hash Function: " << HashFunction << "\n"
<< "Bucket Count: " << BucketCount << "\n"
<< "Header Data Length: " << HeaderDataLength << "\n";
}
void AppleAccelTableHeader::Atom::print(raw_ostream &OS) const {
OS << "Type: " << dwarf::AtomTypeString(Type) << "\n"
<< "Form: " << dwarf::FormEncodingString(Form) << "\n";
}
void AppleAccelTableHeader::HeaderData::print(raw_ostream &OS) const {
OS << "DIE Offset Base: " << DieOffsetBase << "\n";
for (auto Atom : Atoms)
Atom.print(OS);
}
void AppleAccelTableHeader::print(raw_ostream &OS) const {
Header.print(OS);
HeaderData.print(OS);
}
void AppleAccelTableBase::HashData::print(raw_ostream &OS) {
OS << "Name: " << Str << "\n";
OS << " Hash Value: " << format("0x%x", HashValue) << "\n";
OS << " Symbol: ";
if (Sym)
OS << *Sym;
else
OS << "<none>";
OS << "\n";
for (auto *Value : Data.Values)
Value->print(OS);
}
void AppleAccelTableBase::print(raw_ostream &OS) const {
// Print Header.
Header.print(OS);
// Print Content.
OS << "Entries: \n";
for (const auto &Entry : Entries) {
OS << "Name: " << Entry.first() << "\n";
for (auto *V : Entry.second.Values)
V->print(OS);
}
OS << "Buckets and Hashes: \n";
for (auto &Bucket : Buckets)
for (auto &Hash : Bucket)
Hash->print(OS);
OS << "Data: \n";
for (auto &D : Data)
D->print(OS);
}
void AppleAccelTableOffsetData::print(raw_ostream &OS) const {
OS << " Offset: " << Die->getOffset() << "\n";
}
void AppleAccelTableTypeData::print(raw_ostream &OS) const {
OS << " Offset: " << Die->getOffset() << "\n";
OS << " Tag: " << dwarf::TagString(Die->getTag()) << "\n";
}
void AppleAccelTableStaticOffsetData::print(raw_ostream &OS) const {
OS << " Static Offset: " << Offset << "\n";
}
void AppleAccelTableStaticTypeData::print(raw_ostream &OS) const {
OS << " Static Offset: " << Offset << "\n";
OS << " QualifiedNameHash: " << format("%x\n", QualifiedNameHash) << "\n";
OS << " Tag: " << dwarf::TagString(Tag) << "\n";
OS << " ObjCClassIsImplementation: "
<< (ObjCClassIsImplementation ? "true" : "false");
OS << "\n";
}
#endif