summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/compat.hxx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-03-25 15:37:53 +0200
committerNoel Grandin <noel@peralex.com>2015-03-27 10:51:08 +0200
commitc4a9241f72e3b7bf84eaadc51dbaa2accc7b920c (patch)
treec3037d10c40adf45ea32138783c476fce2459abd /compilerplugins/clang/compat.hxx
parent17551216cc6843e8dcdf84bd8f9735d1c7fb145c (diff)
new clang plugin: staticmethods
Genius suggestion from Tor Lillqvist, write a clang plugin that finds methods that can be static. Change-Id: Ie6684cc95d088e8750b300a028b49f763da00345
Diffstat (limited to 'compilerplugins/clang/compat.hxx')
-rw-r--r--compilerplugins/clang/compat.hxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 78acb54418f7..64e0b04659b9 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -224,6 +224,16 @@ inline bool isMacroBodyExpansion(clang::CompilerInstance& compiler, clang::Sourc
}
+inline bool isMacroBodyExpansion(clang::CompilerInstance& compiler, clang::SourceLocation location)
+{
+#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3
+ return compiler.getSourceManager().isMacroBodyExpansion(location);
+#else
+ return location.isMacroID()
+ && !compiler.getSourceManager().isMacroArgExpansion(location);
+#endif
+}
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */