[all-commits] [llvm/llvm-project] 716b9f: [LLVM][Support/ADT] Add assert for isPresent to dy...

Aman LaChapelle via All-commits all-commits at lists.llvm.org
Tue Sep 6 13:59:13 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 716b9f7a1a3ce7db89993c15855d8b89a35fc4fc
      https://github.com/llvm/llvm-project/commit/716b9f7a1a3ce7db89993c15855d8b89a35fc4fc
  Author: bzcheeseman <aman.lachapelle at gmail.com>
  Date:   2022-09-06 (Tue, 06 Sep 2022)

  Changed paths:
    M llvm/include/llvm/ADT/PointerUnion.h
    M llvm/include/llvm/Support/Casting.h
    M llvm/unittests/ADT/PointerUnionTest.cpp

  Log Message:
  -----------
  [LLVM][Support/ADT] Add assert for isPresent to dyn_cast.

This change adds an assert to dyn_cast that the value passed-in is present. In the past, this relied on the isa_impl assertion (which still works in many cases) but which we can tighten up for a better QoI.

The PointerUnion change is because it seems like (based on the call sites) the semantics of the member dyn_cast are actually dyn_cast_if_present.

Reviewed By: rriddle

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




More information about the All-commits mailing list