[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann sbergman at redhat.com
Tue Sep 23 04:47:07 PDT 2014


 compilerplugins/clang/checkconfigmacros.cxx |    3 ++-
 compilerplugins/clang/compat.hxx            |   12 ++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 0f5756e2e4065072aa7bc58f6202bd6c2405ff80
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Sep 23 13:46:24 2014 +0200

    Adapt compilerplugins to Clang trunk towards 3.6
    
    Change-Id: If6ee343bb4d4004e7a95fe1c5adc97210fc0abd0

diff --git a/compilerplugins/clang/checkconfigmacros.cxx b/compilerplugins/clang/checkconfigmacros.cxx
index 608800d..fff7967 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 e6ce98e..e0e3cbb 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


More information about the Libreoffice-commits mailing list