Skip to content

Commit

Permalink
[mlir] use raw function pointer instead of std::function
Browse files Browse the repository at this point in the history
Accessing the target of std::function apparently requires RTTI, use a
raw pointer instead.
  • Loading branch information
ftynse committed Oct 11, 2022
1 parent 6547565 commit a609f56
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mlir/include/mlir/Dialect/Transform/IR/TransformDialect.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ void TransformDialect::addTypeIfNotRegistered() {
auto [it, inserted] = typeParsingHooks.try_emplace(mnemonic, Type::parse);
if (!inserted) {
const ExtensionTypeParsingHook &parsingHook = it->getValue();
if (*parsingHook.target<mlir::Type (*)(AsmParser &)>() != &Type::parse)
if (parsingHook != &Type::parse)
reportDuplicateTypeRegistration(mnemonic);
else
return;
Expand Down
3 changes: 1 addition & 2 deletions mlir/include/mlir/Dialect/Transform/IR/TransformDialect.td
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,7 @@ def Transform_Dialect : Dialect {

/// Parser callback for an individual type registered by this dialect or
/// its extensions.
using ExtensionTypeParsingHook =
std::function<::mlir::Type (::mlir::AsmParser &)>;
using ExtensionTypeParsingHook = ::mlir::Type (*)(::mlir::AsmParser &);

/// Printer callback for an individual type registered by this dialect or
/// its extensions.
Expand Down

0 comments on commit a609f56

Please sign in to comment.