[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 5 10:13:45 PST 2023


================
@@ -194,6 +192,54 @@ class CompilerType {
   bool IsTypedefType() const;
 
   bool IsVoidType() const;
+
+  bool IsSmartPtrType() const;
+
+  bool IsInteger() const;
+
+  bool IsFloat() const;
+
+  bool IsEnumerationType() const;
+
+  bool IsUnscopedEnumerationType() const;
+
+  bool IsIntegerOrUnscopedEnumerationType() const;
+
+  bool IsSigned() const;
+
+  bool IsNullPtrType() const;
+
+  bool IsBoolean() const;
+
+  bool IsEnumerationIntegerTypeSigned() const;
+
+  bool IsScalarOrUnscopedEnumerationType() const;
+
+  bool IsPromotableIntegerType() const;
+
+  bool IsPointerToVoid() const;
+
+  bool IsRecordType() const;
+
+  bool IsVirtualBase(CompilerType target_base, CompilerType *virtual_base,
+                     bool carry_virtual = false) const;
+
+  bool IsContextuallyConvertibleToBool() const;
+
+  bool IsBasicType() const;
+
+  std::string TypeDescription();
+
+  bool CompareTypes(CompilerType rhs) const;
+
+  const char *GetTypeTag();
+
+  uint32_t GetNumberOfNonEmptyBaseClasses();
+
+  CompilerType GetTemplateArgumentType(uint32_t idx);
+
+  CompilerType GetSmartPtrPointeeType();
----------------
adrian-prantl wrote:

Here you are adding a function that takes a CompilerType holding an STL  smart pointer and ask for the pointee type. We also have synthetic child formatters used by `frame variable` that allow evaluating `*my_shared_ptr`. From that I was assuming that there must be some overlap between what the dataformatter provides and what this function does.
What I don't know is whether synthetic children provided by a formatter are a good fit for what you are trying to do, but maybe the inverse is true, and the existing data formatter should be implemented in terms of this new GetSmartPtrPointeeType() API.
I just want to make sure we're not introducing two places in LLDB that have to know about STL smart pointers while covering slightly different functionality.

https://github.com/llvm/llvm-project/pull/73472


More information about the lldb-commits mailing list