summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/compat.hxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-02-15 15:21:06 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-02-15 17:12:56 +0100
commit3cbd3012aa1801ba92d566faf7a827587f479995 (patch)
treeae5384e483fd316ccd82a46501bdfc719e6aea31 /compilerplugins/clang/compat.hxx
parent18742c27af1c67d41831b5d2297746c299ace3d7 (diff)
Properly implement compat::isComparisonOp
...using clang::CXXOperatorCallExpr::isComparisonOp introduced in <https://github.com/llvm/llvm-project/commit/fc3c80c38643aff6c4744433ab485c7550ee77b9> "[ASTMatchers] adds isComparisonOperator to BinaryOperator and CXXOperatorCallExpr" towards Clang 11 Change-Id: Icc4b2a2fc3f944b8c262ec5fea0bb2295fc051bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129968 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang/compat.hxx')
-rw-r--r--compilerplugins/clang/compat.hxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 2c154b975c44..bc1c5dfcd2ee 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -331,13 +331,16 @@ inline clang::QualType getDeclaredReturnType(clang::FunctionDecl const * decl) {
#endif
}
-// The isComparisonOp method on CXXOperatorCallExpr is not available yet for the clang we require
inline bool isComparisonOp(clang::CXXOperatorCallExpr const * callExpr)
{
+#if CLANG_VERSION >= 110000
+ return callExpr->isComparisonOp();
+#else
using namespace clang;
auto op = callExpr->getOperator();
return op == OO_Less || op == OO_Greater || op == OO_LessEqual || op == OO_GreaterEqual
|| op == OO_EqualEqual || op == OO_ExclaimEqual;
+#endif
}
inline bool isPtrMemOp(clang::BinaryOperatorKind op) {