summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-17 09:35:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-17 09:35:02 +0200
commit72356f947b096fc4cc89f1b07ce5ee55047813b0 (patch)
treeef56c4140f923d017f2f0e48f639debf96b70f50 /compilerplugins
parent80dd757500eeca2ee899bcf8e6d972d867690de0 (diff)
teach loplugin unusedenumconstants about CXXOperatorCallExpr
fixes some false+ in the write-only analysis Change-Id: Ie7905c05c8012820c640064d451b33badb04c5fc
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/unusedenumconstants.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/compilerplugins/clang/unusedenumconstants.cxx b/compilerplugins/clang/unusedenumconstants.cxx
index 2500451b803a..8ba5d23f8485 100644
--- a/compilerplugins/clang/unusedenumconstants.cxx
+++ b/compilerplugins/clang/unusedenumconstants.cxx
@@ -164,6 +164,13 @@ try_again:
} else {
bRead = true;
}
+ } else if (const CXXOperatorCallExpr * operatorCall = dyn_cast<CXXOperatorCallExpr>(parent))
+ {
+ if (operatorCall->isAssignmentOp()) {
+ bWrite = true;
+ } else {
+ bRead = true;
+ }
} else if (isa<CastExpr>(parent) || isa<UnaryOperator>(parent)
|| isa<ConditionalOperator>(parent) || isa<ParenExpr>(parent)
|| isa<MaterializeTemporaryExpr>(parent)