MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / emit_py_getsetters

Method emit_py_getsetters

imperative/tablegen/targets/python_c_extension.cpp:645–660  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

643}
644
645void OpDefEmitter::emit_py_getsetters() {
646 auto f = [&](auto&& attr) -> std::string {
647 return tgfmt(
648 "{const_cast<char*>(\"$0\"), py_get_generic($_self, $0), "
649 "py_set_generic($_self, $0), const_cast<char*>(\"$0\"), NULL},",
650 &ctx, attr.name);
651 };
652 os << tgfmt(
653 R"(
654PyGetSetDef PyOp($_self)::py_getsetters[] = {
655 $0
656 {NULL} /* Sentinel */
657};
658)",
659 &ctx, llvm::join(llvm::map_range(op.getMgbAttributes(), f), "\n "));
660}
661
662void OpDefEmitter::emit_py_methods() {
663 // generate methods

Callers

nothing calls this directly

Calls 1

getMgbAttributesMethod · 0.80

Tested by

no test coverage detected