Add an LLVM-style dump method to CompilerType for extra convenience during debugging

This change has no effect on Release (NoAsserts) builds.

Differential Revision: https://reviews.llvm.org/D59102

llvm-svn: 355632
This commit is contained in:
Adrian Prantl 2019-03-07 20:20:02 +00:00
parent 53954b5e12
commit 0c72a42a8f
5 changed files with 39 additions and 0 deletions

View File

@ -929,6 +929,13 @@ public:
//----------------------------------------------------------------------
// Dumping types
//----------------------------------------------------------------------
#ifndef NDEBUG
/// Convenience LLVM-style dump method for use in the debugger only.
/// In contrast to the other \p Dump() methods this directly invokes
/// \p clang::QualType::dump().
LLVM_DUMP_METHOD void dump(lldb::opaque_compiler_type_t type) const override;
#endif
void Dump(Stream &s);
void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,

View File

@ -388,6 +388,13 @@ public:
//----------------------------------------------------------------------
// Dumping types
//----------------------------------------------------------------------
#ifndef NDEBUG
/// Convenience LLVM-style dump method for use in the debugger only.
/// Don't call this function from actual code.
LLVM_DUMP_METHOD void dump() const;
#endif
void DumpValue(ExecutionContext *exe_ctx, Stream *s, lldb::Format format,
const DataExtractor &data, lldb::offset_t data_offset,
size_t data_byte_size, uint32_t bitfield_bit_size,

View File

@ -355,6 +355,12 @@ public:
// Dumping types
//----------------------------------------------------------------------
#ifndef NDEBUG
/// Convenience LLVM-style dump method for use in the debugger only.
LLVM_DUMP_METHOD virtual void
dump(lldb::opaque_compiler_type_t type) const = 0;
#endif
virtual void DumpValue(lldb::opaque_compiler_type_t type,
ExecutionContext *exe_ctx, Stream *s,
lldb::Format format, const DataExtractor &data,

View File

@ -9086,6 +9086,16 @@ ClangASTContext::ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
//----------------------------------------------------------------------
#define DEPTH_INCREMENT 2
#ifndef NDEBUG
LLVM_DUMP_METHOD void
ClangASTContext::dump(lldb::opaque_compiler_type_t type) const {
if (!type)
return;
clang::QualType qual_type(GetQualType(type));
qual_type.dump();
}
#endif
void ClangASTContext::Dump(Stream &s) {
Decl *tu = Decl::castFromDeclContext(GetTranslationUnitDecl());
tu->dump(s.AsRawOstream());

View File

@ -800,6 +800,15 @@ void CompilerType::DumpTypeDescription(Stream *s) const {
}
}
#ifndef NDEBUG
LLVM_DUMP_METHOD void CompilerType::dump() const {
if (IsValid())
m_type_system->dump(m_type);
else
llvm::errs() << "<invalid>\n";
}
#endif
bool CompilerType::GetValueAsScalar(const lldb_private::DataExtractor &data,
lldb::offset_t data_byte_offset,
size_t data_byte_size,