summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/compat.hxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-01-08 10:59:24 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-01-08 10:59:39 +0100
commit44d0e286c8c7a0ddb8e14fb2c3afe5af35311ef7 (patch)
tree0de5ccf34bd1579f41a1950cdaed421bb9216b61 /compilerplugins/clang/compat.hxx
parentbb65b09678d4b6da657f6ccc180d8ff5096e3006 (diff)
loplugin:cstylecast: improve detection of C code
Change-Id: Id5dd1ee1a29c4e1c7cb2b58419d6ccb1f032bffe
Diffstat (limited to 'compilerplugins/clang/compat.hxx')
-rw-r--r--compilerplugins/clang/compat.hxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index e0e3cbbc7d92..44452bd58733 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -56,6 +56,14 @@ inline bool isExternCContext(clang::DeclContext const & ctxt) {
#endif
}
+inline bool isInExternCContext(clang::FunctionDecl const & decl) {
+#if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3
+ return decl.isInExternCContext();
+#else
+ return isExternalCContext(*decl.getCanonicalDecl()->getDeclContext());
+#endif
+}
+
#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3
typedef clang::LinkageInfo LinkageInfo;
#else