[all-commits] [llvm/llvm-project] f0d2a5: Restore isa<Ty>(X) asserts inside cast<Ty>(X)

Philip Reames via All-commits all-commits at lists.llvm.org
Wed Jun 8 07:32:57 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f0d2a55d3aa68827ad708a16650bb0b341ca65bb
      https://github.com/llvm/llvm-project/commit/f0d2a55d3aa68827ad708a16650bb0b341ca65bb
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2022-06-08 (Wed, 08 Jun 2022)

  Changed paths:
    M llvm/include/llvm/Support/Casting.h

  Log Message:
  -----------
  Restore isa<Ty>(X) asserts inside cast<Ty>(X)

PLEASE DO NOT REVERT without careful consideration, and preferably prior
discussion.

cast<Ty>(X) is a "checked cast". Its entire purpose is explicitly documented
(https://llvm.org/docs/ProgrammersManual.html#the-isa-cast-and-dyn-cast
templates) as catching bad casts by asserting that the cast is valid.
Unfortunately, in a recent rewrite of our casting infrastructure about three
months back, these asserts got dropped.

This is discussed in more detail on discourse in https://discourse.llvm.org/t/cast-x-is-broken-implications-and-proposal-to-address/63033.

Differential Revision: https://reviews.llvm.org/D127231




More information about the All-commits mailing list