README.md | 2 compilerplugins/clang/casttovoid.cxx | 4 - compilerplugins/clang/checkconfigmacros.cxx | 12 --- compilerplugins/clang/compat.hxx | 76 -------------------- compilerplugins/clang/constantparam.cxx | 2 compilerplugins/clang/constfields.cxx | 5 - compilerplugins/clang/constparams.cxx | 2 compilerplugins/clang/countusersofdefaultparams.cxx | 2 compilerplugins/clang/dynexcspec.cxx | 5 - compilerplugins/clang/expandablemethods.cxx | 4 - compilerplugins/clang/external.cxx | 8 -- compilerplugins/clang/externvar.cxx | 3 compilerplugins/clang/includeform.cxx | 3 compilerplugins/clang/methodcycles.cxx | 8 -- compilerplugins/clang/oslendian.cxx | 6 - compilerplugins/clang/overrideparam.cxx | 3 compilerplugins/clang/plugin.cxx | 2 compilerplugins/clang/redundantinline.cxx | 9 -- compilerplugins/clang/salbool.cxx | 4 - compilerplugins/clang/singlevalfields.cxx | 4 - compilerplugins/clang/staticconstfield.cxx | 2 compilerplugins/clang/test/staticconstfield.cxx | 2 compilerplugins/clang/test/staticvar.cxx | 2 compilerplugins/clang/test/unnecessaryoverride.cxx | 2 compilerplugins/clang/test/useuniqueptr.cxx | 2 compilerplugins/clang/unnecessaryvirtual.cxx | 3 compilerplugins/clang/unusedfields.cxx | 10 -- compilerplugins/clang/unusedmethods.cxx | 8 -- compilerplugins/clang/unusedmethodsremove.cxx | 2 compilerplugins/clang/useuniqueptr.cxx | 4 - compilerplugins/clang/virtualdown.cxx | 8 -- configure.ac | 4 - 32 files changed, 31 insertions(+), 182 deletions(-)
New commits: commit f23aa1a51cb1beea4ebe3a61ba0c9b3abd844fd9 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Thu Nov 22 19:57:38 2018 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Fri Nov 23 08:20:53 2018 +0100 Bump compiler plugins Clang baseline to 5.0.2 ...as discussed at <https://lists.freedesktop.org/archives/libreoffice/2018-November/081435.html> "minutes of ESC call ..." Change-Id: Ia053da171d59747984546f38e19da808825b4f79 Reviewed-on: https://gerrit.libreoffice.org/63832 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/README.md b/README.md index 1e32005147d3..39fe759836c6 100644 --- a/README.md +++ b/README.md @@ -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.8. Since Xcode doesn't provide the compiler plugin +version of Clang is 5.0.2. 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. diff --git a/compilerplugins/clang/casttovoid.cxx b/compilerplugins/clang/casttovoid.cxx index 3812618a7283..e6da5b6d7445 100644 --- a/compilerplugins/clang/casttovoid.cxx +++ b/compilerplugins/clang/casttovoid.cxx @@ -105,7 +105,6 @@ public: return ret; } -#if CLANG_VERSION >= 50000 bool TraverseCXXDeductionGuideDecl(CXXDeductionGuideDecl * decl) { returnTypes_.push(decl->getReturnType()); auto const ret = RecursiveASTVisitor::TraverseCXXDeductionGuideDecl( @@ -115,7 +114,6 @@ public: returnTypes_.pop(); return ret; } -#endif bool TraverseCXXMethodDecl(CXXMethodDecl * decl) { returnTypes_.push(decl->getReturnType()); @@ -489,7 +487,7 @@ private: } auto const loc = compat::getBeginLoc(dre); if (compiler.getSourceManager().isMacroArgExpansion(loc) - && (compat::getImmediateMacroNameForDiagnostics( + && (Lexer::getImmediateMacroNameForDiagnostics( loc, compiler.getSourceManager(), compiler.getLangOpts()) == "assert")) { diff --git a/compilerplugins/clang/checkconfigmacros.cxx b/compilerplugins/clang/checkconfigmacros.cxx index 7e0a722ef2bb..cff2d41dd6df 100644 --- a/compilerplugins/clang/checkconfigmacros.cxx +++ b/compilerplugins/clang/checkconfigmacros.cxx @@ -37,11 +37,7 @@ 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, MacroDefinition const & -#if CLANG_VERSION >= 50000 - , MacroDirective const * -#endif - ) override; + virtual void MacroUndefined( const Token& macroToken, MacroDefinition const &, MacroDirective const * ) 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; @@ -75,11 +71,7 @@ void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroDirect } } -void CheckConfigMacros::MacroUndefined( const Token& macroToken, MacroDefinition const & -#if CLANG_VERSION >= 50000 - , MacroDirective const * -#endif - ) +void CheckConfigMacros::MacroUndefined( const Token& macroToken, MacroDefinition const &, MacroDirective const * ) { configMacros.erase( macroToken.getIdentifierInfo()->getName()); } diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx index f2a8e2f10fe0..4733cd332e5e 100644 --- a/compilerplugins/clang/compat.hxx +++ b/compilerplugins/clang/compat.hxx @@ -27,30 +27,6 @@ // Compatibility wrapper to abstract over (trivial) changes in the Clang API: namespace compat { -inline llvm::StringRef take_front(llvm::StringRef ref, std::size_t N = 1) { -#if CLANG_VERSION >= 40000 - return ref.take_front(N); -#else - auto const size = ref.size(); - return N >= size ? ref : ref.drop_back(size - N); -#endif -} - - -#if CLANG_VERSION >= 30900 -inline clang::ArrayRef<clang::ParmVarDecl *> parameters( - clang::FunctionDecl const & decl) -{ - return decl.parameters(); -} -#else -inline clang::FunctionDecl::param_const_range parameters( - clang::FunctionDecl const & decl) -{ - return decl.params(); -} -#endif - inline clang::SourceLocation getBeginLoc(clang::Decl const * decl) { #if CLANG_VERSION >= 80000 return decl->getBeginLoc(); @@ -141,58 +117,6 @@ inline bool isPointWithin( #endif } -inline bool isMacroArgExpansion( - clang::CompilerInstance& compiler, clang::SourceLocation location, - clang::SourceLocation * startLocation) -{ -#if CLANG_VERSION >= 30900 - return compiler.getSourceManager().isMacroArgExpansion( - location, startLocation); -#else - bool b = compiler.getSourceManager().isMacroArgExpansion(location); - if (b) { - *startLocation = compiler.getSourceManager() - .getSLocEntry(compiler.getSourceManager().getFileID(location)) - .getExpansion().getExpansionLocStart(); - } - return b; -#endif -} - -inline llvm::StringRef getImmediateMacroNameForDiagnostics( - clang::SourceLocation Loc, clang::SourceManager const & SM, - clang::LangOptions const &LangOpts) -{ -#if CLANG_VERSION >= 30900 - return clang::Lexer::getImmediateMacroNameForDiagnostics(Loc, SM, LangOpts); -#else - using namespace clang; - // Verbatim copy from Clang's lib/Lex/Lexer.cpp: - - assert(Loc.isMacroID() && "Only reasonable to call this on macros"); - // Walk past macro argument expansion. - while (SM.isMacroArgExpansion(Loc)) - Loc = SM.getImmediateExpansionRange(Loc).first; - - // If the macro's spelling has no FileID, then it's actually a token paste - // or stringization (or similar) and not a macro at all. - if (!SM.getFileEntryForID(SM.getFileID(SM.getSpellingLoc(Loc)))) - return StringRef(); - - // Find the spelling location of the start of the non-argument expansion - // range. This is where the macro name was spelled in order to begin - // expanding this macro. - Loc = SM.getSpellingLoc(SM.getImmediateExpansionRange(Loc).first); - - // Dig out the buffer where the macro name was spelled and the extents of - // the name so that we can render it into the expansion note. - std::pair<FileID, unsigned> ExpansionInfo = SM.getDecomposedLoc(Loc); - unsigned MacroTokenLength = Lexer::MeasureTokenLength(Loc, SM, LangOpts); - StringRef ExpansionBuffer = SM.getBufferData(ExpansionInfo.first); - return ExpansionBuffer.substr(ExpansionInfo.second, MacroTokenLength); -#endif -} - inline clang::Expr const * IgnoreImplicit(clang::Expr const * expr) { #if CLANG_VERSION >= 80000 return expr->IgnoreImplicit(); diff --git a/compilerplugins/clang/constantparam.cxx b/compilerplugins/clang/constantparam.cxx index 208fc19ca0f7..34455ee00400 100644 --- a/compilerplugins/clang/constantparam.cxx +++ b/compilerplugins/clang/constantparam.cxx @@ -135,7 +135,7 @@ void ConstantParam::addToCallSet(const FunctionDecl* functionDecl, int paramInde } aInfo.nameAndParams += functionDecl->getNameAsString() + "("; bool bFirst = true; - for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) { + for (const ParmVarDecl *pParmVarDecl : functionDecl->parameters()) { if (bFirst) bFirst = false; else diff --git a/compilerplugins/clang/constfields.cxx b/compilerplugins/clang/constfields.cxx index 6613c836b892..ce73e0d8e51f 100644 --- a/compilerplugins/clang/constfields.cxx +++ b/compilerplugins/clang/constfields.cxx @@ -393,10 +393,7 @@ void ConstFields::check(const FieldDecl* fieldDecl, const Expr* memberExpr) break; } else if (isa<CastExpr>(parent) || isa<MemberExpr>(parent) || isa<ParenExpr>(parent) - || isa<ParenListExpr>(parent) -#if CLANG_VERSION >= 40000 - || isa<ArrayInitLoopExpr>(parent) -#endif + || isa<ParenListExpr>(parent) || isa<ArrayInitLoopExpr>(parent) || isa<ExprWithCleanups>(parent)) { walkUp(); diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx index ee8ede3c1e2c..cccc454fa1af 100644 --- a/compilerplugins/clang/constparams.cxx +++ b/compilerplugins/clang/constparams.cxx @@ -216,7 +216,7 @@ bool ConstParams::CheckTraverseFunctionDecl(FunctionDecl * functionDecl) // calculate the ones we want to check bool foundInterestingParam = false; - for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) { + for (const ParmVarDecl *pParmVarDecl : functionDecl->parameters()) { // ignore unused params if (pParmVarDecl->getName().empty() || pParmVarDecl->hasAttr<UnusedAttr>()) diff --git a/compilerplugins/clang/countusersofdefaultparams.cxx b/compilerplugins/clang/countusersofdefaultparams.cxx index 12057dec9264..0f434689a6c2 100644 --- a/compilerplugins/clang/countusersofdefaultparams.cxx +++ b/compilerplugins/clang/countusersofdefaultparams.cxx @@ -114,7 +114,7 @@ void CountUsersOfDefaultParams::niceName(const FunctionDecl* functionDecl, MyFun } aInfo.nameAndParams += functionDecl->getNameAsString() + "("; bool bFirst = true; - for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) { + for (const ParmVarDecl *pParmVarDecl : functionDecl->parameters()) { if (bFirst) bFirst = false; else diff --git a/compilerplugins/clang/dynexcspec.cxx b/compilerplugins/clang/dynexcspec.cxx index c596547ea195..e5e15cb139fc 100644 --- a/compilerplugins/clang/dynexcspec.cxx +++ b/compilerplugins/clang/dynexcspec.cxx @@ -90,10 +90,7 @@ public: } } bool dtorOrDealloc = isDtorOrDealloc(decl); - SourceRange source; -#if CLANG_VERSION >= 40000 - source = decl->getExceptionSpecSourceRange(); -#endif + auto const source = decl->getExceptionSpecSourceRange(); if (rewriter != nullptr && source.isValid()) { if (dtorOrDealloc) { if (replaceText(source, "noexcept(false)")) { diff --git a/compilerplugins/clang/expandablemethods.cxx b/compilerplugins/clang/expandablemethods.cxx index 4da75cfd0f02..8277ae838028 100644 --- a/compilerplugins/clang/expandablemethods.cxx +++ b/compilerplugins/clang/expandablemethods.cxx @@ -140,7 +140,7 @@ MyFuncInfo ExpandableMethods::niceName(const FunctionDecl* functionDecl) } aInfo.nameAndParams += functionDecl->getNameAsString() + "("; bool bFirst = true; - for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) { + for (const ParmVarDecl *pParmVarDecl : functionDecl->parameters()) { if (bFirst) bFirst = false; else @@ -187,7 +187,7 @@ bool ExpandableMethods::VisitFunctionDecl( const FunctionDecl* functionDecl ) // any function that uses a parameter more than once if (!bLargeFunction) { StringRef bodyText(s1, s2-s1); - for (const ParmVarDecl* param : compat::parameters(*functionDecl)) { + for (const ParmVarDecl* param : functionDecl->parameters()) { StringRef name = param->getName(); if (name.empty()) continue; diff --git a/compilerplugins/clang/external.cxx b/compilerplugins/clang/external.cxx index f0abf52fd52c..8e66cf2ee5df 100644 --- a/compilerplugins/clang/external.cxx +++ b/compilerplugins/clang/external.cxx @@ -251,13 +251,7 @@ private: { return true; } - if (decl->getLinkageInternal() < -#if CLANG_VERSION >= 50000 - ModuleLinkage -#else - ExternalLinkage -#endif - ) + if (decl->getLinkageInternal() < ModuleLinkage) { return true; } diff --git a/compilerplugins/clang/externvar.cxx b/compilerplugins/clang/externvar.cxx index cc2c8fc7f4b0..93a08092bd08 100644 --- a/compilerplugins/clang/externvar.cxx +++ b/compilerplugins/clang/externvar.cxx @@ -8,7 +8,6 @@ */ #include "check.hxx" -#include "compat.hxx" #include "plugin.hxx" // Find variable declarations at namespace scope that need not have external @@ -78,7 +77,7 @@ public: return true; } SourceLocation argLoc; - if (compat::isMacroArgExpansion(compiler, def->getLocation(), &argLoc) + if (compiler.getSourceManager().isMacroArgExpansion(def->getLocation(), &argLoc) && (Lexer::getImmediateMacroName( argLoc, compiler.getSourceManager(), compiler.getLangOpts()) == "DEFINE_GUID")) diff --git a/compilerplugins/clang/includeform.cxx b/compilerplugins/clang/includeform.cxx index 0add9ffc47ba..9d6587506a85 100644 --- a/compilerplugins/clang/includeform.cxx +++ b/compilerplugins/clang/includeform.cxx @@ -11,7 +11,6 @@ #include "config_clang.h" -#include "compat.hxx" #include "plugin.hxx" // Enforces the "Rules for #include directives (C/C++)" described in README.md. @@ -74,7 +73,7 @@ private: pos = pos2; } #endif - auto dir2 = std::string(compat::take_front(file, pos)); + auto dir2 = std::string(file.take_front(pos)); loplugin::normalizeDotDotInFilePath(dir2); shouldUseAngles = !loplugin::isSamePathname(dir1, dir2); } diff --git a/compilerplugins/clang/methodcycles.cxx b/compilerplugins/clang/methodcycles.cxx index 20a31171c001..fb1a88b80a94 100644 --- a/compilerplugins/clang/methodcycles.cxx +++ b/compilerplugins/clang/methodcycles.cxx @@ -18,7 +18,6 @@ #include "clang/AST/Attr.h" #include "plugin.hxx" -#include "compat.hxx" /** What we are looking for here are methods that are not reachable from any of the program @@ -110,9 +109,8 @@ public: bool TraverseCXXConstructorDecl(CXXConstructorDecl*); bool TraverseCXXConversionDecl(CXXConversionDecl*); bool TraverseCXXDestructorDecl(CXXDestructorDecl*); -#if CLANG_VERSION >= 50000 bool TraverseCXXDeductionGuideDecl(CXXDeductionGuideDecl*); -#endif + private: void logCallToRootMethods(const FunctionDecl* functionDeclFrom, const FunctionDecl* functionDeclTo); @@ -154,7 +152,7 @@ MyFuncInfo MethodCycles::niceName(const FunctionDecl* functionDecl) aInfo.nameAndParams = functionDecl->getQualifiedNameAsString() + "("; } bool bFirst = true; - for (const ParmVarDecl* pParmVarDecl : compat::parameters(*functionDecl)) + for (const ParmVarDecl* pParmVarDecl : functionDecl->parameters()) { if (bFirst) bFirst = false; @@ -349,7 +347,6 @@ bool MethodCycles::TraverseCXXConversionDecl(CXXConversionDecl* f) currentFunctionDecl = copy; return ret; } -#if CLANG_VERSION >= 50000 bool MethodCycles::TraverseCXXDeductionGuideDecl(CXXDeductionGuideDecl* f) { auto copy = currentFunctionDecl; @@ -358,7 +355,6 @@ bool MethodCycles::TraverseCXXDeductionGuideDecl(CXXDeductionGuideDecl* f) currentFunctionDecl = copy; return ret; } -#endif bool MethodCycles::TraverseCXXConstructorDecl(CXXConstructorDecl* f) { auto copy = currentFunctionDecl; diff --git a/compilerplugins/clang/oslendian.cxx b/compilerplugins/clang/oslendian.cxx index 75b1dcfdde9f..3cb1adbe3da0 100644 --- a/compilerplugins/clang/oslendian.cxx +++ b/compilerplugins/clang/oslendian.cxx @@ -59,11 +59,7 @@ private: } void MacroUndefined( - Token const & MacroNameTok, MacroDefinition const & -#if CLANG_VERSION >= 50000 - , MacroDirective const * -#endif - ) override + Token const & MacroNameTok, MacroDefinition const &, MacroDirective const *) override { auto id = MacroNameTok.getIdentifierInfo()->getName(); if (id == "OSL_BIGENDIAN" || id == "OSL_LITENDIAN") { diff --git a/compilerplugins/clang/overrideparam.cxx b/compilerplugins/clang/overrideparam.cxx index 39400566152b..63620fe206c3 100644 --- a/compilerplugins/clang/overrideparam.cxx +++ b/compilerplugins/clang/overrideparam.cxx @@ -11,7 +11,6 @@ #include <set> #include "plugin.hxx" -#include "compat.hxx" #include "check.hxx" /* @@ -76,7 +75,7 @@ bool OverrideParam::VisitCXXMethodDecl(const CXXMethodDecl * methodDecl) { continue; } int i = 0; - for (const ParmVarDecl *superParmVarDecl : compat::parameters(*superMethodDecl)) { + for (const ParmVarDecl *superParmVarDecl : superMethodDecl->parameters()) { const ParmVarDecl *parmVarDecl = methodDecl->getParamDecl(i); if (parmVarDecl->hasDefaultArg() && !superParmVarDecl->hasDefaultArg()) { report( diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx index 84975c99107a..ff12ebb2d6ba 100644 --- a/compilerplugins/clang/plugin.cxx +++ b/compilerplugins/clang/plugin.cxx @@ -351,7 +351,6 @@ Plugin::IdenticalDefaultArgumentsResult Plugin::checkIdenticalDefaultArguments( ? IdenticalDefaultArgumentsResult::Yes : IdenticalDefaultArgumentsResult::No; } -#if CLANG_VERSION >= 30900 APFloat f1(0.0f), f2(0.0f); if (argument1->EvaluateAsFloat(f1, compiler.getASTContext()) && argument2->EvaluateAsFloat(f2, compiler.getASTContext())) @@ -360,7 +359,6 @@ Plugin::IdenticalDefaultArgumentsResult Plugin::checkIdenticalDefaultArguments( ? IdenticalDefaultArgumentsResult::Yes : IdenticalDefaultArgumentsResult::No; } -#endif auto const desugared1 = argument1->IgnoreParenImpCasts(); auto const desugared2 = argument2->IgnoreParenImpCasts(); if (auto const lit1 = dyn_cast<clang::StringLiteral>(desugared1)) { diff --git a/compilerplugins/clang/redundantinline.cxx b/compilerplugins/clang/redundantinline.cxx index 1c3ea454a955..5fab44825afa 100644 --- a/compilerplugins/clang/redundantinline.cxx +++ b/compilerplugins/clang/redundantinline.cxx @@ -137,14 +137,7 @@ private: } bool handleNonExternalLinkage(FunctionDecl const * decl) { - if (decl->getLinkageInternal() >= -#if CLANG_VERSION >= 50000 - ModuleLinkage -#else - ExternalLinkage -#endif - ) - { + if (decl->getLinkageInternal() >= ModuleLinkage) { return false; } if (!compiler.getSourceManager().isInMainFile(decl->getLocation())) { diff --git a/compilerplugins/clang/salbool.cxx b/compilerplugins/clang/salbool.cxx index 9b664e626f0d..ad71435470f0 100644 --- a/compilerplugins/clang/salbool.cxx +++ b/compilerplugins/clang/salbool.cxx @@ -333,8 +333,8 @@ bool SalBool::VisitCStyleCastExpr(CStyleCastExpr * expr) { .getImmediateMacroCallerLoc(loc); if (!isSharedCAndCppCode(callLoc)) { SourceLocation argLoc; - if (compat::isMacroArgExpansion( - compiler, compat::getBeginLoc(expr), &argLoc) + if (compiler.getSourceManager().isMacroArgExpansion( + compat::getBeginLoc(expr), &argLoc) //TODO: check it's the complete (first) arg to the macro && (Lexer::getImmediateMacroName( argLoc, compiler.getSourceManager(), diff --git a/compilerplugins/clang/singlevalfields.cxx b/compilerplugins/clang/singlevalfields.cxx index 7e8195bdacb4..e14fd7c84b3b 100644 --- a/compilerplugins/clang/singlevalfields.cxx +++ b/compilerplugins/clang/singlevalfields.cxx @@ -321,13 +321,11 @@ bool SingleValFields::VisitMemberExpr( const MemberExpr* memberExpr ) { break; } -#if CLANG_VERSION >= 40000 else if ( isa<ArrayInitLoopExpr>(parent) ) { bPotentiallyAssignedTo = true; break; } -#endif else { bPotentiallyAssignedTo = true; bDump = true; @@ -451,7 +449,6 @@ std::string SingleValFields::getExprValue(const Expr* arg) return dyn_cast<clang::StringLiteral>(constructExpr->getArg(0))->getString(); } } -#if CLANG_VERSION >= 50000 if (arg->getType()->isFloatingType()) { APFloat x1(0.0f); @@ -463,7 +460,6 @@ std::string SingleValFields::getExprValue(const Expr* arg) return os.str(); } } -#endif APSInt x1; if (arg->EvaluateAsInt(x1, compiler.getASTContext())) return x1.toString(10); diff --git a/compilerplugins/clang/staticconstfield.cxx b/compilerplugins/clang/staticconstfield.cxx index eadbd26bef78..6925c18ec301 100644 --- a/compilerplugins/clang/staticconstfield.cxx +++ b/compilerplugins/clang/staticconstfield.cxx @@ -109,7 +109,6 @@ bool StaticConstField::TraverseConstructorInitializer(CXXCtorInitializer* init) } } } -#if CLANG_VERSION >= 50000 else if (type->isFloatingType()) { APFloat x1(0.0f); @@ -122,7 +121,6 @@ bool StaticConstField::TraverseConstructorInitializer(CXXCtorInitializer* init) found = true; } } -#endif // ignore this, it seems to trigger an infinite recursion else if (isa<UnaryExprOrTypeTraitExpr>(initexpr)) ; diff --git a/compilerplugins/clang/test/staticconstfield.cxx b/compilerplugins/clang/test/staticconstfield.cxx index ab0a24fa734a..d0d6939a3619 100644 --- a/compilerplugins/clang/test/staticconstfield.cxx +++ b/compilerplugins/clang/test/staticconstfield.cxx @@ -47,7 +47,6 @@ class Class4 } }; -#if CLANG_VERSION >= 50000 // Expr::EvaluateAsFloat class Class5 { enum class Enum @@ -77,7 +76,6 @@ class Class5 (void)m_fielda4; } }; -#endif // no warning expected class Class6 diff --git a/compilerplugins/clang/test/staticvar.cxx b/compilerplugins/clang/test/staticvar.cxx index 9963e99db687..639e6cce46d3 100644 --- a/compilerplugins/clang/test/staticvar.cxx +++ b/compilerplugins/clang/test/staticvar.cxx @@ -33,7 +33,6 @@ struct S2 OUString x; }; -#if CLANG_VERSION >= 50000 // probably something to do with how OUString initialisers work S2 const& f2() { static S2 const s1[]{ @@ -42,7 +41,6 @@ S2 const& f2() }; return s1[0]; } -#endif // no warning expected S2 const& f3() diff --git a/compilerplugins/clang/test/unnecessaryoverride.cxx b/compilerplugins/clang/test/unnecessaryoverride.cxx index a4db41aa5a99..89b772e04698 100644 --- a/compilerplugins/clang/test/unnecessaryoverride.cxx +++ b/compilerplugins/clang/test/unnecessaryoverride.cxx @@ -69,7 +69,6 @@ struct DerivedDifferent : Base struct DerivedSame : Base { -#if CLANG_VERSION >= 30900 // cf. corresponding condition in Plugin::checkIdenticalDefaultArguments void defaults( // expected-error {{public function just calls public parent [loplugin:unnecessaryoverride]}} void* x1 = 0, int x2 = (1 - 1), double x3 = 1.0, Base const& x4 = (Base()), @@ -78,7 +77,6 @@ struct DerivedSame : Base { Base::defaults(x1, x2, x3, x4, x5); } -#endif }; struct DerivedSlightlyDifferent : Base diff --git a/compilerplugins/clang/test/useuniqueptr.cxx b/compilerplugins/clang/test/useuniqueptr.cxx index 4cf6c96521ab..5f20c734958c 100644 --- a/compilerplugins/clang/test/useuniqueptr.cxx +++ b/compilerplugins/clang/test/useuniqueptr.cxx @@ -219,7 +219,6 @@ class Foo17 { }; // this only starts to work somewhere after clang 3.8 and before clang7 -#if CLANG_VERSION >= 30900 class Foo18 { std::vector<char*> m_pbar1; // expected-note {{member is here [loplugin:useuniqueptr]}} ~Foo18() @@ -228,7 +227,6 @@ class Foo18 { delete *aIter; // expected-error {{rather manage with std::some_container<std::unique_ptr<T>> [loplugin:useuniqueptr]}} } }; -#endif void foo19() { diff --git a/compilerplugins/clang/unnecessaryvirtual.cxx b/compilerplugins/clang/unnecessaryvirtual.cxx index afc324cee156..df3dda68adbc 100644 --- a/compilerplugins/clang/unnecessaryvirtual.cxx +++ b/compilerplugins/clang/unnecessaryvirtual.cxx @@ -13,7 +13,6 @@ #include <set> #include <unordered_set> #include "plugin.hxx" -#include "compat.hxx" #include <fstream> /** @@ -95,7 +94,7 @@ std::string niceName(const CXXMethodDecl* cxxMethodDecl) cxxMethodDecl = dyn_cast<CXXMethodDecl>(cxxMethodDecl->getInstantiatedFromMemberFunction()); std::string s = cxxMethodDecl->getReturnType().getCanonicalType().getAsString() + " " + cxxMethodDecl->getQualifiedNameAsString() + "("; - for (const ParmVarDecl *pParmVarDecl : compat::parameters(*cxxMethodDecl)) { + for (const ParmVarDecl *pParmVarDecl : cxxMethodDecl->parameters()) { s += pParmVarDecl->getType().getCanonicalType().getAsString(); s += ","; } diff --git a/compilerplugins/clang/unusedfields.cxx b/compilerplugins/clang/unusedfields.cxx index 1e63ac19a3dd..61dcedf434bb 100644 --- a/compilerplugins/clang/unusedfields.cxx +++ b/compilerplugins/clang/unusedfields.cxx @@ -524,10 +524,7 @@ void UnusedFields::checkIfReadFrom(const FieldDecl* fieldDecl, const Expr* membe break; } else if (isa<CastExpr>(parent) || isa<MemberExpr>(parent) || isa<ParenExpr>(parent) || isa<ParenListExpr>(parent) -#if CLANG_VERSION >= 40000 - || isa<ArrayInitLoopExpr>(parent) -#endif - || isa<ExprWithCleanups>(parent)) + || isa<ArrayInitLoopExpr>(parent) || isa<ExprWithCleanups>(parent)) { walkupUp(); } @@ -731,10 +728,7 @@ void UnusedFields::checkIfWrittenTo(const FieldDecl* fieldDecl, const Expr* memb break; } else if (isa<CastExpr>(parent) || isa<MemberExpr>(parent) || isa<ParenExpr>(parent) || isa<ParenListExpr>(parent) -#if CLANG_VERSION >= 40000 - || isa<ArrayInitLoopExpr>(parent) -#endif - || isa<ExprWithCleanups>(parent)) + || isa<ArrayInitLoopExpr>(parent) || isa<ExprWithCleanups>(parent)) { walkupUp(); } diff --git a/compilerplugins/clang/unusedmethods.cxx b/compilerplugins/clang/unusedmethods.cxx index 5f998712d3ef..8ca645335c43 100644 --- a/compilerplugins/clang/unusedmethods.cxx +++ b/compilerplugins/clang/unusedmethods.cxx @@ -18,7 +18,6 @@ #include "clang/AST/Attr.h" #include "plugin.hxx" -#include "compat.hxx" /** This plugin performs 3 different analyses: @@ -118,9 +117,8 @@ public: bool TraverseFunctionDecl( FunctionDecl* ); bool TraverseCXXMethodDecl( CXXMethodDecl* ); bool TraverseCXXConversionDecl( CXXConversionDecl* ); -#if CLANG_VERSION >= 50000 bool TraverseCXXDeductionGuideDecl( CXXDeductionGuideDecl* ); -#endif + private: void logCallToRootMethods(const FunctionDecl* functionDecl, std::set<MyFuncInfo>& funcSet); MyFuncInfo niceName(const FunctionDecl* functionDecl); @@ -167,7 +165,7 @@ MyFuncInfo UnusedMethods::niceName(const FunctionDecl* functionDecl) aInfo.nameAndParams = functionDecl->getQualifiedNameAsString() + "("; } bool bFirst = true; - for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) { + for (const ParmVarDecl *pParmVarDecl : functionDecl->parameters()) { if (bFirst) bFirst = false; else @@ -400,7 +398,6 @@ bool UnusedMethods::TraverseCXXConversionDecl(CXXConversionDecl* f) currentFunctionDecl = copy; return ret; } -#if CLANG_VERSION >= 50000 bool UnusedMethods::TraverseCXXDeductionGuideDecl(CXXDeductionGuideDecl* f) { auto copy = currentFunctionDecl; @@ -409,7 +406,6 @@ bool UnusedMethods::TraverseCXXDeductionGuideDecl(CXXDeductionGuideDecl* f) currentFunctionDecl = copy; return ret; } -#endif loplugin::Plugin::Registration< UnusedMethods > X("unusedmethods", false); diff --git a/compilerplugins/clang/unusedmethodsremove.cxx b/compilerplugins/clang/unusedmethodsremove.cxx index 5fdeefa13a7f..1a4adc0a5c6b 100644 --- a/compilerplugins/clang/unusedmethodsremove.cxx +++ b/compilerplugins/clang/unusedmethodsremove.cxx @@ -81,7 +81,7 @@ std::string niceName(const CXXMethodDecl* functionDecl) + "::" + functionDecl->getNameAsString() + "("; bool bFirst = true; - for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) { + for (const ParmVarDecl *pParmVarDecl : functionDecl->parameters()) { if (bFirst) bFirst = false; else diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx index 72cf39aa049a..3aabbccf991a 100644 --- a/compilerplugins/clang/useuniqueptr.cxx +++ b/compilerplugins/clang/useuniqueptr.cxx @@ -133,9 +133,7 @@ public: bool VisitFunctionDecl(const FunctionDecl* ); bool VisitCXXDeleteExpr(const CXXDeleteExpr* ); bool TraverseFunctionDecl(FunctionDecl* ); -#if CLANG_VERSION >= 50000 bool TraverseCXXDeductionGuideDecl(CXXDeductionGuideDecl* ); -#endif bool TraverseCXXMethodDecl(CXXMethodDecl* ); bool TraverseCXXConstructorDecl(CXXConstructorDecl* ); bool TraverseCXXConversionDecl(CXXConversionDecl* ); @@ -957,7 +955,6 @@ bool UseUniquePtr::TraverseCXXMethodDecl(CXXMethodDecl* methodDecl) return ret; } -#if CLANG_VERSION >= 50000 bool UseUniquePtr::TraverseCXXDeductionGuideDecl(CXXDeductionGuideDecl* methodDecl) { if (ignoreLocation(methodDecl)) @@ -970,7 +967,6 @@ bool UseUniquePtr::TraverseCXXDeductionGuideDecl(CXXDeductionGuideDecl* methodDe return ret; } -#endif bool UseUniquePtr::TraverseCXXConstructorDecl(CXXConstructorDecl* methodDecl) { diff --git a/compilerplugins/clang/virtualdown.cxx b/compilerplugins/clang/virtualdown.cxx index 0bc9bf491148..9e59c842f49f 100644 --- a/compilerplugins/clang/virtualdown.cxx +++ b/compilerplugins/clang/virtualdown.cxx @@ -12,7 +12,6 @@ #include <iostream> #include <set> #include "plugin.hxx" -#include "compat.hxx" #include <fstream> /** @@ -74,9 +73,8 @@ public: bool TraverseFunctionDecl(FunctionDecl*); bool TraverseCXXMethodDecl(CXXMethodDecl*); bool TraverseCXXConversionDecl(CXXConversionDecl*); -#if CLANG_VERSION >= 50000 bool TraverseCXXDeductionGuideDecl(CXXDeductionGuideDecl*); -#endif + private: std::string toString(SourceLocation loc); std::string niceName(const CXXMethodDecl* functionDecl); @@ -177,7 +175,6 @@ bool VirtualDown::TraverseCXXConversionDecl(CXXConversionDecl* f) currentFunctionDecl = copy; return ret; } -#if CLANG_VERSION >= 50000 bool VirtualDown::TraverseCXXDeductionGuideDecl(CXXDeductionGuideDecl* f) { auto copy = currentFunctionDecl; @@ -186,13 +183,12 @@ bool VirtualDown::TraverseCXXDeductionGuideDecl(CXXDeductionGuideDecl* f) currentFunctionDecl = copy; return ret; } -#endif std::string VirtualDown::niceName(const CXXMethodDecl* cxxMethodDecl) { std::string s = cxxMethodDecl->getReturnType().getCanonicalType().getAsString() + " " + cxxMethodDecl->getQualifiedNameAsString() + "("; - for (const ParmVarDecl* pParmVarDecl : compat::parameters(*cxxMethodDecl)) + for (const ParmVarDecl* pParmVarDecl : cxxMethodDecl->parameters()) { s += pParmVarDecl->getType().getCanonicalType().getAsString(); s += ","; diff --git a/configure.ac b/configure.ac index bc165bd6b31a..827b5f6c995e 100644 --- a/configure.ac +++ b/configure.ac @@ -6698,9 +6698,9 @@ if test "$COM_IS_CLANG" = "TRUE"; then else compiler_plugins=no fi - if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then + if test "$compiler_plugins" != no -a "$CLANGVER" -lt 50002; then if test "$compiler_plugins" = yes; then - AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.]) + AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.]) else compiler_plugins=no fi _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits