| 643 | } |
| 644 | |
| 645 | void 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"( |
| 654 | PyGetSetDef PyOp($_self)::py_getsetters[] = { |
| 655 | $0 |
| 656 | {NULL} /* Sentinel */ |
| 657 | }; |
| 658 | )", |
| 659 | &ctx, llvm::join(llvm::map_range(op.getMgbAttributes(), f), "\n ")); |
| 660 | } |
| 661 | |
| 662 | void OpDefEmitter::emit_py_methods() { |
| 663 | // generate methods |
nothing calls this directly
no test coverage detected