[flang-commits] [mlir] [flang] Make MLIR Value more consistent in terms of `const` "correctness" (NFC) (PR #72765)

Mehdi Amini via flang-commits flang-commits at lists.llvm.org
Mon Nov 20 14:32:57 PST 2023


================
@@ -335,8 +335,9 @@ namespace llvm {
     MutableArrayRef(T *begin, T *end) : ArrayRef<T>(begin, end) {}
 
     /// Construct a MutableArrayRef from a SmallVector.
-    /*implicit*/ MutableArrayRef(SmallVectorImpl<T> &Vec)
-    : ArrayRef<T>(Vec) {}
+    template <typename U>
+    /*implicit*/ MutableArrayRef(const SmallVectorTemplateCommon<T, U> &Vec)
+        : ArrayRef<T>(Vec) {}
----------------
joker-eph wrote:

Const seems incorrect here, but this file isn't touched in this revision anymore (in case you missed the revert in the current diff).

> Didn't figure it was NFC - it makes the ctor usable with a wider range of types, so I'd expect the unit test to reflect that wider contract.

We can make something compile that didn't compile before is still NFC to me.
Also we can go all the way with unit-tests, but that's not the historical practice though, there is likely a good middle ground in terms of unit-tests (and historically we've been a bit overly lax on it IMO), but I'm not sure where's the limit here (at some point I'm concerned when the incentives becomes "wrong" and improvements are not done because people prefer to work around instead of jumping through all the hoops).


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


More information about the flang-commits mailing list