[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann sbergman at redhat.com
Wed Jun 29 07:15:49 UTC 2016


 compilerplugins/clang/automem.cxx                     |    1 
 compilerplugins/clang/badvectorinit.cxx               |    1 
 compilerplugins/clang/checkconfigmacros.cxx           |    8 --
 compilerplugins/clang/commaoperator.cxx               |    1 
 compilerplugins/clang/compat.hxx                      |   50 ------------------
 compilerplugins/clang/cppunitassertequals.cxx         |    1 
 compilerplugins/clang/cstylecast.cxx                  |    3 -
 compilerplugins/clang/externandnotdefined.cxx         |    4 -
 compilerplugins/clang/fpcomparison.cxx                |    1 
 compilerplugins/clang/inlinesimplememberfunctions.cxx |    7 +-
 compilerplugins/clang/inlinevisible.cxx               |    1 
 compilerplugins/clang/literaltoboolconversion.cxx     |    3 -
 compilerplugins/clang/loopvartoosmall.cxx             |    1 
 compilerplugins/clang/memoryvar.cxx                   |    1 
 compilerplugins/clang/mergeclasses.cxx                |    1 
 compilerplugins/clang/nullptr.cxx                     |    3 -
 compilerplugins/clang/override.cxx                    |    5 -
 compilerplugins/clang/plugin.cxx                      |    3 -
 compilerplugins/clang/ptrvector.cxx                   |    1 
 compilerplugins/clang/rangedforcopy.cxx               |    1 
 compilerplugins/clang/redundantcast.cxx               |    1 
 compilerplugins/clang/rendercontext.cxx               |    1 
 compilerplugins/clang/reservedid.cxx                  |    1 
 compilerplugins/clang/salbool.cxx                     |   13 +---
 compilerplugins/clang/staticanonymous.cxx             |    4 -
 compilerplugins/clang/store/constantfunction.cxx      |    1 
 compilerplugins/clang/store/deletedspecial.cxx        |    3 -
 compilerplugins/clang/store/oncevar.cxx               |    1 
 compilerplugins/clang/store/paintmethodconversion.cxx |    1 
 compilerplugins/clang/store/stdexception.cxx          |   13 ----
 compilerplugins/clang/store/stylepolice.cxx           |    1 
 compilerplugins/clang/stringconstant.cxx              |    1 
 compilerplugins/clang/unreffun.cxx                    |   13 +---
 compilerplugins/clang/unusedfieldsremove.cxx          |    1 
 34 files changed, 25 insertions(+), 127 deletions(-)

New commits:
commit 733198de1b7fc3907609217147704f493f6146e6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Jun 29 09:15:05 2016 +0200

    Remove support for Clang < 3.4
    
    Change-Id: I81e97c5f720535b33dd3ce72d01151765e4e93a0

diff --git a/compilerplugins/clang/automem.cxx b/compilerplugins/clang/automem.cxx
index dfa3525..b4585fb 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 e544fd2..7b26ca3 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 01ffde6..1a92765 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 3e5df3d..39a2b9c 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 b78f90a..063d0ce 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 f5db384..f14dde63 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 e33e905..ae95bc2 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 57669a5..6d4a798 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 63d69c1..5a04edb 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 74959c3..b151538 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 a161873..280a075 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 c89ad35..26a661e 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 c7fa0d3..aaa6648 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 b407c76..2c8f3fd 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 6fcee44..652e253 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 6bac816..8250d51 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 69155d4..a350415 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 af618de..31648a5 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 513d350..12c7105 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 4c86fe3..4c41482 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 edb8b52..53d4b5b 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 037c7bb..e3d1da4 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 2206257..c675719 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 4e7f463..4b123c7 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 ff62a56..92d18c4 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 272c969..5381915 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 5d4c597..5610df1 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 5c203dfa..e618922 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 47e4108..e19a0f4 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 824d645..85a589f 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 d2e3af7..a0f5373 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 4c9dd86..ceb7654 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 73c74db..bf381f9 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 e33f940..afe937d 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>


More information about the Libreoffice-commits mailing list