diff options
author | Devang Patel <dpatel@apple.com> | 2009-07-01 22:10:23 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-07-01 22:10:23 +0000 |
commit | 7136a6540cce99a9498ffaf4ebab26e7f6ae5b50 (patch) | |
tree | 522c2fe2d2a89df9ab82ae3ad5a8bf9bd19ae602 /lib/Analysis/DebugInfo.cpp | |
parent | b864e89fe412879823afca6dffb7e700a5bf8210 (diff) | |
download | external_llvm-7136a6540cce99a9498ffaf4ebab26e7f6ae5b50.zip external_llvm-7136a6540cce99a9498ffaf4ebab26e7f6ae5b50.tar.gz external_llvm-7136a6540cce99a9498ffaf4ebab26e7f6ae5b50.tar.bz2 |
Keep DIDescriptor methods together.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74652 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DebugInfo.cpp')
-rw-r--r-- | lib/Analysis/DebugInfo.cpp | 250 |
1 files changed, 127 insertions, 123 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index dbc3ae8..945420f 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -321,6 +321,133 @@ bool DISubprogram::describes(const Function *F) { } //===----------------------------------------------------------------------===// +// DIDescriptor: dump routines for all descriptors. +//===----------------------------------------------------------------------===// + + +/// dump - Print descriptor. +void DIDescriptor::dump() const { + cerr << "[" << dwarf::TagString(getTag()) << "] "; + cerr << std::hex << "[GV:" << DbgGV << "]" << std::dec; +} + +/// dump - Print compile unit. +void DICompileUnit::dump() const { + if (getLanguage()) + cerr << " [" << dwarf::LanguageString(getLanguage()) << "] "; + + std::string Res1, Res2; + cerr << " [" << getDirectory(Res1) << "/" << getFilename(Res2) << " ]"; +} + +/// dump - Print type. +void DIType::dump() const { + if (isNull()) return; + + std::string Res; + if (!getName(Res).empty()) + cerr << " [" << Res << "] "; + + unsigned Tag = getTag(); + cerr << " [" << dwarf::TagString(Tag) << "] "; + + // TODO : Print context + getCompileUnit().dump(); + cerr << " [" + << getLineNumber() << ", " + << getSizeInBits() << ", " + << getAlignInBits() << ", " + << getOffsetInBits() + << "] "; + + if (isPrivate()) + cerr << " [private] "; + else if (isProtected()) + cerr << " [protected] "; + + if (isForwardDecl()) + cerr << " [fwd] "; + + if (isBasicType(Tag)) + DIBasicType(DbgGV).dump(); + else if (isDerivedType(Tag)) + DIDerivedType(DbgGV).dump(); + else if (isCompositeType(Tag)) + DICompositeType(DbgGV).dump(); + else { + cerr << "Invalid DIType\n"; + return; + } + + cerr << "\n"; +} + +/// dump - Print basic type. +void DIBasicType::dump() const { + cerr << " [" << dwarf::AttributeEncodingString(getEncoding()) << "] "; +} + +/// dump - Print derived type. +void DIDerivedType::dump() const { + cerr << "\n\t Derived From: "; getTypeDerivedFrom().dump(); +} + +/// dump - Print composite type. +void DICompositeType::dump() const { + DIArray A = getTypeArray(); + if (A.isNull()) + return; + cerr << " [" << A.getNumElements() << " elements]"; +} + +/// dump - Print global. +void DIGlobal::dump() const { + std::string Res; + if (!getName(Res).empty()) + cerr << " [" << Res << "] "; + + unsigned Tag = getTag(); + cerr << " [" << dwarf::TagString(Tag) << "] "; + + // TODO : Print context + getCompileUnit().dump(); + cerr << " [" << getLineNumber() << "] "; + + if (isLocalToUnit()) + cerr << " [local] "; + + if (isDefinition()) + cerr << " [def] "; + + if (isGlobalVariable(Tag)) + DIGlobalVariable(DbgGV).dump(); + + cerr << "\n"; +} + +/// dump - Print subprogram. +void DISubprogram::dump() const { + DIGlobal::dump(); +} + +/// dump - Print global variable. +void DIGlobalVariable::dump() const { + cerr << " ["; getGlobal()->dump(); cerr << "] "; +} + +/// dump - Print variable. +void DIVariable::dump() const { + std::string Res; + if (!getName(Res).empty()) + cerr << " [" << Res << "] "; + + getCompileUnit().dump(); + cerr << " [" << getLineNumber() << "] "; + getType().dump(); + cerr << "\n"; +} + +//===----------------------------------------------------------------------===// // DIFactory: Basic Helpers //===----------------------------------------------------------------------===// @@ -924,126 +1051,3 @@ namespace llvm { } } } - -/// dump - Print descriptor. -void DIDescriptor::dump() const { - cerr << "[" << dwarf::TagString(getTag()) << "] "; - cerr << std::hex << "[GV:" << DbgGV << "]" << std::dec; -} - -/// dump - Print compile unit. -void DICompileUnit::dump() const { - if (getLanguage()) - cerr << " [" << dwarf::LanguageString(getLanguage()) << "] "; - - std::string Res1, Res2; - cerr << " [" << getDirectory(Res1) << "/" << getFilename(Res2) << " ]"; -} - -/// dump - Print type. -void DIType::dump() const { - if (isNull()) return; - - std::string Res; - if (!getName(Res).empty()) - cerr << " [" << Res << "] "; - - unsigned Tag = getTag(); - cerr << " [" << dwarf::TagString(Tag) << "] "; - - // TODO : Print context - getCompileUnit().dump(); - cerr << " [" - << getLineNumber() << ", " - << getSizeInBits() << ", " - << getAlignInBits() << ", " - << getOffsetInBits() - << "] "; - - if (isPrivate()) - cerr << " [private] "; - else if (isProtected()) - cerr << " [protected] "; - - if (isForwardDecl()) - cerr << " [fwd] "; - - if (isBasicType(Tag)) - DIBasicType(DbgGV).dump(); - else if (isDerivedType(Tag)) - DIDerivedType(DbgGV).dump(); - else if (isCompositeType(Tag)) - DICompositeType(DbgGV).dump(); - else { - cerr << "Invalid DIType\n"; - return; - } - - cerr << "\n"; -} - -/// dump - Print basic type. -void DIBasicType::dump() const { - cerr << " [" << dwarf::AttributeEncodingString(getEncoding()) << "] "; -} - -/// dump - Print derived type. -void DIDerivedType::dump() const { - cerr << "\n\t Derived From: "; getTypeDerivedFrom().dump(); -} - -/// dump - Print composite type. -void DICompositeType::dump() const { - DIArray A = getTypeArray(); - if (A.isNull()) - return; - cerr << " [" << A.getNumElements() << " elements]"; -} - -/// dump - Print global. -void DIGlobal::dump() const { - std::string Res; - if (!getName(Res).empty()) - cerr << " [" << Res << "] "; - - unsigned Tag = getTag(); - cerr << " [" << dwarf::TagString(Tag) << "] "; - - // TODO : Print context - getCompileUnit().dump(); - cerr << " [" << getLineNumber() << "] "; - - if (isLocalToUnit()) - cerr << " [local] "; - - if (isDefinition()) - cerr << " [def] "; - - if (isGlobalVariable(Tag)) - DIGlobalVariable(DbgGV).dump(); - - cerr << "\n"; -} - -/// dump - Print subprogram. -void DISubprogram::dump() const { - DIGlobal::dump(); -} - -/// dump - Print global variable. -void DIGlobalVariable::dump() const { - cerr << " ["; getGlobal()->dump(); cerr << "] "; -} - -/// dump - Print variable. -void DIVariable::dump() const { - std::string Res; - if (!getName(Res).empty()) - cerr << " [" << Res << "] "; - - getCompileUnit().dump(); - cerr << " [" << getLineNumber() << "] "; - getType().dump(); - cerr << "\n"; -} - |