summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/compat.hxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-04-21 12:05:48 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-04-21 12:05:48 +0200
commit8d934b73ccac14c76f6596c33b087e22ba82be09 (patch)
tree45891f4c7dbbdde207f4bfa771550c93b591e8d8 /compilerplugins/clang/compat.hxx
parentb481d42e56c9585a3a6018ee851dcca41e89666f (diff)
Better fix for 13758a3d154e8e450fdfe8bcdeb6b3a03996c53a
"SourceManager::isMacroArgExpansion has only one param in older Clang", which caused false positives like warning about sal_False in CPPUNIT_ASSERT_EQUAL(guard.p->m1, sal_False); in cppu/qa/cppumaker/test_cppumaker.cxx Change-Id: I1c5a67527aef381e336d71cb8fefbb87961bbf96
Diffstat (limited to 'compilerplugins/clang/compat.hxx')
-rw-r--r--compilerplugins/clang/compat.hxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 6c1152c1fc9b..cd3cb3af89ee 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -256,6 +256,24 @@ inline void addPPCallbacks(
#endif
}
+inline bool isMacroArgExpansion(
+ clang::CompilerInstance& compiler, clang::SourceLocation location,
+ clang::SourceLocation * startLocation)
+{
+#if CLANG_VERSION >= 30900
+ return compiler.getSourceManager().isMacroArgExpansion(
+ location, startLocation);
+#else
+ bool b = compiler.getSourceManager().isMacroArgExpansion(location);
+ if (b) {
+ startLocation* = compiler.getSourceManager()
+ .getSLocEntry(compiler.getSourceManager().getFileID(location))
+ .getExpansion().getExpansionLocStart();
+ }
+ return b;
+#endif
+}
+
inline bool isMacroBodyExpansion(clang::CompilerInstance& compiler, clang::SourceLocation location)
{
#if CLANG_VERSION >= 30300