[Lldb-commits] [lldb] r355632 - Add an LLVM-style dump method to CompilerType for extra convenience during debugging
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Thu Mar 7 12:20:02 PST 2019
Author: adrian
Date: Thu Mar 7 12:20:02 2019
New Revision: 355632
URL: http://llvm.org/viewvc/llvm-project?rev=355632&view=rev
Log:
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
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/CompilerType.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/CompilerType.cpp
Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=355632&r1=355631&r2=355632&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Mar 7 12:20:02 2019
@@ -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,
Modified: lldb/trunk/include/lldb/Symbol/CompilerType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerType.h?rev=355632&r1=355631&r2=355632&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/CompilerType.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerType.h Thu Mar 7 12:20:02 2019
@@ -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,
Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=355632&r1=355631&r2=355632&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Thu Mar 7 12:20:02 2019
@@ -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,
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=355632&r1=355631&r2=355632&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Mar 7 12:20:02 2019
@@ -9086,6 +9086,16 @@ ClangASTContext::ConvertStringToFloatVal
//----------------------------------------------------------------------
#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());
Modified: lldb/trunk/source/Symbol/CompilerType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompilerType.cpp?rev=355632&r1=355631&r2=355632&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompilerType.cpp (original)
+++ lldb/trunk/source/Symbol/CompilerType.cpp Thu Mar 7 12:20:02 2019
@@ -800,6 +800,15 @@ void CompilerType::DumpTypeDescription(S
}
}
+#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,
More information about the lldb-commits
mailing list