[llvm] [LLVM] Use {} instead of std::nullopt to initialize empty ArrayRef (PR #109133)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 06:08:04 PDT 2024


================
@@ -1450,7 +1450,8 @@ bool AArch64CallLowering::lowerCall(MachineIRBuilder &MIRBuilder,
     if (!determineAndHandleAssignments(
             UsingReturnedArg ? ReturnedArgHandler : Handler, Assigner, InArgs,
             MIRBuilder, Info.CallConv, Info.IsVarArg,
-            UsingReturnedArg ? ArrayRef(OutArgs[0].Regs) : std::nullopt))
+            UsingReturnedArg ? ArrayRef(OutArgs[0].Regs)
+                             : ArrayRef<Register>()))
----------------
jayfoad wrote:

Couldn't use `{}` here due to:
```
lib/Target/AArch64/GISel/AArch64CallLowering.cpp:1453:58: error: initializer list cannot be used on the right hand side of operator ':'
```

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


More information about the llvm-commits mailing list