Kaydet (Commit) 9663341f authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Bump --enable-compiler-plugins to Clang 3.8.0

<https://lists.freedesktop.org/archives/libreoffice/2017-December/079107.html>
"Clang baseline bump"

Change-Id: I18fca8794ea34118fc6308458064d0c28cf5caf7
Reviewed-on: https://gerrit.libreoffice.org/46557Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 00bc5a09
......@@ -50,7 +50,7 @@ C++17, C++14, or C++11" in its current form (due to the #pragma GCC diagnostic i
that it does not understand).
If you want to use Clang with the LibreOffice compiler plugins, the minimal
version of Clang is 3.4. Since Xcode doesn't provide the compiler plugin
version of Clang is 3.8. Since Xcode doesn't provide the compiler plugin
headers, you have to compile your own Clang to use them on macOS.
You can find the TDF configure switches in the distro-configs/ directory.
......
......@@ -9,8 +9,9 @@
#include <cassert>
#include <clang/AST/DeclCXX.h>
#include "check.hxx"
#include "compat.hxx"
namespace loplugin {
......@@ -153,14 +154,14 @@ ContextCheck DeclCheck::MemberFunction() const {
TerminalCheck ContextCheck::GlobalNamespace() const {
return TerminalCheck(
context_ != nullptr
&& ((compat::isLookupContext(*context_)
&& ((context_->isLookupContext()
? context_ : context_->getLookupParent())
->isTranslationUnit()));
}
TerminalCheck ContextCheck::StdNamespace() const {
return TerminalCheck(
context_ != nullptr && compat::isStdNamespace(*context_));
context_ != nullptr && context_->isStdNamespace());
}
ContextCheck ContextCheck::AnonymousNamespace() const {
......@@ -171,13 +172,7 @@ ContextCheck ContextCheck::AnonymousNamespace() const {
namespace {
bool BaseCheckNotSomethingInterestingSubclass(
const clang::CXXRecordDecl *BaseDefinition
#if CLANG_VERSION < 30800
, void *
#endif
)
{
bool BaseCheckNotSomethingInterestingSubclass(const clang::CXXRecordDecl *BaseDefinition) {
if (BaseDefinition) {
auto tc = TypeCheck(BaseDefinition);
if (tc.Class("Dialog").GlobalNamespace() || tc.Class("SfxPoolItem").GlobalNamespace()) {
......@@ -201,7 +196,7 @@ bool isDerivedFromSomethingInteresting(const clang::CXXRecordDecl *decl) {
if (// not sure what hasAnyDependentBases() does,
// but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1
!decl->hasAnyDependentBases() &&
!compat::forallBases(*decl, BaseCheckNotSomethingInterestingSubclass, nullptr, true)) {
!decl->forallBases(BaseCheckNotSomethingInterestingSubclass, true)) {
return true;
}
return false;
......
......@@ -9,9 +9,9 @@
*
*/
#include <memory>
#include <set>
#include "compat.hxx"
#include "plugin.hxx"
#include <clang/Lex/Preprocessor.h>
......@@ -37,14 +37,14 @@ class CheckConfigMacros
explicit CheckConfigMacros( const InstantiationData& data );
virtual void run() override;
virtual void MacroDefined( const Token& macroToken, const MacroDirective* info ) override;
virtual void MacroUndefined( const Token& macroToken, compat::MacroDefinitionParam
virtual void MacroUndefined( const Token& macroToken, MacroDefinition const &
#if CLANG_VERSION >= 50000
, MacroDirective const *
#endif
) override;
virtual void Ifdef( SourceLocation location, const Token& macroToken, compat::MacroDefinitionParam ) override;
virtual void Ifndef( SourceLocation location, const Token& macroToken, compat::MacroDefinitionParam ) override;
virtual void Defined( const Token& macroToken, compat::MacroDefinitionParam, SourceRange Range ) override;
virtual void Ifdef( SourceLocation location, const Token& macroToken, MacroDefinition const & ) override;
virtual void Ifndef( SourceLocation location, const Token& macroToken, MacroDefinition const & ) override;
virtual void Defined( const Token& macroToken, MacroDefinition const &, SourceRange Range ) override;
enum { isPPCallback = true };
private:
void checkMacro( const Token& macroToken, SourceLocation location );
......@@ -54,7 +54,7 @@ class CheckConfigMacros
CheckConfigMacros::CheckConfigMacros( const InstantiationData& data )
: Plugin( data )
{
compat::addPPCallbacks(compiler.getPreprocessor(), this);
compiler.getPreprocessor().addPPCallbacks(std::unique_ptr<PPCallbacks>(this));
}
void CheckConfigMacros::run()
......@@ -75,7 +75,7 @@ void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroDirect
}
}
void CheckConfigMacros::MacroUndefined( const Token& macroToken, compat::MacroDefinitionParam
void CheckConfigMacros::MacroUndefined( const Token& macroToken, MacroDefinition const &
#if CLANG_VERSION >= 50000
, MacroDirective const *
#endif
......@@ -84,17 +84,17 @@ void CheckConfigMacros::MacroUndefined( const Token& macroToken, compat::MacroDe
configMacros.erase( macroToken.getIdentifierInfo()->getName());
}
void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken, compat::MacroDefinitionParam )
void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken, MacroDefinition const & )
{
checkMacro( macroToken, location );
}
void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken, compat::MacroDefinitionParam )
void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken, MacroDefinition const & )
{
checkMacro( macroToken, location );
}
void CheckConfigMacros::Defined( const Token& macroToken, compat::MacroDefinitionParam , SourceRange )
void CheckConfigMacros::Defined( const Token& macroToken, MacroDefinition const &, SourceRange )
{
checkMacro( macroToken, macroToken.getLocation());
}
......
......@@ -11,26 +11,14 @@
#define INCLUDED_COMPILERPLUGINS_CLANG_COMPAT_HXX
#include <cstddef>
#include <memory>
#include <string>
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/Type.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticIDs.h"
#include "clang/Basic/Linkage.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Visibility.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_ostream.h"
#include "config_clang.h"
......@@ -46,37 +34,6 @@ inline llvm::StringRef take_front(llvm::StringRef ref, std::size_t N = 1) {
#endif
}
inline bool isLookupContext(clang::DeclContext const & ctxt) {
#if CLANG_VERSION >= 30700
return ctxt.isLookupContext();
#else
return !ctxt.isFunctionOrMethod()
&& ctxt.getDeclKind() != clang::Decl::LinkageSpec;
#endif
}
inline bool forallBases(
clang::CXXRecordDecl const & decl,
clang::CXXRecordDecl::ForallBasesCallback BaseMatches,
void* callbackParam,
bool AllowShortCircuit)
{
#if CLANG_VERSION >= 30800
(void) callbackParam;
return decl.forallBases(BaseMatches, AllowShortCircuit);
#else
return decl.forallBases(BaseMatches, callbackParam, AllowShortCircuit);
#endif
}
inline clang::QualType getReturnType(clang::FunctionDecl const & decl) {
#if CLANG_VERSION >= 30500
return decl.getReturnType();
#else
return decl.getResultType();
#endif
}
#if CLANG_VERSION >= 30900
inline clang::ArrayRef<clang::ParmVarDecl *> parameters(
......@@ -84,127 +41,14 @@ inline clang::ArrayRef<clang::ParmVarDecl *> parameters(
{
return decl.parameters();
}
#elif CLANG_VERSION >= 30500
#else
inline clang::FunctionDecl::param_const_range parameters(
clang::FunctionDecl const & decl)
{
return decl.params();
}
#else
struct FunctionDeclParamsWrapper
{
clang::FunctionDecl const & decl;
FunctionDeclParamsWrapper(clang::FunctionDecl const & _decl) : decl(_decl) {}
clang::FunctionDecl::param_const_iterator begin() const { return decl.param_begin(); }
clang::FunctionDecl::param_const_iterator end() const { return decl.param_end(); }
};
inline FunctionDeclParamsWrapper parameters(
clang::FunctionDecl const & decl)
{
return FunctionDeclParamsWrapper(decl);
}
#endif
inline clang::QualType getReturnType(clang::FunctionProtoType const & type) {
#if CLANG_VERSION >= 30500
return type.getReturnType();
#else
return type.getResultType();
#endif
}
inline unsigned getNumParams(clang::FunctionProtoType const & type) {
#if CLANG_VERSION >= 30500
return type.getNumParams();
#else
return type.getNumArgs();
#endif
}
inline clang::QualType getParamType(
clang::FunctionProtoType const & type, unsigned i)
{
#if CLANG_VERSION >= 30500
return type.getParamType(i);
#else
return type.getArgType(i);
#endif
}
inline clang::Stmt::const_child_iterator begin(
clang::Stmt::const_child_range const & range)
{
#if CLANG_VERSION >= 30800
return range.begin();
#else
return range.first;
#endif
}
inline clang::Stmt::const_child_iterator end(
clang::Stmt::const_child_range const & range)
{
#if CLANG_VERSION >= 30800
return range.end();
#else
return range.second;
#endif
}
inline unsigned getBuiltinCallee(clang::CallExpr const & expr) {
#if CLANG_VERSION >= 30500
return expr.getBuiltinCallee();
#else
return expr.isBuiltinCall();
#endif
}
inline unsigned getCustomDiagID(
clang::DiagnosticsEngine & engine, clang::DiagnosticsEngine::Level L,
llvm::StringRef FormatString)
{
#if CLANG_VERSION >= 30500
return engine.getDiagnosticIDs()->getCustomDiagID(
static_cast<clang::DiagnosticIDs::Level>(L), FormatString);
#else
return engine.getCustomDiagID(L, FormatString);
#endif
}
inline std::unique_ptr<llvm::raw_fd_ostream> create_raw_fd_ostream(
char const * Filename, std::string & ErrorInfo)
{
#if CLANG_VERSION >= 30600
std::error_code ec;
std::unique_ptr<llvm::raw_fd_ostream> s(
new llvm::raw_fd_ostream(Filename, ec, llvm::sys::fs::F_None));
ErrorInfo = ec ? "error: " + ec.message() : std::string();
return s;
#elif CLANG_VERSION >= 30500
return std::unique_ptr<llvm::raw_fd_ostream>(
new llvm::raw_fd_ostream(Filename, ErrorInfo, llvm::sys::fs::F_None));
#else
return std::unique_ptr<llvm::raw_fd_ostream>(
new llvm::raw_fd_ostream(Filename, ErrorInfo));
#endif
}
#if CLANG_VERSION >= 30700
using MacroDefinitionParam = clang::MacroDefinition const &;
#else
using MacroDefinitionParam = clang::MacroDirective const *;
#endif
inline void addPPCallbacks(
clang::Preprocessor & preprocessor, clang::PPCallbacks * C)
{
#if CLANG_VERSION >= 30600
preprocessor.addPPCallbacks(std::unique_ptr<clang::PPCallbacks>(C));
#else
preprocessor.addPPCallbacks(C);
#endif
}
inline bool isPointWithin(
clang::SourceManager const & SM, clang::SourceLocation Location, clang::SourceLocation Start,
......@@ -272,37 +116,6 @@ inline llvm::StringRef getImmediateMacroNameForDiagnostics(
#endif
}
inline auto getAsTagDecl(clang::Type const& t) -> clang::TagDecl *
{
#if CLANG_VERSION >= 30500
// TODO not sure if it works with clang 3.6, trunk is known to work
return t.getAsTagDecl();
#else
return t.getAs<clang::TagType>()->getDecl();
#endif
}
inline bool isStdNamespace(clang::DeclContext const & context) {
#if CLANG_VERSION >= 30500
return context.isStdNamespace();
#else
// cf. lib/AST/DeclBase.cpp:
if (!context.isNamespace()) {
return false;
}
const clang::NamespaceDecl *ND = clang::cast<clang::NamespaceDecl>(
&context);
if (ND->isInline()) {
return isStdNamespace(*ND->getParent());
}
if (!context.getParent()->getRedeclContext()->isTranslationUnit()) {
return false;
}
const clang::IdentifierInfo *II = ND->getIdentifier();
return II && II->isStr("std");
#endif
}
// Work around <http://reviews.llvm.org/D22128>:
//
// SfxErrorHandler::GetClassString (svtools/source/misc/ehdl.cxx):
......
......@@ -107,12 +107,8 @@ void ConstantParam::addToCallSet(const FunctionDecl* functionDecl, int paramInde
functionDecl = functionDecl->getInstantiatedFromMemberFunction();
else if (functionDecl->getClassScopeSpecializationPattern())
functionDecl = functionDecl->getClassScopeSpecializationPattern();
// workaround clang-3.5 issue
#if CLANG_VERSION >= 30600
else if (functionDecl->getTemplateInstantiationPattern())
functionDecl = functionDecl->getTemplateInstantiationPattern();
#endif
if (!functionDecl->getNameInfo().getLoc().isValid())
return;
......@@ -131,7 +127,7 @@ void ConstantParam::addToCallSet(const FunctionDecl* functionDecl, int paramInde
MyCallSiteInfo aInfo;
aInfo.returnType = compat::getReturnType(*functionDecl).getCanonicalType().getAsString();
aInfo.returnType = functionDecl->getReturnType().getCanonicalType().getAsString();
if (isa<CXXMethodDecl>(functionDecl)) {
const CXXRecordDecl* recordDecl = dyn_cast<CXXMethodDecl>(functionDecl)->getParent();
......@@ -259,11 +255,8 @@ bool ConstantParam::VisitCallExpr(const CallExpr * callExpr) {
functionDecl = functionDecl->getInstantiatedFromMemberFunction();
else if (functionDecl->getClassScopeSpecializationPattern())
functionDecl = functionDecl->getClassScopeSpecializationPattern();
// workaround clang-3.5 issue
#if CLANG_VERSION >= 30600
else if (functionDecl->getTemplateInstantiationPattern())
functionDecl = functionDecl->getTemplateInstantiationPattern();
#endif
unsigned len = std::max(callExpr->getNumArgs(), functionDecl->getNumParams());
for (unsigned i = 0; i < len; ++i) {
......
......@@ -95,11 +95,8 @@ void CountUsersOfDefaultParams::niceName(const FunctionDecl* functionDecl, MyFun
functionDecl = functionDecl->getInstantiatedFromMemberFunction();
else if (functionDecl->getClassScopeSpecializationPattern())
functionDecl = functionDecl->getClassScopeSpecializationPattern();
// workaround clang-3.5 issue
#if CLANG_VERSION >= 30600
else if (functionDecl->getTemplateInstantiationPattern())
functionDecl = functionDecl->getTemplateInstantiationPattern();
#endif
switch (functionDecl->getAccess())
{
......@@ -108,7 +105,7 @@ void CountUsersOfDefaultParams::niceName(const FunctionDecl* functionDecl, MyFun
case AS_protected: aInfo.access = "protected"; break;
default: aInfo.access = "unknown"; break;
}
aInfo.returnType = compat::getReturnType(*functionDecl).getCanonicalType().getAsString();
aInfo.returnType = functionDecl->getReturnType().getCanonicalType().getAsString();
if (isa<CXXMethodDecl>(functionDecl)) {
const CXXRecordDecl* recordDecl = dyn_cast<CXXMethodDecl>(functionDecl)->getParent();
......@@ -160,11 +157,8 @@ bool CountUsersOfDefaultParams::VisitCallExpr(const CallExpr * callExpr) {
functionDecl = functionDecl->getInstantiatedFromMemberFunction();
else if (functionDecl->getClassScopeSpecializationPattern())
functionDecl = functionDecl->getClassScopeSpecializationPattern();
// workaround clang-3.5 issue
#if CLANG_VERSION >= 30600
else if (functionDecl->getTemplateInstantiationPattern())
functionDecl = functionDecl->getTemplateInstantiationPattern();
#endif
int n = functionDecl->getNumParams() - 1;
if (n < 0 || !functionDecl->getParamDecl(n)->hasDefaultArg()) {
return true;
......@@ -192,11 +186,8 @@ bool CountUsersOfDefaultParams::VisitCXXConstructExpr(const CXXConstructExpr * c
constructorDecl = dyn_cast<CXXConstructorDecl>(constructorDecl->getInstantiatedFromMemberFunction());
else if (constructorDecl->getClassScopeSpecializationPattern())
constructorDecl = dyn_cast<CXXConstructorDecl>(constructorDecl->getClassScopeSpecializationPattern());
// workaround clang-3.5 issue
#if CLANG_VERSION >= 30600
else if (constructorDecl->getTemplateInstantiationPattern())
constructorDecl = dyn_cast<CXXConstructorDecl>(constructorDecl->getTemplateInstantiationPattern());
#endif
int n = constructorDecl->getNumParams() - 1;
if (n < 0 || !constructorDecl->getParamDecl(n)->hasDefaultArg()) {
return true;
......
......@@ -100,8 +100,6 @@ bool DataMemberShadow::VisitFieldDecl(FieldDecl const * fieldDecl)
fieldDecl = fieldDecl->getCanonicalDecl();
#if CLANG_VERSION >= 30800
auto BaseMatchesCallback = [&](const CXXBaseSpecifier *cxxBaseSpecifier, CXXBasePath& Paths)
{
if (!cxxBaseSpecifier->getType().getTypePtr())
......@@ -143,7 +141,6 @@ bool DataMemberShadow::VisitFieldDecl(FieldDecl const * fieldDecl)
CXXBasePaths aPaths;
parentCXXRecordDecl->lookupInBases(BaseMatchesCallback, aPaths);
#endif
return true;
}
......
......@@ -116,11 +116,8 @@ MyFuncInfo ExpandableMethods::niceName(const FunctionDecl* functionDecl)
functionDecl = functionDecl->getInstantiatedFromMemberFunction();
else if (functionDecl->getClassScopeSpecializationPattern())
functionDecl = functionDecl->getClassScopeSpecializationPattern();
// workaround clang-3.5 issue
#if CLANG_VERSION >= 30600
else if (functionDecl->getTemplateInstantiationPattern())
functionDecl = functionDecl->getTemplateInstantiationPattern();
#endif
MyFuncInfo aInfo;
switch (functionDecl->getAccess())
......@@ -131,7 +128,7 @@ MyFuncInfo ExpandableMethods::niceName(const FunctionDecl* functionDecl)
default: aInfo.access = "unknown"; break;
}
if (!isa<CXXConstructorDecl>(functionDecl)) {
aInfo.returnType = compat::getReturnType(*functionDecl).getCanonicalType().getAsString();
aInfo.returnType = functionDecl->getReturnType().getCanonicalType().getAsString();
} else {
aInfo.returnType = "";
}
......
......@@ -13,7 +13,6 @@
// only compile this on clang 3.7 or higher, which is known to work
// there were problems on clang 3.5 at least
#include "config_clang.h"
#if CLANG_VERSION >= 30700
#include <cassert>
#include <stdlib.h>
#include <string>
......@@ -312,6 +311,5 @@ loplugin::Plugin::Registration<GetImplementationName> X(
"getimplementationname", false);
}
#endif
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -19,30 +19,6 @@
#include "compat.hxx"
#include "plugin.hxx"
#if CLANG_VERSION < 30700
namespace std {
template<> struct iterator_traits<ExprIterator> {
typedef std::ptrdiff_t difference_type;
typedef Expr * value_type;
typedef Expr const ** pointer;
typedef Expr const & reference;
typedef std::random_access_iterator_tag iterator_category;
};
template<> struct iterator_traits<ConstExprIterator> {
typedef std::ptrdiff_t difference_type;
typedef Expr const * value_type;
typedef Expr const ** pointer;
typedef Expr const & reference;
typedef std::random_access_iterator_tag iterator_category;
};
}
#endif
namespace {
Expr const * ignoreParenAndTemporaryMaterialization(Expr const * expr) {
......@@ -334,19 +310,19 @@ bool ImplicitBoolConversion::TraverseCallExpr(CallExpr * expr) {
std::ptrdiff_t n = j - expr->arg_begin();
assert(n >= 0);
if (t != nullptr
&& static_cast<std::size_t>(n) >= compat::getNumParams(*t))
&& static_cast<std::size_t>(n) >= t->getNumParams())
{
assert(t->isVariadic());
// ignore bool to int promotions of variadic arguments
} else if (bExt) {
if (t != nullptr) {
assert(
static_cast<std::size_t>(n) < compat::getNumParams(*t));
if (!(compat::getParamType(*t, n)->isSpecificBuiltinType(
static_cast<std::size_t>(n) < t->getNumParams());
if (!(t->getParamType(n)->isSpecificBuiltinType(
BuiltinType::Int)
|| compat::getParamType(*t, n)->isSpecificBuiltinType(
|| t->getParamType(n)->isSpecificBuiltinType(
BuiltinType::UInt)
|| compat::getParamType(*t, n)->isSpecificBuiltinType(
|| t->getParamType(n)->isSpecificBuiltinType(
BuiltinType::Long)))
{
reportWarning(i);
......@@ -831,7 +807,7 @@ bool ImplicitBoolConversion::TraverseReturnStmt(ReturnStmt * stmt) {
bool ImplicitBoolConversion::TraverseFunctionDecl(FunctionDecl * decl) {
bool bExt = false;
if (hasCLanguageLinkageType(decl) && decl->isThisDeclarationADefinition()) {
QualType t { compat::getReturnType(*decl) };
QualType t { decl->getReturnType() };
if (t->isSpecificBuiltinType(BuiltinType::Int)
|| t->isSpecificBuiltinType(BuiltinType::UInt))
{
......
......@@ -7,6 +7,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <memory>
#include "compat.hxx"
#include "plugin.hxx"
......@@ -16,7 +18,7 @@ class IncludeForm final: public PPCallbacks, public loplugin::RewritePlugin {
public:
explicit IncludeForm(loplugin::InstantiationData const & data):
RewritePlugin(data)
{ compat::addPPCallbacks(compiler.getPreprocessor(), this); }
{ compiler.getPreprocessor().addPPCallbacks(std::unique_ptr<PPCallbacks>(this)); }
private:
void run() override {}
......
......@@ -31,10 +31,10 @@ private:
};
static bool oneAndOnlyOne(clang::Stmt::const_child_range range) {
if (compat::begin(range) == compat::end(range)) {
if (range.begin() == range.end()) {
return false;
}
if (++compat::begin(range) != compat::end(range)) {
if (++range.begin() != range.end()) {
return false;
}
return true;
......@@ -133,7 +133,7 @@ bool InlineSimpleMemberFunctions::VisitCXXMethodDecl(const CXXMethodDecl * funct
{
childStmt2 = *childStmt2->child_begin();
if (dyn_cast<CXXThisExpr>( childStmt2 ) != nullptr
&& compat::begin(childStmt2->children()) == compat::end(childStmt2->children()))
&& childStmt2->children().begin() == childStmt2->children().end())
{
return true;
}
......@@ -144,7 +144,7 @@ bool InlineSimpleMemberFunctions::VisitCXXMethodDecl(const CXXMethodDecl * funct
{
const Stmt* childStmt2 = *childStmt->child_begin();
if (dyn_cast<CXXThisExpr>( childStmt2 ) != nullptr
&& compat::begin(childStmt2->children()) == compat::end(childStmt2->children()))
&& childStmt2->children().begin() == childStmt2->children().end())
{
return true;
}
......@@ -207,7 +207,7 @@ bool InlineSimpleMemberFunctions::VisitCXXMethodDecl(const CXXMethodDecl * funct
}
return true;
}
if ( compat::begin(childStmt->children()) == compat::end(childStmt->children()) )
if ( childStmt->children().begin() == childStmt->children().end() )
return true;
childStmt = *childStmt->child_begin();
}
......
......@@ -8,8 +8,8 @@
*/
#include <cassert>
#include <memory>
#include "compat.hxx"
#include "plugin.hxx"
namespace {
......@@ -17,7 +17,7 @@ namespace {
class OslEndian: public loplugin::Plugin, public PPCallbacks {
public:
explicit OslEndian(loplugin::InstantiationData const & data): Plugin(data) {
compat::addPPCallbacks(compiler.getPreprocessor(), this);
compiler.getPreprocessor().addPPCallbacks(std::unique_ptr<PPCallbacks>(this));
}
enum { isPPCallback = true };
......@@ -59,7 +59,7 @@ private:
}
void MacroUndefined(
Token const & MacroNameTok, compat::MacroDefinitionParam
Token const & MacroNameTok, MacroDefinition const &
#if CLANG_VERSION >= 50000
, MacroDirective const *
#endif
......@@ -75,7 +75,7 @@ private:
}
void Defined(
Token const & MacroNameTok, compat::MacroDefinitionParam, SourceRange)
Token const & MacroNameTok, MacroDefinition const &, SourceRange)
override
{
check(MacroNameTok);
......@@ -83,14 +83,14 @@ private:
void Ifdef(
SourceLocation, Token const & MacroNameTok,
compat::MacroDefinitionParam) override
MacroDefinition const &) override
{
check(MacroNameTok);
}
void Ifndef(
SourceLocation, Token const & MacroNameTok,
compat::MacroDefinitionParam) override
MacroDefinition const &) override
{
check(MacroNameTok);
}
......
......@@ -11,7 +11,6 @@
#include <set>
#include "check.hxx"
#include "compat.hxx"
#include "plugin.hxx"
// Find places where various things are passed by value.
......@@ -222,7 +221,7 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C
return;
}
const QualType type = compat::getReturnType(*functionDecl).getDesugaredType(compiler.getASTContext());
const QualType type = functionDecl->getReturnType().getDesugaredType(compiler.getASTContext());
if (type->isReferenceType() || type->isIntegralOrEnumerationType() || type->isPointerType()
|| type->isTemplateTypeParmType() || type->isDependentType() || type->isBuiltinType()
|| type->isScalarType())
......
......@@ -10,7 +10,8 @@
*/
#include <memory>
#include "compat.hxx"
#include <system_error>
#include "plugin.hxx"
#include "pluginhandler.hxx"
......@@ -168,9 +169,9 @@ DiagnosticBuilder PluginHandler::report( DiagnosticsEngine::Level level, const c