Author: Raphael Isemann Date: 2020-08-17T10:19:51+02:00 New Revision: 5913f2591c45dc84e872a62343f81462372ccbdb
URL: https://github.com/llvm/llvm-project/commit/5913f2591c45dc84e872a62343f81462372ccbdb DIFF: https://github.com/llvm/llvm-project/commit/5913f2591c45dc84e872a62343f81462372ccbdb.diff LOG: [lldb][NFC] Remove stride parameter from GetArrayElementType This parameter isn't used anywhere in LLDB nor the Swift downstream branch. It also doesn't really fit into the TypeSystem APIs that usually don't return additional related functionality via some output parameters. Also the implementations already states that the calculated value there is wrong. Let's remove it. If we need this functionality at some point then Swift's much nicer `GetByteStride` function seems like the way to go. Reviewed By: aprantl Differential Revision: https://reviews.llvm.org/D84299 Added: Modified: lldb/include/lldb/Symbol/CompilerType.h lldb/include/lldb/Symbol/TypeSystem.h lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h lldb/source/Symbol/CompilerType.cpp Removed: ################################################################################ diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h index 7d5d71cbc55c..c5e19773d51c 100644 --- a/lldb/include/lldb/Symbol/CompilerType.h +++ b/lldb/include/lldb/Symbol/CompilerType.h @@ -177,8 +177,7 @@ class CompilerType { /// Creating related types. /// \{ - CompilerType GetArrayElementType(ExecutionContextScope *exe_scope, - uint64_t *stride = nullptr) const; + CompilerType GetArrayElementType(ExecutionContextScope *exe_scope) const; CompilerType GetArrayType(uint64_t size) const; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index 4b851fea6e02..31cd447ed29a 100644 --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -218,7 +218,7 @@ class TypeSystem : public PluginInterface { // Creating related types virtual CompilerType - GetArrayElementType(lldb::opaque_compiler_type_t type, uint64_t *stride, + GetArrayElementType(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) = 0; virtual CompilerType GetArrayType(lldb::opaque_compiler_type_t type, diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index 7f5fdb5b0d91..69c829d21fda 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -4090,7 +4090,6 @@ unsigned TypeSystemClang::GetTypeQualifiers(lldb::opaque_compiler_type_t type) { CompilerType TypeSystemClang::GetArrayElementType(lldb::opaque_compiler_type_t type, - uint64_t *stride, ExecutionContextScope *exe_scope) { if (type) { clang::QualType qual_type(GetQualType(type)); @@ -4101,14 +4100,7 @@ TypeSystemClang::GetArrayElementType(lldb::opaque_compiler_type_t type, if (!array_eletype) return CompilerType(); - CompilerType element_type = GetType(clang::QualType(array_eletype, 0)); - - // TODO: the real stride will be >= this value.. find the real one! - if (stride) - if (Optional<uint64_t> size = element_type.GetByteSize(exe_scope)) - *stride = *size; - - return element_type; + return GetType(clang::QualType(array_eletype, 0)); } return CompilerType(); } diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index 78c45ae32d3b..399743a72f76 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -689,7 +689,6 @@ class TypeSystemClang : public TypeSystem { uint32_t opaque_payload); CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type, - uint64_t *stride, ExecutionContextScope *exe_scope) override; CompilerType GetArrayType(lldb::opaque_compiler_type_t type, diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp index c27bba26a208..2d2d8c3463c4 100644 --- a/lldb/source/Symbol/CompilerType.cpp +++ b/lldb/source/Symbol/CompilerType.cpp @@ -317,10 +317,10 @@ unsigned CompilerType::GetTypeQualifiers() const { // Creating related types -CompilerType CompilerType::GetArrayElementType(ExecutionContextScope *exe_scope, - uint64_t *stride) const { +CompilerType +CompilerType::GetArrayElementType(ExecutionContextScope *exe_scope) const { if (IsValid()) { - return m_type_system->GetArrayElementType(m_type, stride, exe_scope); + return m_type_system->GetArrayElementType(m_type, exe_scope); } return CompilerType(); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits