summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/compat.hxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-10-09 14:25:36 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-10-09 20:42:21 +0200
commit4b0afe968ed62ac65d5f04918f4cda501ecf1619 (patch)
tree861b5911bc3a24517f5e14fccca0d8310a1580b5 /compilerplugins/clang/compat.hxx
parent39090afac268f9ae985832c2f08863b41e6c06f2 (diff)
Improve loplugin:redundantpointerops diagnostic messages
Change-Id: If09f5c916f2db98c5d1754d2fbc8f53c502799c9 Reviewed-on: https://gerrit.libreoffice.org/80543 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang/compat.hxx')
-rw-r--r--compilerplugins/clang/compat.hxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index cb13f44cfa66..c091c51601f7 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -240,6 +240,19 @@ inline const clang::Expr *getSubExprAsWritten(const clang::CastExpr *This) {
return getSubExprAsWritten(const_cast<clang::CastExpr *>(This));
}
+inline clang::QualType getObjectType(clang::CXXMemberCallExpr const * expr) {
+#if CLANG_VERSION >= 100000
+ return expr->getObjectType();
+#else
+ // <https://github.com/llvm/llvm-project/commit/88559637641e993895337e1047a0bd787fecc647>
+ // "[OpenCL] Improve destructor support in C++ for OpenCL":
+ clang::QualType Ty = expr->getImplicitObjectArgument()->getType();
+ if (Ty->isPointerType())
+ Ty = Ty->getPointeeType();
+ return Ty;
+#endif
+}
+
inline bool isExplicitSpecified(clang::CXXConstructorDecl const * decl) {
#if CLANG_VERSION >= 90000
return decl->getExplicitSpecifier().isExplicit();