[Lldb-commits] [lldb] [lldb][dap] always add column field in StackFrame body (PR #73393)
@@ -817,8 +817,7 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame) { if (line && line != LLDB_INVALID_LINE_NUMBER) object.try_emplace("line", line); xujuntwt95329 wrote: Thanks! Updated https://github.com/llvm/llvm-project/pull/73393 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][dap] always add column field in StackFrame body (PR #73393)
https://github.com/xujuntwt95329 updated https://github.com/llvm/llvm-project/pull/73393 >From 4621be9af9a8003c52850ed57ae7a24f26769b2c Mon Sep 17 00:00:00 2001 From: Xu Jun <693788...@qq.com> Date: Sat, 25 Nov 2023 22:52:53 +0800 Subject: [PATCH 1/2] [lldb][dap] always add column field in StackFrame body Signed-off-by: Xu Jun <693788...@qq.com> --- lldb/tools/lldb-dap/JSONUtils.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 03a43f9da87f241..e65b05243df7066 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -817,8 +817,7 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame) { if (line && line != LLDB_INVALID_LINE_NUMBER) object.try_emplace("line", line); auto column = line_entry.GetColumn(); -if (column && column != LLDB_INVALID_COLUMN_NUMBER) - object.try_emplace("column", column); +object.try_emplace("column", column); } else { object.try_emplace("line", 0); object.try_emplace("column", 0); >From 2e2c7cd63d9855016e3dff99720188dc912bb64e Mon Sep 17 00:00:00 2001 From: Xu Jun <693788...@qq.com> Date: Mon, 27 Nov 2023 06:25:17 + Subject: [PATCH 2/2] [lldb][dap] always add line field in StackFrame body --- lldb/tools/lldb-dap/JSONUtils.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index e65b05243df7066..d5edafccfedc3c6 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -816,6 +816,8 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame) { auto line = line_entry.GetLine(); if (line && line != LLDB_INVALID_LINE_NUMBER) object.try_emplace("line", line); +else + object.try_emplace("line", 0); auto column = line_entry.GetColumn(); object.try_emplace("column", column); } else { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class. (PR #73467)
cmtice wrote: Never mind; I'll just create a new pull request. See https://github.com/llvm/llvm-project/pull/73472. https://github.com/llvm/llvm-project/pull/73467 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: None (cmtice) Changes This adds 23 new helper functions to LLDB's CompilerType class, things like IsSmartPtrType, IsPromotableIntegerType, GetNumberofNonEmptyBaseClasses, and GetTemplateArgumentType (to name a few). It also has run clang-format on the files CompilerType.{h,cpp}. These helper functions are needed as part of the implementation for the Data Inspection Language, (see https://discourse.llvm.org/t/rfc-data-inspection-language/69893). --- Full diff: https://github.com/llvm/llvm-project/pull/73472.diff 2 Files Affected: - (modified) lldb/include/lldb/Symbol/CompilerType.h (+51-5) - (modified) lldb/source/Symbol/CompilerType.cpp (+269-16) ``diff diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h index 0a9533a1ac0efc1..a3331ad3269c01d 100644 --- a/lldb/include/lldb/Symbol/CompilerType.h +++ b/lldb/include/lldb/Symbol/CompilerType.h @@ -112,9 +112,7 @@ 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; } @@ -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(); + /// \} /// Type Completion. @@ -436,8 +482,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 78cc8dad94a9c5f..854d6cab01b508e 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; } @@ -302,6 +303,256 @@ 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_st
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)
https://github.com/cmtice created https://github.com/llvm/llvm-project/pull/73472 This adds 23 new helper functions to LLDB's CompilerType class, things like IsSmartPtrType, IsPromotableIntegerType, GetNumberofNonEmptyBaseClasses, and GetTemplateArgumentType (to name a few). It also has run clang-format on the files CompilerType.{h,cpp}. These helper functions are needed as part of the implementation for the Data Inspection Language, (see https://discourse.llvm.org/t/rfc-data-inspection-language/69893). >From a063ebd8ee8bbd491fff3449bc20d663d2e501ea Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Sun, 26 Nov 2023 17:24:39 -0800 Subject: [PATCH] [LLDB] Add more helper functions to CompilerType class (second try). This adds 23 new helper functions to LLDB's CompilerType class, things like IsSmartPtrType, IsPromotableIntegerType, GetNumberofNonEmptyBaseClasses, and GetTemplateArgumentType (to name a few). It also has run clang-format on the files CompilerType.{h,cpp}. These helper functions are needed as part of the implementation for the Data Inspection Language, (see https://discourse.llvm.org/t/rfc-data-inspection-language/69893). --- lldb/include/lldb/Symbol/CompilerType.h | 56 - lldb/source/Symbol/CompilerType.cpp | 285 ++-- 2 files changed, 320 insertions(+), 21 deletions(-) diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h index 0a9533a1ac0efc1..a3331ad3269c01d 100644 --- a/lldb/include/lldb/Symbol/CompilerType.h +++ b/lldb/include/lldb/Symbol/CompilerType.h @@ -112,9 +112,7 @@ 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; } @@ -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(); + /// \} /// Type Completion. @@ -436,8 +482,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 78cc8dad94a9c5f..854d6cab01b508e 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; } @@
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class. (PR #73467)
cmtice wrote: I accidentally committed this PR. I could not revert using github pull requests, due to clang format errors. So I reverted it manually. (See git hash af3c5a7cf1e008a467eb3104424ed122b533d7b3). Is there any way to re-open this PR for reviews, or do I need to start all over again and make a new PR? https://github.com/llvm/llvm-project/pull/73467 ___ 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)
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)
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] af3c5a7 - Revert "[LLDB] Add more helper functions to CompilerType class."
Author: Caroline Tice Date: 2023-11-26T17:03:35-08:00 New Revision: af3c5a7cf1e008a467eb3104424ed122b533d7b3 URL: https://github.com/llvm/llvm-project/commit/af3c5a7cf1e008a467eb3104424ed122b533d7b3 DIFF: https://github.com/llvm/llvm-project/commit/af3c5a7cf1e008a467eb3104424ed122b533d7b3.diff LOG: Revert "[LLDB] Add more helper functions to CompilerType class." PR 73467 was committed by accident. This undoes the premature commit. Added: Modified: lldb/include/lldb/Symbol/CompilerType.h lldb/source/Symbol/CompilerType.cpp Removed: 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
[Lldb-commits] [lldb] [lldb][test] Remove `reason` from `unittest2.expectedFailure` usage (PR #73028)
https://github.com/bulbazord commented: I suppose we don't really lose anything by moving away from `expectedFailure` from decorators? Is it worth deleting the custom decorator that we have as well? 😄 https://github.com/llvm/llvm-project/pull/73028 ___ 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)
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 &callback) const { if (IsValid()) if (auto type_system_sp = GetTypeSystem()) @@ -623,7 +624,8 @@ CompilerType CompilerType::GetFieldAtIndex(size_t idx, std::string &name, 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)
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) || - k_li
[Lldb-commits] [lldb] Revert "[LLDB] Add more helper functions to CompilerType class." (PR #73470)
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( - "^s
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class. (PR #73467)
https://github.com/cmtice closed https://github.com/llvm/llvm-project/pull/73467 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 42d669f - [LLDB] Add more helper functions to CompilerType class. (#73467)
Author: cmtice Date: 2023-11-26T16:37:39-08:00 New Revision: 42d669f82c4db6abd6f39e1d89e4e62872c4e0a8 URL: https://github.com/llvm/llvm-project/commit/42d669f82c4db6abd6f39e1d89e4e62872c4e0a8 DIFF: https://github.com/llvm/llvm-project/commit/42d669f82c4db6abd6f39e1d89e4e62872c4e0a8.diff LOG: [LLDB] Add more helper functions to CompilerType class. (#73467) This adds 23 new helper functions to LLDB's CompilerType class, things like IsSmartPtrType, IsPromotableIntegerType, GetNumberofNonEmptyBaseClasses, and GetTemplateArgumentType (to name a few). These helper functions are needed as part of the implementation for the Data Inspection Language, (see https://discourse.llvm.org/t/rfc-data-inspection-language/69893). Added: Modified: lldb/include/lldb/Symbol/CompilerType.h lldb/source/Symbol/CompilerType.cpp Removed: diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h index 0a9533a1ac0efc1..a3331ad3269c01d 100644 --- a/lldb/include/lldb/Symbol/CompilerType.h +++ b/lldb/include/lldb/Symbol/CompilerType.h @@ -112,9 +112,7 @@ 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; } @@ -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(); + /// \} /// Type Completion. @@ -436,8 +482,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 78cc8dad94a9c5f..854d6cab01b508e 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; } @@ -302,6 +303,256 @@ 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( +
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class. (PR #73467)
https://github.com/cmtice updated https://github.com/llvm/llvm-project/pull/73467 >From 70957429780c31c8981198967af254a4232ad3bc Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Sun, 26 Nov 2023 16:14:46 -0800 Subject: [PATCH 1/2] [LLDB] Add more helper functions to CompilerType class. This adds 23 new helper functions to LLDB's CompilerType class, things like IsSmartPtrType, IsPromotableIntegerType, GetNumberofNonEmptyBaseClasses, and GetTemplateArgumentType (to name a few). These helper functions are needed as part of the implementation for the Data Inspection Language, (see https://discourse.llvm.org/t/rfc-data-inspection-language/69893). --- lldb/include/lldb/Symbol/CompilerType.h | 49 + lldb/source/Symbol/CompilerType.cpp | 252 2 files changed, 301 insertions(+) diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h index 0a9533a1ac0efc1..e02dfeb08b1d063 100644 --- a/lldb/include/lldb/Symbol/CompilerType.h +++ b/lldb/include/lldb/Symbol/CompilerType.h @@ -194,6 +194,55 @@ 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. diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp index 78cc8dad94a9c5f..f5c38a6f92d4151 100644 --- a/lldb/source/Symbol/CompilerType.cpp +++ b/lldb/source/Symbol/CompilerType.cpp @@ -302,6 +302,258 @@ 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) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; + 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 { + // This is used when you don't care about the signedness of the enum. + bool is_signed; + 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; +} + +bool CompilerType::IsNullPtrType() const { + return GetCanonicalType().GetBasicTypeEnumeration() == + lldb::eBasicTypeNullPtr; +} + +bool CompilerType::IsBoolean() const { + return GetCanonicalType().GetBasicTypeEnumeration() == + lldb::eBasicTypeBool; +} + +bool CompilerType::IsEnumerationIntegerTypeSigned() const { + if (IsValid()) { +return GetEnumerationInt
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class. (PR #73467)
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 a369a5946f99254d56455f3deb0031199562c1dd 70957429780c31c8981198967af254a4232ad3bc -- 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 e02dfeb08b..6239f190b7 100644 --- a/lldb/include/lldb/Symbol/CompilerType.h +++ b/lldb/include/lldb/Symbol/CompilerType.h @@ -223,8 +223,7 @@ public: bool IsRecordType() const; - bool IsVirtualBase(CompilerType target_base, - CompilerType *virtual_base, + bool IsVirtualBase(CompilerType target_base, CompilerType *virtual_base, bool carry_virtual = false) const; bool IsContextuallyConvertibleToBool() const; @@ -235,7 +234,7 @@ public: bool CompareTypes(CompilerType rhs) const; - const char * GetTypeTag(); + const char *GetTypeTag(); uint32_t GetNumberOfNonEmptyBaseClasses(); diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp index f5c38a6f92..69f037bb59 100644 --- a/lldb/source/Symbol/CompilerType.cpp +++ b/lldb/source/Symbol/CompilerType.cpp @@ -323,7 +323,7 @@ bool CompilerType::IsSmartPtrType() const { llvm::StringRef name = GetTypeName(); return k_libcxx_std_unique_ptr_regex.match(name) || k_libcxx_std_shared_ptr_regex.match(name) || - k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || k_libcxx_std_unique_ptr_regex_2.match(name) || k_libcxx_std_shared_ptr_regex_2.match(name) || k_libcxx_std_weak_ptr_regex_2.match(name); @@ -364,18 +364,16 @@ bool CompilerType::IsSigned() const { bool CompilerType::IsNullPtrType() const { return GetCanonicalType().GetBasicTypeEnumeration() == - lldb::eBasicTypeNullPtr; + lldb::eBasicTypeNullPtr; } bool CompilerType::IsBoolean() const { - return GetCanonicalType().GetBasicTypeEnumeration() == - lldb::eBasicTypeBool; + return GetCanonicalType().GetBasicTypeEnumeration() == lldb::eBasicTypeBool; } bool CompilerType::IsEnumerationIntegerTypeSigned() const { if (IsValid()) { -return GetEnumerationIntegerType().GetTypeInfo() -& lldb::eTypeIsSigned; +return GetEnumerationIntegerType().GetTypeInfo() & lldb::eTypeIsSigned; } return false; } @@ -392,21 +390,21 @@ bool CompilerType::IsPromotableIntegerType() const { } switch (GetCanonicalType().GetBasicTypeEnumeration()) { -case lldb::eBasicTypeBool: -case lldb::eBasicTypeChar: -case lldb::eBasicTypeSignedChar: -case lldb::eBasicTypeUnsignedChar: -case lldb::eBasicTypeShort: -case lldb::eBasicTypeUnsignedShort: -case lldb::eBasicTypeWChar: -case lldb::eBasicTypeSignedWChar: -case lldb::eBasicTypeUnsignedWChar: -case lldb::eBasicTypeChar16: -case lldb::eBasicTypeChar32: - return true; + case lldb::eBasicTypeBool: + case lldb::eBasicTypeChar: + case lldb::eBasicTypeSignedChar: + case lldb::eBasicTypeUnsignedChar: + case lldb::eBasicTypeShort: + case lldb::eBasicTypeUnsignedShort: + case lldb::eBasicTypeWChar: + case lldb::eBasicTypeSignedWChar: + case lldb::eBasicTypeUnsignedWChar: + case lldb::eBasicTypeChar16: + case lldb::eBasicTypeChar32: +return true; -default: - return false; + default: +return false; } } @@ -415,7 +413,7 @@ bool CompilerType::IsPointerToVoid() const { return false; return IsPointerType() && - GetPointeeType().GetBasicTypeEnumeration() == lldb::eBasicTypeVoid; + GetPointeeType().GetBasicTypeEnumeration() == lldb::eBasicTypeVoid; } bool CompilerType::IsRecordType() const { @@ -423,7 +421,8 @@ bool CompilerType::IsRecordType() const { return false; return GetCanonicalType().GetTypeClass() & - (lldb::eTypeClassClass | lldb::eTypeClassStruct | lldb::eTypeClassUnion); + (lldb::eTypeClassClass | lldb::eTypeClassStruct | + lldb::eTypeClassUnion); } // Checks whether `target_base` is a virtual base of `type` (direct or @@ -465,19 +464,19 @@ bool CompilerType::IsVirtualBase(CompilerType target_base, bool CompilerType::IsContextuallyConvertibleToBool() const { return IsScalarType() || IsUnscopedEnumerationType() || IsPointerType() || - IsNullPtrType() || IsArrayType(); + IsNullPtrType() || IsArrayType(); } bool CompilerType::IsBasicType() const { - return GetCanonicalType().GetBasicTypeEnumeration() - != lldb::eBasicTypeInvalid; + return GetCanonicalType().GetBasicTypeEnumeration() != + lldb::eBasicTypeInvalid; } std::string CompilerType::TypeDescription() { auto name = GetTypeName(); auto canonical_name = GetCanonic
[Lldb-commits] [lldb] [lldb] Improve error message for script commands when there's no interpreter (PR #73321)
@@ -26,17 +26,19 @@ ScriptInterpreterNone::ScriptInterpreterNone(Debugger &debugger) ScriptInterpreterNone::~ScriptInterpreterNone() = default; +static const char *no_interpreter_err_msg = +"There is no embedded script interpreter. Check that LLDB was built with a " +"scripting language enabled.\n"; JDevlieghere wrote: [begin bikeshedding] How about: > Embedded script interpreter unavailable: LLDB was built without scripting > language support. "Check" makes it sound like that's something the user has control over, which is only really the case for us developers. [end bikeshedding] https://github.com/llvm/llvm-project/pull/73321 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Improve error message for script commands when there's no interpreter (PR #73321)
https://github.com/JDevlieghere approved this pull request. Thanks for improving the error message. I left a suggestion inline, but happy to see this merged regardless of the concrete wording. https://github.com/llvm/llvm-project/pull/73321 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Improve error message for script commands when there's no interpreter (PR #73321)
https://github.com/JDevlieghere edited https://github.com/llvm/llvm-project/pull/73321 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class. (PR #73467)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: None (cmtice) Changes This adds 23 new helper functions to LLDB's CompilerType class, things like IsSmartPtrType, IsPromotableIntegerType, GetNumberofNonEmptyBaseClasses, and GetTemplateArgumentType (to name a few). These helper functions are needed as part of the implementation for the Data Inspection Language, (see https://discourse.llvm.org/t/rfc-data-inspection-language/69893). --- Full diff: https://github.com/llvm/llvm-project/pull/73467.diff 2 Files Affected: - (modified) lldb/include/lldb/Symbol/CompilerType.h (+49) - (modified) lldb/source/Symbol/CompilerType.cpp (+252) ``diff diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h index 0a9533a1ac0efc1..e02dfeb08b1d063 100644 --- a/lldb/include/lldb/Symbol/CompilerType.h +++ b/lldb/include/lldb/Symbol/CompilerType.h @@ -194,6 +194,55 @@ 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. diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp index 78cc8dad94a9c5f..f5c38a6f92d4151 100644 --- a/lldb/source/Symbol/CompilerType.cpp +++ b/lldb/source/Symbol/CompilerType.cpp @@ -302,6 +302,258 @@ 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) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; + 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 { + // This is used when you don't care about the signedness of the enum. + bool is_signed; + 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; +} + +bool CompilerType::IsNullPtrType() const { + return GetCanonicalType().GetBasicTypeEnumeration() == + lldb::eBasicTypeNullPtr; +} + +bool CompilerType::IsBoolean() const { + return GetCanonicalType().GetBasicTypeEnumeration() == + lldb::eBasicTypeBool; +} + +bool CompilerType::IsEnumerationIntegerTypeSigned() const { + if (IsValid()) { +return GetEnumerationIntegerType().GetTypeInfo() +& lldb::eTypeIsSigned; + } + return false; +} + +bool CompilerType::IsScalarOrUnscopedEnumerationType() const { + re
[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class. (PR #73467)
https://github.com/cmtice created https://github.com/llvm/llvm-project/pull/73467 This adds 23 new helper functions to LLDB's CompilerType class, things like IsSmartPtrType, IsPromotableIntegerType, GetNumberofNonEmptyBaseClasses, and GetTemplateArgumentType (to name a few). These helper functions are needed as part of the implementation for the Data Inspection Language, (see https://discourse.llvm.org/t/rfc-data-inspection-language/69893). >From 70957429780c31c8981198967af254a4232ad3bc Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Sun, 26 Nov 2023 16:14:46 -0800 Subject: [PATCH] [LLDB] Add more helper functions to CompilerType class. This adds 23 new helper functions to LLDB's CompilerType class, things like IsSmartPtrType, IsPromotableIntegerType, GetNumberofNonEmptyBaseClasses, and GetTemplateArgumentType (to name a few). These helper functions are needed as part of the implementation for the Data Inspection Language, (see https://discourse.llvm.org/t/rfc-data-inspection-language/69893). --- lldb/include/lldb/Symbol/CompilerType.h | 49 + lldb/source/Symbol/CompilerType.cpp | 252 2 files changed, 301 insertions(+) diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h index 0a9533a1ac0efc1..e02dfeb08b1d063 100644 --- a/lldb/include/lldb/Symbol/CompilerType.h +++ b/lldb/include/lldb/Symbol/CompilerType.h @@ -194,6 +194,55 @@ 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. diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp index 78cc8dad94a9c5f..f5c38a6f92d4151 100644 --- a/lldb/source/Symbol/CompilerType.cpp +++ b/lldb/source/Symbol/CompilerType.cpp @@ -302,6 +302,258 @@ 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) || + k_libcxx_std_shared_ptr_regex.match(name) || + k_libcxx_std_weak_ptr_regex.match(name) || + k_libcxx_std_unique_ptr_regex_2.match(name) || + k_libcxx_std_shared_ptr_regex_2.match(name) || + k_libcxx_std_weak_ptr_regex_2.match(name); +} + +bool CompilerType::IsInteger() const { + // This is used when you don't care about the signedness of the integer. + bool is_signed; + 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 { + // This is used when you don't care about the signedness of the enum. + bool is_signed; + 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; +} + +bool CompilerTyp
[Lldb-commits] [lldb] [lldb] Improve error message for script commands when there's no interpreter (PR #73321)
https://github.com/bulbazord approved this pull request. I think overall this is a better error message. I think "mode" probably refers to the configuration LLDB was built with (e.g. `LLDB_ENABLE_PYTHON`) but that's really unhelpful for developers actually using LLDB. This message has been around since 2015 (Looks like `2c1f46dcc609a` introduced it) so this is pretty overdue. Thank you for changing this! :) https://github.com/llvm/llvm-project/pull/73321 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][dap] always add column field in StackFrame body (PR #73393)
@@ -817,8 +817,7 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame) { if (line && line != LLDB_INVALID_LINE_NUMBER) object.try_emplace("line", line); bulbazord wrote: >From the [DAP >specification](https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame) > it looks like `line` is also not optional. Can you make sure that `line` is >always added as well? Note that `LLDB_INVALID_COLUMN_NUMBER` is 0 so we don't need to worry about that one. The same is not true for `LLDB_INVALID_LINE_NUMBER` which has the value of `UINT32_MAX`. You'll need to do some checking since the specification says that the line number should be 0 when the line should be ignored by the client. https://github.com/llvm/llvm-project/pull/73393 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libc] [compiler-rt] [llvm] [lldb] [lld] [clang-tools-extra] [mlir] [clang] [openmp] [libcxx] [flang] [MLIR] Enabling Intel GPU Integration. (PR #65539)
antiagainst wrote: Thanks for breaking down this pull request into various smaller pieces to make it easier for review. I looked at various pieces; LGTM. Looking forward to see this being supported! :) from @joker-eph: > Vulkan and Spirv still have dedicated runners on the model of the original > cuda-runner, but I suspect this is just legacy? from @Jianhui-Li: > The current way of mlir-cpu-runner using the share library name to indicate > target-platform looks good to me: Cuda, Rocm, and SYCL with this PR. Vulkan > could be added same way. mlir-cpu-spirv-runner could be refactored to be > mlir-opt passes generating spirv binary and feed to mlir-cpu-runner. Yup; it's legacy. +1 to the idea of unifying! I've created https://github.com/llvm/llvm-project/issues/73457 to track this issue to make it more visible. I might not have the bandwidth to work on this; if somebody else is interested that'd be nice! So maked it as "good first issue" (not sure whether I'm pushing the limit of "good first issue" but hoping to get traction there). https://github.com/llvm/llvm-project/pull/65539 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [mlir] [flang] [clang-tools-extra] [lldb] [llvm] [libc] [lld] [compiler-rt] [libcxx] [clang] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)
https://github.com/antiagainst approved this pull request. LGTM regarding SPIR-V. But please address comments from others. :) https://github.com/llvm/llvm-project/pull/71430 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits