From f168f831cce9e161612f4734b578e72f50ef7f85 Mon Sep 17 00:00:00 2001 From: David Stuttard Date: Thu, 25 Sep 2025 09:54:46 +0100 Subject: [PATCH 1/2] Fix up warnings Change use of ArrayRef into {} Change deprecated getValues into getElements --- lib/TableGen/Operations.cpp | 4 ++-- test/example/generated/ExampleDialect.cpp.inc | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/TableGen/Operations.cpp b/lib/TableGen/Operations.cpp index 0350219..c6b479e 100644 --- a/lib/TableGen/Operations.cpp +++ b/lib/TableGen/Operations.cpp @@ -322,7 +322,7 @@ void OperationBase::parseValueTraits(raw_ostream &errs, RecordTy *record, } const ListInit *List = record->getValueAsListInit("value_traits"); - for (const Init *I : List->getValues()) { + for (const Init *I : List->getElements()) { if (const DagInit *DI = dyn_cast(I)) { if (DI->getNumArgs() != 1) { errs << "value_traits " << *DI << " is missing argument name"; @@ -840,7 +840,7 @@ void BuilderMethod::emitDefinition(raw_ostream &out, FmtContext &fmt, )", &fmt); } else { - out << tgfmt("return ::llvm::cast<$_op>($_builder.CreateCall($fn, std::nullopt, $_instname));\n", + out << tgfmt("return ::llvm::cast<$_op>($_builder.CreateCall($fn, {}, $_instname));\n", &fmt); } diff --git a/test/example/generated/ExampleDialect.cpp.inc b/test/example/generated/ExampleDialect.cpp.inc index a7949fc..6f817b8 100644 --- a/test/example/generated/ExampleDialect.cpp.inc +++ b/test/example/generated/ExampleDialect.cpp.inc @@ -1007,7 +1007,7 @@ source assert(fn.getFunctionType() == fnType); assert(::llvm::cast<::llvm::Function>(fn.getCallee())->getFunctionType() == fn.getFunctionType()); - return ::llvm::cast(b.CreateCall(fn, std::nullopt, instName)); + return ::llvm::cast(b.CreateCall(fn, {}, instName)); } @@ -1692,7 +1692,7 @@ instName assert(fn.getFunctionType() == fnType); assert(::llvm::cast<::llvm::Function>(fn.getCallee())->getFunctionType() == fn.getFunctionType()); - return ::llvm::cast(b.CreateCall(fn, std::nullopt, instName)); + return ::llvm::cast(b.CreateCall(fn, {}, instName)); } @@ -1743,7 +1743,7 @@ instName assert(fn.getFunctionType() == fnType); assert(::llvm::cast<::llvm::Function>(fn.getCallee())->getFunctionType() == fn.getFunctionType()); - return ::llvm::cast(b.CreateCall(fn, std::nullopt, instName)); + return ::llvm::cast(b.CreateCall(fn, {}, instName)); } @@ -1797,7 +1797,7 @@ instName assert(fn.getFunctionType() == fnType); assert(::llvm::cast<::llvm::Function>(fn.getCallee())->getFunctionType() == fn.getFunctionType()); - return ::llvm::cast(b.CreateCall(fn, std::nullopt, instName)); + return ::llvm::cast(b.CreateCall(fn, {}, instName)); } @@ -1854,7 +1854,7 @@ instName assert(fn.getFunctionType() == fnType); assert(::llvm::cast<::llvm::Function>(fn.getCallee())->getFunctionType() == fn.getFunctionType()); - return ::llvm::cast(b.CreateCall(fn, std::nullopt, instName)); + return ::llvm::cast(b.CreateCall(fn, {}, instName)); } From 69847f97d0b76726a5f3c14667cb91a60f6d5dab Mon Sep 17 00:00:00 2001 From: David Stuttard Date: Thu, 25 Sep 2025 10:10:14 +0100 Subject: [PATCH 2/2] Cater for llvm versions --- lib/TableGen/Operations.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/TableGen/Operations.cpp b/lib/TableGen/Operations.cpp index c6b479e..6705c18 100644 --- a/lib/TableGen/Operations.cpp +++ b/lib/TableGen/Operations.cpp @@ -322,7 +322,13 @@ void OperationBase::parseValueTraits(raw_ostream &errs, RecordTy *record, } const ListInit *List = record->getValueAsListInit("value_traits"); - for (const Init *I : List->getElements()) { + for (const Init *I : List-> +#if LLVM_MAIN_REVISION && LLVM_MAIN_REVISION < 538013 + getValues() +#else + getElements() +#endif + ) { if (const DagInit *DI = dyn_cast(I)) { if (DI->getNumArgs() != 1) { errs << "value_traits " << *DI << " is missing argument name";