aaron.ballman added inline comments.
================ Comment at: clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp:56-57 -void NarrowingConversionsCheck::check(const MatchFinder::MatchResult &Result) { - if (const auto *Op = Result.Nodes.getNodeAs<BinaryOperator>("op")) { - if (Op->getBeginLoc().isMacroID()) - return; - diag(Op->getOperatorLoc(), "narrowing conversion from %0 to %1") - << Op->getRHS()->getType() << Op->getLHS()->getType(); +static bool isNarrower(const ASTContext *const Context, const QualType Lhs, + const QualType Rhs) { + assert(Lhs->isRealType()); // Either integer or floating point. ---------------- Please drop the top-level `const` qualifiers (that's not something we do consistently elsewhere). Here and elsewhere. ================ Comment at: clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp:68 return; - } - const auto *Cast = Result.Nodes.getNodeAs<ImplicitCastExpr>("cast"); - if (Cast->getBeginLoc().isMacroID()) + const auto LhsType = Op.getLHS()->getType(); + const auto RhsType = Op.getRHS()->getType(); ---------------- Do not use `auto` here as the type is not spelled out in the initialization (same elsewhere). You should also drop the top-level `const`. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53488 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits