[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
Wed Dec 13 15:48:47 PST 2023


================
@@ -302,6 +302,195 @@ bool CompilerType::IsBeingDefined() const {
   return false;
 }
 
+bool CompilerType::IsInteger() const {
+  bool is_signed = false; // May be reset by the call below.
+  return IsIntegerType(is_signed);
+}
+
+bool CompilerType::IsFloat() const {
+  uint32_t count = 0;
+  bool is_complex = false;
+  return IsFloatingPointType(count, is_complex);
+}
+
+bool CompilerType::IsEnumerationType() const {
+  bool is_signed = false; // May be reset by the call below.
+  return IsEnumerationType(is_signed);
+}
+
+bool CompilerType::IsUnscopedEnumerationType() const {
+  return IsEnumerationType() && !IsScopedEnumerationType();
+}
+
+bool CompilerType::IsIntegerOrUnscopedEnumerationType() const {
+  return IsInteger() || IsUnscopedEnumerationType();
+}
+
+bool CompilerType::IsSigned() const {
+  if (IsEnumerationType())
+    return IsEnumerationIntegerTypeSigned();
+
+  return GetTypeInfo() & lldb::eTypeIsSigned;
----------------
adrian-prantl wrote:

(i.e., could this be fixed by modifying TypeSystemClang::GetTypeInfo to return the sign bit on enums?

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


More information about the lldb-commits mailing list