Lines Matching defs:Exp
96 auto *Exp = dyn_cast<Expr>(&Node);
97 if (!Exp)
102 return canExprResolveTo(Exp, Target);
149 auto *Exp = dyn_cast<Expr>(&Node);
150 if (!Exp)
155 return ExprPointeeResolve{Target}.resolve(Exp);
248 const Stmt *ExprMutationAnalyzer::Analyzer::findMutation(const Expr *Exp) {
250 Exp,
266 ExprMutationAnalyzer::Analyzer::findPointeeMutation(const Expr *Exp) {
268 Exp,
284 const Expr *Exp, llvm::ArrayRef<MutationFinder> Finders,
286 // Assume Exp is not mutated before analyzing Exp.
287 auto [Memoized, Inserted] = MemoizedResults.try_emplace(Exp);
291 if (ExprMutationAnalyzer::isUnevaluated(Exp, Context))
295 if (const Stmt *S = (this->*Finder)(Exp))
296 return MemoizedResults[Exp] = S;
325 // `Exp` is part of the underlying expression of
373 ExprMutationAnalyzer::Analyzer::findDirectMutation(const Expr *Exp) {
376 binaryOperator(isAssignmentOperator(), hasLHS(canResolveToExpr(Exp)));
381 hasUnaryOperand(canResolveToExpr(Exp)));
388 cxxMemberCallExpr(on(canResolveToExpr(Exp)), unless(isConstCallee())),
390 hasArgument(0, canResolveToExpr(Exp))),
396 hasEitherOperand(ignoringImpCasts(canResolveToExpr(Exp)))),
397 // A fold expression may contain `Exp` as it's initializer.
398 // We don't know if the operator modifies `Exp` because the
400 cxxFoldExpr(hasFoldInit(ignoringImpCasts(canResolveToExpr(Exp)))),
405 unresolvedMemberExpr(hasObjectExpression(canResolveToExpr(Exp))),
407 hasObjectExpression(canResolveToExpr(Exp))))))),
413 hasObjectExpression(canResolveToExpr(Exp))))))));
415 // Taking address of 'Exp'.
416 // We're assuming 'Exp' is mutated as soon as its address is taken, though in
423 hasUnaryOperand(canResolveToExpr(Exp)));
426 unless(hasParent(arraySubscriptExpr())), has(canResolveToExpr(Exp)));
434 argumentCountIs(1), hasArgument(0, canResolveToExpr(Exp)));
442 anyOf(canResolveToExpr(Exp),
444 hasObjectExpression(ignoringImpCasts(canResolveToExpr(Exp))))),
454 callExpr(isTypeDependent(), hasAnyArgument(canResolveToExpr(Exp))),
455 cxxUnresolvedConstructExpr(hasAnyArgument(canResolveToExpr(Exp))),
461 parenListExpr(hasDescendant(expr(canResolveToExpr(Exp)))),
464 initListExpr(hasAnyInit(expr(canResolveToExpr(Exp)))));
467 // If we're initializing a capture with 'Exp' directly then we're initializing
470 const auto AsLambdaRefCaptureInit = lambdaExpr(hasCaptureInit(Exp));
473 // If we're returning 'Exp' directly then it's returned as non-const-ref.
478 returnStmt(hasReturnValue(canResolveToExpr(Exp)));
482 allOf(canResolveToExpr(Exp), hasType(nonConstReferenceType())))));
498 ExprMutationAnalyzer::Analyzer::findMemberMutation(const Expr *Exp) {
499 // Check whether any member of 'Exp' is mutated.
501 findAll(expr(anyOf(memberExpr(hasObjectExpression(canResolveToExpr(Exp))),
503 hasObjectExpression(canResolveToExpr(Exp))),
505 hasLHS(equalsNode(Exp)))))
512 ExprMutationAnalyzer::Analyzer::findArrayElementMutation(const Expr *Exp) {
516 anyOf(hasBase(canResolveToExpr(Exp)),
519 hasSourceExpression(canResolveToExpr(Exp)))))))
525 const Stmt *ExprMutationAnalyzer::Analyzer::findCastMutation(const Expr *Exp) {
526 // If the 'Exp' is explicitly casted to a non-const reference type the
527 // 'Exp' is considered to be modified.
529 match(findFirst(stmt(castExpr(hasSourceExpression(canResolveToExpr(Exp)),
538 // If 'Exp' is casted to any non-const reference type, check the castExpr.
540 findAll(expr(castExpr(hasSourceExpression(canResolveToExpr(Exp)),
554 hasArgument(0, canResolveToExpr(Exp)))
561 ExprMutationAnalyzer::Analyzer::findRangeLoopMutation(const Expr *Exp) {
577 hasRangeInit(canResolveToExpr(Exp))))
605 hasRangeInit(canResolveToExpr(Exp)))))
613 // If range for looping over 'Exp' with a non-const reference loop variable,
619 hasRangeInit(canResolveToExpr(Exp)))),
625 ExprMutationAnalyzer::Analyzer::findReferenceMutation(const Expr *Exp) {
634 argumentCountIs(1), hasArgument(0, canResolveToExpr(Exp)))
640 // If 'Exp' is bound to a non-const reference, check all declRefExpr to that.
645 canResolveToExpr(Exp),
646 memberExpr(hasObjectExpression(canResolveToExpr(Exp))))),
658 ExprMutationAnalyzer::Analyzer::findFunctionArgMutation(const Expr *Exp) {
660 canResolveToExpr(Exp),
676 const auto *Exp = Nodes.getNodeAs<Expr>(NodeID<Expr>::value);
679 return Exp;
700 return Exp;
705 return Exp;
711 ExprMutationAnalyzer::Analyzer::findPointeeValueMutation(const Expr *Exp) {
717 hasUnaryOperand(canResolveToExprPointee(Exp))),
719 arraySubscriptExpr(hasBase(canResolveToExprPointee(Exp)))))
726 ExprMutationAnalyzer::Analyzer::findPointeeMemberMutation(const Expr *Exp) {
729 cxxMemberCallExpr(on(canResolveToExprPointee(Exp)),
737 memberExpr(hasObjectExpression(canResolveToExprPointee(Exp)))
744 ExprMutationAnalyzer::Analyzer::findPointeeToNonConst(const Expr *Exp) {
751 hasInitializer(expr(canResolveToExprPointee(Exp)).bind("stmt")));
755 hasRHS(canResolveToExprPointee(Exp)));
758 hasAnyArgument(canResolveToExprPointee(Exp)), isInstantiationDependent());
760 canResolveToExprPointee(Exp), NonConstPointerOrDependentType);
766 parenListExpr(has(canResolveToExprPointee(Exp))),
767 initListExpr(hasAnyInit(canResolveToExprPointee(Exp)))));
770 explicitCastExpr(hasSourceExpression(canResolveToExprPointee(Exp)),
775 const auto CaptureNoConst = lambdaExpr(hasCaptureInit(Exp));