summaryrefslogtreecommitdiffstats
path: root/compilerplugins/clang/buriedassign.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-04 08:45:36 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-04 11:21:36 +0200
commitcda88ec7a43162df37098c4525c33451266a1575 (patch)
tree4f80310ab0ef1210b7dcd4d769b70c59fbc09f1e /compilerplugins/clang/buriedassign.cxx
parentloplugin:flatten in vcl (diff)
downloadcore-cda88ec7a43162df37098c4525c33451266a1575.tar.gz
core-cda88ec7a43162df37098c4525c33451266a1575.zip
loplugin:simplifybool a little more aggressive
with expressions like !(a && b) Change-Id: Id2acec2a8d0eaaa8e5e37dbd2cae7281be36572e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100040 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/buriedassign.cxx')
-rw-r--r--compilerplugins/clang/buriedassign.cxx8
1 files changed, 1 insertions, 7 deletions
diff --git a/compilerplugins/clang/buriedassign.cxx b/compilerplugins/clang/buriedassign.cxx
index 1758a4fcbca8..658ad4789d87 100644
--- a/compilerplugins/clang/buriedassign.cxx
+++ b/compilerplugins/clang/buriedassign.cxx
@@ -255,12 +255,6 @@ static bool isAssignmentOp(clang::OverloadedOperatorKind Opc)
|| Opc == OO_AmpEqual || Opc == OO_CaretEqual || Opc == OO_PipeEqual;
}
-static bool isComparisonOp(clang::OverloadedOperatorKind op)
-{
- return op == OO_Less || op == OO_Greater || op == OO_LessEqual || op == OO_GreaterEqual
- || op == OO_EqualEqual || op == OO_ExclaimEqual;
-}
-
static const Expr* IgnoreImplicitAndConversionOperator(const Expr* expr)
{
expr = compat::IgnoreImplicit(expr);
@@ -570,7 +564,7 @@ void BuriedAssign::MarkConditionForControlLoops(Expr const* expr)
else if (auto cxxOper = dyn_cast<CXXOperatorCallExpr>(expr))
{
// handle: ((xxx = foo()) != error)
- if (isComparisonOp(cxxOper->getOperator()))
+ if (compat::isComparisonOp(cxxOper))
{
MarkIfAssignment(compat::IgnoreImplicit(cxxOper->getArg(0))->IgnoreParens());
MarkIfAssignment(compat::IgnoreImplicit(cxxOper->getArg(1))->IgnoreParens());