summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-03-27 09:51:01 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-03-27 10:23:39 +0100
commit26f6ff08291848212a2f844878c1e330c4fa6349 (patch)
treec424108bcdfdfc8c648a8fad82452b25fab61db8 /compilerplugins
parentb566aa7f16bf5ec389f27f4b7a9c9872fffc3d69 (diff)
More compat stuff
(currently only used by a not-yet committed plugin, though) Change-Id: I4cff7eb97dbe10a44a911be9db090ea8cd10d8f0
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/compat.hxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index f100f255d64a..1f025e70472f 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -24,6 +24,14 @@
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_ostream.h"
+#if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3
+#define LO_COMPILERPLUGINS_CLANG_COMPAT_HAVE_isAtEndOfImmediateMacroExpansion \
+ true
+#else
+#define LO_COMPILERPLUGINS_CLANG_COMPAT_HAVE_isAtEndOfImmediateMacroExpansion \
+ false
+#endif
+
// Compatibility wrapper to abstract over (trivial) changes in the Clang API:
namespace compat {
@@ -43,6 +51,14 @@ inline bool isExternCContext(clang::DeclContext const & ctxt) {
#endif
}
+inline bool isFirstDecl(clang::FunctionDecl const & decl) {
+#if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3
+ return decl.isFirstDecl();
+#else
+ return decl.isFirstDeclaration();
+#endif
+}
+
inline clang::QualType getReturnType(clang::FunctionDecl const & decl) {
#if (__clang_major__ == 3 && __clang_minor__ >= 5) || __clang_major__ > 3
return decl.getReturnType();