diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-01-30 13:36:30 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-01-30 13:36:30 +0000 |
commit | 1ce64dcc64601acc219492885254aae5bf888e24 (patch) | |
tree | fa9adf69ff7dd3bf311dfb39f88444cbc27473d0 | |
parent | 1e0d3b43eafd48df426f1d9f30382124946ab0fb (diff) | |
download | bcm5719-llvm-1ce64dcc64601acc219492885254aae5bf888e24.tar.gz bcm5719-llvm-1ce64dcc64601acc219492885254aae5bf888e24.zip |
[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
-rw-r--r-- | llvm/include/llvm/CodeGen/AccelTable.h | 88 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp | 83 |
2 files changed, 93 insertions, 78 deletions
diff --git a/llvm/include/llvm/CodeGen/AccelTable.h b/llvm/include/llvm/CodeGen/AccelTable.h index f90c4a077cb..62ec29836db 100644 --- a/llvm/include/llvm/CodeGen/AccelTable.h +++ b/llvm/include/llvm/CodeGen/AccelTable.h @@ -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; } diff --git a/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp b/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp index abbb1b512a3..0320b540866 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp @@ -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 |