forked from OSchip/llvm-project
Convert the DebugInfo classes dump() methods into print(raw_ostream &)
methods, and add dump functions implemented in terms of the print. llvm-svn: 103254
This commit is contained in:
parent
a1f9cc1bec
commit
4bbcf644da
|
@ -34,6 +34,7 @@ namespace llvm {
|
|||
class Instruction;
|
||||
class MDNode;
|
||||
class LLVMContext;
|
||||
class raw_ostream;
|
||||
|
||||
/// DIDescriptor - A thin wraper around MDNode to access encoded debug info.
|
||||
/// This should not be stored in a container, because underly MDNode may
|
||||
|
@ -75,7 +76,10 @@ namespace llvm {
|
|||
/// ValidDebugInfo - Return true if N represents valid debug info value.
|
||||
static bool ValidDebugInfo(MDNode *N, unsigned OptLevel);
|
||||
|
||||
/// dump - print descriptor.
|
||||
/// print - print descriptor.
|
||||
void print(raw_ostream &OS) const;
|
||||
|
||||
/// dump - print descriptor to dbgs() with a newline.
|
||||
void dump() const;
|
||||
|
||||
bool isDerivedType() const;
|
||||
|
@ -153,7 +157,10 @@ namespace llvm {
|
|||
/// Verify - Verify that a compile unit is well formed.
|
||||
bool Verify() const;
|
||||
|
||||
/// dump - print compile unit.
|
||||
/// print - print compile unit.
|
||||
void print(raw_ostream &OS) const;
|
||||
|
||||
/// dump - print compile unit to dbgs() with a newline.
|
||||
void dump() const;
|
||||
};
|
||||
|
||||
|
@ -253,7 +260,11 @@ namespace llvm {
|
|||
}
|
||||
StringRef getFilename() const { return getCompileUnit().getFilename();}
|
||||
StringRef getDirectory() const { return getCompileUnit().getDirectory();}
|
||||
/// dump - print type.
|
||||
|
||||
/// print - print type.
|
||||
void print(raw_ostream &OS) const;
|
||||
|
||||
/// dump - print type to dbgs() with a newline.
|
||||
void dump() const;
|
||||
};
|
||||
|
||||
|
@ -264,7 +275,10 @@ namespace llvm {
|
|||
|
||||
unsigned getEncoding() const { return getUnsignedField(9); }
|
||||
|
||||
/// dump - print basic type.
|
||||
/// print - print basic type.
|
||||
void print(raw_ostream &OS) const;
|
||||
|
||||
/// dump - print basic type to dbgs() with a newline.
|
||||
void dump() const;
|
||||
};
|
||||
|
||||
|
@ -283,7 +297,11 @@ namespace llvm {
|
|||
/// getOriginalTypeSize - If this type is derived from a base type then
|
||||
/// return base type size.
|
||||
uint64_t getOriginalTypeSize() const;
|
||||
/// dump - print derived type.
|
||||
|
||||
/// print - print derived type.
|
||||
void print(raw_ostream &OS) const;
|
||||
|
||||
/// dump - print derived type to dbgs() with a newline.
|
||||
void dump() const;
|
||||
|
||||
/// replaceAllUsesWith - Replace all uses of debug info referenced by
|
||||
|
@ -312,7 +330,10 @@ namespace llvm {
|
|||
/// Verify - Verify that a composite type descriptor is well formed.
|
||||
bool Verify() const;
|
||||
|
||||
/// dump - print composite type.
|
||||
/// print - print composite type.
|
||||
void print(raw_ostream &OS) const;
|
||||
|
||||
/// dump - print composite type to dbgs() with a newline.
|
||||
void dump() const;
|
||||
};
|
||||
|
||||
|
@ -344,7 +365,10 @@ namespace llvm {
|
|||
unsigned isLocalToUnit() const { return getUnsignedField(9); }
|
||||
unsigned isDefinition() const { return getUnsignedField(10); }
|
||||
|
||||
/// dump - print global.
|
||||
/// print - print global.
|
||||
void print(raw_ostream &OS) const;
|
||||
|
||||
/// dump - print global to dbgs() with a newline.
|
||||
void dump() const;
|
||||
};
|
||||
|
||||
|
@ -413,7 +437,10 @@ namespace llvm {
|
|||
/// Verify - Verify that a subprogram descriptor is well formed.
|
||||
bool Verify() const;
|
||||
|
||||
/// dump - print subprogram.
|
||||
/// print - print subprogram.
|
||||
void print(raw_ostream &OS) const;
|
||||
|
||||
/// dump - print subprogram to dbgs() with a newline.
|
||||
void dump() const;
|
||||
|
||||
/// describes - Return true if this subprogram provides debugging
|
||||
|
@ -431,7 +458,10 @@ namespace llvm {
|
|||
/// Verify - Verify that a global variable descriptor is well formed.
|
||||
bool Verify() const;
|
||||
|
||||
/// dump - print global variable.
|
||||
/// print - print global variable.
|
||||
void print(raw_ostream &OS) const;
|
||||
|
||||
/// dump - print global variable to dbgs() with a newline.
|
||||
void dump() const;
|
||||
};
|
||||
|
||||
|
@ -479,7 +509,10 @@ namespace llvm {
|
|||
/// information for an inlined function arguments.
|
||||
bool isInlinedFnArgument(const Function *CurFn);
|
||||
|
||||
/// dump - print variable.
|
||||
/// print - print variable.
|
||||
void print(raw_ostream &OS) const;
|
||||
|
||||
/// dump - print variable to dbgs() with a newline.
|
||||
void dump() const;
|
||||
};
|
||||
|
||||
|
|
|
@ -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,95 +524,145 @@ 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";
|
||||
}
|
||||
|
||||
/// print - Print global variable.
|
||||
void DIGlobalVariable::print(raw_ostream &OS) const {
|
||||
OS << " [";
|
||||
getGlobal()->dump();
|
||||
OS << "] ";
|
||||
}
|
||||
|
||||
/// print - Print variable.
|
||||
void DIVariable::print(raw_ostream &OS) const {
|
||||
StringRef Res = getName();
|
||||
if (!Res.empty())
|
||||
OS << " [" << Res << "] ";
|
||||
|
||||
getCompileUnit().dump();
|
||||
OS << " [" << getLineNumber() << "] ";
|
||||
getType().dump();
|
||||
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 {
|
||||
dbgs() << " [";
|
||||
getGlobal()->dump();
|
||||
dbgs() << "] ";
|
||||
print(dbgs()); dbgs() << '\n';
|
||||
}
|
||||
|
||||
/// dump - Print variable.
|
||||
void DIVariable::dump() const {
|
||||
StringRef Res = getName();
|
||||
if (!Res.empty())
|
||||
dbgs() << " [" << Res << "] ";
|
||||
|
||||
getCompileUnit().dump();
|
||||
dbgs() << " [" << getLineNumber() << "] ";
|
||||
getType().dump();
|
||||
dbgs() << "\n";
|
||||
|
||||
// FIXME: Dump complex addresses
|
||||
print(dbgs()); dbgs() << '\n';
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue