summaryrefslogtreecommitdiff
path: root/compilerplugins/clang
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-09-23 13:46:24 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-09-23 13:46:24 +0200
commit0f5756e2e4065072aa7bc58f6202bd6c2405ff80 (patch)
treed3eba1981c7f161aa306015794ab980c120a6ea0 /compilerplugins/clang
parent6f8b4c068ec4c26ec26f6c95589b0d7d6901d627 (diff)
Adapt compilerplugins to Clang trunk towards 3.6
Change-Id: If6ee343bb4d4004e7a95fe1c5adc97210fc0abd0
Diffstat (limited to 'compilerplugins/clang')
-rw-r--r--compilerplugins/clang/checkconfigmacros.cxx3
-rw-r--r--compilerplugins/clang/compat.hxx12
2 files changed, 14 insertions, 1 deletions
diff --git a/compilerplugins/clang/checkconfigmacros.cxx b/compilerplugins/clang/checkconfigmacros.cxx
index 608800db2642..fff7967e49e8 100644
--- a/compilerplugins/clang/checkconfigmacros.cxx
+++ b/compilerplugins/clang/checkconfigmacros.cxx
@@ -9,6 +9,7 @@
*
*/
+#include "compat.hxx"
#include "plugin.hxx"
#include <clang/Lex/Preprocessor.h>
@@ -59,7 +60,7 @@ class CheckConfigMacros
CheckConfigMacros::CheckConfigMacros( const InstantiationData& data )
: Plugin( data )
{
- compiler.getPreprocessor().addPPCallbacks( this );
+ compat::addPPCallbacks(compiler.getPreprocessor(), this);
}
void CheckConfigMacros::run()
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index e6ce98ea64bd..e0e3cbbc7d92 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -23,6 +23,8 @@
#include "clang/Basic/Linkage.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Visibility.h"
+#include "clang/Lex/PPCallbacks.h"
+#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_ostream.h"
@@ -186,6 +188,16 @@ inline clang::NamedDecl * const * end(
#endif
}
+inline void addPPCallbacks(
+ clang::Preprocessor & preprocessor, clang::PPCallbacks * C)
+{
+#if (__clang_major__ == 3 && __clang_minor__ >= 6) || __clang_major__ > 3
+ preprocessor.addPPCallbacks(std::unique_ptr<clang::PPCallbacks>(C));
+#else
+ preprocessor.addPPCallbacks(C);
+#endif
+}
+
}
#endif