[clang] f20ef85 - [CIR][NFC] Fix init llvm::ArrayRef warning (#146147)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 27 13:39:31 PDT 2025


Author: Amr Hesham
Date: 2025-06-27T22:39:28+02:00
New Revision: f20ef8520ddc5c8dfa925b7a6be3aad7622ffc17

URL: https://github.com/llvm/llvm-project/commit/f20ef8520ddc5c8dfa925b7a6be3aad7622ffc17
DIFF: https://github.com/llvm/llvm-project/commit/f20ef8520ddc5c8dfa925b7a6be3aad7622ffc17.diff

LOG: [CIR][NFC] Fix init llvm::ArrayRef warning (#146147)

Fix init llvm::ArrayRef deprecation warning when initialized with
std::nullopt

Added: 
    

Modified: 
    clang/lib/CIR/CodeGen/CIRGenCall.cpp
    clang/lib/CIR/CodeGen/CIRGenFunction.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/CIR/CodeGen/CIRGenCall.cpp b/clang/lib/CIR/CodeGen/CIRGenCall.cpp
index 9c9c96604c168..163d0dbfec3dc 100644
--- a/clang/lib/CIR/CodeGen/CIRGenCall.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenCall.cpp
@@ -404,7 +404,7 @@ CIRGenTypes::arrangeFunctionDeclaration(const FunctionDecl *fd) {
           funcTy.getAs<FunctionNoProtoType>()) {
     assert(!cir::MissingFeatures::opCallCIRGenFuncInfoExtParamInfo());
     assert(!cir::MissingFeatures::opCallFnInfoOpts());
-    return arrangeCIRFunctionInfo(noProto->getReturnType(), std::nullopt,
+    return arrangeCIRFunctionInfo(noProto->getReturnType(), {},
                                   RequiredArgs::All);
   }
 

diff  --git a/clang/lib/CIR/CodeGen/CIRGenFunction.h b/clang/lib/CIR/CodeGen/CIRGenFunction.h
index 7e6fdf130cca1..759b83cb7c11f 100644
--- a/clang/lib/CIR/CodeGen/CIRGenFunction.h
+++ b/clang/lib/CIR/CodeGen/CIRGenFunction.h
@@ -894,9 +894,8 @@ class CIRGenFunction : public CIRGenTypeCache {
 
   // Build CIR for a statement. useCurrentScope should be true if no
   // new scopes need be created when finding a compound statement.
-  mlir::LogicalResult
-  emitStmt(const clang::Stmt *s, bool useCurrentScope,
-           llvm::ArrayRef<const Attr *> attrs = std::nullopt);
+  mlir::LogicalResult emitStmt(const clang::Stmt *s, bool useCurrentScope,
+                               llvm::ArrayRef<const Attr *> attrs = {});
 
   mlir::LogicalResult emitSimpleStmt(const clang::Stmt *s,
                                      bool useCurrentScope);


        


More information about the cfe-commits mailing list