clang-tools 22.0.0git
|
Looks at conditionals and finds and replaces cases of cast<>, which will / assert rather than return a null pointer, and dyn_cast<> where / the return value is not captured. More...
#include <PreferIsaOrDynCastInConditionalsCheck.h>
Public Member Functions | |
PreferIsaOrDynCastInConditionalsCheck (StringRef Name, ClangTidyContext *Context) | |
bool | isLanguageVersionSupported (const LangOptions &LangOpts) const override |
void | registerMatchers (ast_matchers::MatchFinder *Finder) override |
void | check (const ast_matchers::MatchFinder::MatchResult &Result) override |
Looks at conditionals and finds and replaces cases of cast<>, which will / assert rather than return a null pointer, and dyn_cast<> where / the return value is not captured.
Additionally, finds and replaces cases / that match the pattern var && isa<X>(var), where var is evaluated twice.
Finds cases like these:
// Other cases are ignored, e.g.:
For the user-facing documentation see: https://clang.llvm.org/extra/clang-tidy/checks/llvm/prefer-isa-or-dyn-cast-in-conditionals.html
Definition at line 50 of file PreferIsaOrDynCastInConditionalsCheck.h.
|
inline |
Definition at line 52 of file PreferIsaOrDynCastInConditionalsCheck.h.
|
override |
Definition at line 61 of file PreferIsaOrDynCastInConditionalsCheck.cpp.
|
inlineoverride |
Definition at line 55 of file PreferIsaOrDynCastInConditionalsCheck.h.
|
override |
Definition at line 23 of file PreferIsaOrDynCastInConditionalsCheck.cpp.