llvm-redundant-casting¶
Points out uses of cast<>, dyn_cast<> and their or_null variants
that are unnecessary because the argument already is of the target type, or a
derived type thereof.
struct A {};
A a;
// Finds:
A x = cast<A>(a);
// replaced by:
A x = a;
struct B : public A {};
B b;
// Finds:
A y = cast<A>(b);
// replaced by:
A y = b;
- Supported functions:
llvm::castllvm::cast_or_nullllvm::cast_if_presentllvm::dyn_castllvm::dyn_cast_or_nullllvm::dyn_cast_if_present