Adapt to Clang <= 3.4
Change-Id: If9c9d63d85ce29629e6453f2d69355bd64ac2fc5
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
#define INCLUDED_COMPILERPLUGINS_CLANG_COMPAT_HXX
|
#define INCLUDED_COMPILERPLUGINS_CLANG_COMPAT_HXX
|
||||||
|
|
||||||
#include "clang/AST/Decl.h"
|
#include "clang/AST/Decl.h"
|
||||||
|
#include "clang/AST/Expr.h"
|
||||||
#include "clang/AST/Type.h"
|
#include "clang/AST/Type.h"
|
||||||
#include "clang/Basic/Diagnostic.h"
|
#include "clang/Basic/Diagnostic.h"
|
||||||
#include "clang/Basic/DiagnosticIDs.h"
|
#include "clang/Basic/DiagnosticIDs.h"
|
||||||
@@ -45,6 +46,14 @@ inline clang::QualType getParamType(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline unsigned getBuiltinCallee(clang::CallExpr const & expr) {
|
||||||
|
#if (__clang_major__ == 3 && __clang_minor__ >= 5) || __clang_major__ > 3
|
||||||
|
return expr.getBuiltinCallee();
|
||||||
|
#else
|
||||||
|
return expr.isBuiltinCall();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
inline unsigned getCustomDiagID(
|
inline unsigned getCustomDiagID(
|
||||||
clang::DiagnosticsEngine & engine, clang::DiagnosticsEngine::Level L,
|
clang::DiagnosticsEngine & engine, clang::DiagnosticsEngine::Level L,
|
||||||
llvm::StringRef FormatString)
|
llvm::StringRef FormatString)
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "clang/Lex/Lexer.h"
|
#include "clang/Lex/Lexer.h"
|
||||||
|
|
||||||
|
#include "compat.hxx"
|
||||||
#include "plugin.hxx"
|
#include "plugin.hxx"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -138,7 +139,7 @@ bool LiteralToBoolConversion::VisitImplicitCastExpr(
|
|||||||
} else if (sub->isIntegerConstantExpr(compiler.getASTContext())) {
|
} else if (sub->isIntegerConstantExpr(compiler.getASTContext())) {
|
||||||
CallExpr const * ce = dyn_cast<CallExpr>(sub);
|
CallExpr const * ce = dyn_cast<CallExpr>(sub);
|
||||||
if (ce == nullptr
|
if (ce == nullptr
|
||||||
|| ce->getBuiltinCallee() != Builtin::BI__builtin_expect)
|
|| compat::getBuiltinCallee(*ce) != Builtin::BI__builtin_expect)
|
||||||
{
|
{
|
||||||
report(
|
report(
|
||||||
DiagnosticsEngine::Warning,
|
DiagnosticsEngine::Warning,
|
||||||
|
Reference in New Issue
Block a user