- Mark the following methods const:
- ArrayAttr::getAsRange
- ArrayAttr::getAsValueRange
- DictionaryAttr::getAs(StringRef)
- Add a DictionarAttr::getAs(Identifier) overload that may be faster in some cases.
Details
Details
- Reviewers
rriddle - Commits
- rG41eb2cec4798: [MLIR] Mark additional builtin attr methods const
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/include/mlir/IR/BuiltinAttributes.h | ||
---|---|---|
13 ↗ | (On Diff #350311) | Please try to avoid the need for an extra dependency here. |
mlir/include/mlir/IR/BuiltinAttributes.h | ||
---|---|---|
13 ↗ | (On Diff #350311) | Done. Only way I found to avoid this is to make getAs generic over the type of its name argument. Otherwise the compiler would choke on Identifier being an incomplete type, requiring all places that include BuiltinAttributes.h to also include Identifier.h. With the template the only place where this is necessary are call sites that pass in an Identifier, which are already very likely to include the appropriate header. |
mlir/include/mlir/IR/BuiltinAttributes.td | ||
---|---|---|
349 | nit; You'll likely want to do NameClass && here. |
mlir/include/mlir/IR/BuiltinAttributes.td | ||
---|---|---|
349 | Added in 41135a4367a7. |
nit; You'll likely want to do NameClass && here.