summaryrefslogtreecommitdiff
path: root/compilerplugins/clang
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-01-31 09:50:21 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-01-31 09:50:21 +0100
commit11235e86497df47ff3acc61c1cab9fff0b91949e (patch)
treef1d3234e0cd2cd5252a82bba3ead98f641d5bfd8 /compilerplugins/clang
parentb21e3d16aa21992d6370c4b57a83039c433ef070 (diff)
clang::DiagnosticsEnginge::getCustomDiagID now needs a literal FormatString
...at least in trunk 200400 towards Clang 3.5. Change-Id: Ibe956a7f28c16510506bd354582b3fe5a72582e5
Diffstat (limited to 'compilerplugins/clang')
-rw-r--r--compilerplugins/clang/compat.hxx15
-rw-r--r--compilerplugins/clang/pluginhandler.cxx5
2 files changed, 18 insertions, 2 deletions
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<clang::DiagnosticIDs::Level>(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 <clang/Frontend/CompilerInstance.h>
@@ -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 )