[Lldb-commits] [lldb] Revert "[LLDB] Add more helper functions to CompilerType class." (PR #73470)

2023-11-26 Thread via lldb-commits

cmtice wrote:

Can't commit this revert because of the clang format errors. Reverted manually 
instead.

https://github.com/llvm/llvm-project/pull/73470
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Revert "[LLDB] Add more helper functions to CompilerType class." (PR #73470)

2023-11-26 Thread via lldb-commits

https://github.com/cmtice closed https://github.com/llvm/llvm-project/pull/73470
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Revert "[LLDB] Add more helper functions to CompilerType class." (PR #73470)

2023-11-26 Thread via lldb-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff 42d669f82c4db6abd6f39e1d89e4e62872c4e0a8 
d4cddc1a596b60c128996c8f96f63af6fb21506a -- 
lldb/include/lldb/Symbol/CompilerType.h lldb/source/Symbol/CompilerType.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/include/lldb/Symbol/CompilerType.h 
b/lldb/include/lldb/Symbol/CompilerType.h
index 0a9533a1ac..226a684c86 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -112,9 +112,7 @@ public:
 
   /// Tests.
   /// \{
-  explicit operator bool() const {
-return m_type_system.lock() && m_type;
-  }
+  explicit operator bool() const { return m_type_system.lock() && m_type; }
 
   bool IsValid() const { return (bool)*this; }
 
@@ -436,8 +434,8 @@ public:
  ExecutionContextScope *exe_scope);
 
   /// Dump to stdout.
-  void DumpTypeDescription(lldb::DescriptionLevel level =
-   lldb::eDescriptionLevelFull) const;
+  void DumpTypeDescription(
+  lldb::DescriptionLevel level = lldb::eDescriptionLevelFull) const;
 
   /// Print a description of the type to a stream. The exact implementation
   /// varies, but the expectation is that eDescriptionLevelFull returns a
diff --git a/lldb/source/Symbol/CompilerType.cpp 
b/lldb/source/Symbol/CompilerType.cpp
index 78cc8dad94..936fe8f2a9 100644
--- a/lldb/source/Symbol/CompilerType.cpp
+++ b/lldb/source/Symbol/CompilerType.cpp
@@ -54,7 +54,7 @@ bool CompilerType::IsArrayType(CompilerType 
*element_type_ptr, uint64_t *size,
   if (IsValid())
 if (auto type_system_sp = GetTypeSystem())
   return type_system_sp->IsArrayType(m_type, element_type_ptr, size,
-  is_incomplete);
+ is_incomplete);
 
   if (element_type_ptr)
 element_type_ptr->Clear();
@@ -157,7 +157,8 @@ bool CompilerType::IsBlockPointerType(
 CompilerType *function_pointer_type_ptr) const {
   if (IsValid())
 if (auto type_system_sp = GetTypeSystem())
-  return type_system_sp->IsBlockPointerType(m_type, 
function_pointer_type_ptr);
+  return type_system_sp->IsBlockPointerType(m_type,
+function_pointer_type_ptr);
   return false;
 }
 
@@ -249,7 +250,7 @@ bool CompilerType::IsPossibleDynamicType(CompilerType 
*dynamic_pointee_type,
   if (IsValid())
 if (auto type_system_sp = GetTypeSystem())
   return type_system_sp->IsPossibleDynamicType(m_type, 
dynamic_pointee_type,
-check_cplusplus, check_objc);
+   check_cplusplus, 
check_objc);
   return false;
 }
 
@@ -336,9 +337,9 @@ ConstString CompilerType::GetDisplayTypeName() const {
 uint32_t CompilerType::GetTypeInfo(
 CompilerType *pointee_or_element_compiler_type) const {
   if (IsValid())
-  if (auto type_system_sp = GetTypeSystem())
-return type_system_sp->GetTypeInfo(m_type,
-   pointee_or_element_compiler_type);
+if (auto type_system_sp = GetTypeSystem())
+  return type_system_sp->GetTypeInfo(m_type,
+ pointee_or_element_compiler_type);
   return 0;
 }
 
@@ -362,8 +363,9 @@ void CompilerType::SetCompilerType(lldb::TypeSystemWP 
type_system,
   m_type = type;
 }
 
-void CompilerType::SetCompilerType(CompilerType::TypeSystemSPWrapper 
type_system,
-   lldb::opaque_compiler_type_t type) {
+void CompilerType::SetCompilerType(
+CompilerType::TypeSystemSPWrapper type_system,
+lldb::opaque_compiler_type_t type) {
   m_type_system = type_system.GetSharedPointer();
   m_type = type;
 }
@@ -589,7 +591,7 @@ uint32_t CompilerType::GetNumChildren(bool 
omit_empty_base_classes,
   if (IsValid())
 if (auto type_system_sp = GetTypeSystem())
   return type_system_sp->GetNumChildren(m_type, omit_empty_base_classes,
-   exe_ctx);
+exe_ctx);
   return 0;
 }
 
@@ -601,8 +603,7 @@ lldb::BasicType CompilerType::GetBasicTypeEnumeration() 
const {
 }
 
 void CompilerType::ForEachEnumerator(
-std::function const ) const {
   if (IsValid())
 if (auto type_system_sp = GetTypeSystem())
@@ -623,7 +624,8 @@ CompilerType CompilerType::GetFieldAtIndex(size_t idx, 
std::string ,
   if (IsValid())
 if (auto type_system_sp = GetTypeSystem())
   return type_system_sp->GetFieldAtIndex(m_type, idx, name, bit_offset_ptr,
-bitfield_bit_size_ptr, 
is_bitfield_ptr);
+ bitfield_bit_size_ptr,
+ is_bitfield_ptr);
   return CompilerType();
 }
 
@@ 

[Lldb-commits] [lldb] Revert "[LLDB] Add more helper functions to CompilerType class." (PR #73470)

2023-11-26 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: None (cmtice)


Changes

Reverts llvm/llvm-project#73467

Merged the commit by accident!

---
Full diff: https://github.com/llvm/llvm-project/pull/73470.diff


2 Files Affected:

- (modified) lldb/include/lldb/Symbol/CompilerType.h (+5-51) 
- (modified) lldb/source/Symbol/CompilerType.cpp (+16-269) 


``diff
diff --git a/lldb/include/lldb/Symbol/CompilerType.h 
b/lldb/include/lldb/Symbol/CompilerType.h
index a3331ad3269c01d..0a9533a1ac0efc1 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -112,7 +112,9 @@ class CompilerType {
 
   /// Tests.
   /// \{
-  explicit operator bool() const { return m_type_system.lock() && m_type; }
+  explicit operator bool() const {
+return m_type_system.lock() && m_type;
+  }
 
   bool IsValid() const { return (bool)*this; }
 
@@ -192,54 +194,6 @@ 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();
-
   /// \}
 
   /// Type Completion.
@@ -482,8 +436,8 @@ class CompilerType {
  ExecutionContextScope *exe_scope);
 
   /// Dump to stdout.
-  void DumpTypeDescription(
-  lldb::DescriptionLevel level = lldb::eDescriptionLevelFull) const;
+  void DumpTypeDescription(lldb::DescriptionLevel level =
+   lldb::eDescriptionLevelFull) const;
 
   /// Print a description of the type to a stream. The exact implementation
   /// varies, but the expectation is that eDescriptionLevelFull returns a
diff --git a/lldb/source/Symbol/CompilerType.cpp 
b/lldb/source/Symbol/CompilerType.cpp
index 854d6cab01b508e..78cc8dad94a9c5f 100644
--- a/lldb/source/Symbol/CompilerType.cpp
+++ b/lldb/source/Symbol/CompilerType.cpp
@@ -54,7 +54,7 @@ bool CompilerType::IsArrayType(CompilerType 
*element_type_ptr, uint64_t *size,
   if (IsValid())
 if (auto type_system_sp = GetTypeSystem())
   return type_system_sp->IsArrayType(m_type, element_type_ptr, size,
- is_incomplete);
+  is_incomplete);
 
   if (element_type_ptr)
 element_type_ptr->Clear();
@@ -157,8 +157,7 @@ bool CompilerType::IsBlockPointerType(
 CompilerType *function_pointer_type_ptr) const {
   if (IsValid())
 if (auto type_system_sp = GetTypeSystem())
-  return type_system_sp->IsBlockPointerType(m_type,
-function_pointer_type_ptr);
+  return type_system_sp->IsBlockPointerType(m_type, 
function_pointer_type_ptr);
   return false;
 }
 
@@ -250,7 +249,7 @@ bool CompilerType::IsPossibleDynamicType(CompilerType 
*dynamic_pointee_type,
   if (IsValid())
 if (auto type_system_sp = GetTypeSystem())
   return type_system_sp->IsPossibleDynamicType(m_type, 
dynamic_pointee_type,
-   check_cplusplus, 
check_objc);
+check_cplusplus, check_objc);
   return false;
 }
 
@@ -303,256 +302,6 @@ bool CompilerType::IsBeingDefined() const {
   return false;
 }
 
-bool CompilerType::IsSmartPtrType() const {
-  // These regular expressions cover shared, unique and weak pointers both from
-  // stdlibc++ and libc+++.
-
-  static llvm::Regex k_libcxx_std_unique_ptr_regex(
-  "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$");
-  static llvm::Regex k_libcxx_std_shared_ptr_regex(
-  "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$");
-  static llvm::Regex k_libcxx_std_weak_ptr_regex(
-  "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$");
-  //
-  static llvm::Regex k_libcxx_std_unique_ptr_regex_2(
-  "^std::unique_ptr<.+>(( )?&)?$");
-  static llvm::Regex k_libcxx_std_shared_ptr_regex_2(
-  "^std::shared_ptr<.+>(( )?&)?$");
-  static llvm::Regex k_libcxx_std_weak_ptr_regex_2(
-  "^std::weak_ptr<.+>(( )?&)?$");
-  //
-  llvm::StringRef name = GetTypeName();
-  return k_libcxx_std_unique_ptr_regex.match(name) ||
- 

[Lldb-commits] [lldb] Revert "[LLDB] Add more helper functions to CompilerType class." (PR #73470)

2023-11-26 Thread via lldb-commits

https://github.com/cmtice created 
https://github.com/llvm/llvm-project/pull/73470

Reverts llvm/llvm-project#73467

Merged the commit by accident!

>From d4cddc1a596b60c128996c8f96f63af6fb21506a Mon Sep 17 00:00:00 2001
From: cmtice 
Date: Sun, 26 Nov 2023 16:37:50 -0800
Subject: [PATCH] Revert "[LLDB] Add more helper functions to CompilerType
 class. (#73467)"

This reverts commit 42d669f82c4db6abd6f39e1d89e4e62872c4e0a8.
---
 lldb/include/lldb/Symbol/CompilerType.h |  56 +
 lldb/source/Symbol/CompilerType.cpp | 285 ++--
 2 files changed, 21 insertions(+), 320 deletions(-)

diff --git a/lldb/include/lldb/Symbol/CompilerType.h 
b/lldb/include/lldb/Symbol/CompilerType.h
index a3331ad3269c01d..0a9533a1ac0efc1 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -112,7 +112,9 @@ class CompilerType {
 
   /// Tests.
   /// \{
-  explicit operator bool() const { return m_type_system.lock() && m_type; }
+  explicit operator bool() const {
+return m_type_system.lock() && m_type;
+  }
 
   bool IsValid() const { return (bool)*this; }
 
@@ -192,54 +194,6 @@ 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();
-
   /// \}
 
   /// Type Completion.
@@ -482,8 +436,8 @@ class CompilerType {
  ExecutionContextScope *exe_scope);
 
   /// Dump to stdout.
-  void DumpTypeDescription(
-  lldb::DescriptionLevel level = lldb::eDescriptionLevelFull) const;
+  void DumpTypeDescription(lldb::DescriptionLevel level =
+   lldb::eDescriptionLevelFull) const;
 
   /// Print a description of the type to a stream. The exact implementation
   /// varies, but the expectation is that eDescriptionLevelFull returns a
diff --git a/lldb/source/Symbol/CompilerType.cpp 
b/lldb/source/Symbol/CompilerType.cpp
index 854d6cab01b508e..78cc8dad94a9c5f 100644
--- a/lldb/source/Symbol/CompilerType.cpp
+++ b/lldb/source/Symbol/CompilerType.cpp
@@ -54,7 +54,7 @@ bool CompilerType::IsArrayType(CompilerType 
*element_type_ptr, uint64_t *size,
   if (IsValid())
 if (auto type_system_sp = GetTypeSystem())
   return type_system_sp->IsArrayType(m_type, element_type_ptr, size,
- is_incomplete);
+  is_incomplete);
 
   if (element_type_ptr)
 element_type_ptr->Clear();
@@ -157,8 +157,7 @@ bool CompilerType::IsBlockPointerType(
 CompilerType *function_pointer_type_ptr) const {
   if (IsValid())
 if (auto type_system_sp = GetTypeSystem())
-  return type_system_sp->IsBlockPointerType(m_type,
-function_pointer_type_ptr);
+  return type_system_sp->IsBlockPointerType(m_type, 
function_pointer_type_ptr);
   return false;
 }
 
@@ -250,7 +249,7 @@ bool CompilerType::IsPossibleDynamicType(CompilerType 
*dynamic_pointee_type,
   if (IsValid())
 if (auto type_system_sp = GetTypeSystem())
   return type_system_sp->IsPossibleDynamicType(m_type, 
dynamic_pointee_type,
-   check_cplusplus, 
check_objc);
+check_cplusplus, check_objc);
   return false;
 }
 
@@ -303,256 +302,6 @@ bool CompilerType::IsBeingDefined() const {
   return false;
 }
 
-bool CompilerType::IsSmartPtrType() const {
-  // These regular expressions cover shared, unique and weak pointers both from
-  // stdlibc++ and libc+++.
-
-  static llvm::Regex k_libcxx_std_unique_ptr_regex(
-  "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$");
-  static llvm::Regex k_libcxx_std_shared_ptr_regex(
-  "^std::__[[:alnum:]]+::shared_ptr<.+>(( )?&)?$");
-  static llvm::Regex k_libcxx_std_weak_ptr_regex(
-  "^std::__[[:alnum:]]+::weak_ptr<.+>(( )?&)?$");
-  //
-  static llvm::Regex k_libcxx_std_unique_ptr_regex_2(
-  "^std::unique_ptr<.+>(( )?&)?$");
-  static llvm::Regex k_libcxx_std_shared_ptr_regex_2(
-