[PATCH] D123901: [LLVM][Casting.h] Allow dyn_cast to return Optional for types that are not constructble from nullptr.

Aman LaChapelle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 16 11:38:31 PDT 2022


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

This will allow types that could not previously use the LLVM RTTI infrastructure to use it by simply utilizing llvm::Optional. Also adds dyn_cast_or_none for convenient optional chaining.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123901

Files:
  llvm/include/llvm/Support/Casting.h
  llvm/unittests/Support/Casting.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123901.423248.patch
Type: text/x-patch
Size: 6545 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220416/b43a513c/attachment.bin>


More information about the llvm-commits mailing list