aboutsummaryrefslogtreecommitdiff
path: root/clang-tidy/utils
diff options
context:
space:
mode:
authorShuai Wang <shuaiwang@google.com>2018-09-10 23:58:04 +0000
committerShuai Wang <shuaiwang@google.com>2018-09-10 23:58:04 +0000
commit888f00c3ecd73a8cb2b65aae798c79142283c26b (patch)
tree3ac4d50f6a990e860c37be7d2cae2df26f826750 /clang-tidy/utils
parente8f226ac6aadac6d149ade141390052dcbac2701 (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@341886 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clang-tidy/utils')
-rw-r--r--clang-tidy/utils/ExprMutationAnalyzer.cpp26
1 files changed, 6 insertions, 20 deletions
diff --git a/clang-tidy/utils/ExprMutationAnalyzer.cpp b/clang-tidy/utils/ExprMutationAnalyzer.cpp
index f979e97a..adf4095d 100644
--- a/clang-tidy/utils/ExprMutationAnalyzer.cpp
+++ b/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);
}