diff options
| author | Chris Lattner <clattner@nondot.org> | 2021-03-21 10:24:20 -0700 |
|---|---|---|
| committer | Chris Lattner <clattner@nondot.org> | 2021-03-22 11:18:21 -0700 |
| commit | 6874726610cc2f9eea7fa828c8585bf84969f9c3 (patch) | |
| tree | 6c04b6781a18eb03bb28a4a3698a0e93f96fd1d4 /lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp | |
| parent | f21704e080a04580ef837822244a624c6e2e7cac (diff) | |
[PatternMatching] Add convenience insert method to OwningRewritePatternList. NFC.
This allows adding a C function pointer as a matchAndRewrite style pattern, which
is a very common case. This adopts it in ExpandTanh to show how it reduces a level
of nesting.
We could allow C++ lambdas here, but that doesn't work as well with type inference
in the common case. Instead of:
patterns.insert(convertTanhOp);
you need to specify:
patterns.insert<math::TanhOp>(convertTanhOp);
which is boilerplate'y. Capturing state like this is very uncommon, so we choose
to require clients to define their own structs and use the non-convenience method
when they need to do so.
Differential Revision: https://reviews.llvm.org/D99039
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp')
0 files changed, 0 insertions, 0 deletions
