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

Stephan Bergmann sbergman at redhat.com
Wed Jun 29 06:55:55 UTC 2016


 compilerplugins/clang/checkconfigmacros.cxx        |   30 +----------
 compilerplugins/clang/compat.hxx                   |   56 ---------------------
 compilerplugins/clang/externandnotdefined.cxx      |    2 
 compilerplugins/clang/implicitboolconversion.cxx   |    6 --
 compilerplugins/clang/literaltoboolconversion.cxx  |    2 
 compilerplugins/clang/nullptr.cxx                  |   19 +------
 compilerplugins/clang/redundantcast.cxx            |    8 +--
 compilerplugins/clang/salbool.cxx                  |   30 +----------
 compilerplugins/clang/store/constantfunction.cxx   |    2 
 compilerplugins/clang/store/rtlconstasciimacro.cxx |    8 ---
 compilerplugins/clang/stringconstant.cxx           |    7 +-
 compilerplugins/clang/unreffun.cxx                 |   14 +----
 12 files changed, 29 insertions(+), 155 deletions(-)

New commits:
commit 1ce7176ba1b39f02ab45056023f8e7622f48cc74
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Jun 29 08:55:27 2016 +0200

    Remove support for Clang < 3.3
    
    Change-Id: I185852a738bac10dc6d331afccfcbc7ae1225cb1

diff --git a/compilerplugins/clang/checkconfigmacros.cxx b/compilerplugins/clang/checkconfigmacros.cxx
index 5baea1e..01ffde6 100644
--- a/compilerplugins/clang/checkconfigmacros.cxx
+++ b/compilerplugins/clang/checkconfigmacros.cxx
@@ -34,13 +34,6 @@ class CheckConfigMacros
     public:
         explicit CheckConfigMacros( const InstantiationData& data );
         virtual void run() override;
-#if CLANG_VERSION < 30300
-        virtual void MacroDefined( const Token& macroToken, const MacroInfo* info ) override;
-        virtual void MacroUndefined( const Token& macroToken, const MacroInfo* info ) override;
-        virtual void Ifdef( SourceLocation location, const Token& macroToken ) override;
-        virtual void Ifndef( SourceLocation location, const Token& macroToken ) override;
-        virtual void Defined( const Token& macroToken ) override;
-#else
         virtual void MacroDefined( const Token& macroToken, const MacroDirective* info ) override;
 #if CLANG_VERSION < 30700
         virtual void MacroUndefined( const Token& macroToken, const MacroDirective* info ) override;
@@ -58,7 +51,6 @@ class CheckConfigMacros
 #else
         virtual void Defined( const Token& macroToken, const MacroDefinition& info, SourceRange Range ) override;
 #endif
-#endif
         enum { isPPCallback = true };
     private:
         void checkMacro( const Token& macroToken, SourceLocation location );
@@ -76,15 +68,9 @@ void CheckConfigMacros::run()
     // nothing, only check preprocessor usage
     }
 
-#if CLANG_VERSION < 30300
-void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroInfo* info )
-    {
-    SourceLocation location = info->getDefinitionLoc();
-#else
 void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroDirective* info )
     {
     SourceLocation location = info->getLocation();
-#endif
     const char* filename = compiler.getSourceManager().getPresumedLoc( location ).getFilename();
     if( filename != NULL
         && ( strncmp( filename, BUILDDIR "/config_host/", strlen( BUILDDIR "/config_host/" )) == 0
@@ -95,9 +81,7 @@ void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroDirect
         }
     }
 
-#if CLANG_VERSION < 30300
-void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroInfo* )
-#elif CLANG_VERSION < 30700
+#if CLANG_VERSION < 30700
 void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroDirective* )
 #else
 void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroDefinition& )
@@ -106,9 +90,7 @@ void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroDefi
     configMacros.erase( macroToken.getIdentifierInfo()->getName());
     }
 
-#if CLANG_VERSION < 30300
-void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken )
-#elif CLANG_VERSION < 30700
+#if CLANG_VERSION < 30700
 void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken, const MacroDirective* )
 #else
 void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken, const MacroDefinition& )
@@ -117,9 +99,7 @@ void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken,
     checkMacro( macroToken, location );
     }
 
-#if CLANG_VERSION < 30300
-void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken )
-#elif CLANG_VERSION < 30700
+#if CLANG_VERSION < 30700
 void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken, const MacroDirective* )
 #else
 void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken, const MacroDefinition& )
@@ -128,9 +108,7 @@ void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken
     checkMacro( macroToken, location );
     }
 
-#if CLANG_VERSION < 30300
-void CheckConfigMacros::Defined( const Token& macroToken )
-#elif CLANG_VERSION < 30400
+#if CLANG_VERSION < 30400
 void CheckConfigMacros::Defined( const Token& macroToken, const MacroDirective* )
 #elif CLANG_VERSION < 30700
 void CheckConfigMacros::Defined( const Token& macroToken, const MacroDirective* , SourceRange )
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 2f73b7f..b78f90a 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -90,28 +90,6 @@ inline bool forallBases(
 #endif
 }
 
-#if CLANG_VERSION >= 30300
-typedef clang::LinkageInfo LinkageInfo;
-#else
-typedef clang::NamedDecl::LinkageInfo LinkageInfo;
-#endif
-
-inline clang::Linkage getLinkage(LinkageInfo const & info) {
-#if CLANG_VERSION >= 30300
-    return info.getLinkage();
-#else
-    return info.linkage();
-#endif
-}
-
-inline clang::Visibility getVisibility(LinkageInfo const & info) {
-#if CLANG_VERSION >= 30300
-    return info.getVisibility();
-#else
-    return info.visibility();
-#endif
-}
-
 inline bool isFirstDecl(clang::FunctionDecl const & decl) {
 #if CLANG_VERSION >= 30400
     return decl.isFirstDecl();
@@ -251,30 +229,6 @@ inline std::unique_ptr<llvm::raw_fd_ostream> create_raw_fd_ostream(
 #endif
 }
 
-#if CLANG_VERSION >= 30700
-typedef clang::DeclContext::lookup_result DeclContextLookupResult;
-typedef clang::DeclContext::lookup_iterator DeclContextLookupIterator;
-#else
-typedef clang::DeclContext::lookup_const_result DeclContextLookupResult;
-typedef clang::DeclContext::lookup_const_iterator DeclContextLookupIterator;
-#endif
-
-inline DeclContextLookupIterator begin(DeclContextLookupResult const & result) {
-#if CLANG_VERSION >= 30300
-    return result.begin();
-#else
-    return result.first;
-#endif
-}
-
-inline DeclContextLookupIterator end(DeclContextLookupResult const & result) {
-#if CLANG_VERSION >= 30300
-    return result.end();
-#else
-    return result.second;
-#endif
-}
-
 inline void addPPCallbacks(
     clang::Preprocessor & preprocessor, clang::PPCallbacks * C)
 {
@@ -303,16 +257,6 @@ inline bool isMacroArgExpansion(
 #endif
 }
 
-inline bool isMacroBodyExpansion(clang::CompilerInstance& compiler, clang::SourceLocation location)
-{
-#if CLANG_VERSION >= 30300
-    return compiler.getSourceManager().isMacroBodyExpansion(location);
-#else
-    return location.isMacroID()
-        && !compiler.getSourceManager().isMacroArgExpansion(location);
-#endif
-}
-
 inline auto getAsTagDecl(clang::Type const& t) -> clang::TagDecl *
 {
 #if CLANG_VERSION >= 30500
diff --git a/compilerplugins/clang/externandnotdefined.cxx b/compilerplugins/clang/externandnotdefined.cxx
index 2deca8a..57669a5 100644
--- a/compilerplugins/clang/externandnotdefined.cxx
+++ b/compilerplugins/clang/externandnotdefined.cxx
@@ -33,7 +33,7 @@ bool ExternAndNotDefined::VisitFunctionDecl(const FunctionDecl * functionDecl) {
         return true;
     }
     if (functionDecl->isDefined() || functionDecl->isPure()
-      || (compat::getLinkage(functionDecl->getLinkageAndVisibility())
+      || (functionDecl->getLinkageAndVisibility().getLinkage()
           != ExternalLinkage)) {
         return true;
     }
diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx
index 552293f..629a507 100644
--- a/compilerplugins/clang/implicitboolconversion.cxx
+++ b/compilerplugins/clang/implicitboolconversion.cxx
@@ -224,15 +224,9 @@ bool hasCLanguageLinkageType(FunctionDecl const * decl) {
     if (decl->isExternC()) {
         return true;
     }
-#if CLANG_VERSION >= 30300
     if (decl->isInExternCContext()) {
         return true;
     }
-#else
-    if (decl->getCanonicalDecl()->getDeclContext()->isExternCContext()) {
-        return true;
-    }
-#endif
     return false;
 }
 
diff --git a/compilerplugins/clang/literaltoboolconversion.cxx b/compilerplugins/clang/literaltoboolconversion.cxx
index 8e0c719..c89ad35 100644
--- a/compilerplugins/clang/literaltoboolconversion.cxx
+++ b/compilerplugins/clang/literaltoboolconversion.cxx
@@ -93,7 +93,7 @@ void LiteralToBoolConversion::handleImplicitCastSubExpr(
         while (compiler.getSourceManager().isMacroArgExpansion(loc)) {
             loc = compiler.getSourceManager().getImmediateMacroCallerLoc(loc);
         }
-        if (compat::isMacroBodyExpansion(compiler, loc)) {
+        if (compiler.getSourceManager().isMacroBodyExpansion(loc)) {
             StringRef name { Lexer::getImmediateMacroName(
                 loc, compiler.getSourceManager(), compiler.getLangOpts()) };
             if (name == "sal_False" || name == "sal_True") {
diff --git a/compilerplugins/clang/nullptr.cxx b/compilerplugins/clang/nullptr.cxx
index 34e27e6..6bac816 100644
--- a/compilerplugins/clang/nullptr.cxx
+++ b/compilerplugins/clang/nullptr.cxx
@@ -67,8 +67,6 @@ private:
 
     bool isFromCIncludeFile(SourceLocation spellingLocation) const;
 
-    bool isMacroBodyExpansion(SourceLocation location) const;
-
     void visitCXXCtorInitializer(CXXCtorInitializer const * init);
 
     void handleZero(Expr const * expr);
@@ -218,15 +216,6 @@ bool Nullptr::isFromCIncludeFile(SourceLocation spellingLocation) const {
             .endswith(".h"));
 }
 
-bool Nullptr::isMacroBodyExpansion(SourceLocation location) const {
-#if CLANG_VERSION >= 30300
-    return compiler.getSourceManager().isMacroBodyExpansion(location);
-#else
-    return location.isMacroID()
-        && !compiler.getSourceManager().isMacroArgExpansion(location);
-#endif
-}
-
 void Nullptr::visitCXXCtorInitializer(CXXCtorInitializer const * init) {
     if (!init->isWritten()) {
         return;
@@ -273,7 +262,7 @@ void Nullptr::handleNull(
         while (compiler.getSourceManager().isMacroArgExpansion(loc)) {
             loc = compiler.getSourceManager().getImmediateMacroCallerLoc(loc);
         }
-        if (isMacroBodyExpansion(loc)) {
+        if (compiler.getSourceManager().isMacroBodyExpansion(loc)) {
             if (Lexer::getImmediateMacroName(
                     loc, compiler.getSourceManager(), compiler.getLangOpts())
                 == "NULL")
@@ -336,7 +325,8 @@ void Nullptr::rewriteOrWarn(
             locStart = compiler.getSourceManager()
                 .getImmediateMacroCallerLoc(locStart);
         }
-        if (compiler.getLangOpts().CPlusPlus && isMacroBodyExpansion(locStart)
+        if (compiler.getLangOpts().CPlusPlus
+            && compiler.getSourceManager().isMacroBodyExpansion(locStart)
             && (Lexer::getImmediateMacroName(
                     locStart, compiler.getSourceManager(),
                     compiler.getLangOpts())
@@ -350,7 +340,8 @@ void Nullptr::rewriteOrWarn(
             locEnd = compiler.getSourceManager()
                 .getImmediateMacroCallerLoc(locEnd);
         }
-        if (compiler.getLangOpts().CPlusPlus && isMacroBodyExpansion(locEnd)
+        if (compiler.getLangOpts().CPlusPlus
+            && compiler.getSourceManager().isMacroBodyExpansion(locEnd)
             && (Lexer::getImmediateMacroName(
                     locEnd, compiler.getSourceManager(),
                     compiler.getLangOpts())
diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx
index 7100b4e..edb8b52 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -146,8 +146,8 @@ bool RedundantCast::VisitImplicitCastExpr(const ImplicitCastExpr * expr) {
                        && isVoidPointer(
                            dyn_cast<CXXStaticCastExpr>(e)->getSubExpr()
                            ->IgnoreParenImpCasts()->getType())
-                       && !compat::isMacroBodyExpansion(
-                           compiler, e->getLocStart()))
+                       && !compiler.getSourceManager().isMacroBodyExpansion(
+                           e->getLocStart()))
             {
                 report(
                     DiagnosticsEngine::Warning,
@@ -223,13 +223,13 @@ bool RedundantCast::VisitCXXReinterpretCastExpr(
                 loc = compiler.getSourceManager().getImmediateMacroCallerLoc(
                     loc);
             }
-            if (compat::isMacroBodyExpansion(compiler, loc)) {
+            if (compiler.getSourceManager().isMacroBodyExpansion(loc)) {
                 auto loc2 = expr->getLocEnd();
                 while (compiler.getSourceManager().isMacroArgExpansion(loc2)) {
                     loc2 = compiler.getSourceManager()
                         .getImmediateMacroCallerLoc(loc2);
                 }
-                if (compat::isMacroBodyExpansion(compiler, loc2)) {
+                if (compiler.getSourceManager().isMacroBodyExpansion(loc2)) {
                     //TODO: check loc, loc2 are in same macro body expansion
                     loc = compiler.getSourceManager().getSpellingLoc(loc);
                 }
diff --git a/compilerplugins/clang/salbool.cxx b/compilerplugins/clang/salbool.cxx
index 117ce61..4e7f463 100644
--- a/compilerplugins/clang/salbool.cxx
+++ b/compilerplugins/clang/salbool.cxx
@@ -32,20 +32,6 @@ bool isSalBoolArray(QualType type) {
             || isSalBoolArray(t->getElementType()));
 }
 
-// Clang 3.2 FunctionDecl::isInlined doesn't work as advertised ("Determine
-// whether this function should be inlined, because it is either marked 'inline'
-// or 'constexpr' or is a member function of a class that was defined in the
-// class body.") but mis-classifies salhelper::Timer's isTicking, isExpired, and
-// expiresBefore members as defined in salhelper/source/timer.cxx as inlined:
-bool isInlined(FunctionDecl const & decl) {
-#if CLANG_VERSION >= 30300
-    return decl.isInlined();
-#else
-    (void)decl;
-    return false;
-#endif
-}
-
 // It appears that, given a function declaration, there is no way to determine
 // the language linkage of the function's type, only of the function's name
 // (via FunctionDecl::isExternC); however, in a case like
@@ -61,15 +47,9 @@ bool hasCLanguageLinkageType(FunctionDecl const * decl) {
     if (decl->isExternC()) {
         return true;
     }
-#if CLANG_VERSION >= 30300
     if (decl->isInExternCContext()) {
         return true;
     }
-#else
-    if (decl->getCanonicalDecl()->getDeclContext()->isExternCContext()) {
-        return true;
-    }
-#endif
     return false;
 }
 
@@ -94,7 +74,7 @@ OverrideKind getOverrideKind(FunctionDecl const * decl) {
 bool hasBoolOverload(FunctionDecl const * decl, bool mustBeDeleted) {
     unsigned n = decl->getNumParams();
     auto res = decl->getDeclContext()->lookup(decl->getDeclName());
-    for (auto d = compat::begin(res); d != compat::end(res); ++d) {
+    for (auto d = res.begin(); d != res.end(); ++d) {
         FunctionDecl const * f = dyn_cast<FunctionDecl>(*d);
         if (f != nullptr && (!mustBeDeleted || f->isDeleted())) {
             if (f->getNumParams() == n) {
@@ -298,7 +278,7 @@ bool SalBool::VisitCStyleCastExpr(CStyleCastExpr * expr) {
         while (compiler.getSourceManager().isMacroArgExpansion(loc)) {
             loc = compiler.getSourceManager().getImmediateMacroCallerLoc(loc);
         }
-        if (compat::isMacroBodyExpansion(compiler, loc)) {
+        if (compiler.getSourceManager().isMacroBodyExpansion(loc)) {
             StringRef name { Lexer::getImmediateMacroName(
                 loc, compiler.getSourceManager(), compiler.getLangOpts()) };
             if (name == "sal_False" || name == "sal_True") {
@@ -396,7 +376,7 @@ bool SalBool::VisitImplicitCastExpr(ImplicitCastExpr * expr) {
     while (compiler.getSourceManager().isMacroArgExpansion(l)) {
         l = compiler.getSourceManager().getImmediateMacroCallerLoc(l);
     }
-    if (compat::isMacroBodyExpansion(compiler, l)) {
+    if (compiler.getSourceManager().isMacroBodyExpansion(l)) {
         auto n = Lexer::getImmediateMacroName(
             l, compiler.getSourceManager(), compiler.getLangOpts());
         if (n == "sal_False" || n == "sal_True") {
@@ -495,7 +475,7 @@ bool SalBool::VisitParmVarDecl(ParmVarDecl const * decl) {
                   || (isInUnoIncludeFile(
                           compiler.getSourceManager().getSpellingLoc(
                               f->getNameInfo().getLoc()))
-                      && (!isInlined(*f) || f->hasAttr<DeprecatedAttr>()
+                      && (!f->isInlined() || f->hasAttr<DeprecatedAttr>()
                           || decl->getType()->isReferenceType()
                           || hasBoolOverload(f, false)))
                   || f->isDeleted() || hasBoolOverload(f, true)))
@@ -672,7 +652,7 @@ bool SalBool::VisitFunctionDecl(FunctionDecl const * decl) {
                  || (isInUnoIncludeFile(
                          compiler.getSourceManager().getSpellingLoc(
                              f->getNameInfo().getLoc()))
-                     && (!isInlined(*f) || f->hasAttr<DeprecatedAttr>()))))
+                     && (!f->isInlined() || f->hasAttr<DeprecatedAttr>()))))
         {
             SourceLocation loc { decl->getLocStart() };
             SourceLocation l { compiler.getSourceManager().getExpansionLoc(
diff --git a/compilerplugins/clang/store/constantfunction.cxx b/compilerplugins/clang/store/constantfunction.cxx
index 104e696..272c969 100644
--- a/compilerplugins/clang/store/constantfunction.cxx
+++ b/compilerplugins/clang/store/constantfunction.cxx
@@ -440,7 +440,7 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) {
     }
 
     std::string aImmediateMacro = "";
-    if (compat::isMacroBodyExpansion(compiler, pFunctionDecl->getLocStart()) ) {
+    if (compiler.getSourceManager().isMacroBodyExpansion(pFunctionDecl->getLocStart()) ) {
         StringRef name { Lexer::getImmediateMacroName(
                 pFunctionDecl->getLocStart(), compiler.getSourceManager(), compiler.getLangOpts()) };
         aImmediateMacro = name;
diff --git a/compilerplugins/clang/store/rtlconstasciimacro.cxx b/compilerplugins/clang/store/rtlconstasciimacro.cxx
index 720f0e7..eb955e2 100644
--- a/compilerplugins/clang/store/rtlconstasciimacro.cxx
+++ b/compilerplugins/clang/store/rtlconstasciimacro.cxx
@@ -34,12 +34,8 @@ class RtlConstAsciiMacro
         bool VisitCXXConstructExpr( CXXConstructExpr* expr );
         bool VisitCXXTemporaryObjectExpr( CXXTemporaryObjectExpr* expr );
         bool VisitStringLiteral( const StringLiteral* literal );
-#if CLANG_VERSION < 30300
-        virtual void MacroExpands( const Token& macro, const MacroInfo* info, SourceRange range ) override;
-#else
         virtual void MacroExpands( const Token& macro, const MacroDirective* directive,
             SourceRange range, const MacroArgs* args ) override;
-#endif
         enum { isPPCallback = true };
     private:
         map< SourceLocation, SourceLocation > expansions; // start location -> end location
@@ -59,12 +55,8 @@ void RtlConstAsciiMacro::run()
     TraverseDecl( compiler.getASTContext().getTranslationUnitDecl());
     }
 
-#if CLANG_VERSION < 30300
-void RtlConstAsciiMacro::MacroExpands( const Token& macro, const MacroInfo*, SourceRange range )
-#else
 void RtlConstAsciiMacro::MacroExpands( const Token& macro, const MacroDirective*,
     SourceRange range, const MacroArgs* )
-#endif
     {
     if( macro.getIdentifierInfo()->getName() != "RTL_CONSTASCII_USTRINGPARAM" )
         return;
diff --git a/compilerplugins/clang/stringconstant.cxx b/compilerplugins/clang/stringconstant.cxx
index 157039b..4c9dd86 100644
--- a/compilerplugins/clang/stringconstant.cxx
+++ b/compilerplugins/clang/stringconstant.cxx
@@ -62,7 +62,7 @@ bool hasOverloads(FunctionDecl const * decl, unsigned arguments) {
         ctx = ctx->getParent();
     }
     auto res = ctx->lookup(decl->getDeclName());
-    for (auto d = compat::begin(res); d != compat::end(res); ++d) {
+    for (auto d = res.begin(); d != res.end(); ++d) {
         FunctionDecl const * f = dyn_cast<FunctionDecl>(*d);
         if (f != nullptr && f->getMinRequiredArguments() <= arguments
             && f->getNumParams() >= arguments)
@@ -782,7 +782,8 @@ bool StringConstant::VisitCXXConstructExpr(CXXConstructExpr const * expr) {
                                     loc = compiler.getSourceManager()
                                         .getImmediateMacroCallerLoc(loc);
                                 }
-                                if (compat::isMacroBodyExpansion(compiler, loc)
+                                if ((compiler.getSourceManager()
+                                     .isMacroBodyExpansion(loc))
                                     && (Lexer::getImmediateMacroName(
                                             loc, compiler.getSourceManager(),
                                             compiler.getLangOpts())
@@ -1119,7 +1120,7 @@ void StringConstant::reportChange(
         while (compiler.getSourceManager().isMacroArgExpansion(loc)) {
             loc = compiler.getSourceManager().getImmediateMacroCallerLoc(loc);
         }
-        if (compat::isMacroBodyExpansion(compiler, loc)) {
+        if (compiler.getSourceManager().isMacroBodyExpansion(loc)) {
             loc = compiler.getSourceManager().getSpellingLoc(loc);
         }
         unsigned n = Lexer::MeasureTokenLength(
diff --git a/compilerplugins/clang/unreffun.cxx b/compilerplugins/clang/unreffun.cxx
index 36e1816..73c74db 100644
--- a/compilerplugins/clang/unreffun.cxx
+++ b/compilerplugins/clang/unreffun.cxx
@@ -33,15 +33,9 @@ bool hasCLanguageLinkageType(FunctionDecl const * decl) {
     if (decl->isExternC()) {
         return true;
     }
-#if CLANG_VERSION >= 30300
     if (decl->isInExternCContext()) {
         return true;
     }
-#else
-    if (decl->getCanonicalDecl()->getDeclContext()->isExternCContext()) {
-        return true;
-    }
-#endif
     return false;
 }
 
@@ -134,13 +128,13 @@ bool UnrefFun::VisitFunctionDecl(FunctionDecl const * decl) {
     {
         return true;
     }
-    compat::LinkageInfo info(canon->getLinkageAndVisibility());
-    if (compat::getLinkage(info) == ExternalLinkage
+    LinkageInfo info(canon->getLinkageAndVisibility());
+    if (info.getLinkage() == ExternalLinkage
         && hasCLanguageLinkageType(canon) && canon->isDefined()
-        && ((decl == canon && compat::getVisibility(info) == DefaultVisibility)
+        && ((decl == canon && info.getVisibility() == DefaultVisibility)
             || ((canon->hasAttr<ConstructorAttr>()
                  || canon->hasAttr<DestructorAttr>())
-                && compat::getVisibility(info) == HiddenVisibility)))
+                && info.getVisibility() == HiddenVisibility)))
     {
         return true;
     }


More information about the Libreoffice-commits mailing list