summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/compat.hxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-07-30 17:59:29 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-07-31 16:29:45 +0200
commit6b962889b2581ed67e20e4f3028757859361c28e (patch)
tree9de8b661165ca7dfa2b8de2ec0c54ced397b82e3 /compilerplugins/clang/compat.hxx
parent98c0cefb18d8af7aa4732708ba0ae6be2e808d6f (diff)
Improved loplugin:stringconstant (now that GCC 7 supports it)
Change-Id: I8f83c1941b8f39b261005939f4dcf3577ae9fc6f Reviewed-on: https://gerrit.libreoffice.org/76702 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang/compat.hxx')
-rw-r--r--compilerplugins/clang/compat.hxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 64ee9a8fd265..cb13f44cfa66 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -256,6 +256,18 @@ inline bool isExplicitSpecified(clang::CXXConversionDecl const * decl) {
#endif
}
+inline clang::QualType getDeclaredReturnType(clang::FunctionDecl const * decl) {
+#if CLANG_VERSION >= 80000
+ return decl->getDeclaredReturnType();
+#else
+ // <https://github.com/llvm/llvm-project/commit/4576a77b809649f5b8d0ff8c7a4be57eeee0ecf9>
+ // "PR33222: Require the declared return type not the actual return type to":
+ auto *TSI = decl->getTypeSourceInfo();
+ clang::QualType T = TSI ? TSI->getType() : decl->getType();
+ return T->castAs<clang::FunctionType>()->getReturnType();
+#endif
+}
+
}
#endif