[Mlir-commits] [mlir] [MLIR][TableGen] Use const pointers for various `Init` objects (PR #112316)
Rahul Joshi
llvmlistbot at llvm.org
Mon Oct 14 23:47:32 PDT 2024
================
@@ -251,13 +254,14 @@ void Generator::emitParseHelper(StringRef kind, StringRef returnType,
std::string returnType = getCType(def);
ios << "auto " << listHelperName(name) << " = [&]() -> FailureOr<"
<< returnType << "> ";
- SmallVector<Init *> args;
+ SmallVector<const Init *> args;
SmallVector<std::string> argNames;
if (def->isSubClassOf("CompositeBytecode")) {
- DagInit *members = def->getValueAsDag("members");
- args = llvm::to_vector(members->getArgs());
+ const DagInit *members = def->getValueAsDag("members");
+ args = llvm::to_vector(map_range(
+ members->getArgs(), [](Init *init) { return (const Init *)init; }));
----------------
jurahul wrote:
This map_range will go away in a subsequent change where `members->getArgs()` will return a vector of `const Init*`.
https://github.com/llvm/llvm-project/pull/112316
More information about the Mlir-commits
mailing list