Skip to content

Commit c2a8a10

Browse files
[MLIR][NFC] Remove unnecessary cast.
I was reading this post: https://www.fluentcpp.com/2017/05/19/crtp-helper/ And I noticed that most likely this cast is not needed. Unless it is needed by some compiler versions. I tested it with: cmake --build . --target check-mlir Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D121555
1 parent 368d35a commit c2a8a10

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

mlir/include/mlir/IR/OpDefinition.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,14 +322,8 @@ class TraitBase {
322322
protected:
323323
/// Return the ultimate Operation being worked on.
324324
Operation *getOperation() {
325-
// We have to cast up to the trait type, then to the concrete type, then to
326-
// the BaseState class in explicit hops because the concrete type will
327-
// multiply derive from the (content free) TraitBase class, and we need to
328-
// be able to disambiguate the path for the C++ compiler.
329-
auto *trait = static_cast<TraitType<ConcreteType> *>(this);
330-
auto *concrete = static_cast<ConcreteType *>(trait);
331-
auto *base = static_cast<OpState *>(concrete);
332-
return base->getOperation();
325+
auto *concrete = static_cast<ConcreteType *>(this);
326+
return concrete->getOperation();
333327
}
334328
};
335329

0 commit comments

Comments
 (0)