diff options
author | Noel Grandin <noel@peralex.com> | 2015-03-24 15:26:35 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-03-25 08:55:31 +0200 |
commit | c7a50d072f0f9a19e7975c09eeff7a11bdea1370 (patch) | |
tree | fa599d420f2d533ad0c0061f5108a8b425432e9e /compilerplugins/clang/compat.hxx | |
parent | 3f6bfb4c0d6814c38035e4e1d0c4d5321dd6a5a7 (diff) |
new constantfunction loplugin
Change-Id: Ie9b7a0c41fc4dbd2560ceff6bae9ab85357f518b
Diffstat (limited to 'compilerplugins/clang/compat.hxx')
-rw-r--r-- | compilerplugins/clang/compat.hxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx index dd1d7e3537c2..78acb54418f7 100644 --- a/compilerplugins/clang/compat.hxx +++ b/compilerplugins/clang/compat.hxx @@ -23,6 +23,7 @@ #include "clang/Basic/Linkage.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/Visibility.h" +#include "clang/Frontend/CompilerInstance.h" #include "clang/Lex/PPCallbacks.h" #include "clang/Lex/Preprocessor.h" #include "llvm/ADT/StringRef.h" @@ -210,6 +211,17 @@ inline void addPPCallbacks( #endif } +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 |