[Mlir-commits] [mlir] 564619b - Use cast<> instead of dyn_cast<> when we don't check the result (NFC)

Mehdi Amini llvmlistbot at llvm.org
Sun Jan 2 22:06:58 PST 2022


Author: Mehdi Amini
Date: 2022-01-03T06:06:36Z
New Revision: 564619b786c35fc281eea5c3c45ff29c00b3c16d

URL: https://github.com/llvm/llvm-project/commit/564619b786c35fc281eea5c3c45ff29c00b3c16d
DIFF: https://github.com/llvm/llvm-project/commit/564619b786c35fc281eea5c3c45ff29c00b3c16d.diff

LOG: Use cast<> instead of dyn_cast<> when we don't check the result (NFC)

Added: 
    

Modified: 
    mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
index f27b537d63622..638369e90c3a1 100644
--- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -2065,8 +2065,8 @@ void OpEmitter::genTypeInterfaceMethods() {
     return;
   // Generate 'inferReturnTypes' method declaration using the interface method
   // declared in 'InferTypeOpInterface' op interface.
-  const auto *trait = dyn_cast<InterfaceTrait>(
-      op.getTrait("::mlir::InferTypeOpInterface::Trait"));
+  const auto *trait =
+      cast<InterfaceTrait>(op.getTrait("::mlir::InferTypeOpInterface::Trait"));
   Interface interface = trait->getInterface();
   Method *method = [&]() -> Method * {
     for (const InterfaceMethod &interfaceMethod : interface.getMethods()) {


        


More information about the Mlir-commits mailing list