Skip to content

Commit 9d65abb

Browse files
committed
[Heavy] Add context accessors
1 parent dfd0cb5 commit 9d65abb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

heavy/lib/Nbdl/NbdlWriter.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ class ContextWriter : public NbdlWriter<ContextWriter> {
455455
<< Op.getName() << '(' << Op.getName() << " const&) = delete;\n"
456456
<< Op.getName() << '(' << Op.getName() << "&) = delete;\n";
457457
WriteConstructor(Op);
458+
WriteAccessors();
458459
OS << "};\n";
459460
Flush();
460461
}
@@ -556,6 +557,13 @@ class ContextWriter : public NbdlWriter<ContextWriter> {
556557
SetErrorV("unsupported operation arguments", Member);
557558
}
558559
}
560+
561+
void WriteAccessors() {
562+
for (mlir::Value Value : Members) {
563+
OS << "decltype(auto) get_" << GetLocalVal(Value)
564+
<< "() const {\n return " << GetLocalVal(Value) << ";\n}\n";
565+
}
566+
}
559567
};
560568

561569
} // end namespace

0 commit comments

Comments
 (0)