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

via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 5 13:09:53 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();
----------------
jimingham wrote:

I was mostly trying to say that the ValueObject support for "faking the arrow operator effects" is orthogonal to having the type system contain the notion of "smart pointers".  

I also think the whole naming of this is confusing.  What is a "smart pointer"?  The IsSmartPtr states some intent about this:

`  /// This determines if the type is a shared, unique or weak pointer, either
  /// from stdlibc++ or libc+++.
  bool IsSmartPtrType() const;
`

But that is also a little odd.  This is a general type system query but doesn't in fact have anything to do with the type system.  Rather with a particular implementation in the C++ STL - which is orthogonal to the C++ type system...  So it seems like an awfully C++ specific API to have in the Typesystem.



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


More information about the lldb-commits mailing list