Kaydet (Commit) 11235e86 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

clang::DiagnosticsEnginge::getCustomDiagID now needs a literal FormatString

...at least in trunk 200400 towards Clang 3.5.

Change-Id: Ibe956a7f28c16510506bd354582b3fe5a72582e5
üst b21e3d16
......@@ -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
......
......@@ -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 )
......
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