convert the DIE printing stuff to use raw_ostream instead of std::ostream.

Tweak #includes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79800 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2009-08-23 01:01:17 +00:00
parent 623dd141b4
commit b01acfae5b
4 changed files with 37 additions and 54 deletions

View File

@@ -17,7 +17,7 @@
#include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCAsmInfo.h"
#include "llvm/Target/TargetData.h" #include "llvm/Target/TargetData.h"
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
#include <ostream> #include "llvm/Support/Format.h"
using namespace llvm; using namespace llvm;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@@ -76,24 +76,24 @@ void DIEAbbrev::Emit(const AsmPrinter *Asm) const {
} }
#ifndef NDEBUG #ifndef NDEBUG
void DIEAbbrev::print(std::ostream &O) { void DIEAbbrev::print(raw_ostream &O) {
O << "Abbreviation @" O << "Abbreviation @"
<< std::hex << (intptr_t)this << std::dec << format("0x%lx", (long)(intptr_t)this)
<< " " << " "
<< dwarf::TagString(Tag) << dwarf::TagString(Tag)
<< " " << " "
<< dwarf::ChildrenString(ChildrenFlag) << dwarf::ChildrenString(ChildrenFlag)
<< "\n"; << '\n';
for (unsigned i = 0, N = Data.size(); i < N; ++i) { for (unsigned i = 0, N = Data.size(); i < N; ++i) {
O << " " O << " "
<< dwarf::AttributeString(Data[i].getAttribute()) << dwarf::AttributeString(Data[i].getAttribute())
<< " " << " "
<< dwarf::FormEncodingString(Data[i].getForm()) << dwarf::FormEncodingString(Data[i].getForm())
<< "\n"; << '\n';
} }
} }
void DIEAbbrev::dump() { print(cerr); } void DIEAbbrev::dump() { print(errs()); }
#endif #endif
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@@ -126,7 +126,7 @@ void DIE::Profile(FoldingSetNodeID &ID) {
} }
#ifndef NDEBUG #ifndef NDEBUG
void DIE::print(std::ostream &O, unsigned IncIndent) { void DIE::print(raw_ostream &O, unsigned IncIndent) {
IndentCount += IncIndent; IndentCount += IncIndent;
const std::string Indent(IndentCount, ' '); const std::string Indent(IndentCount, ' ');
bool isBlock = Abbrev.getTag() == 0; bool isBlock = Abbrev.getTag() == 0;
@@ -134,7 +134,7 @@ void DIE::print(std::ostream &O, unsigned IncIndent) {
if (!isBlock) { if (!isBlock) {
O << Indent O << Indent
<< "Die: " << "Die: "
<< "0x" << std::hex << (intptr_t)this << std::dec << format("0x%lx", (long)(intptr_t)this)
<< ", Offset: " << Offset << ", Offset: " << Offset
<< ", Size: " << Size << ", Size: " << Size
<< "\n"; << "\n";
@@ -176,14 +176,14 @@ void DIE::print(std::ostream &O, unsigned IncIndent) {
} }
void DIE::dump() { void DIE::dump() {
print(cerr); print(errs());
} }
#endif #endif
#ifndef NDEBUG #ifndef NDEBUG
void DIEValue::dump() { void DIEValue::dump() {
print(cerr); print(errs());
} }
#endif #endif
@@ -242,9 +242,9 @@ void DIEInteger::Profile(FoldingSetNodeID &ID) {
} }
#ifndef NDEBUG #ifndef NDEBUG
void DIEInteger::print(std::ostream &O) { void DIEInteger::print(raw_ostream &O) {
O << "Int: " << (int64_t)Integer O << "Int: " << (int64_t)Integer
<< " 0x" << std::hex << Integer << std::dec; << format(" 0x%llx", (unsigned long long)Integer);
} }
#endif #endif
@@ -269,7 +269,7 @@ void DIEString::Profile(FoldingSetNodeID &ID) {
} }
#ifndef NDEBUG #ifndef NDEBUG
void DIEString::print(std::ostream &O) { void DIEString::print(raw_ostream &O) {
O << "Str: \"" << Str << "\""; O << "Str: \"" << Str << "\"";
} }
#endif #endif
@@ -303,7 +303,7 @@ void DIEDwarfLabel::Profile(FoldingSetNodeID &ID) {
} }
#ifndef NDEBUG #ifndef NDEBUG
void DIEDwarfLabel::print(std::ostream &O) { void DIEDwarfLabel::print(raw_ostream &O) {
O << "Lbl: "; O << "Lbl: ";
Label.print(O); Label.print(O);
} }
@@ -338,7 +338,7 @@ void DIEObjectLabel::Profile(FoldingSetNodeID &ID) {
} }
#ifndef NDEBUG #ifndef NDEBUG
void DIEObjectLabel::print(std::ostream &O) { void DIEObjectLabel::print(raw_ostream &O) {
O << "Obj: " << Label; O << "Obj: " << Label;
} }
#endif #endif
@@ -378,7 +378,7 @@ void DIESectionOffset::Profile(FoldingSetNodeID &ID) {
} }
#ifndef NDEBUG #ifndef NDEBUG
void DIESectionOffset::print(std::ostream &O) { void DIESectionOffset::print(raw_ostream &O) {
O << "Off: "; O << "Off: ";
Label.print(O); Label.print(O);
O << "-"; O << "-";
@@ -418,7 +418,7 @@ void DIEDelta::Profile(FoldingSetNodeID &ID) {
} }
#ifndef NDEBUG #ifndef NDEBUG
void DIEDelta::print(std::ostream &O) { void DIEDelta::print(raw_ostream &O) {
O << "Del: "; O << "Del: ";
LabelHi.print(O); LabelHi.print(O);
O << "-"; O << "-";
@@ -452,8 +452,8 @@ void DIEEntry::Profile(FoldingSetNodeID &ID) {
} }
#ifndef NDEBUG #ifndef NDEBUG
void DIEEntry::print(std::ostream &O) { void DIEEntry::print(raw_ostream &O) {
O << "Die: 0x" << std::hex << (intptr_t)Entry << std::dec; O << format("Die: 0x%lx", (long)(intptr_t)Entry);
} }
#endif #endif
@@ -511,7 +511,7 @@ void DIEBlock::Profile(FoldingSetNodeID &ID) {
} }
#ifndef NDEBUG #ifndef NDEBUG
void DIEBlock::print(std::ostream &O) { void DIEBlock::print(raw_ostream &O) {
O << "Blk: "; O << "Blk: ";
DIE::print(O, 5); DIE::print(O, 5);
} }

View File

@@ -19,8 +19,7 @@
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Compiler.h" #include "llvm/Support/Compiler.h"
#include "llvm/Support/Dwarf.h" #include "llvm/Support/Dwarf.h"
#include "llvm/Support/raw_ostream.h" #include <vector>
#include <iosfwd>
namespace llvm { namespace llvm {
class AsmPrinter; class AsmPrinter;
@@ -103,10 +102,7 @@ namespace llvm {
void Emit(const AsmPrinter *Asm) const; void Emit(const AsmPrinter *Asm) const;
#ifndef NDEBUG #ifndef NDEBUG
void print(std::ostream *O) { void print(raw_ostream &O);
if (O) print(*O);
}
void print(std::ostream &O);
void dump(); void dump();
#endif #endif
}; };
@@ -198,10 +194,7 @@ namespace llvm {
void Profile(FoldingSetNodeID &ID) ; void Profile(FoldingSetNodeID &ID) ;
#ifndef NDEBUG #ifndef NDEBUG
void print(std::ostream *O, unsigned IncIndent = 0) { void print(raw_ostream &O, unsigned IncIndent = 0);
if (O) print(*O, IncIndent);
}
void print(std::ostream &O, unsigned IncIndent = 0);
void dump(); void dump();
#endif #endif
}; };
@@ -248,10 +241,7 @@ namespace llvm {
static bool classof(const DIEValue *) { return true; } static bool classof(const DIEValue *) { return true; }
#ifndef NDEBUG #ifndef NDEBUG
void print(std::ostream *O) { virtual void print(raw_ostream &O) = 0;
if (O) print(*O);
}
virtual void print(std::ostream &O) = 0;
void dump(); void dump();
#endif #endif
}; };
@@ -297,7 +287,7 @@ namespace llvm {
static bool classof(const DIEValue *I) { return I->getType() == isInteger; } static bool classof(const DIEValue *I) { return I->getType() == isInteger; }
#ifndef NDEBUG #ifndef NDEBUG
virtual void print(std::ostream &O); virtual void print(raw_ostream &O);
#endif #endif
}; };
@@ -329,7 +319,7 @@ namespace llvm {
static bool classof(const DIEValue *S) { return S->getType() == isString; } static bool classof(const DIEValue *S) { return S->getType() == isString; }
#ifndef NDEBUG #ifndef NDEBUG
virtual void print(std::ostream &O); virtual void print(raw_ostream &O);
#endif #endif
}; };
@@ -359,7 +349,7 @@ namespace llvm {
static bool classof(const DIEValue *L) { return L->getType() == isLabel; } static bool classof(const DIEValue *L) { return L->getType() == isLabel; }
#ifndef NDEBUG #ifndef NDEBUG
virtual void print(std::ostream &O); virtual void print(raw_ostream &O);
#endif #endif
}; };
@@ -392,7 +382,7 @@ namespace llvm {
} }
#ifndef NDEBUG #ifndef NDEBUG
virtual void print(std::ostream &O); virtual void print(raw_ostream &O);
#endif #endif
}; };
@@ -431,7 +421,7 @@ namespace llvm {
} }
#ifndef NDEBUG #ifndef NDEBUG
virtual void print(std::ostream &O); virtual void print(raw_ostream &O);
#endif #endif
}; };
@@ -464,7 +454,7 @@ namespace llvm {
static bool classof(const DIEValue *D) { return D->getType() == isDelta; } static bool classof(const DIEValue *D) { return D->getType() == isDelta; }
#ifndef NDEBUG #ifndef NDEBUG
virtual void print(std::ostream &O); virtual void print(raw_ostream &O);
#endif #endif
}; };
@@ -500,7 +490,7 @@ namespace llvm {
static bool classof(const DIEValue *E) { return E->getType() == isEntry; } static bool classof(const DIEValue *E) { return E->getType() == isEntry; }
#ifndef NDEBUG #ifndef NDEBUG
virtual void print(std::ostream &O); virtual void print(raw_ostream &O);
#endif #endif
}; };
@@ -544,7 +534,7 @@ namespace llvm {
static bool classof(const DIEValue *E) { return E->getType() == isBlock; } static bool classof(const DIEValue *E) { return E->getType() == isBlock; }
#ifndef NDEBUG #ifndef NDEBUG
virtual void print(std::ostream &O); virtual void print(raw_ostream &O);
#endif #endif
}; };

View File

@@ -13,7 +13,7 @@
#include "DwarfLabel.h" #include "DwarfLabel.h"
#include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/FoldingSet.h"
#include <ostream> #include "llvm/Support/raw_ostream.h"
using namespace llvm; using namespace llvm;
@@ -25,10 +25,7 @@ void DWLabel::Profile(FoldingSetNodeID &ID) const {
} }
#ifndef NDEBUG #ifndef NDEBUG
void DWLabel::print(std::ostream *O) const { void DWLabel::print(raw_ostream &O) const {
if (O) print(*O);
}
void DWLabel::print(std::ostream &O) const {
O << "." << Tag; O << "." << Tag;
if (Number) O << Number; if (Number) O << Number;
} }

View File

@@ -14,19 +14,16 @@
#ifndef CODEGEN_ASMPRINTER_DWARFLABEL_H__ #ifndef CODEGEN_ASMPRINTER_DWARFLABEL_H__
#define CODEGEN_ASMPRINTER_DWARFLABEL_H__ #define CODEGEN_ASMPRINTER_DWARFLABEL_H__
#include "llvm/Support/Compiler.h"
#include <iosfwd>
#include <vector>
namespace llvm { namespace llvm {
class FoldingSetNodeID; class FoldingSetNodeID;
class raw_ostream;
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
/// DWLabel - Labels are used to track locations in the assembler file. /// DWLabel - Labels are used to track locations in the assembler file.
/// Labels appear in the form @verbatim <prefix><Tag><Number> @endverbatim, /// Labels appear in the form @verbatim <prefix><Tag><Number> @endverbatim,
/// where the tag is a category of label (Ex. location) and number is a value /// where the tag is a category of label (Ex. location) and number is a value
/// unique in that category. /// unique in that category.
class VISIBILITY_HIDDEN DWLabel { class DWLabel {
/// Tag - Label category tag. Should always be a statically declared C /// Tag - Label category tag. Should always be a statically declared C
/// string. /// string.
/// ///
@@ -47,8 +44,7 @@ namespace llvm {
void Profile(FoldingSetNodeID &ID) const; void Profile(FoldingSetNodeID &ID) const;
#ifndef NDEBUG #ifndef NDEBUG
void print(std::ostream *O) const; void print(raw_ostream &O) const;
void print(std::ostream &O) const;
#endif #endif
}; };
} // end llvm namespace } // end llvm namespace