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

David Blaikie via flang-commits flang-commits at lists.llvm.org
Mon Nov 20 15:54:29 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) {}
----------------
dwblaikie 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).

*nod* Caught that, but figured it might be worth pointing out in case it came up again in another patch/later in a series, etc.

> We can make something compile that didn't compile before is still NFC to me.

Not sure I follow that - most changes allow things to compile that didn't before (adding a new function, etc), so I'm not sure I follow that being a relevant criteria. New (albeit fairly simple) functionality was added - ideally an existing unit test that tested the previous version of the function could be slightly modified to test the more general case. (doesn't look like there's existing test coverage, which is unfortunate - though the deduction guide test is probably/maybe close enough to extend & looks like if this ctor was changed the deduction guide should change too - I wouldn't complain too much if the deduction guide test was the only one updated when adding a feature like this, and incidentally tested the ctor too (& to some extent, ensured that the ctors and deduction guides were kept in sync)

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


More information about the flang-commits mailing list