[PATCH] D133221: [LLVM][Support/ADT] Add assert for isPresent to dyn_cast.

Aman LaChapelle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 2 11:44:27 PDT 2022


bzcheeseman created this revision.
Herald added a project: All.
bzcheeseman requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133221

Files:
  llvm/include/llvm/ADT/PointerUnion.h
  llvm/include/llvm/Support/Casting.h
  llvm/unittests/ADT/PointerUnionTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133221.457657.patch
Type: text/x-patch
Size: 7750 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220902/e094fefb/attachment.bin>


More information about the llvm-commits mailing list