Skip to content

Commit aed448e

Browse files
committed
[CIR] Fix many new warnings on Darwin with most recent developer tools
1 parent aeac352 commit aed448e

File tree

13 files changed

+31
-60
lines changed

13 files changed

+31
-60
lines changed

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,8 @@ def CIR_ReturnOp : CIR_Op<"return", [
767767

768768
// Allow building a ReturnOp with no return operand.
769769
let builders = [
770-
OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
770+
OpBuilder<(ins),
771+
[{ build($_builder, $_state, {}); }]>
771772
];
772773

773774
// Provide extra utility definitions on the c++ operation class definition.

clang/lib/Basic/LangStandards.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ StringRef clang::languageToString(Language L) {
2121
return "Asm";
2222
case Language::LLVM_IR:
2323
return "LLVM IR";
24+
case Language::CIR:
25+
return "ClangIR";
2426
case Language::C:
2527
return "C";
2628
case Language::CXX:
@@ -91,6 +93,7 @@ LangStandard::Kind clang::getDefaultLanguageStandard(clang::Language Lang,
9193
switch (Lang) {
9294
case Language::Unknown:
9395
case Language::LLVM_IR:
96+
case Language::CIR:
9497
case Language::OpenCL:
9598
return LangStandard::lang_opencl12;
9699
case Language::OpenCLCXX:

clang/lib/CIR/CodeGen/CIRGenCall.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,8 +1087,8 @@ CIRGenTypes::arrangeFreeFunctionType(CanQual<FunctionNoProtoType> FTNP) {
10871087
// When translating an unprototyped function type, always use a
10881088
// variadic type.
10891089
return arrangeCIRFunctionInfo(FTNP->getReturnType().getUnqualifiedType(),
1090-
cir::FnInfoOpts::None, std::nullopt,
1091-
FTNP->getExtInfo(), {}, RequiredArgs(0));
1090+
cir::FnInfoOpts::None, {}, FTNP->getExtInfo(),
1091+
{}, RequiredArgs(0));
10921092
}
10931093

10941094
const CIRGenFunctionInfo &
@@ -1370,7 +1370,7 @@ CIRGenTypes::arrangeFunctionDeclaration(const FunctionDecl *FD) {
13701370
// type.
13711371
if (CanQual<FunctionNoProtoType> noProto = FTy.getAs<FunctionNoProtoType>()) {
13721372
return arrangeCIRFunctionInfo(noProto->getReturnType(),
1373-
cir::FnInfoOpts::None, std::nullopt,
1373+
cir::FnInfoOpts::None, {},
13741374
noProto->getExtInfo(), {}, RequiredArgs::All);
13751375
}
13761376

clang/lib/CIR/CodeGen/CIRGenDecl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,7 @@ void CIRGenFunction::emitDecl(const Decl &D) {
772772
switch (D.getKind()) {
773773
case Decl::ImplicitConceptSpecialization:
774774
case Decl::HLSLBuffer:
775+
case Decl::HLSLRootSignature:
775776
case Decl::TopLevelStmt:
776777
case Decl::OpenACCDeclare:
777778
case Decl::OpenACCRoutine:

clang/lib/CIR/CodeGen/CIRGenFunction.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ cir::TypeEvaluationKind CIRGenFunction::getEvaluationKind(QualType type) {
8383

8484
case Type::ArrayParameter:
8585
case Type::HLSLAttributedResource:
86+
case Type::HLSLInlineSpirv:
8687
llvm_unreachable("NYI");
8788

8889
case Type::Auto:
@@ -1786,6 +1787,8 @@ void CIRGenFunction::emitVariablyModifiedType(QualType type) {
17861787
case clang::Type::PackIndexing:
17871788
case clang::Type::ArrayParameter:
17881789
case clang::Type::HLSLAttributedResource:
1790+
case clang::Type::HLSLInlineSpirv:
1791+
case clang::Type::PredefinedSugar:
17891792
llvm_unreachable("NYI");
17901793

17911794
#define TYPE(Class, Base)

clang/lib/CIR/CodeGen/CIRGenFunction.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,7 +2029,7 @@ class CIRGenFunction : public CIRGenTypeCache {
20292029

20302030
mlir::LogicalResult
20312031
emitCXXForRangeStmt(const CXXForRangeStmt &S,
2032-
llvm::ArrayRef<const Attr *> Attrs = std::nullopt);
2032+
llvm::ArrayRef<const Attr *> Attrs = {});
20332033

20342034
RValue emitCXXMemberCallExpr(const clang::CXXMemberCallExpr *E,
20352035
ReturnValueSlot ReturnValue);
@@ -2387,9 +2387,8 @@ class CIRGenFunction : public CIRGenTypeCache {
23872387

23882388
// Build CIR for a statement. useCurrentScope should be true if no
23892389
// new scopes need be created when finding a compound statement.
2390-
mlir::LogicalResult
2391-
emitStmt(const clang::Stmt *S, bool useCurrentScope,
2392-
llvm::ArrayRef<const Attr *> Attrs = std::nullopt);
2390+
mlir::LogicalResult emitStmt(const clang::Stmt *S, bool useCurrentScope,
2391+
llvm::ArrayRef<const Attr *> Attrs = {});
23932392

23942393
LValue emitStmtExprLValue(const StmtExpr *E);
23952394

clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,6 +1578,7 @@ void CIRGenItaniumRTTIBuilder::BuildVTablePointer(mlir::Location loc,
15781578
switch (Ty->getTypeClass()) {
15791579
case Type::ArrayParameter:
15801580
case Type::HLSLAttributedResource:
1581+
case Type::HLSLInlineSpirv:
15811582
llvm_unreachable("NYI");
15821583
#define TYPE(Class, Base)
15831584
#define ABSTRACT_TYPE(Class, Base)
@@ -1954,6 +1955,7 @@ mlir::Attribute CIRGenItaniumRTTIBuilder::BuildTypeInfo(
19541955
switch (Ty->getTypeClass()) {
19551956
case Type::ArrayParameter:
19561957
case Type::HLSLAttributedResource:
1958+
case Type::HLSLInlineSpirv:
19571959
llvm_unreachable("NYI");
19581960
#define TYPE(Class, Base)
19591961
#define ABSTRACT_TYPE(Class, Base)

clang/lib/CIR/CodeGen/CIRGenTypes.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ mlir::Type CIRGenTypes::convertType(QualType T) {
372372

373373
case Type::ArrayParameter:
374374
case Type::HLSLAttributedResource:
375+
case Type::HLSLInlineSpirv:
375376
llvm_unreachable("NYI");
376377

377378
case Type::Builtin: {

clang/lib/CIR/Dialect/IR/CIRDialect.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,10 +2491,9 @@ void cir::FuncOp::build(OpBuilder &builder, OperationState &result,
24912491
if (argAttrs.empty())
24922492
return;
24932493

2494-
call_interface_impl::addArgAndResultAttrs(builder, result, argAttrs,
2495-
/*resultAttrs=*/std::nullopt,
2496-
getArgAttrsAttrName(result.name),
2497-
getResAttrsAttrName(result.name));
2494+
call_interface_impl::addArgAndResultAttrs(
2495+
builder, result, argAttrs, ArrayRef<DictionaryAttr>{},
2496+
getArgAttrsAttrName(result.name), getResAttrsAttrName(result.name));
24982497
}
24992498

25002499
ParseResult cir::FuncOp::parse(OpAsmParser &parser, OperationState &state) {

clang/lib/CIR/Lowering/ThroughMLIR/LowerCIRToMLIR.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,8 @@ class CIRCastOpLowering : public mlir::OpConversionPattern<cir::CastOp> {
12631263
case CIR::array_to_ptrdecay: {
12641264
auto newDstType = llvm::cast<mlir::MemRefType>(convertTy(dstType));
12651265
rewriter.replaceOpWithNewOp<mlir::memref::ReinterpretCastOp>(
1266-
op, newDstType, src, 0, std::nullopt, std::nullopt);
1266+
op, newDstType, src, 0, ArrayRef<int64_t>{}, ArrayRef<int64_t>{},
1267+
ArrayRef<mlir::NamedAttribute>{});
12671268
return mlir::success();
12681269
}
12691270
case CIR::int_to_bool: {
@@ -1397,8 +1398,9 @@ class CIRGetElementOpLowering
13971398
rewriter.replaceOpWithNewOp<mlir::memref::ReinterpretCastOp>(
13981399
op, dstType, adaptor.getBase(),
13991400
/* offset */ index,
1400-
/* sizes */ std::nullopt,
1401-
/* strides */ std::nullopt);
1401+
/* sizes */ ArrayRef<mlir::OpFoldResult>{},
1402+
/* strides */ ArrayRef<mlir::OpFoldResult>{},
1403+
/* attr */ ArrayRef<mlir::NamedAttribute>{});
14021404

14031405
return mlir::success();
14041406
}
@@ -1476,7 +1478,8 @@ class CIRPtrStrideOpLowering
14761478
stride = rewriter.create<mlir::arith::IndexCastOp>(op.getLoc(), indexType,
14771479
stride);
14781480
rewriter.replaceOpWithNewOp<mlir::memref::ReinterpretCastOp>(
1479-
op, newDstType, base, stride, std::nullopt, std::nullopt);
1481+
op, newDstType, base, stride, mlir::ValueRange{}, mlir::ValueRange{},
1482+
llvm::ArrayRef<mlir::NamedAttribute>{});
14801483
rewriter.eraseOp(baseOp);
14811484
return mlir::success();
14821485
}

0 commit comments

Comments
 (0)