Kaydet (Commit) 0f5756e2 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Adapt compilerplugins to Clang trunk towards 3.6

Change-Id: If6ee343bb4d4004e7a95fe1c5adc97210fc0abd0
üst 6f8b4c06
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* *
*/ */
#include "compat.hxx"
#include "plugin.hxx" #include "plugin.hxx"
#include <clang/Lex/Preprocessor.h> #include <clang/Lex/Preprocessor.h>
...@@ -59,7 +60,7 @@ class CheckConfigMacros ...@@ -59,7 +60,7 @@ class CheckConfigMacros
CheckConfigMacros::CheckConfigMacros( const InstantiationData& data ) CheckConfigMacros::CheckConfigMacros( const InstantiationData& data )
: Plugin( data ) : Plugin( data )
{ {
compiler.getPreprocessor().addPPCallbacks( this ); compat::addPPCallbacks(compiler.getPreprocessor(), this);
} }
void CheckConfigMacros::run() void CheckConfigMacros::run()
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#include "clang/Basic/Linkage.h" #include "clang/Basic/Linkage.h"
#include "clang/Basic/SourceManager.h" #include "clang/Basic/SourceManager.h"
#include "clang/Basic/Visibility.h" #include "clang/Basic/Visibility.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringRef.h"
#include "llvm/Support/FileSystem.h" #include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
...@@ -186,6 +188,16 @@ inline clang::NamedDecl * const * end( ...@@ -186,6 +188,16 @@ inline clang::NamedDecl * const * end(
#endif #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 #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment