[llvm] r323757 - [AccelTable] Move print methods to implementation. NFC
Jonas Devlieghere via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 30 05:36:30 PST 2018
Author: jdevlieghere
Date: Tue Jan 30 05:36:30 2018
New Revision: 323757
URL: http://llvm.org/viewvc/llvm-project?rev=323757&view=rev
Log:
[AccelTable] Move print methods to implementation. NFC
This patch moves the implementation of the print methods from the header
to the cpp file.
Modified:
llvm/trunk/include/llvm/CodeGen/AccelTable.h
llvm/trunk/lib/CodeGen/AsmPrinter/AccelTable.cpp
Modified: llvm/trunk/include/llvm/CodeGen/AccelTable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AccelTable.h?rev=323757&r1=323756&r2=323757&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AccelTable.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AccelTable.h Tue Jan 30 05:36:30 2018
@@ -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; }
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AccelTable.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AccelTable.cpp?rev=323757&r1=323756&r2=323757&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AccelTable.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AccelTable.cpp Tue Jan 30 05:36:30 2018
@@ -260,3 +260,86 @@ const SmallVector<AppleAccelTableHeader:
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
More information about the llvm-commits
mailing list