summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-12-15 14:20:38 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-12-19 22:08:38 +0100
commit9663341f9249c739219ffe6cccf3762aa8dd78f3 (patch)
tree2b22177d01916abca8314b0834185892a8f77030 /compilerplugins
parent00bc5a097313fbd003675267be961ad3a152ba42 (diff)
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/46557 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/check.cxx17
-rw-r--r--compilerplugins/clang/checkconfigmacros.cxx20
-rw-r--r--compilerplugins/clang/compat.hxx191
-rw-r--r--compilerplugins/clang/constantparam.cxx9
-rw-r--r--compilerplugins/clang/countusersofdefaultparams.cxx11
-rw-r--r--compilerplugins/clang/datamembershadow.cxx3
-rw-r--r--compilerplugins/clang/expandablemethods.cxx5
-rw-r--r--compilerplugins/clang/getimplementationname.cxx2
-rw-r--r--compilerplugins/clang/implicitboolconversion.cxx36
-rw-r--r--compilerplugins/clang/includeform.cxx4
-rw-r--r--compilerplugins/clang/inlinesimplememberfunctions.cxx10
-rw-r--r--compilerplugins/clang/oslendian.cxx12
-rw-r--r--compilerplugins/clang/passstuffbyref.cxx3
-rw-r--r--compilerplugins/clang/pluginhandler.cxx21
-rw-r--r--compilerplugins/clang/pluginhandler.hxx4
-rw-r--r--compilerplugins/clang/redundantcast.cxx16
-rw-r--r--compilerplugins/clang/refcounting.cxx12
-rw-r--r--compilerplugins/clang/reservedid.cxx2
-rw-r--r--compilerplugins/clang/salbool.cxx8
-rw-r--r--compilerplugins/clang/sfxpoolitem.cxx21
-rw-r--r--compilerplugins/clang/singlevalfields.cxx7
-rw-r--r--compilerplugins/clang/staticmethods.cxx11
-rw-r--r--compilerplugins/clang/store/removevirtuals.cxx3
-rw-r--r--compilerplugins/clang/store/returnbyref.cxx3
-rw-r--r--compilerplugins/clang/test/datamembershadow.cxx5
-rw-r--r--compilerplugins/clang/unnecessaryoverride.cxx22
-rw-r--r--compilerplugins/clang/unnecessaryvirtual.cxx2
-rw-r--r--compilerplugins/clang/unusedmethods.cxx7
-rw-r--r--compilerplugins/clang/unusedmethodsremove.cxx2
-rw-r--r--compilerplugins/clang/vclwidgets.cxx11
30 files changed, 84 insertions, 396 deletions
diff --git a/compilerplugins/clang/check.cxx b/compilerplugins/clang/check.cxx
index 9ded6d296e5f..2a7b0a978348 100644
--- a/compilerplugins/clang/check.cxx
+++ b/compilerplugins/clang/check.cxx
@@ -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;
diff --git a/compilerplugins/clang/checkconfigmacros.cxx b/compilerplugins/clang/checkconfigmacros.cxx
index 46cb35a450c3..7e0a722ef2bb 100644
--- a/compilerplugins/clang/checkconfigmacros.cxx
+++ b/compilerplugins/clang/checkconfigmacros.cxx
@@ -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());
}
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 60eab1251e28..5a540b8ef695 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -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):
diff --git a/compilerplugins/clang/constantparam.cxx b/compilerplugins/clang/constantparam.cxx
index e09050a2af12..461eb52a2e97 100644
--- a/compilerplugins/clang/constantparam.cxx
+++ b/compilerplugins/clang/constantparam.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) {
diff --git a/compilerplugins/clang/countusersofdefaultparams.cxx b/compilerplugins/clang/countusersofdefaultparams.cxx
index de0ab7e741cf..d86e66a35490 100644
--- a/compilerplugins/clang/countusersofdefaultparams.cxx
+++ b/compilerplugins/clang/countusersofdefaultparams.cxx
@@ -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;
diff --git a/compilerplugins/clang/datamembershadow.cxx b/compilerplugins/clang/datamembershadow.cxx
index cc2ec7675b8d..040743bad028 100644
--- a/compilerplugins/clang/datamembershadow.cxx
+++ b/compilerplugins/clang/datamembershadow.cxx
@@ -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;
}
diff --git a/compilerplugins/clang/expandablemethods.cxx b/compilerplugins/clang/expandablemethods.cxx
index 2f2c3a2d68db..6d70ad81cefa 100644
--- a/compilerplugins/clang/expandablemethods.cxx
+++ b/compilerplugins/clang/expandablemethods.cxx
@@ -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 = "";
}
diff --git a/compilerplugins/clang/getimplementationname.cxx b/compilerplugins/clang/getimplementationname.cxx
index 81c3473aa678..4c8f2d19ee73 100644
--- a/compilerplugins/clang/getimplementationname.cxx
+++ b/compilerplugins/clang/getimplementationname.cxx
@@ -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: */
diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx
index 41f6fd56bcae..d7e80f56ab36 100644
--- a/compilerplugins/clang/implicitboolconversion.cxx
+++ b/compilerplugins/clang/implicitboolconversion.cxx
@@ -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))
{
diff --git a/compilerplugins/clang/includeform.cxx b/compilerplugins/clang/includeform.cxx
index bf3d689c603b..4994e8ddd75b 100644
--- a/compilerplugins/clang/includeform.cxx
+++ b/compilerplugins/clang/includeform.cxx
@@ -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 {}
diff --git a/compilerplugins/clang/inlinesimplememberfunctions.cxx b/compilerplugins/clang/inlinesimplememberfunctions.cxx
index de8de482513b..9a1d1f6f3abb 100644
--- a/compilerplugins/clang/inlinesimplememberfunctions.cxx
+++ b/compilerplugins/clang/inlinesimplememberfunctions.cxx
@@ -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();
}
diff --git a/compilerplugins/clang/oslendian.cxx b/compilerplugins/clang/oslendian.cxx
index 2a7bfa6b2efb..75b1dcfdde9f 100644
--- a/compilerplugins/clang/oslendian.cxx
+++ b/compilerplugins/clang/oslendian.cxx
@@ -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);
}
diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx
index 3b4b974c697f..8c522efb5dbe 100644
--- a/compilerplugins/clang/passstuffbyref.cxx
+++ b/compilerplugins/clang/passstuffbyref.cxx
@@ -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())
diff --git a/compilerplugins/clang/pluginhandler.cxx b/compilerplugins/clang/pluginhandler.cxx
index 1740a5d05486..433bd0a9efad 100644
--- a/compilerplugins/clang/pluginhandler.cxx
+++ b/compilerplugins/clang/pluginhandler.cxx
@@ -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
}
fullMessage += "]";
if( loc.isValid())
- return diag.Report( loc, compat::getCustomDiagID(diag, level, fullMessage) );
+ return diag.Report( loc, diag.getDiagnosticIDs()->getCustomDiagID(static_cast<DiagnosticIDs::Level>(level), fullMessage) );
else
- return diag.Report( compat::getCustomDiagID(diag, level, fullMessage) );
+ return diag.Report( diag.getDiagnosticIDs()->getCustomDiagID(static_cast<DiagnosticIDs::Level>(level), fullMessage) );
}
DiagnosticBuilder PluginHandler::report( DiagnosticsEngine::Level level, StringRef message, SourceLocation loc )
@@ -305,15 +306,18 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context )
sprintf( filename, "%s.new.%d", modifyFile.c_str(), getpid());
std::string error;
bool bOk = false;
+ std::error_code ec;
std::unique_ptr<raw_fd_ostream> ostream(
- compat::create_raw_fd_ostream(filename, error) );
- if( error.empty())
+ new raw_fd_ostream(filename, ec, sys::fs::F_None));
+ if( !ec)
{
it->second.write( *ostream );
ostream->close();
if( !ostream->has_error() && rename( filename, modifyFile.c_str()) == 0 )
bOk = true;
}
+ else
+ error = "error: " + ec.message();
ostream->clear_error();
unlink( filename );
if( !bOk )
@@ -323,17 +327,10 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context )
#endif
}
-#if CLANG_VERSION >= 30600
std::unique_ptr<ASTConsumer> LibreOfficeAction::CreateASTConsumer( CompilerInstance& Compiler, StringRef )
{
return llvm::make_unique<PluginHandler>( Compiler, _args );
}
-#else
-ASTConsumer* LibreOfficeAction::CreateASTConsumer( CompilerInstance& Compiler, StringRef )
-{
- return new PluginHandler( Compiler, _args );
-}
-#endif
bool LibreOfficeAction::ParseArgs( const CompilerInstance&, const std::vector< std::string >& args )
{
diff --git a/compilerplugins/clang/pluginhandler.hxx b/compilerplugins/clang/pluginhandler.hxx
index 2befaf7fc6a8..ea0eb2444506 100644
--- a/compilerplugins/clang/pluginhandler.hxx
+++ b/compilerplugins/clang/pluginhandler.hxx
@@ -80,11 +80,7 @@ class LibreOfficeAction
: public PluginASTAction
{
public:
-#if CLANG_VERSION >= 30600
virtual std::unique_ptr<ASTConsumer> CreateASTConsumer( CompilerInstance& Compiler, StringRef InFile );
-#else
- virtual ASTConsumer* CreateASTConsumer( CompilerInstance& Compiler, StringRef InFile );
-#endif
virtual bool ParseArgs( const CompilerInstance& CI, const std::vector< std::string >& args );
private:
diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx
index 2f905d355720..c4d50424b1a0 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -103,20 +103,10 @@ public:
}
}
- bool TraverseInitListExpr(
- InitListExpr * expr
-#if CLANG_VERSION >= 30800
- , DataRecursionQueue * queue = nullptr
-#endif
- )
- {
+ bool TraverseInitListExpr(InitListExpr * expr, DataRecursionQueue * queue = nullptr) {
return WalkUpFromInitListExpr(expr)
&& TraverseSynOrSemInitListExpr(
- expr->isSemanticForm() ? expr : expr->getSemanticForm()
-#if CLANG_VERSION >= 30800
- , queue
-#endif
- );
+ expr->isSemanticForm() ? expr : expr->getSemanticForm(), queue);
}
bool VisitImplicitCastExpr(ImplicitCastExpr const * expr);
@@ -806,7 +796,7 @@ bool RedundantCast::visitBinOp(BinaryOperator const * expr) {
bool RedundantCast::isOverloadedFunction(FunctionDecl const * decl) {
auto const ctx = decl->getDeclContext();
- if (!compat::isLookupContext(*ctx)) {
+ if (!ctx->isLookupContext()) {
return false;
}
auto const canon = decl->getCanonicalDecl();
diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx
index 58a9884ede0d..b902db4efd10 100644
--- a/compilerplugins/clang/refcounting.cxx
+++ b/compilerplugins/clang/refcounting.cxx
@@ -11,7 +11,6 @@
#include <iostream>
#include "check.hxx"
-#include "compat.hxx"
#include "plugin.hxx"
#include "clang/AST/CXXInheritance.h"
@@ -95,15 +94,10 @@ bool isDerivedFrom(const CXXRecordDecl *decl, DeclChecker base) {
if (!decl->hasDefinition()) {
return false;
}
- if (!compat::forallBases(
- *decl,
-#if CLANG_VERSION < 30800
- BaseCheckNotSubclass,
-#else
+ if (!decl->forallBases(
[&base](const CXXRecordDecl *BaseDefinition) -> bool
{ return BaseCheckNotSubclass(BaseDefinition, &base); },
-#endif
- &base, true))
+ true))
{
return true;
}
@@ -550,7 +544,7 @@ bool RefCounting::VisitFunctionDecl(const FunctionDecl * functionDecl) {
if (methodDecl && methodDecl->size_overridden_methods() > 0) {
return true;
}
- checkUnoReference(compat::getReturnType(*functionDecl), functionDecl, nullptr, "return");
+ checkUnoReference(functionDecl->getReturnType(), functionDecl, nullptr, "return");
return true;
}
diff --git a/compilerplugins/clang/reservedid.cxx b/compilerplugins/clang/reservedid.cxx
index 82bbc7ea033c..5fefb26c2589 100644
--- a/compilerplugins/clang/reservedid.cxx
+++ b/compilerplugins/clang/reservedid.cxx
@@ -59,7 +59,6 @@ void ReservedId::run() {
if (TraverseDecl(compiler.getASTContext().getTranslationUnitDecl())
&& compiler.hasPreprocessor())
{
-#if CLANG_VERSION >= 30700
auto & prep = compiler.getPreprocessor();
for (auto const & m: prep.macros(false)) {
auto id = m.first->getName();
@@ -129,7 +128,6 @@ void ReservedId::run() {
}
}
}
-#endif
}
}
diff --git a/compilerplugins/clang/salbool.cxx b/compilerplugins/clang/salbool.cxx
index 2402986467b1..e828dbfcfc55 100644
--- a/compilerplugins/clang/salbool.cxx
+++ b/compilerplugins/clang/salbool.cxx
@@ -108,7 +108,7 @@ BoolOverloadKind isBoolOverloadOf(
// encounter in practice:
bool hasBoolOverload(FunctionDecl const * decl, bool mustBeDeleted) {
auto ctx = decl->getDeclContext();
- if (!compat::isLookupContext(*ctx)) {
+ if (!ctx->isLookupContext()) {
return false;
}
auto res = ctx->lookup(decl->getDeclName());
@@ -285,8 +285,8 @@ bool SalBool::VisitCallExpr(CallExpr * expr) {
}
}
if (ft != nullptr) {
- for (unsigned i = 0; i != compat::getNumParams(*ft); ++i) {
- QualType t(compat::getParamType(*ft, i));
+ for (unsigned i = 0; i != ft->getNumParams(); ++i) {
+ QualType t(ft->getParamType(i));
bool b = false;
if (t->isLValueReferenceType()) {
t = t.getNonReferenceType();
@@ -688,7 +688,7 @@ bool SalBool::VisitFunctionDecl(FunctionDecl const * decl) {
if (ignoreLocation(decl)) {
return true;
}
- if (isSalBool(compat::getReturnType(*decl).getNonReferenceType())
+ if (isSalBool(decl->getReturnType().getNonReferenceType())
&& !(decl->isDeletedAsWritten() && isa<CXXConversionDecl>(decl)))
{
FunctionDecl const * f = decl->getCanonicalDecl();
diff --git a/compilerplugins/clang/sfxpoolitem.cxx b/compilerplugins/clang/sfxpoolitem.cxx
index d2d469d2f4a3..d269070e03fe 100644
--- a/compilerplugins/clang/sfxpoolitem.cxx
+++ b/compilerplugins/clang/sfxpoolitem.cxx
@@ -11,7 +11,6 @@
#include <iostream>
#include "plugin.hxx"
-#include "compat.hxx"
#include "check.hxx"
#include "clang/AST/CXXInheritance.h"
@@ -34,13 +33,7 @@ public:
bool VisitCXXRecordDecl( const CXXRecordDecl* );
};
-bool BaseCheckNotSfxPoolItemSubclass(
- const CXXRecordDecl *BaseDefinition
-#if CLANG_VERSION < 30800
- , void *
-#endif
- )
-{
+bool BaseCheckNotSfxPoolItemSubclass(const CXXRecordDecl *BaseDefinition) {
if (BaseDefinition && loplugin::TypeCheck(BaseDefinition).Class("SfxPoolItem").GlobalNamespace()) {
return false;
}
@@ -58,20 +51,14 @@ bool isDerivedFromSfxPoolItem(const CXXRecordDecl *decl) {
if (// not sure what hasAnyDependentBases() does,
// but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1
!decl->hasAnyDependentBases() &&
- !compat::forallBases(*decl, BaseCheckNotSfxPoolItemSubclass, nullptr, true)) {
+ !decl->forallBases(BaseCheckNotSfxPoolItemSubclass, true)) {
return true;
}
return false;
}
-bool BaseCheckNotSwMsgPoolItemSubclass(
- const CXXRecordDecl *BaseDefinition
-#if CLANG_VERSION < 30800
- , void *
-#endif
- )
-{
+bool BaseCheckNotSwMsgPoolItemSubclass(const CXXRecordDecl *BaseDefinition) {
if (BaseDefinition && loplugin::TypeCheck(BaseDefinition).Class("SwMsgPoolItem")) {
return false;
}
@@ -89,7 +76,7 @@ bool isDerivedFromSwMsgPoolItem(const CXXRecordDecl *decl) {
if (// not sure what hasAnyDependentBases() does,
// but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1
!decl->hasAnyDependentBases() &&
- !compat::forallBases(*decl, BaseCheckNotSwMsgPoolItemSubclass, nullptr, true)) {
+ !decl->forallBases(BaseCheckNotSwMsgPoolItemSubclass, true)) {
return true;
}
return false;
diff --git a/compilerplugins/clang/singlevalfields.cxx b/compilerplugins/clang/singlevalfields.cxx
index 85d77b005562..61cfe044d1fd 100644
--- a/compilerplugins/clang/singlevalfields.cxx
+++ b/compilerplugins/clang/singlevalfields.cxx
@@ -13,7 +13,6 @@
#include <fstream>
#include <set>
#include "plugin.hxx"
-#include "compat.hxx"
/**
Look for fields that are only ever assigned a single constant value.
@@ -262,7 +261,7 @@ bool SingleValFields::VisitMemberExpr( const MemberExpr* memberExpr )
if (parentFunction && parent && isa<ReturnStmt>(parent)) {
const Stmt* parent2 = getParentStmt(parent);
if (parent2 && isa<CompoundStmt>(parent2)) {
- QualType qt = compat::getReturnType(*parentFunction).getDesugaredType(compiler.getASTContext());
+ QualType qt = parentFunction->getReturnType().getDesugaredType(compiler.getASTContext());
if (!qt.isConstQualified() && qt->isReferenceType()) {
bPotentiallyAssignedTo = true;
}
@@ -449,10 +448,10 @@ void SingleValFields::checkCallExpr(const Stmt* child, const CallExpr* callExpr,
return;
}
for (unsigned i = 0; i < callExpr->getNumArgs(); ++i) {
- if (i >= compat::getNumParams(*proto)) // can happen in template code
+ if (i >= proto->getNumParams()) // can happen in template code
break;
if (callExpr->getArg(i) == child) {
- QualType qt = compat::getParamType(*proto, i).getDesugaredType(compiler.getASTContext());
+ QualType qt = proto->getParamType(i).getDesugaredType(compiler.getASTContext());
if (!qt.isConstQualified() && qt->isReferenceType()) {
assignValue = "?";
bPotentiallyAssignedTo = true;
diff --git a/compilerplugins/clang/staticmethods.cxx b/compilerplugins/clang/staticmethods.cxx
index 7d5b23a7ba04..f4e1f068ec0e 100644
--- a/compilerplugins/clang/staticmethods.cxx
+++ b/compilerplugins/clang/staticmethods.cxx
@@ -10,7 +10,6 @@
#include "clang/AST/Attr.h"
#include "check.hxx"
-#include "compat.hxx"
#include "plugin.hxx"
/*
@@ -39,13 +38,7 @@ private:
StringRef getFilename(SourceLocation loc);
};
-bool BaseCheckNotTestFixtureSubclass(
- const CXXRecordDecl *BaseDefinition
-#if CLANG_VERSION < 30800
- , void *
-#endif
- )
-{
+bool BaseCheckNotTestFixtureSubclass(const CXXRecordDecl *BaseDefinition) {
if (loplugin::TypeCheck(BaseDefinition).Class("TestFixture").Namespace("CppUnit").GlobalNamespace()) {
return false;
}
@@ -58,7 +51,7 @@ bool isDerivedFromTestFixture(const CXXRecordDecl *decl) {
if (// not sure what hasAnyDependentBases() does,
// but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1
!decl->hasAnyDependentBases() &&
- !compat::forallBases(*decl, BaseCheckNotTestFixtureSubclass, nullptr, true)) {
+ !decl->forallBases(BaseCheckNotTestFixtureSubclass, true)) {
return true;
}
return false;
diff --git a/compilerplugins/clang/store/removevirtuals.cxx b/compilerplugins/clang/store/removevirtuals.cxx
index 6ed3dd60e191..e44cb738629e 100644
--- a/compilerplugins/clang/store/removevirtuals.cxx
+++ b/compilerplugins/clang/store/removevirtuals.cxx
@@ -11,7 +11,6 @@
#include <string>
#include <iostream>
#include "plugin.hxx"
-#include "compat.hxx"
#include <sys/mman.h>
#include <sys/types.h>
#include <fcntl.h>
@@ -75,7 +74,7 @@ std::string niceName(const CXXMethodDecl* functionDecl)
{
std::string s =
functionDecl->getParent()->getQualifiedNameAsString() + "::"
- + compat::getReturnType(*functionDecl).getAsString() + "-"
+ + functionDecl->getReturnType().getAsString() + "-"
+ functionDecl->getNameAsString() + "(";
for (const ParmVarDecl *pParmVarDecl : functionDecl->params()) {
s += pParmVarDecl->getType().getAsString();
diff --git a/compilerplugins/clang/store/returnbyref.cxx b/compilerplugins/clang/store/returnbyref.cxx
index 9fa66131a880..51723c0f40a4 100644
--- a/compilerplugins/clang/store/returnbyref.cxx
+++ b/compilerplugins/clang/store/returnbyref.cxx
@@ -10,7 +10,6 @@
#include <string>
#include <set>
-#include "compat.hxx"
#include "plugin.hxx"
// Find places where we are returning a pointer to something, where we can be returning a reference.
@@ -55,7 +54,7 @@ bool ReturnByRef::VisitCXXMethodDecl(const CXXMethodDecl * functionDecl) {
if (isInUnoIncludeFile(functionDecl)) {
return true;
}
- QualType t1 { compat::getReturnType(*functionDecl) };
+ QualType t1 { functionDecl->getReturnType() };
if (!t1->isPointerType()) {
return true;
}
diff --git a/compilerplugins/clang/test/datamembershadow.cxx b/compilerplugins/clang/test/datamembershadow.cxx
index 5965421360ec..a11a7cc51c65 100644
--- a/compilerplugins/clang/test/datamembershadow.cxx
+++ b/compilerplugins/clang/test/datamembershadow.cxx
@@ -11,8 +11,6 @@
#include <config_clang.h>
-// '#if CLANG_VERSION >= 30800' covers large parts of compilerplugins/clang/datamembershadow.cxx
-#if CLANG_VERSION >= 30800
struct Bar {
int x; // expected-note {{superclass member here [loplugin:datamembershadow]}}
};
@@ -20,8 +18,5 @@ struct Bar {
struct Foo : public Bar {
int x; // expected-error {{data member x is shadowing member in superclass, through inheritance path Foo->Bar [loplugin:datamembershadow]}}
};
-#else
-// expected-no-diagnostics
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/unnecessaryoverride.cxx b/compilerplugins/clang/unnecessaryoverride.cxx
index 336c7712a95f..f912e43009bb 100644
--- a/compilerplugins/clang/unnecessaryoverride.cxx
+++ b/compilerplugins/clang/unnecessaryoverride.cxx
@@ -14,7 +14,6 @@
#include <set>
#include <clang/AST/CXXInheritance.h>
-#include "compat.hxx"
#include "plugin.hxx"
/**
@@ -102,12 +101,7 @@ public:
private:
const CXXMethodDecl * findOverriddenOrSimilarMethodInSuperclasses(const CXXMethodDecl *);
- bool BaseCheckCallback(
- const CXXRecordDecl *BaseDefinition
- #if CLANG_VERSION < 30800
- , void *
- #endif
- );
+ bool BaseCheckCallback(const CXXRecordDecl *BaseDefinition);
};
bool UnnecessaryOverride::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
@@ -277,8 +271,8 @@ bool UnnecessaryOverride::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
}
}
- if (compat::getReturnType(*methodDecl).getCanonicalType()
- != compat::getReturnType(*overriddenMethodDecl).getCanonicalType())
+ if (methodDecl->getReturnType().getCanonicalType()
+ != overriddenMethodDecl->getReturnType().getCanonicalType())
{
return true;
}
@@ -290,7 +284,7 @@ bool UnnecessaryOverride::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
return true;
const CXXMemberCallExpr* callExpr = nullptr;
- if (compat::getReturnType(*methodDecl).getCanonicalType()->isVoidType())
+ if (methodDecl->getReturnType().getCanonicalType()->isVoidType())
{
if (auto const e = dyn_cast<Expr>(*compoundStmt->body_begin())) {
callExpr = dyn_cast<CXXMemberCallExpr>(e->IgnoreImplicit()->IgnoreParens());
@@ -395,9 +389,6 @@ const CXXMethodDecl* UnnecessaryOverride::findOverriddenOrSimilarMethodInSupercl
return nullptr;
}
-#if CLANG_VERSION < 30800
- return nullptr;
-#else
std::vector<const CXXMethodDecl*> maSimilarMethods;
auto BaseMatchesCallback = [&](const CXXBaseSpecifier *cxxBaseSpecifier, CXXBasePath& )
@@ -425,8 +416,8 @@ const CXXMethodDecl* UnnecessaryOverride::findOverriddenOrSimilarMethodInSupercl
{
continue;
}
- if (compat::getReturnType(*methodDecl).getCanonicalType()
- != compat::getReturnType(*baseMethod).getCanonicalType())
+ if (methodDecl->getReturnType().getCanonicalType()
+ != baseMethod->getReturnType().getCanonicalType())
{
continue;
}
@@ -454,7 +445,6 @@ const CXXMethodDecl* UnnecessaryOverride::findOverriddenOrSimilarMethodInSupercl
return maSimilarMethods[0];
}
return nullptr;
-#endif
}
diff --git a/compilerplugins/clang/unnecessaryvirtual.cxx b/compilerplugins/clang/unnecessaryvirtual.cxx
index 9ff389d1290e..f9283e3a1754 100644
--- a/compilerplugins/clang/unnecessaryvirtual.cxx
+++ b/compilerplugins/clang/unnecessaryvirtual.cxx
@@ -84,7 +84,7 @@ std::string niceName(const CXXMethodDecl* functionDecl)
{
std::string s =
functionDecl->getParent()->getQualifiedNameAsString() + "::"
- + compat::getReturnType(*functionDecl).getAsString() + "-"
+ + functionDecl->getReturnType().getAsString() + "-"
+ functionDecl->getNameAsString() + "(";
for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) {
s += pParmVarDecl->getType().getAsString();
diff --git a/compilerplugins/clang/unusedmethods.cxx b/compilerplugins/clang/unusedmethods.cxx
index 9122e3565d54..6ea3da69716b 100644
--- a/compilerplugins/clang/unusedmethods.cxx
+++ b/compilerplugins/clang/unusedmethods.cxx
@@ -136,11 +136,8 @@ MyFuncInfo UnusedMethods::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())
@@ -151,7 +148,7 @@ MyFuncInfo UnusedMethods::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 = "";
}
@@ -262,7 +259,7 @@ gotfunc:
}
// Now do the checks necessary for the "unused return value" analysis
- if (compat::getReturnType(*calleeFunctionDecl)->isVoidType()) {
+ if (calleeFunctionDecl->getReturnType()->isVoidType()) {
return true;
}
if (!parent) {
diff --git a/compilerplugins/clang/unusedmethodsremove.cxx b/compilerplugins/clang/unusedmethodsremove.cxx
index 3d3886ace0db..33c7ee7a1fec 100644
--- a/compilerplugins/clang/unusedmethodsremove.cxx
+++ b/compilerplugins/clang/unusedmethodsremove.cxx
@@ -76,7 +76,7 @@ UnusedMethodsRemove::~UnusedMethodsRemove()
std::string niceName(const CXXMethodDecl* functionDecl)
{
std::string s =
- compat::getReturnType(*functionDecl).getCanonicalType().getAsString()
+ functionDecl->getReturnType().getCanonicalType().getAsString()
+ " " + functionDecl->getParent()->getQualifiedNameAsString()
+ "::" + functionDecl->getNameAsString()
+ "(";
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index 0f966708bc2d..c2cfeaa08095 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -12,7 +12,6 @@
#include <iostream>
#include "plugin.hxx"
-#include "compat.hxx"
#include "check.hxx"
#include "clang/AST/CXXInheritance.h"
@@ -55,13 +54,7 @@ private:
#define BASE_REF_COUNTED_CLASS "VclReferenceBase"
-bool BaseCheckNotWindowSubclass(
- const CXXRecordDecl *BaseDefinition
-#if CLANG_VERSION < 30800
- , void *
-#endif
- )
-{
+bool BaseCheckNotWindowSubclass(const CXXRecordDecl *BaseDefinition) {
return !loplugin::DeclCheck(BaseDefinition).Class(BASE_REF_COUNTED_CLASS)
.GlobalNamespace();
}
@@ -80,7 +73,7 @@ bool isDerivedFromVclReferenceBase(const CXXRecordDecl *decl) {
if (// not sure what hasAnyDependentBases() does,
// but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1
!decl->hasAnyDependentBases() &&
- !compat::forallBases(*decl, BaseCheckNotWindowSubclass, nullptr, true)) {
+ !decl->forallBases(BaseCheckNotWindowSubclass, true)) {
return true;
}
return false;