diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-06-29 09:15:05 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-06-29 09:15:25 +0200 |
commit | 733198de1b7fc3907609217147704f493f6146e6 (patch) | |
tree | 1ab5ee016775b53b00a3ccdc43f7bd3a767982b6 /compilerplugins | |
parent | 94809ea0d4101679794bb239313c4d73fab30419 (diff) |
Remove support for Clang < 3.4
Change-Id: I81e97c5f720535b33dd3ce72d01151765e4e93a0
Diffstat (limited to 'compilerplugins')
34 files changed, 25 insertions, 127 deletions
diff --git a/compilerplugins/clang/automem.cxx b/compilerplugins/clang/automem.cxx index dfa35250895a..b4585fb76c7b 100644 --- a/compilerplugins/clang/automem.cxx +++ b/compilerplugins/clang/automem.cxx @@ -13,7 +13,6 @@ #include <fstream> #include <set> #include "plugin.hxx" -#include "compat.hxx" /** Find calls to "delete x" where x is a field on an object. diff --git a/compilerplugins/clang/badvectorinit.cxx b/compilerplugins/clang/badvectorinit.cxx index e544fd21e9f0..7b26ca301203 100644 --- a/compilerplugins/clang/badvectorinit.cxx +++ b/compilerplugins/clang/badvectorinit.cxx @@ -13,7 +13,6 @@ #include <fstream> #include <set> #include "plugin.hxx" -#include "compat.hxx" /** diff --git a/compilerplugins/clang/checkconfigmacros.cxx b/compilerplugins/clang/checkconfigmacros.cxx index 01ffde6d280a..1a927658fcaf 100644 --- a/compilerplugins/clang/checkconfigmacros.cxx +++ b/compilerplugins/clang/checkconfigmacros.cxx @@ -44,9 +44,7 @@ class CheckConfigMacros virtual void Ifdef( SourceLocation location, const Token& macroToken, const MacroDefinition& info ) override; virtual void Ifndef( SourceLocation location, const Token& macroToken, const MacroDefinition& info ) override; #endif -#if CLANG_VERSION < 30400 - virtual void Defined( const Token& macroToken, const MacroDirective* info ) override; -#elif CLANG_VERSION < 30700 +#if CLANG_VERSION < 30700 virtual void Defined( const Token& macroToken, const MacroDirective* info, SourceRange Range ) override; #else virtual void Defined( const Token& macroToken, const MacroDefinition& info, SourceRange Range ) override; @@ -108,9 +106,7 @@ void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken checkMacro( macroToken, location ); } -#if CLANG_VERSION < 30400 -void CheckConfigMacros::Defined( const Token& macroToken, const MacroDirective* ) -#elif CLANG_VERSION < 30700 +#if CLANG_VERSION < 30700 void CheckConfigMacros::Defined( const Token& macroToken, const MacroDirective* , SourceRange ) #else void CheckConfigMacros::Defined( const Token& macroToken, const MacroDefinition& , SourceRange ) diff --git a/compilerplugins/clang/commaoperator.cxx b/compilerplugins/clang/commaoperator.cxx index 3e5df3d6e5d9..39a2b9cb8720 100644 --- a/compilerplugins/clang/commaoperator.cxx +++ b/compilerplugins/clang/commaoperator.cxx @@ -13,7 +13,6 @@ #include <fstream> #include <set> #include "plugin.hxx" -#include "compat.hxx" /** the comma operator is best used sparingly diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx index b78f90a23dfd..063d0ce946fd 100644 --- a/compilerplugins/clang/compat.hxx +++ b/compilerplugins/clang/compat.hxx @@ -32,14 +32,6 @@ #include "config_clang.h" -#if CLANG_VERSION >= 30400 -#define LO_COMPILERPLUGINS_CLANG_COMPAT_HAVE_isAtEndOfImmediateMacroExpansion \ - true -#else -#define LO_COMPILERPLUGINS_CLANG_COMPAT_HAVE_isAtEndOfImmediateMacroExpansion \ - false -#endif - // Compatibility wrapper to abstract over (trivial) changes in the Clang API: namespace compat { @@ -52,30 +44,6 @@ inline bool isLookupContext(clang::DeclContext const & ctxt) { #endif } -inline bool isExternCContext(clang::DeclContext const & ctxt) { -#if CLANG_VERSION >= 30400 - return ctxt.isExternCContext(); -#else - for (clang::DeclContext const * c = &ctxt; - c->getDeclKind() != clang::Decl::TranslationUnit; c = c->getParent()) - { - if (c->getDeclKind() == clang::Decl::LinkageSpec) { - return llvm::cast<clang::LinkageSpecDecl>(c)->getLanguage() - == clang::LinkageSpecDecl::lang_c; - } - } - return false; -#endif -} - -inline bool isInExternCContext(clang::FunctionDecl const & decl) { -#if CLANG_VERSION >= 30400 - return decl.isInExternCContext(); -#else - return isExternCContext(*decl.getCanonicalDecl()->getDeclContext()); -#endif -} - inline bool forallBases( clang::CXXRecordDecl const & decl, clang::CXXRecordDecl::ForallBasesCallback BaseMatches, @@ -90,14 +58,6 @@ inline bool forallBases( #endif } -inline bool isFirstDecl(clang::FunctionDecl const & decl) { -#if CLANG_VERSION >= 30400 - return decl.isFirstDecl(); -#else - return decl.isFirstDeclaration(); -#endif -} - inline clang::QualType getReturnType(clang::FunctionDecl const & decl) { #if CLANG_VERSION >= 30500 return decl.getReturnType(); @@ -189,16 +149,6 @@ inline unsigned getBuiltinCallee(clang::CallExpr const & expr) { #endif } -inline bool isInMainFile( - clang::SourceManager const & manager, clang::SourceLocation Loc) -{ -#if CLANG_VERSION >= 30400 - return manager.isInMainFile(Loc); -#else - return manager.isFromMainFile(Loc); -#endif -} - inline unsigned getCustomDiagID( clang::DiagnosticsEngine & engine, clang::DiagnosticsEngine::Level L, llvm::StringRef FormatString) diff --git a/compilerplugins/clang/cppunitassertequals.cxx b/compilerplugins/clang/cppunitassertequals.cxx index f5db38421dd3..f14dde6300e4 100644 --- a/compilerplugins/clang/cppunitassertequals.cxx +++ b/compilerplugins/clang/cppunitassertequals.cxx @@ -13,7 +13,6 @@ #include <fstream> #include <set> #include "plugin.hxx" -#include "compat.hxx" /** Check for calls to CPPUNIT_ASSERT when it should be using CPPUNIT_ASSERT_EQUALS diff --git a/compilerplugins/clang/cstylecast.cxx b/compilerplugins/clang/cstylecast.cxx index e33e905cac1a..ae95bc2a455b 100644 --- a/compilerplugins/clang/cstylecast.cxx +++ b/compilerplugins/clang/cstylecast.cxx @@ -10,7 +10,6 @@ #include <cassert> #include <string> #include "plugin.hxx" -#include "compat.hxx" // // We don't like using C-style casts in C++ code @@ -76,7 +75,7 @@ bool areSimilar(QualType type1, QualType type2) { } bool hasCLanguageLinkageType(FunctionDecl const * decl) { - return decl->isExternC() || compat::isInExternCContext(*decl); + return decl->isExternC() || decl->isInExternCContext(); } QualType resolvePointers(QualType type) { diff --git a/compilerplugins/clang/externandnotdefined.cxx b/compilerplugins/clang/externandnotdefined.cxx index 57669a57dac8..6d4a7989782e 100644 --- a/compilerplugins/clang/externandnotdefined.cxx +++ b/compilerplugins/clang/externandnotdefined.cxx @@ -10,7 +10,6 @@ #include <string> #include "plugin.hxx" -#include "compat.hxx" // Having an extern prototype for a method in a module and not actually declaring that method is dodgy. // @@ -54,7 +53,8 @@ bool ExternAndNotDefined::VisitFunctionDecl(const FunctionDecl * functionDecl) { if (functionName == "gdk_x11_screen_get_screen_number") { return true; } - if (!compat::isInMainFile( compiler.getSourceManager(), functionDecl->getLocation())) { + if (!compiler.getSourceManager().isInMainFile(functionDecl->getLocation())) + { return true; } StringRef fileName { compiler.getSourceManager().getFilename(functionDecl->getLocation()) }; diff --git a/compilerplugins/clang/fpcomparison.cxx b/compilerplugins/clang/fpcomparison.cxx index 63d69c19519d..5a04edbc037b 100644 --- a/compilerplugins/clang/fpcomparison.cxx +++ b/compilerplugins/clang/fpcomparison.cxx @@ -14,7 +14,6 @@ #include <set> #include "check.hxx" -#include "compat.hxx" #include "plugin.hxx" /** diff --git a/compilerplugins/clang/inlinesimplememberfunctions.cxx b/compilerplugins/clang/inlinesimplememberfunctions.cxx index 74959c3127bd..b1515382205a 100644 --- a/compilerplugins/clang/inlinesimplememberfunctions.cxx +++ b/compilerplugins/clang/inlinesimplememberfunctions.cxx @@ -234,9 +234,10 @@ bool InlineSimpleMemberFunctions::rewrite(const CXXMethodDecl * functionDecl) { // definition (in a main file only processed later) to fail // with a "mismatch" error before the rewriter had a chance // to act upon the definition. - if (!compat::isInMainFile( compiler.getSourceManager(), - compiler.getSourceManager().getSpellingLoc( - functionDecl->getNameInfo().getLoc()))) { + if (!compiler.getSourceManager().isInMainFile( + compiler.getSourceManager().getSpellingLoc( + functionDecl->getNameInfo().getLoc()))) + { return false; } diff --git a/compilerplugins/clang/inlinevisible.cxx b/compilerplugins/clang/inlinevisible.cxx index a16187307b7d..280a0750f573 100644 --- a/compilerplugins/clang/inlinevisible.cxx +++ b/compilerplugins/clang/inlinevisible.cxx @@ -13,7 +13,6 @@ #include "clang/AST/Attr.h" #include "clang/Sema/SemaInternal.h" // warn_unused_function -#include "compat.hxx" #include "plugin.hxx" namespace { diff --git a/compilerplugins/clang/literaltoboolconversion.cxx b/compilerplugins/clang/literaltoboolconversion.cxx index c89ad3509227..26a661eb9e02 100644 --- a/compilerplugins/clang/literaltoboolconversion.cxx +++ b/compilerplugins/clang/literaltoboolconversion.cxx @@ -9,7 +9,6 @@ #include "clang/Lex/Lexer.h" -#include "compat.hxx" #include "plugin.hxx" namespace { @@ -50,7 +49,7 @@ bool LiteralToBoolConversion::VisitImplicitCastExpr( bool LiteralToBoolConversion::isFromCIncludeFile( SourceLocation spellingLocation) const { - return !compat::isInMainFile(compiler.getSourceManager(), spellingLocation) + return !compiler.getSourceManager().isInMainFile(spellingLocation) && (StringRef( compiler.getSourceManager().getPresumedLoc(spellingLocation) .getFilename()) diff --git a/compilerplugins/clang/loopvartoosmall.cxx b/compilerplugins/clang/loopvartoosmall.cxx index c7fa0d384bbd..aaa664827298 100644 --- a/compilerplugins/clang/loopvartoosmall.cxx +++ b/compilerplugins/clang/loopvartoosmall.cxx @@ -11,7 +11,6 @@ #include <iostream> #include "plugin.hxx" -#include "compat.hxx" #include "clang/AST/CXXInheritance.h" // Idea from bubli. Check that the index variable in a for loop is able to cover the range diff --git a/compilerplugins/clang/memoryvar.cxx b/compilerplugins/clang/memoryvar.cxx index b407c76f7709..2c8f3fd193b3 100644 --- a/compilerplugins/clang/memoryvar.cxx +++ b/compilerplugins/clang/memoryvar.cxx @@ -13,7 +13,6 @@ #include <set> #include "plugin.hxx" -#include "compat.hxx" #include "clang/AST/CXXInheritance.h" // Check for local variables that we are calling delete on diff --git a/compilerplugins/clang/mergeclasses.cxx b/compilerplugins/clang/mergeclasses.cxx index 6fcee444eedd..652e25310e28 100644 --- a/compilerplugins/clang/mergeclasses.cxx +++ b/compilerplugins/clang/mergeclasses.cxx @@ -11,7 +11,6 @@ #include <string> #include <iostream> #include "plugin.hxx" -#include "compat.hxx" #include <fstream> /** diff --git a/compilerplugins/clang/nullptr.cxx b/compilerplugins/clang/nullptr.cxx index 6bac8169750d..8250d519abdd 100644 --- a/compilerplugins/clang/nullptr.cxx +++ b/compilerplugins/clang/nullptr.cxx @@ -11,7 +11,6 @@ #include <cstdlib> #include <set> -#include "compat.hxx" #include "plugin.hxx" namespace { @@ -209,7 +208,7 @@ bool Nullptr::isInLokIncludeFile(SourceLocation spellingLocation) const { } bool Nullptr::isFromCIncludeFile(SourceLocation spellingLocation) const { - return !compat::isInMainFile(compiler.getSourceManager(), spellingLocation) + return !compiler.getSourceManager().isInMainFile(spellingLocation) && (StringRef( compiler.getSourceManager().getPresumedLoc(spellingLocation) .getFilename()) diff --git a/compilerplugins/clang/override.cxx b/compilerplugins/clang/override.cxx index 69155d4b6948..a350415e36d6 100644 --- a/compilerplugins/clang/override.cxx +++ b/compilerplugins/clang/override.cxx @@ -15,7 +15,6 @@ #include "clang/AST/Attr.h" -#include "compat.hxx" #include "plugin.hxx" namespace { @@ -46,7 +45,7 @@ bool Override::VisitCXXMethodDecl(CXXMethodDecl const * decl) { // As a heuristic, ignore declarations where the name is spelled out in an // ignored location; that e.g. handles uses of the Q_OBJECT macro from // external QtCore/qobjectdefs.h: - if (ignoreLocation(decl) || !compat::isFirstDecl(*decl) + if (ignoreLocation(decl) || !decl->isFirstDecl() || decl->begin_overridden_methods() == decl->end_overridden_methods() || decl->hasAttr<OverrideAttr>() || ignoreLocation( @@ -76,7 +75,6 @@ bool Override::VisitCXXMethodDecl(CXXMethodDecl const * decl) { std::string over( isInUnoIncludeFile(decl->getSourceRange().getBegin()) ? "SAL_OVERRIDE" : "override"); -#if LO_COMPILERPLUGINS_CLANG_COMPAT_HAVE_isAtEndOfImmediateMacroExpansion if (rewriter != nullptr) { // In void MACRO(...); getSourceRange().getEnd() would (erroneously?) // point at "MACRO" rather than ")", so make the loop always terminate @@ -163,7 +161,6 @@ bool Override::VisitCXXMethodDecl(CXXMethodDecl const * decl) { return true; } } -#endif report( DiagnosticsEngine::Warning, ("overriding virtual function declaration not marked '%0'"), diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx index af618de232b8..31648a5f9d2c 100644 --- a/compilerplugins/clang/plugin.cxx +++ b/compilerplugins/clang/plugin.cxx @@ -17,7 +17,6 @@ #include <clang/Lex/Lexer.h> #include "pluginhandler.hxx" -#include "compat.hxx" /* Base classes for plugin actions. @@ -106,7 +105,7 @@ const FunctionDecl* Plugin::parentFunctionDecl( const Stmt* stmt ) bool Plugin::isInUnoIncludeFile(SourceLocation spellingLocation) const { StringRef name { compiler.getSourceManager().getFilename(spellingLocation) }; - return compat::isInMainFile(compiler.getSourceManager(), spellingLocation) + return compiler.getSourceManager().isInMainFile(spellingLocation) ? (name == SRCDIR "/cppu/source/cppu/compat.cxx" || name == SRCDIR "/cppuhelper/source/compat.cxx" || name == SRCDIR "/sal/osl/all/compat.cxx") diff --git a/compilerplugins/clang/ptrvector.cxx b/compilerplugins/clang/ptrvector.cxx index 513d3509cf13..12c710508f6d 100644 --- a/compilerplugins/clang/ptrvector.cxx +++ b/compilerplugins/clang/ptrvector.cxx @@ -13,7 +13,6 @@ #include <fstream> #include <set> #include "plugin.hxx" -#include "compat.hxx" /** Check for calls to operator== on a std::container< std::unique_ptr >, which is not useful, diff --git a/compilerplugins/clang/rangedforcopy.cxx b/compilerplugins/clang/rangedforcopy.cxx index 4c86fe34420e..4c4148210004 100644 --- a/compilerplugins/clang/rangedforcopy.cxx +++ b/compilerplugins/clang/rangedforcopy.cxx @@ -12,7 +12,6 @@ #include <iostream> #include "plugin.hxx" -#include "compat.hxx" #include "clang/AST/CXXInheritance.h" // Check that we're not unnecessarily copying variables in a range based for loop diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx index edb8b52b45b9..53d4b5b1d9a5 100644 --- a/compilerplugins/clang/redundantcast.cxx +++ b/compilerplugins/clang/redundantcast.cxx @@ -25,7 +25,6 @@ #include "clang/Sema/Sema.h" -#include "compat.hxx" #include "plugin.hxx" namespace { diff --git a/compilerplugins/clang/rendercontext.cxx b/compilerplugins/clang/rendercontext.cxx index 037c7bb2d1fa..e3d1da40ae1e 100644 --- a/compilerplugins/clang/rendercontext.cxx +++ b/compilerplugins/clang/rendercontext.cxx @@ -11,7 +11,6 @@ #include <iostream> #include "plugin.hxx" -#include "compat.hxx" #include "clang/AST/CXXInheritance.h" // Check for calls to OutputDevice methods that are not passing through RenderContext diff --git a/compilerplugins/clang/reservedid.cxx b/compilerplugins/clang/reservedid.cxx index 2206257e6c86..c6757199cbf9 100644 --- a/compilerplugins/clang/reservedid.cxx +++ b/compilerplugins/clang/reservedid.cxx @@ -15,7 +15,6 @@ #include "clang/AST/Attr.h" -#include "compat.hxx" #include "plugin.hxx" namespace { diff --git a/compilerplugins/clang/salbool.cxx b/compilerplugins/clang/salbool.cxx index 4e7f46304433..4b123c77b020 100644 --- a/compilerplugins/clang/salbool.cxx +++ b/compilerplugins/clang/salbool.cxx @@ -527,8 +527,7 @@ bool SalBool::VisitParmVarDecl(ParmVarDecl const * decl) { // where the function would still implicitly override and // cause a compilation error due to the incompatible return // type): - if (!((compat::isInMainFile( - compiler.getSourceManager(), + if (!((compiler.getSourceManager().isInMainFile( compiler.getSourceManager().getSpellingLoc( dyn_cast<FunctionDecl>( decl->getDeclContext()) @@ -587,8 +586,7 @@ bool SalBool::VisitFieldDecl(FieldDecl const * decl) { { TagDecl const * td = dyn_cast<TagDecl>(decl->getDeclContext()); assert(td != nullptr); - if (!(((td->isStruct() || td->isUnion()) - && compat::isExternCContext(*td)) + if (!(((td->isStruct() || td->isUnion()) && td->isExternCContext()) || isInUnoIncludeFile( compiler.getSourceManager().getSpellingLoc( decl->getLocation())))) @@ -679,8 +677,7 @@ bool SalBool::VisitFunctionDecl(FunctionDecl const * decl) { // rewriter had a chance to act upon the definition (but use the // heuristic of assuming pure virtual functions do not have // definitions): - if (!((compat::isInMainFile( - compiler.getSourceManager(), + if (!((compiler.getSourceManager().isInMainFile( compiler.getSourceManager().getSpellingLoc( decl->getNameInfo().getLoc())) || f->isDefined() || f->isPure()) @@ -729,7 +726,7 @@ bool SalBool::TraverseStaticAssertDecl(StaticAssertDecl * decl) { } bool SalBool::isFromCIncludeFile(SourceLocation spellingLocation) const { - return !compat::isInMainFile(compiler.getSourceManager(), spellingLocation) + return !compiler.getSourceManager().isInMainFile(spellingLocation) && (StringRef( compiler.getSourceManager().getPresumedLoc(spellingLocation) .getFilename()) @@ -737,7 +734,7 @@ bool SalBool::isFromCIncludeFile(SourceLocation spellingLocation) const { } bool SalBool::isInSpecialMainFile(SourceLocation spellingLocation) const { - if (!compat::isInMainFile(compiler.getSourceManager(), spellingLocation)) { + if (!compiler.getSourceManager().isInMainFile(spellingLocation)) { return false; } auto f = compiler.getSourceManager().getFilename(spellingLocation); diff --git a/compilerplugins/clang/staticanonymous.cxx b/compilerplugins/clang/staticanonymous.cxx index ff62a56358d4..92d18c4017d8 100644 --- a/compilerplugins/clang/staticanonymous.cxx +++ b/compilerplugins/clang/staticanonymous.cxx @@ -6,7 +6,7 @@ * */ #include "plugin.hxx" -#include "compat.hxx" + /* This is a compile check. @@ -45,7 +45,7 @@ bool StaticAnonymous::VisitFunctionDecl( FunctionDecl* func ) return true; if( func -> isInAnonymousNamespace () ) { - if ( !isa<CXXMethodDecl>(func) && !compat::isInExternCContext(*func) ) + if ( !isa<CXXMethodDecl>(func) && !func->isInExternCContext() ) { if(func-> getStorageClass() == SC_Static) { diff --git a/compilerplugins/clang/store/constantfunction.cxx b/compilerplugins/clang/store/constantfunction.cxx index 272c9695dd0b..538191544f80 100644 --- a/compilerplugins/clang/store/constantfunction.cxx +++ b/compilerplugins/clang/store/constantfunction.cxx @@ -8,7 +8,6 @@ */ #include "plugin.hxx" -#include "compat.hxx" #include <iostream> /* diff --git a/compilerplugins/clang/store/deletedspecial.cxx b/compilerplugins/clang/store/deletedspecial.cxx index 5d4c59788413..5610df1da6b4 100644 --- a/compilerplugins/clang/store/deletedspecial.cxx +++ b/compilerplugins/clang/store/deletedspecial.cxx @@ -11,7 +11,6 @@ #include <iterator> #include <string> -#include "compat.hxx" #include "plugin.hxx" // Second-guess that certain private special member function declarations for @@ -58,7 +57,7 @@ void DeletedSpecial::run() { } bool DeletedSpecial::VisitCXXMethodDecl(CXXMethodDecl const * decl) { - if (ignoreLocation(decl) || !compat::isFirstDecl(*decl) || decl->isDefined() + if (ignoreLocation(decl) || !decl->isFirstDecl() || decl->isDefined() || decl->isDefaulted() || decl->getAccess() != AS_private) { return true; diff --git a/compilerplugins/clang/store/oncevar.cxx b/compilerplugins/clang/store/oncevar.cxx index 5c203dfa22e4..e618922a2395 100644 --- a/compilerplugins/clang/store/oncevar.cxx +++ b/compilerplugins/clang/store/oncevar.cxx @@ -12,7 +12,6 @@ #include <map> #include "plugin.hxx" -#include "compat.hxx" #include "clang/AST/CXXInheritance.h" // Idea from tml. diff --git a/compilerplugins/clang/store/paintmethodconversion.cxx b/compilerplugins/clang/store/paintmethodconversion.cxx index 47e410872b35..e19a0f416819 100644 --- a/compilerplugins/clang/store/paintmethodconversion.cxx +++ b/compilerplugins/clang/store/paintmethodconversion.cxx @@ -9,7 +9,6 @@ #include "clang/Lex/Lexer.h" -#include "compat.hxx" #include "plugin.hxx" #include <iostream> #include <fstream> diff --git a/compilerplugins/clang/store/stdexception.cxx b/compilerplugins/clang/store/stdexception.cxx index 824d6450d0f7..85a589f7abdd 100644 --- a/compilerplugins/clang/store/stdexception.cxx +++ b/compilerplugins/clang/store/stdexception.cxx @@ -33,9 +33,6 @@ public: { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); } bool VisitCXXMethodDecl(CXXMethodDecl const * decl); - -private: - bool isInMainFile(SourceLocation spellingLocation) const; }; bool StdException::VisitCXXMethodDecl(CXXMethodDecl const * decl) { @@ -150,7 +147,7 @@ found: // (but use the heuristic of assuming pure virtual functions do // not have definitions): if (rewriter != nullptr - && (isInMainFile( + && (compiler.getSourceManager().isInMainFile( compiler.getSourceManager().getSpellingLoc(loc)) || decl->isDefined() || decl->isPure()) && insertTextAfterToken( @@ -184,14 +181,6 @@ found: return true; } -bool StdException::isInMainFile(SourceLocation spellingLocation) const { -#if CLANG_VERSION >= 30400 - return compiler.getSourceManager().isInMainFile(spellingLocation); -#else - return compiler.getSourceManager().isFromMainFile(spellingLocation); -#endif -} - loplugin::Plugin::Registration<StdException> X("stdexception", true); } diff --git a/compilerplugins/clang/store/stylepolice.cxx b/compilerplugins/clang/store/stylepolice.cxx index d2e3af752b98..a0f5373a16a6 100644 --- a/compilerplugins/clang/store/stylepolice.cxx +++ b/compilerplugins/clang/store/stylepolice.cxx @@ -11,7 +11,6 @@ #include <string> #include <set> -#include "compat.hxx" #include "plugin.hxx" // Check for some basic naming mismatches which make the code harder to read diff --git a/compilerplugins/clang/stringconstant.cxx b/compilerplugins/clang/stringconstant.cxx index 4c9dd86d8f03..ceb7654f0c38 100644 --- a/compilerplugins/clang/stringconstant.cxx +++ b/compilerplugins/clang/stringconstant.cxx @@ -16,7 +16,6 @@ #include <iostream> #include "check.hxx" -#include "compat.hxx" #include "plugin.hxx" // Define a "string constant" to be a constant expression either of type "array diff --git a/compilerplugins/clang/unreffun.cxx b/compilerplugins/clang/unreffun.cxx index 73c74dbffc1f..bf381f9f07fc 100644 --- a/compilerplugins/clang/unreffun.cxx +++ b/compilerplugins/clang/unreffun.cxx @@ -13,7 +13,6 @@ #include "clang/AST/Attr.h" #include "clang/Sema/SemaInternal.h" // warn_unused_function -#include "compat.hxx" #include "plugin.hxx" namespace { @@ -111,10 +110,8 @@ bool UnrefFun::VisitFunctionDecl(FunctionDecl const * decl) { //TODO: is that the first? if (canon->isDeleted() || canon->isReferenced() || !(canon->isDefined() - ? decl->isThisDeclarationADefinition() - : compat::isFirstDecl(*decl)) - || !compat::isInMainFile( - compiler.getSourceManager(), canon->getLocation()) + ? decl->isThisDeclarationADefinition() : decl->isFirstDecl()) + || !compiler.getSourceManager().isInMainFile(canon->getLocation()) || isInUnoIncludeFile( compiler.getSourceManager().getSpellingLoc( canon->getNameInfo().getLoc())) @@ -141,19 +138,15 @@ bool UnrefFun::VisitFunctionDecl(FunctionDecl const * decl) { report( DiagnosticsEngine::Warning, (canon->isDefined() -#if CLANG_VERSION >= 30400 ? (canon->isExternallyVisible() ? "Unreferenced externally visible function%0 definition" : "Unreferenced externally invisible function%0 definition") -#else - ? "Unreferenced function%0 definition" -#endif : "Unreferenced function%0 declaration"), decl->getLocation()) << (decl->getTemplatedKind() == FunctionDecl::TK_FunctionTemplate ? " template" : "") << decl->getSourceRange(); - if (canon->isDefined() && !compat::isFirstDecl(*decl)) { + if (canon->isDefined() && !decl->isFirstDecl()) { report( DiagnosticsEngine::Note, "first declaration is here", canon->getLocation()) diff --git a/compilerplugins/clang/unusedfieldsremove.cxx b/compilerplugins/clang/unusedfieldsremove.cxx index e33f940a8a35..afe937df0ecd 100644 --- a/compilerplugins/clang/unusedfieldsremove.cxx +++ b/compilerplugins/clang/unusedfieldsremove.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> |