Files
clang-p2996/llvm/unittests/Support/Casting.cpp
Aleksandr Bezzubikov a7a634aa2b [LLVM][Casting.h] Fix dyn_cast for std::unique_ptr.
Unlike isa<> and cast<>, current implementation of dyn_cast<> fails
to process a std::unique_ptr to a class supporting LLVM RTTI:

// A and B support LLVM RTTI
class A {...}
class B: public A {...}

void foo() {
...
  auto V = std::make_unique<A>();
  auto VB = dyn_cast<B>(std::move(V));
  if (VB)
    ...
...
}

Reviewed By: lattner, bzcheeseman

Differential Revision: https://reviews.llvm.org/D147991
2023-08-13 18:04:19 -07:00

16 KiB