[PATCH] D59802: [clang-tidy] Add new checker: llvm-avoid-cast-in-conditional
Eugene Zelenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 28 18:22:36 PDT 2019
Eugene.Zelenko added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/llvm/AvoidCastInConditionalCheck.cpp:73
+ Result.Nodes.getNodeAs<CallExpr>("cast-assign")) {
+ auto StartLoc = MatchedDecl->getCallee()->getExprLoc();
+ auto EndLoc = StartLoc.getLocWithOffset(StringRef("cast").size() - 1);
----------------
Please don't use auto where type is not obvious.
================
Comment at: clang-tools-extra/clang-tidy/llvm/AvoidCastInConditionalCheck.cpp:74
+ auto StartLoc = MatchedDecl->getCallee()->getExprLoc();
+ auto EndLoc = StartLoc.getLocWithOffset(StringRef("cast").size() - 1);
+
----------------
Please don't use auto where type is not obvious.
================
Comment at: clang-tools-extra/clang-tidy/llvm/AvoidCastInConditionalCheck.cpp:82
+ Result.Nodes.getNodeAs<CallExpr>("cast")) {
+ auto StartLoc = MatchedDecl->getCallee()->getExprLoc();
+ auto EndLoc = StartLoc.getLocWithOffset(StringRef("cast").size() - 1);
----------------
Please don't use auto where type is not obvious.
================
Comment at: clang-tools-extra/clang-tidy/llvm/AvoidCastInConditionalCheck.cpp:83
+ auto StartLoc = MatchedDecl->getCallee()->getExprLoc();
+ auto EndLoc = StartLoc.getLocWithOffset(StringRef("cast").size() - 1);
+
----------------
Please don't use auto where type is not obvious.
================
Comment at: clang-tools-extra/clang-tidy/llvm/AvoidCastInConditionalCheck.cpp:90
+ Result.Nodes.getNodeAs<CallExpr>("dyn_cast")) {
+ auto StartLoc = MatchedDecl->getCallee()->getExprLoc();
+ auto EndLoc = StartLoc.getLocWithOffset(StringRef("dyn_cast").size() - 1);
----------------
Please don't use auto where type is not obvious.
================
Comment at: clang-tools-extra/clang-tidy/llvm/AvoidCastInConditionalCheck.cpp:91
+ auto StartLoc = MatchedDecl->getCallee()->getExprLoc();
+ auto EndLoc = StartLoc.getLocWithOffset(StringRef("dyn_cast").size() - 1);
+
----------------
Please don't use auto where type is not obvious.
================
Comment at: clang-tools-extra/clang-tidy/llvm/AvoidCastInConditionalCheck.cpp:101
+
+ auto ArgRange = CharSourceRange::getTokenRange(Arg->getSourceRange());
+ std::string ArgString(
----------------
Please don't use auto where type is not obvious.
================
Comment at: clang-tools-extra/clang-tidy/llvm/AvoidCastInConditionalCheck.cpp:104
+ Lexer::getSourceText(ArgRange, *Result.SourceManager, getLangOpts()));
+ auto LHSRange = CharSourceRange::getTokenRange(LHS->getSourceRange());
+ std::string LHSString(
----------------
Please don't use auto where type is not obvious.
================
Comment at: clang-tools-extra/clang-tidy/llvm/AvoidCastInConditionalCheck.cpp:107
+ Lexer::getSourceText(LHSRange, *Result.SourceManager, getLangOpts()));
+ auto RHSRange = CharSourceRange::getTokenRange(RHS->getSourceRange());
+ std::string RHSString(
----------------
Please don't use auto where type is not obvious.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59802/new/
https://reviews.llvm.org/D59802
More information about the cfe-commits
mailing list