[clang] [CIR] Fix mlir::ValueRange init from ArrayRef warning (PR #146577)

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 1 10:42:38 PDT 2025


https://github.com/AmrDeveloper created https://github.com/llvm/llvm-project/pull/146577

Fix initalizing ValueRange with ArrayRef `ValueRange(ArrayRef<Value>(std::forward<Arg>(arg))) {}` warning

>From fc24ac864fe0517ab8c78969d4a508c1a9baf2af Mon Sep 17 00:00:00 2001
From: AmrDeveloper <amr96 at programmer.net>
Date: Tue, 1 Jul 2025 19:40:11 +0200
Subject: [PATCH] [CIR] Fix mlir::ValueRange init from ArrayRef warning

---
 clang/include/clang/CIR/Dialect/IR/CIROps.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index 4daff74cbae5a..4d3ebfb93615d 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -489,7 +489,7 @@ def ReturnOp : CIR_Op<"return", [ParentOneOf<["FuncOp", "ScopeOp", "IfOp",
 
   // Allow building a ReturnOp with no return operand.
   let builders = [
-    OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
+    OpBuilder<(ins), [{ build($_builder, $_state, {}); }]>
   ];
 
   // Provide extra utility definitions on the c++ operation class definition.



More information about the cfe-commits mailing list