[PATCH] D147991: [LLVM][Casting.h] Fix dyn_cast for std::unique_ptr.

Aman LaChapelle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 07:43:46 PDT 2023


bzcheeseman added a comment.

In D147991#4260252 <https://reviews.llvm.org/D147991#4260252>, @zuban32 wrote:

> Oh, you're right, haven't tried that yet but I'm pretty sure that's what's going to happen. I think we could just make dyn_cast take lvalue reference to `unique_ptr` instead of an rvalue one, then check it with `isa<>`, and then either move the pointer further or just return nullptr leaving the original pointer intact. I'll update the patch

Thanks! I think we want dyn_cast to consume its input *if it works* and leave it alone if not. Would you mind also dropping a comment to this effect, please?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147991/new/

https://reviews.llvm.org/D147991



More information about the llvm-commits mailing list