Skip to content

[MLIR] correct return type of parse() functions #120180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2114,8 +2114,8 @@ LogicalResult ObjectAttr::verify(function_ref<InFlightDiagnostic()> emitError,
}

namespace {
LogicalResult parseObject(AsmParser &odsParser, CompilationTarget &format,
StringAttr &object) {
ParseResult parseObject(AsmParser &odsParser, CompilationTarget &format,
StringAttr &object) {
std::optional<CompilationTarget> formatResult;
StringRef enumKeyword;
auto loc = odsParser.getCurrentLocation();
Expand Down
8 changes: 4 additions & 4 deletions mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ using namespace mlir::LLVM;
/// Parses DWARF expression arguments with respect to the DWARF operation
/// opcode. Some DWARF expression operations have a specific number of operands
/// and may appear in a textual form.
static LogicalResult parseExpressionArg(AsmParser &parser, uint64_t opcode,
SmallVector<uint64_t> &args);
static ParseResult parseExpressionArg(AsmParser &parser, uint64_t opcode,
SmallVector<uint64_t> &args);

/// Prints DWARF expression arguments with respect to the specific DWARF
/// operation. Some operands are printed in their textual form.
Expand Down Expand Up @@ -144,8 +144,8 @@ DIExpressionAttr DIExpressionAttr::get(MLIRContext *context) {
return get(context, ArrayRef<DIExpressionElemAttr>({}));
}

LogicalResult parseExpressionArg(AsmParser &parser, uint64_t opcode,
SmallVector<uint64_t> &args) {
ParseResult parseExpressionArg(AsmParser &parser, uint64_t opcode,
SmallVector<uint64_t> &args) {
auto operandParser = [&]() -> LogicalResult {
uint64_t operand = 0;
if (!args.empty() && opcode == llvm::dwarf::DW_OP_LLVM_convert) {
Expand Down
10 changes: 5 additions & 5 deletions mlir/test/lib/Dialect/Test/TestTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ static llvm::hash_code test::hash_value(const FieldInfo &fi) { // NOLINT
// TestCustomType
//===----------------------------------------------------------------------===//

static LogicalResult parseCustomTypeA(AsmParser &parser, int &aResult) {
static ParseResult parseCustomTypeA(AsmParser &parser, int &aResult) {
return parser.parseInteger(aResult);
}

static void printCustomTypeA(AsmPrinter &printer, int a) { printer << a; }

static LogicalResult parseCustomTypeB(AsmParser &parser, int a,
std::optional<int> &bResult) {
static ParseResult parseCustomTypeB(AsmParser &parser, int a,
std::optional<int> &bResult) {
if (a < 0)
return success();
for (int i : llvm::seq(0, a))
Expand All @@ -116,7 +116,7 @@ static void printCustomTypeB(AsmPrinter &printer, int a, std::optional<int> b) {
printer << *b;
}

static LogicalResult parseFooString(AsmParser &parser, std::string &foo) {
static ParseResult parseFooString(AsmParser &parser, std::string &foo) {
std::string result;
if (parser.parseString(&result))
return failure();
Expand All @@ -128,7 +128,7 @@ static void printFooString(AsmPrinter &printer, StringRef foo) {
printer << '"' << foo << '"';
}

static LogicalResult parseBarString(AsmParser &parser, StringRef foo) {
static ParseResult parseBarString(AsmParser &parser, StringRef foo) {
return parser.parseKeyword(foo);
}

Expand Down
Loading