From 11235e86497df47ff3acc61c1cab9fff0b91949e Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 31 Jan 2014 09:50:21 +0100 Subject: clang::DiagnosticsEnginge::getCustomDiagID now needs a literal FormatString ...at least in trunk 200400 towards Clang 3.5. Change-Id: Ibe956a7f28c16510506bd354582b3fe5a72582e5 --- compilerplugins/clang/compat.hxx | 15 +++++++++++++++ compilerplugins/clang/pluginhandler.cxx | 5 +++-- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'compilerplugins') diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx index 9e35049e5f75..d4d92a0ad122 100644 --- a/compilerplugins/clang/compat.hxx +++ b/compilerplugins/clang/compat.hxx @@ -12,6 +12,9 @@ #include "clang/AST/Decl.h" #include "clang/AST/Type.h" +#include "clang/Basic/Diagnostic.h" +#include "clang/Basic/DiagnosticIDs.h" +#include "llvm/ADT/StringRef.h" // Compatibility wrapper to abstract over (trivial) chanes in the Clang API: namespace compat { @@ -42,6 +45,18 @@ inline clang::QualType getParamType( #endif } +inline unsigned getCustomDiagID( + clang::DiagnosticsEngine const & engine, clang::DiagnosticsEngine::Level L, + llvm::StringRef FormatString) +{ +#if (__clang_major__ == 3 && __clang_minor__ >= 5) || __clang_major__ > 3 + return engine.getDiagnosticIDs()->getCustomDiagID( + static_cast(L), FormatString); +#else + return engine.getCustomDiagID(L, FormatString); +#endif +} + } #endif diff --git a/compilerplugins/clang/pluginhandler.cxx b/compilerplugins/clang/pluginhandler.cxx index 440df1cf07fb..345363b0a90f 100644 --- a/compilerplugins/clang/pluginhandler.cxx +++ b/compilerplugins/clang/pluginhandler.cxx @@ -9,6 +9,7 @@ * */ +#include "compat.hxx" #include "pluginhandler.hxx" #include @@ -161,9 +162,9 @@ DiagnosticBuilder PluginHandler::report( DiagnosticsEngine::Level level, const c } fullMessage += "]"; if( loc.isValid()) - return diag.Report( loc, diag.getCustomDiagID( level, fullMessage )); + return diag.Report( loc, compat::getCustomDiagID(diag, level, fullMessage) ); else - return diag.Report( diag.getCustomDiagID( level, fullMessage )); + return diag.Report( compat::getCustomDiagID(diag, level, fullMessage) ); } DiagnosticBuilder PluginHandler::report( DiagnosticsEngine::Level level, StringRef message, SourceLocation loc ) -- cgit