[all-commits] [llvm/llvm-project] a4f81b: [mlir] ODS: emit interface traits outside of the i...
ftynse via All-commits
all-commits at lists.llvm.org
Thu Jun 17 01:25:49 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a4f81b2054c30954c6739532b923f2b223bc7d77
https://github.com/llvm/llvm-project/commit/a4f81b2054c30954c6739532b923f2b223bc7d77
Author: Alex Zinenko <zinenko at google.com>
Date: 2021-06-17 (Thu, 17 Jun 2021)
Changed paths:
M mlir/docs/Interfaces.md
M mlir/include/mlir/Interfaces/ControlFlowInterfaces.td
M mlir/tools/mlir-tblgen/OpInterfacesGen.cpp
Log Message:
-----------
[mlir] ODS: emit interface traits outside of the interface class
ODS currently emits the interface trait class as a nested class inside the
interface class. As an unintended consequence, the default implementations of
interface methods have implicit access to static fields of the interface class,
e.g. those declared in `extraClassDeclaration`, including private methods (!),
or in the parent class. This may break the use of default implementations for
external models, which are not defined in the interface class, and generally
complexifies the abstraction.
Emit intraface traits outside of the interface class itself to avoid accidental
implicit visibility. Public static fields can still be accessed via explicit
qualification with a class name, e.g., `MyOpInterface::staticMethod()` instead
of `staticMethod`.
Update the documentation to clarify the role of `extraClassDeclaration` in
interfaces.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D104384
More information about the All-commits
mailing list