diff options
author | Dan Gohman <gohman@apple.com> | 2010-05-07 15:30:29 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-05-07 15:30:29 +0000 |
commit | 504043662ced71235b7c7d4ae3ce3cee898cb391 (patch) | |
tree | d4d85b20a38ca45a7cad8934764d9138cd79be95 /lib/Analysis/DebugInfo.cpp | |
parent | 733783b27c9f07d090747213e2a2db646eaeb18a (diff) |
Convert the DebugInfo classes dump() methods into print(raw_ostream &)
methods, and add dump functions implemented in terms of the print.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103254 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DebugInfo.cpp')
-rw-r--r-- | lib/Analysis/DebugInfo.cpp | 154 |
1 files changed, 102 insertions, 52 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 141b181ab7..e4233540a5 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -475,34 +475,34 @@ StringRef DIScope::getDirectory() const { //===----------------------------------------------------------------------===// -/// dump - Print descriptor. -void DIDescriptor::dump() const { - dbgs() << "[" << dwarf::TagString(getTag()) << "] "; - dbgs().write_hex((intptr_t) &*DbgNode) << ']'; +/// print - Print descriptor. +void DIDescriptor::print(raw_ostream &OS) const { + OS << "[" << dwarf::TagString(getTag()) << "] "; + OS.write_hex((intptr_t) &*DbgNode) << ']'; } -/// dump - Print compile unit. -void DICompileUnit::dump() const { +/// print - Print compile unit. +void DICompileUnit::print(raw_ostream &OS) const { if (getLanguage()) - dbgs() << " [" << dwarf::LanguageString(getLanguage()) << "] "; + OS << " [" << dwarf::LanguageString(getLanguage()) << "] "; - dbgs() << " [" << getDirectory() << "/" << getFilename() << " ]"; + OS << " [" << getDirectory() << "/" << getFilename() << " ]"; } -/// dump - Print type. -void DIType::dump() const { +/// print - Print type. +void DIType::print(raw_ostream &OS) const { if (!DbgNode) return; StringRef Res = getName(); if (!Res.empty()) - dbgs() << " [" << Res << "] "; + OS << " [" << Res << "] "; unsigned Tag = getTag(); - dbgs() << " [" << dwarf::TagString(Tag) << "] "; + OS << " [" << dwarf::TagString(Tag) << "] "; // TODO : Print context getCompileUnit().dump(); - dbgs() << " [" + OS << " [" << getLineNumber() << ", " << getSizeInBits() << ", " << getAlignInBits() << ", " @@ -510,12 +510,12 @@ void DIType::dump() const { << "] "; if (isPrivate()) - dbgs() << " [private] "; + OS << " [private] "; else if (isProtected()) - dbgs() << " [protected] "; + OS << " [protected] "; if (isForwardDecl()) - dbgs() << " [fwd] "; + OS << " [fwd] "; if (isBasicType()) DIBasicType(DbgNode).dump(); @@ -524,97 +524,147 @@ void DIType::dump() const { else if (isCompositeType()) DICompositeType(DbgNode).dump(); else { - dbgs() << "Invalid DIType\n"; + OS << "Invalid DIType\n"; return; } - dbgs() << "\n"; + OS << "\n"; } -/// dump - Print basic type. -void DIBasicType::dump() const { - dbgs() << " [" << dwarf::AttributeEncodingString(getEncoding()) << "] "; +/// print - Print basic type. +void DIBasicType::print(raw_ostream &OS) const { + OS << " [" << dwarf::AttributeEncodingString(getEncoding()) << "] "; } -/// dump - Print derived type. -void DIDerivedType::dump() const { - dbgs() << "\n\t Derived From: "; getTypeDerivedFrom().dump(); +/// print - Print derived type. +void DIDerivedType::print(raw_ostream &OS) const { + OS << "\n\t Derived From: "; getTypeDerivedFrom().dump(); } -/// dump - Print composite type. -void DICompositeType::dump() const { +/// print - Print composite type. +void DICompositeType::print(raw_ostream &OS) const { DIArray A = getTypeArray(); - dbgs() << " [" << A.getNumElements() << " elements]"; + OS << " [" << A.getNumElements() << " elements]"; } -/// dump - Print global. -void DIGlobal::dump() const { +/// print - Print global. +void DIGlobal::print(raw_ostream &OS) const { StringRef Res = getName(); if (!Res.empty()) - dbgs() << " [" << Res << "] "; + OS << " [" << Res << "] "; unsigned Tag = getTag(); - dbgs() << " [" << dwarf::TagString(Tag) << "] "; + OS << " [" << dwarf::TagString(Tag) << "] "; // TODO : Print context getCompileUnit().dump(); - dbgs() << " [" << getLineNumber() << "] "; + OS << " [" << getLineNumber() << "] "; if (isLocalToUnit()) - dbgs() << " [local] "; + OS << " [local] "; if (isDefinition()) - dbgs() << " [def] "; + OS << " [def] "; if (isGlobalVariable()) DIGlobalVariable(DbgNode).dump(); - dbgs() << "\n"; + OS << "\n"; } -/// dump - Print subprogram. -void DISubprogram::dump() const { +/// print - Print subprogram. +void DISubprogram::print(raw_ostream &OS) const { StringRef Res = getName(); if (!Res.empty()) - dbgs() << " [" << Res << "] "; + OS << " [" << Res << "] "; unsigned Tag = getTag(); - dbgs() << " [" << dwarf::TagString(Tag) << "] "; + OS << " [" << dwarf::TagString(Tag) << "] "; // TODO : Print context getCompileUnit().dump(); - dbgs() << " [" << getLineNumber() << "] "; + OS << " [" << getLineNumber() << "] "; if (isLocalToUnit()) - dbgs() << " [local] "; + OS << " [local] "; if (isDefinition()) - dbgs() << " [def] "; + OS << " [def] "; - dbgs() << "\n"; + OS << "\n"; } -/// dump - Print global variable. -void DIGlobalVariable::dump() const { - dbgs() << " ["; +/// print - Print global variable. +void DIGlobalVariable::print(raw_ostream &OS) const { + OS << " ["; getGlobal()->dump(); - dbgs() << "] "; + OS << "] "; } -/// dump - Print variable. -void DIVariable::dump() const { +/// print - Print variable. +void DIVariable::print(raw_ostream &OS) const { StringRef Res = getName(); if (!Res.empty()) - dbgs() << " [" << Res << "] "; + OS << " [" << Res << "] "; getCompileUnit().dump(); - dbgs() << " [" << getLineNumber() << "] "; + OS << " [" << getLineNumber() << "] "; getType().dump(); - dbgs() << "\n"; + OS << "\n"; // FIXME: Dump complex addresses } +/// dump - Print descriptor to dbgs() with a newline. +void DIDescriptor::dump() const { + print(dbgs()); dbgs() << '\n'; +} + +/// dump - Print compile unit to dbgs() with a newline. +void DICompileUnit::dump() const { + print(dbgs()); dbgs() << '\n'; +} + +/// dump - Print type to dbgs() with a newline. +void DIType::dump() const { + print(dbgs()); dbgs() << '\n'; +} + +/// dump - Print basic type to dbgs() with a newline. +void DIBasicType::dump() const { + print(dbgs()); dbgs() << '\n'; +} + +/// dump - Print derived type to dbgs() with a newline. +void DIDerivedType::dump() const { + print(dbgs()); dbgs() << '\n'; +} + +/// dump - Print composite type to dbgs() with a newline. +void DICompositeType::dump() const { + print(dbgs()); dbgs() << '\n'; +} + +/// dump - Print global to dbgs() with a newline. +void DIGlobal::dump() const { + print(dbgs()); dbgs() << '\n'; +} + +/// dump - Print subprogram to dbgs() with a newline. +void DISubprogram::dump() const { + print(dbgs()); dbgs() << '\n'; +} + +/// dump - Print global variable. +void DIGlobalVariable::dump() const { + print(dbgs()); dbgs() << '\n'; +} + +/// dump - Print variable. +void DIVariable::dump() const { + print(dbgs()); dbgs() << '\n'; +} + //===----------------------------------------------------------------------===// // DIFactory: Basic Helpers //===----------------------------------------------------------------------===// |