compilerplugins/clang/compat.hxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
New commits: commit 3cbd3012aa1801ba92d566faf7a827587f479995 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Tue Feb 15 15:21:06 2022 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Tue Feb 15 17:12:56 2022 +0100 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 <sberg...@redhat.com> 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) {