Commit a7a634aa authored by Aleksandr Bezzubikov's avatar Aleksandr Bezzubikov
Browse files

[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
parent 1acbc21d
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment