Kaydet (Commit) 4a6268f0 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Adapt compilerplugins to old Clang versions

Change-Id: I91335f1e81e251f0578792517dded9fae239fb61
üst e6d21d08
......@@ -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();
......
......@@ -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()));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment