[Lldb-commits] [PATCH] D59102: Add an LLVM-style dump method to CompilerType for extra convenience during debugging

Phabricator via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 7 12:20:11 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL355632: Add an LLVM-style dump method to CompilerType for extra convenience during… (authored by adrian, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D59102?vs=189754&id=189767#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59102/new/

https://reviews.llvm.org/D59102

Files:
  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


Index: lldb/trunk/include/lldb/Symbol/CompilerType.h
===================================================================
--- lldb/trunk/include/lldb/Symbol/CompilerType.h
+++ lldb/trunk/include/lldb/Symbol/CompilerType.h
@@ -388,6 +388,13 @@
   //----------------------------------------------------------------------
   // 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,
Index: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
===================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h
@@ -929,6 +929,13 @@
   //----------------------------------------------------------------------
   // 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,
Index: lldb/trunk/include/lldb/Symbol/TypeSystem.h
===================================================================
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h
@@ -355,6 +355,12 @@
   // 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,
Index: lldb/trunk/source/Symbol/ClangASTContext.cpp
===================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp
@@ -9086,6 +9086,16 @@
 //----------------------------------------------------------------------
 #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());
Index: lldb/trunk/source/Symbol/CompilerType.cpp
===================================================================
--- lldb/trunk/source/Symbol/CompilerType.cpp
+++ lldb/trunk/source/Symbol/CompilerType.cpp
@@ -800,6 +800,15 @@
   }
 }
 
+#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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59102.189767.patch
Type: text/x-patch
Size: 3681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190307/0b90c495/attachment.bin>


More information about the lldb-commits mailing list