Skip to content

[mlir] Revert to old fold logic in IR::Dialect::add{Types, Attributes}() #79582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions mlir/include/mlir/IR/Dialect.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,11 @@ class Dialect {
/// Register a set of type classes with this dialect.
template <typename... Args>
void addTypes() {
(addType<Args>(), ...);
// This initializer_list argument pack expansion is essentially equal to
// using a fold expression with a comma operator. Clang however, refuses
// to compile a fold expression with a depth of more than 256 by default.
// There seem to be no such limitations for initializer_list.
(void)std::initializer_list<int>{0, (addType<Args>(), 0)...};
}

/// Register a type instance with this dialect.
Expand All @@ -292,7 +296,11 @@ class Dialect {
/// Register a set of attribute classes with this dialect.
template <typename... Args>
void addAttributes() {
(addAttribute<Args>(), ...);
// This initializer_list argument pack expansion is essentially equal to
// using a fold expression with a comma operator. Clang however, refuses
// to compile a fold expression with a depth of more than 256 by default.
// There seem to be no such limitations for initializer_list.
(void)std::initializer_list<int>{0, (addAttribute<Args>(), 0)...};
}

/// Register an attribute instance with this dialect.
Expand Down