[flang-commits] [flang] [Flang][Lower] NFC: Replace SmallVector with more suitable alternatives (PR #85227)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Fri Mar 15 06:28:12 PDT 2024


================
@@ -620,7 +620,7 @@ class TypeInfo {
   }
 
   // Returns the shape of array types.
-  const llvm::SmallVector<int64_t> &getShape() const { return shape; }
+  llvm::ArrayRef<int64_t> getShape() const { return shape; }
----------------
skatrak wrote:

I get what you say. The idea with this change was mainly to avoid giving users too much detail on how the shape is stored internally. They shouldn't care whether it is stored as a `SmallVector`, an `std::vector` or anything else. By returning a more generic `ArrayRef` interface we prevent users from relying on `SmallVector`-specific features, allowing us to easily change the container if we need to later on. So, if that's ok, I'd prefer keeping the change.

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


More information about the flang-commits mailing list