[Mlir-commits] [mlir] 019e207 - [mlir][NFC] Tidy up the doc comment on CastInfo for Types

River Riddle llvmlistbot at llvm.org
Tue Sep 20 23:46:19 PDT 2022


Author: River Riddle
Date: 2022-09-20T23:45:38-07:00
New Revision: 019e20758542823372e36fbd04ca9dc8b3f6b088

URL: https://github.com/llvm/llvm-project/commit/019e20758542823372e36fbd04ca9dc8b3f6b088
DIFF: https://github.com/llvm/llvm-project/commit/019e20758542823372e36fbd04ca9dc8b3f6b088.diff

LOG: [mlir][NFC] Tidy up the doc comment on CastInfo for Types

This had quite a few grammatical errors and typos.

Added: 
    

Modified: 
    mlir/include/mlir/IR/Types.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/Types.h b/mlir/include/mlir/IR/Types.h
index 28cccd15dc8d..7f657d8f81e5 100644
--- a/mlir/include/mlir/IR/Types.h
+++ b/mlir/include/mlir/IR/Types.h
@@ -334,16 +334,16 @@ struct CastInfo<
                      std::is_base_of_v<mlir::Type, From>>>
     : NullableValueCastFailed<To>,
       DefaultDoCastIfPossible<To, From, CastInfo<To, From>> {
-  /// Arguments are taken as mlir::Type here and not as From.
-  /// Because when casting from an intermediate type of the hierarchy to one of
-  /// its children, the val.getTypeID() inside T::classof will use the static
-  /// getTypeID of the parent instead of the non-static Type::getTypeID return
-  /// the dynamic ID. so T::classof would end up comparing the static TypeID of
-  /// The children to the static TypeID of its parent making it impossible to
-  /// downcast from the parent to the child
+  /// Arguments are taken as mlir::Type here and not as `From`, because when
+  /// casting from an intermediate type of the hierarchy to one of its children,
+  /// the val.getTypeID() inside T::classof will use the static getTypeID of the
+  /// parent instead of the non-static Type::getTypeID that returns the dynamic
+  /// ID. This means that T::classof would end up comparing the static TypeID of
+  /// the children to the static TypeID of its parent, making it impossible to
+  /// downcast from the parent to the child.
   static inline bool isPossible(mlir::Type ty) {
     /// Return a constant true instead of a dynamic true when casting to self or
-    /// up the hierarchy
+    /// up the hierarchy.
     return std::is_same_v<To, std::remove_const_t<From>> ||
            std::is_base_of_v<To, From> || To::classof(ty);
   }


        


More information about the Mlir-commits mailing list