summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
diff options
context:
space:
mode:
authorMogball <jeffniu22@gmail.com>2022-01-06 01:42:12 +0000
committerMogball <jeffniu22@gmail.com>2022-01-06 01:43:26 +0000
commitb0774e5f500b5bb68451ee3f0590035d0f6e4e54 (patch)
tree1a00bb6b4d4a29f8dc9caea2de2492fd95b075e6 /lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
parent0f5b718030e7112773ff4e88dd026204ba5b2890 (diff)
[mlir][ods] ODS ops get an `extraClassDefinition`
Extra definitions are placed in the generated source file for each op class. The substitution `$cppClass` is replaced by the op's C++ class name. This is useful when declaring but not defining methods in TableGen base classes: ``` class BaseOp<string mnemonic> : Op<MyDialect, mnemonic, [DeclareOpInterfaceMethods<SomeInterface>] { let extraClassDeclaration = [{ // ZOp is declared at at the bottom of the file and is incomplete here ZOp getParent(); }]; let extraClassDefinition = [{ int $cppClass::someInterfaceMethod() { return someUtilityFunction(*this); } ZOp $cppClass::getParent() { return dyn_cast<ZOp>(this->getParentOp()); } }]; } ``` Certain things may prevent defining these functions inline, in the declaration. In this example, `ZOp` in the same dialect is incomplete at the function declaration because ops classes are declared in alphabetical order. Alternatively, functions may be too big to be desired as inlined, or they may require dependencies that create cyclic includes, or they may be calling a templated utility function that one may not want to expose in a header. If the functions are not inlined, then inheriting from the base class N times means that each function will need to be defined N times. With `extraClassDefinitions`, they only need to be defined once. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D115783
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp')
0 files changed, 0 insertions, 0 deletions