summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-11-06 14:23:56 +0100
committerMichael Stahl <mstahl@redhat.com>2015-11-06 19:38:13 +0000
commit22fb58a6fa7764ec0045529c483693e1a81b488e (patch)
tree01d5d98d6ff63fa4f6ed22621898eedee24d018c /compilerplugins
parent24db02dc8d771b8aa722d0fa2a410635b5179e35 (diff)
compilerplugins: getAsTagDecl doesn't exist in clang 3.5
Change-Id: If7277820227486e2eb578a167e0fd9f05c8f74ae Reviewed-on: https://gerrit.libreoffice.org/19823 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/compat.hxx10
-rw-r--r--compilerplugins/clang/stringconstant.cxx2
2 files changed, 11 insertions, 1 deletions
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 0ca37fad982f..6b1451000ff6 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -255,6 +255,16 @@ inline bool isMacroBodyExpansion(clang::CompilerInstance& compiler, clang::Sourc
#endif
}
+inline auto getAsTagDecl(clang::Type const& t) -> clang::TagDecl *
+{
+#if (__clang_major__ == 3 && __clang_minor__ > 5) || __clang_major__ > 3
+ // TODO not sure if it works with clang 3.6, trunk is known to work
+ return t.getAsTagDecl();
+#else
+ return t.getAs<clang::TagType>()->getDecl();
+#endif
+}
+
}
#endif
diff --git a/compilerplugins/clang/stringconstant.cxx b/compilerplugins/clang/stringconstant.cxx
index 8fbed25a975f..56ae27c90bc5 100644
--- a/compilerplugins/clang/stringconstant.cxx
+++ b/compilerplugins/clang/stringconstant.cxx
@@ -235,7 +235,7 @@ bool StringConstant::VisitCallExpr(CallExpr const * expr) {
&& t->isClassType()
&& t->getAs<SubstTemplateTypeParmType>() == nullptr)
{
- auto td = t->getAsTagDecl();
+ auto td = compat::getAsTagDecl(*t);
auto id = td->getIdentifier();
if (id != nullptr && id->isStr("OUString")) {
auto nd = dyn_cast<NamespaceDecl>(td->getParent());