[Mlir-commits] [mlir] [mlir] Fix use-after-free bugs in {RankedTensorType|VectorType}::Builder (PR #68969)

Mehdi Amini llvmlistbot at llvm.org
Tue Oct 17 14:19:50 PDT 2023


================
@@ -191,6 +191,60 @@ class BaseMemRefType : public Type, public ShapedType::Trait<BaseMemRefType> {
 
 namespace mlir {
 
+//===----------------------------------------------------------------------===//
+// CopyOnWriteArrayRef<T>
+//===----------------------------------------------------------------------===//
+
+// A wrapper around an ArrayRef<T> that copies to a SmallVector<T> on
+// modification. This is for use in the mlir::<Type>::Builders.
+template <typename T>
+class CopyOnWriteArrayRef {
----------------
joker-eph wrote:

Seems like a nice abstraction! 
Should this go in a more general header in `mlir/include/mlir/Support/` ?

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


More information about the Mlir-commits mailing list