Skip to content

[clang-tidy] Check request: suggest usage of llvm::dyn_cast_if_present, llvm::cast_if_present and llvm::isa_and_present #168103

@denzor200

Description

@denzor200

before:

const auto *ICE = S ? dyn_cast<ImplicitCastExpr>(S) : nullptr;
const bool IsParen = S ? isa<ParenExpr>(S) : false;
auto *Inst = Val ? cast<Instruction>(Val)  : nullptr;

after:

const auto *ICE = dyn_cast_if_present<ImplicitCastExpr>(S);
const bool IsParen = isa_and_present<ParenExpr>(S);
auto *Inst = cast_if_present<Instruction>(Val);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions