Make getRank abort for unranked type
authorGeoffrey Martin-Noble <gcmn@google.com>
Thu, 30 May 2019 18:01:17 +0000 (11:01 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Sun, 2 Jun 2019 03:11:12 +0000 (20:11 -0700)
commit97505013c6a9bdae6d069234be007f07e9779a76
treefcf4240d8f82e6f6bc7f8daae4a03b16b0ad8f12
parent29073d999cd6c1c00bd3006a00c854235106ac91
Make getRank abort for unranked type

    This better matches the other methods in ShapedType which only make sense for ranked types. There's now an explicit hasRank for checking the rank. Actual call sites rarely used the "-1" sentinel to combine checking for rankedness and checking that rank is a certain value. And in most cases they should actually be checking for rankedness at a higher level using type predicates. Using an explicit method is clearer than a sentinel anyway.

--

PiperOrigin-RevId: 250720853
mlir/include/mlir/IR/StandardTypes.h
mlir/lib/IR/StandardTypes.cpp