[lldb][NFC] Remove stride parameter from GetArrayElementType
authorRaphael Isemann <teemperor@gmail.com>
Mon, 17 Aug 2020 08:18:38 +0000 (10:18 +0200)
committerRaphael Isemann <teemperor@gmail.com>
Mon, 17 Aug 2020 08:19:51 +0000 (10:19 +0200)
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

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

index 7d5d71c..c5e1977 100644 (file)
@@ -177,8 +177,7 @@ public:
 
   /// 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;
 
index 4b851fe..31cd447 100644 (file)
@@ -218,7 +218,7 @@ public:
   // 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,
index 7f5fdb5..69c829d 100644 (file)
@@ -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();
 }
index 78c45ae..399743a 100644 (file)
@@ -689,7 +689,6 @@ public:
                     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,
index c27bba2..2d2d8c3 100644 (file)
@@ -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();
 }