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

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Thu Mar 14 08:59:37 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; }
----------------
kparzysz wrote:

You don't really gain much by returning `ArrayRef` for a `const Container &`.  The flexibility of ArrayRef comes from the ability to convert multiple containers into it, the reverse isn't true (there is only a conversion to `std::vector` available).

I'll leave it up to you what you want to do with it.

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


More information about the flang-commits mailing list