comparison clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 0572611fdcc8
children 1f2b6ac9f198
comparison
equal deleted inserted replaced
173:0572611fdcc8 207:2e18cbf3894f
38 has(ignoringParenImpCasts(Calc))); 38 has(ignoringParenImpCasts(Calc)));
39 const auto ImplicitCast = 39 const auto ImplicitCast =
40 implicitCastExpr(hasImplicitDestinationType(isInteger()), 40 implicitCastExpr(hasImplicitDestinationType(isInteger()),
41 has(ignoringParenImpCasts(Calc))); 41 has(ignoringParenImpCasts(Calc)));
42 const auto Cast = 42 const auto Cast =
43 traverse(ast_type_traits::TK_AsIs, 43 traverse(TK_AsIs, expr(anyOf(ExplicitCast, ImplicitCast)).bind("Cast"));
44 expr(anyOf(ExplicitCast, ImplicitCast)).bind("Cast"));
45 44
46 Finder->addMatcher(varDecl(hasInitializer(Cast)), this); 45 Finder->addMatcher(varDecl(hasInitializer(Cast)), this);
47 Finder->addMatcher(returnStmt(hasReturnValue(Cast)), this); 46 Finder->addMatcher(returnStmt(hasReturnValue(Cast)), this);
48 Finder->addMatcher(callExpr(hasAnyArgument(Cast)), this); 47 Finder->addMatcher(callExpr(hasAnyArgument(Cast)), this);
49 Finder->addMatcher(binaryOperator(hasOperatorName("="), hasRHS(Cast)), this); 48 Finder->addMatcher(binaryOperator(hasOperatorName("="), hasRHS(Cast)), this);