summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/compat.hxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-04-07 16:37:50 +0200
committerStephan Bergmann <sbergman@redhat.com>2021-04-08 07:31:47 +0200
commit673297dea98892abca3e4421a2e40d8940d7220b (patch)
tree04ab85be31704641325bcfb6ff80a0b0ef7c7bad /compilerplugins/clang/compat.hxx
parentf458b30b15526e95a6d25820450241fd6234171c (diff)
Adapt loplugin:unnecessaryparen to CXXRewrittenBinaryOperator
...as debuted in Clang with <https://github.com/llvm/llvm-project/commit/778dc0f1d49230f53401ae0c190fe460bda4ffd1> "[c++20] Add CXXRewrittenBinaryOperator to represent a comparison operator that is rewritten as a call to multiple other operators" towards Clang 10, and would have caused a false > xmloff/source/style/XMLRtlGutterPropertyHandler.cxx:40:16: error: parentheses immediately inside assignment [loplugin:unnecessaryparen] > rValue <<= (it != aRtlModes.end()); > ^~~~~~~~~~~~~~~~~~~~~~~ with --with-latest-c++ and an appropriate libstdc++. Change-Id: Iede63144dff1e1c833a1da7090b599e792351926 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113744 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang/compat.hxx')
-rw-r--r--compilerplugins/clang/compat.hxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index ae7557b71956..897d9fe855c0 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -321,6 +321,14 @@ inline bool isComparisonOp(clang::CXXOperatorCallExpr const * callExpr)
|| op == OO_EqualEqual || op == OO_ExclaimEqual;
}
+inline bool isPtrMemOp(clang::BinaryOperatorKind op) {
+#if CLANG_VERSION >= 80000
+ return clang::BinaryOperator::isPtrMemOp(op);
+#else
+ return op == clang::BO_PtrMemD || op == clang::BO_PtrMemI;
+#endif
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */