diff options
author | Shuai Wang <shuaiwang@google.com> | 2018-09-10 23:58:04 +0000 |
---|---|---|
committer | Shuai Wang <shuaiwang@google.com> | 2018-09-10 23:58:04 +0000 |
commit | cec7d3a055ede1655707c1c3a0b6fcc69c1569cf (patch) | |
tree | 86e2fc663f3d30c239a37b90fb1cab1364b96164 /clang-tools-extra/clang-tidy/utils/ExprMutationAnalyzer.cpp | |
parent | a80d6faa10d9b1562bb8d08506da8c69ff0b0ec6 (diff) | |
download | bcm5719-llvm-cec7d3a055ede1655707c1c3a0b6fcc69c1569cf.tar.gz bcm5719-llvm-cec7d3a055ede1655707c1c3a0b6fcc69c1569cf.zip |
Revert "[clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer"
Summary:
Tests somehow break on windows (and only on windows)
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/13003
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/13747
I have yet figure out why so reverting to unbreak first.
Reviewers: george.karpenkov
Subscribers: xazax.hun, a.sidorin, Szelethus, cfe-commits
Differential Revision: https://reviews.llvm.org/D51898
llvm-svn: 341886
Diffstat (limited to 'clang-tools-extra/clang-tidy/utils/ExprMutationAnalyzer.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/utils/ExprMutationAnalyzer.cpp | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/clang-tools-extra/clang-tidy/utils/ExprMutationAnalyzer.cpp b/clang-tools-extra/clang-tidy/utils/ExprMutationAnalyzer.cpp index f979e97a03d..adf4095d009 100644 --- a/clang-tools-extra/clang-tidy/utils/ExprMutationAnalyzer.cpp +++ b/clang-tools-extra/clang-tidy/utils/ExprMutationAnalyzer.cpp @@ -145,16 +145,11 @@ const Stmt *ExprMutationAnalyzer::findDirectMutation(const Expr *Exp) { hasUnaryOperand(equalsNode(Exp))); // Invoking non-const member function. - // A member function is assumed to be non-const when it is unresolved. const auto NonConstMethod = cxxMethodDecl(unless(isConst())); const auto AsNonConstThis = expr(anyOf(cxxMemberCallExpr(callee(NonConstMethod), on(equalsNode(Exp))), cxxOperatorCallExpr(callee(NonConstMethod), - hasArgument(0, equalsNode(Exp))), - callExpr(callee(expr(anyOf( - unresolvedMemberExpr(hasObjectExpression(equalsNode(Exp))), - cxxDependentScopeMemberExpr( - hasObjectExpression(equalsNode(Exp))))))))); + hasArgument(0, equalsNode(Exp))))); // Taking address of 'Exp'. // We're assuming 'Exp' is mutated as soon as its address is taken, though in @@ -170,16 +165,10 @@ const Stmt *ExprMutationAnalyzer::findDirectMutation(const Expr *Exp) { unless(hasParent(arraySubscriptExpr())), has(equalsNode(Exp))); // Used as non-const-ref argument when calling a function. - // An argument is assumed to be non-const-ref when the function is unresolved. const auto NonConstRefParam = forEachArgumentWithParam( equalsNode(Exp), parmVarDecl(hasType(nonConstReferenceType()))); - const auto AsNonConstRefArg = anyOf( - callExpr(NonConstRefParam), cxxConstructExpr(NonConstRefParam), - callExpr(callee(expr(anyOf(unresolvedLookupExpr(), unresolvedMemberExpr(), - cxxDependentScopeMemberExpr(), - hasType(templateTypeParmType())))), - hasAnyArgument(equalsNode(Exp))), - cxxUnresolvedConstructExpr(hasAnyArgument(equalsNode(Exp)))); + const auto AsNonConstRefArg = + anyOf(callExpr(NonConstRefParam), cxxConstructExpr(NonConstRefParam)); // Captured by a lambda by reference. // If we're initializing a capture with 'Exp' directly then we're initializing @@ -206,12 +195,9 @@ const Stmt *ExprMutationAnalyzer::findDirectMutation(const Expr *Exp) { const Stmt *ExprMutationAnalyzer::findMemberMutation(const Expr *Exp) { // Check whether any member of 'Exp' is mutated. - const auto MemberExprs = - match(findAll(expr(anyOf(memberExpr(hasObjectExpression(equalsNode(Exp))), - cxxDependentScopeMemberExpr( - hasObjectExpression(equalsNode(Exp))))) - .bind("expr")), - Stm, Context); + const auto MemberExprs = match( + findAll(memberExpr(hasObjectExpression(equalsNode(Exp))).bind("expr")), + Stm, Context); return findExprMutation(MemberExprs); } |