[Libreoffice-commits] core.git: compilerplugins/clang
Stephan Bergmann
sbergman at redhat.com
Thu Nov 19 00:20:02 PST 2015
compilerplugins/clang/compat.hxx | 9 +++++++++
compilerplugins/clang/typecheck.hxx | 6 +++---
2 files changed, 12 insertions(+), 3 deletions(-)
New commits:
commit 4a6268f0d37f377181f972ed307d2a074e8e1b6a
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Nov 19 09:19:30 2015 +0100
Adapt compilerplugins to old Clang versions
Change-Id: I91335f1e81e251f0578792517dded9fae239fb61
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 6b14510..0a16a3c 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -41,6 +41,15 @@
// Compatibility wrapper to abstract over (trivial) changes in the Clang API:
namespace compat {
+inline bool isLookupContext(clang::DeclContext const & ctxt) {
+#if (__clang_major__ == 3 && __clang_minor__ > 7) || __clang_major__ > 3
+ return ctxt.isLookupContext();
+#else
+ return !ctxt.isFunctionOrMethod()
+ && ctxt.getDeclKind() != clang::Decl::LinkageSpec;
+#endif
+}
+
inline bool isExternCContext(clang::DeclContext const & ctxt) {
#if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3
return ctxt.isExternCContext();
diff --git a/compilerplugins/clang/typecheck.hxx b/compilerplugins/clang/typecheck.hxx
index 6ab8f74..35d4e57 100644
--- a/compilerplugins/clang/typecheck.hxx
+++ b/compilerplugins/clang/typecheck.hxx
@@ -12,11 +12,11 @@
#include <cstddef>
-#include <iostream>
-
#include <clang/AST/DeclBase.h>
#include <clang/AST/Type.h>
+#include "compat.hxx"
+
namespace loplugin {
class NamespaceCheck;
@@ -72,7 +72,7 @@ public:
TerminalCheck GlobalNamespace() const {
return TerminalCheck(
context_ != nullptr
- && ((context_->isLookupContext()
+ && ((compat::isLookupContext(*context_)
? context_ : context_->getLookupParent())
->isTranslationUnit()));
}
More information about the Libreoffice-commits
mailing list