From: Davide Italiano Date: Tue, 24 Nov 2015 02:21:43 +0000 (+0000) Subject: [DIE] Make DIE.h NDEBUG conditional-free. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=505dc6c8637d700985ec928edd8cb70b58f3fd38;hp=b856f91ff457d0abf7ae9500fe08b7d9468e0c09 [DIE] Make DIE.h NDEBUG conditional-free. Switch dump()/print() method definitions to LLVM_DUMP_METHOD instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253945 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/DIE.h b/include/llvm/CodeGen/DIE.h index 2e6d4aa6d19..fa612d981de 100644 --- a/include/llvm/CodeGen/DIE.h +++ b/include/llvm/CodeGen/DIE.h @@ -100,10 +100,8 @@ public: /// void Emit(const AsmPrinter *AP) const; -#ifndef NDEBUG void print(raw_ostream &O); void dump(); -#endif }; //===--------------------------------------------------------------------===// @@ -143,9 +141,7 @@ public: void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const; unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const; -#ifndef NDEBUG void print(raw_ostream &O) const; -#endif }; //===--------------------------------------------------------------------===// @@ -164,9 +160,7 @@ public: void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const; unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const; -#ifndef NDEBUG void print(raw_ostream &O) const; -#endif }; //===--------------------------------------------------------------------===// @@ -185,9 +179,7 @@ public: void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const; unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const; -#ifndef NDEBUG void print(raw_ostream &O) const; -#endif }; //===--------------------------------------------------------------------===// @@ -203,9 +195,7 @@ public: void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const; unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const; -#ifndef NDEBUG void print(raw_ostream &O) const; -#endif }; //===--------------------------------------------------------------------===// @@ -223,9 +213,7 @@ public: void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const; unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const; -#ifndef NDEBUG void print(raw_ostream &O) const; -#endif }; //===--------------------------------------------------------------------===// @@ -252,9 +240,7 @@ public: : sizeof(int32_t); } -#ifndef NDEBUG void print(raw_ostream &O) const; -#endif }; //===--------------------------------------------------------------------===// @@ -273,9 +259,7 @@ public: return 8; } -#ifndef NDEBUG void print(raw_ostream &O) const; -#endif }; //===--------------------------------------------------------------------===// @@ -295,9 +279,7 @@ public: void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const; unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const; -#ifndef NDEBUG void print(raw_ostream &O) const; -#endif }; //===--------------------------------------------------------------------===// @@ -444,10 +426,8 @@ public: /// unsigned SizeOf(const AsmPrinter *AP) const; -#ifndef NDEBUG void print(raw_ostream &O) const; void dump() const; -#endif }; struct IntrusiveBackListNode { @@ -710,10 +690,8 @@ public: /// gives \a DIEValue::isNone) if no such attribute exists. DIEValue findAttribute(dwarf::Attribute Attribute) const; -#ifndef NDEBUG void print(raw_ostream &O, unsigned IndentCount = 0) const; void dump(); -#endif }; //===--------------------------------------------------------------------===// @@ -747,9 +725,7 @@ public: void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const; unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const; -#ifndef NDEBUG void print(raw_ostream &O) const; -#endif }; //===--------------------------------------------------------------------===// @@ -780,9 +756,7 @@ public: void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const; unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const; -#ifndef NDEBUG void print(raw_ostream &O) const; -#endif }; } // end llvm namespace diff --git a/lib/CodeGen/AsmPrinter/DIE.cpp b/lib/CodeGen/AsmPrinter/DIE.cpp index 41790bd58bc..bf794f7f70f 100644 --- a/lib/CodeGen/AsmPrinter/DIE.cpp +++ b/lib/CodeGen/AsmPrinter/DIE.cpp @@ -86,7 +86,7 @@ void DIEAbbrev::Emit(const AsmPrinter *AP) const { AP->EmitULEB128(0, "EOM(2)"); } -#ifndef NDEBUG +LLVM_DUMP_METHOD void DIEAbbrev::print(raw_ostream &O) { O << "Abbreviation @" << format("0x%lx", (long)(intptr_t)this) @@ -104,8 +104,9 @@ void DIEAbbrev::print(raw_ostream &O) { << '\n'; } } + +LLVM_DUMP_METHOD void DIEAbbrev::dump() { print(dbgs()); } -#endif DIEAbbrev DIE::generateAbbrev() const { DIEAbbrev Abbrev(Tag, hasChildren()); @@ -144,7 +145,7 @@ DIEValue DIE::findAttribute(dwarf::Attribute Attribute) const { return DIEValue(); } -#ifndef NDEBUG +LLVM_DUMP_METHOD static void printValues(raw_ostream &O, const DIEValueList &Values, StringRef Type, unsigned Size, unsigned IndentCount) { O << Type << ": Size: " << Size << "\n"; @@ -160,6 +161,7 @@ static void printValues(raw_ostream &O, const DIEValueList &Values, } } +LLVM_DUMP_METHOD void DIE::print(raw_ostream &O, unsigned IndentCount) const { const std::string Indent(IndentCount, ' '); O << Indent << "Die: " << format("0x%lx", (long)(intptr_t) this) @@ -184,10 +186,10 @@ void DIE::print(raw_ostream &O, unsigned IndentCount) const { O << "\n"; } +LLVM_DUMP_METHOD void DIE::dump() { print(dbgs()); } -#endif void DIEValue::EmitValue(const AsmPrinter *AP) const { switch (Ty) { @@ -213,7 +215,7 @@ unsigned DIEValue::SizeOf(const AsmPrinter *AP) const { llvm_unreachable("Unknown DIE kind"); } -#ifndef NDEBUG +LLVM_DUMP_METHOD void DIEValue::print(raw_ostream &O) const { switch (Ty) { case isNone: @@ -226,10 +228,10 @@ void DIEValue::print(raw_ostream &O) const { } } +LLVM_DUMP_METHOD void DIEValue::dump() const { print(dbgs()); } -#endif //===----------------------------------------------------------------------===// // DIEInteger Implementation @@ -303,12 +305,11 @@ unsigned DIEInteger::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const { } } -#ifndef NDEBUG +LLVM_DUMP_METHOD void DIEInteger::print(raw_ostream &O) const { O << "Int: " << (int64_t)Integer << " 0x"; O.write_hex(Integer); } -#endif //===----------------------------------------------------------------------===// // DIEExpr Implementation @@ -329,9 +330,8 @@ unsigned DIEExpr::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const { return AP->getPointerSize(); } -#ifndef NDEBUG +LLVM_DUMP_METHOD void DIEExpr::print(raw_ostream &O) const { O << "Expr: " << *Expr; } -#endif //===----------------------------------------------------------------------===// // DIELabel Implementation @@ -355,9 +355,8 @@ unsigned DIELabel::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const { return AP->getPointerSize(); } -#ifndef NDEBUG +LLVM_DUMP_METHOD void DIELabel::print(raw_ostream &O) const { O << "Lbl: " << Label->getName(); } -#endif //===----------------------------------------------------------------------===// // DIEDelta Implementation @@ -378,11 +377,10 @@ unsigned DIEDelta::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const { return AP->getPointerSize(); } -#ifndef NDEBUG +LLVM_DUMP_METHOD void DIEDelta::print(raw_ostream &O) const { O << "Del: " << LabelHi->getName() << "-" << LabelLo->getName(); } -#endif //===----------------------------------------------------------------------===// // DIEString Implementation @@ -431,11 +429,10 @@ unsigned DIEString::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const { return DIEInteger(S.getOffset()).SizeOf(AP, Form); } -#ifndef NDEBUG +LLVM_DUMP_METHOD void DIEString::print(raw_ostream &O) const { O << "String: " << S.getString(); } -#endif //===----------------------------------------------------------------------===// // DIEEntry Implementation @@ -476,11 +473,10 @@ unsigned DIEEntry::getRefAddrSize(const AsmPrinter *AP) { return sizeof(int32_t); } -#ifndef NDEBUG +LLVM_DUMP_METHOD void DIEEntry::print(raw_ostream &O) const { O << format("Die: 0x%lx", (long)(intptr_t)&Entry); } -#endif //===----------------------------------------------------------------------===// // DIETypeSignature Implementation @@ -491,11 +487,10 @@ void DIETypeSignature::EmitValue(const AsmPrinter *Asm, Asm->OutStreamer->EmitIntValue(Unit->getTypeSignature(), 8); } -#ifndef NDEBUG +LLVM_DUMP_METHOD void DIETypeSignature::print(raw_ostream &O) const { O << format("Type Unit: 0x%lx", Unit->getTypeSignature()); } -#endif //===----------------------------------------------------------------------===// // DIELoc Implementation @@ -543,11 +538,10 @@ unsigned DIELoc::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const { } } -#ifndef NDEBUG +LLVM_DUMP_METHOD void DIELoc::print(raw_ostream &O) const { printValues(O, *this, "ExprLoc", Size, 5); } -#endif //===----------------------------------------------------------------------===// // DIEBlock Implementation @@ -591,11 +585,10 @@ unsigned DIEBlock::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const { } } -#ifndef NDEBUG +LLVM_DUMP_METHOD void DIEBlock::print(raw_ostream &O) const { printValues(O, *this, "Blk", Size, 5); } -#endif //===----------------------------------------------------------------------===// // DIELocList Implementation @@ -617,6 +610,5 @@ void DIELocList::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const { AP->emitDwarfSymbolReference(Label, /*ForceOffset*/ DD->useSplitDwarf()); } -#ifndef NDEBUG +LLVM_DUMP_METHOD void DIELocList::print(raw_ostream &O) const { O << "LocList: " << Index; } -#endif