[mlir][examples] Use {} instead of std::nullopt (NFC) (#146949)
This patch fixes deprecation warnings like: mlir/include/mlir/IR/TypeRange.h:51:19: error: 'ArrayRef' is deprecated: Use {} or ArrayRef<T>() instead [-Werror,-Wdeprecated-declarations]
This commit is contained in:
parent
2910c24638
commit
96f7f22825
@ -120,7 +120,7 @@ private:
|
||||
// Arguments type are uniformly unranked tensors.
|
||||
llvm::SmallVector<mlir::Type, 4> argTypes(proto.getArgs().size(),
|
||||
getType(VarType{}));
|
||||
auto funcType = builder.getFunctionType(argTypes, std::nullopt);
|
||||
auto funcType = builder.getFunctionType(argTypes, {});
|
||||
return builder.create<mlir::toy::FuncOp>(location, proto.getName(),
|
||||
funcType);
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ private:
|
||||
// Arguments type are uniformly unranked tensors.
|
||||
llvm::SmallVector<mlir::Type, 4> argTypes(proto.getArgs().size(),
|
||||
getType(VarType{}));
|
||||
auto funcType = builder.getFunctionType(argTypes, std::nullopt);
|
||||
auto funcType = builder.getFunctionType(argTypes, /*results=*/{});
|
||||
return builder.create<mlir::toy::FuncOp>(location, proto.getName(),
|
||||
funcType);
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ private:
|
||||
// Arguments type are uniformly unranked tensors.
|
||||
llvm::SmallVector<mlir::Type, 4> argTypes(proto.getArgs().size(),
|
||||
getType(VarType{}));
|
||||
auto funcType = builder.getFunctionType(argTypes, std::nullopt);
|
||||
auto funcType = builder.getFunctionType(argTypes, /*results=*/{});
|
||||
return builder.create<mlir::toy::FuncOp>(location, proto.getName(),
|
||||
funcType);
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ private:
|
||||
// Arguments type are uniformly unranked tensors.
|
||||
llvm::SmallVector<mlir::Type, 4> argTypes(proto.getArgs().size(),
|
||||
getType(VarType{}));
|
||||
auto funcType = builder.getFunctionType(argTypes, std::nullopt);
|
||||
auto funcType = builder.getFunctionType(argTypes, /*results=*/{});
|
||||
return builder.create<mlir::toy::FuncOp>(location, proto.getName(),
|
||||
funcType);
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ private:
|
||||
// Arguments type are uniformly unranked tensors.
|
||||
llvm::SmallVector<mlir::Type, 4> argTypes(proto.getArgs().size(),
|
||||
getType(VarType{}));
|
||||
auto funcType = builder.getFunctionType(argTypes, std::nullopt);
|
||||
auto funcType = builder.getFunctionType(argTypes, /*results=*/{});
|
||||
return builder.create<mlir::toy::FuncOp>(location, proto.getName(),
|
||||
funcType);
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ private:
|
||||
return nullptr;
|
||||
argTypes.push_back(type);
|
||||
}
|
||||
auto funcType = builder.getFunctionType(argTypes, std::nullopt);
|
||||
auto funcType = builder.getFunctionType(argTypes, /*results=*/{});
|
||||
return builder.create<mlir::toy::FuncOp>(location, proto.getName(),
|
||||
funcType);
|
||||
}
|
||||
@ -441,10 +441,10 @@ private:
|
||||
for (auto &var : lit.getValues()) {
|
||||
if (auto *number = llvm::dyn_cast<NumberExprAST>(var.get())) {
|
||||
attrElements.push_back(getConstantAttr(*number));
|
||||
typeElements.push_back(getType(std::nullopt));
|
||||
typeElements.push_back(getType(/*shape=*/{}));
|
||||
} else if (auto *lit = llvm::dyn_cast<LiteralExprAST>(var.get())) {
|
||||
attrElements.push_back(getConstantAttr(*lit));
|
||||
typeElements.push_back(getType(std::nullopt));
|
||||
typeElements.push_back(getType(/*shape=*/{}));
|
||||
} else {
|
||||
auto *structLit = llvm::cast<StructLiteralExprAST>(var.get());
|
||||
auto attrTypePair = getConstantAttr(*structLit);
|
||||
|
Loading…
x
Reference in New Issue
Block a user