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

Stephan Bergmann sbergman at redhat.com
Fri Aug 26 10:39:04 UTC 2016


 compilerplugins/clang/refcounting.cxx  |   13 +------------
 compilerplugins/clang/staticaccess.cxx |    7 +++++--
 2 files changed, 6 insertions(+), 14 deletions(-)

New commits:
commit 6a1bebcc890c04acdc79236ff54cdd49b27be71a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Aug 26 12:36:12 2016 +0200

    Remove wrong check through template args from containsXInterfaceSubclass
    
    ...that was probably only there as a workaround for cases (equally wrongly)
    covered by the check for !hasAnyDependentBase in isDerivedFrom.  And the latter
    appears to no longer be necessary, probably because the cases it happened to
    cover intentionally are now covered correctly through some other logic that got
    added to this plugin meanwhile.
    
    Change-Id: Ife6370b4f966198fc731813afe62d765450382e6

diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx
index bfdafe9..523f048 100644
--- a/compilerplugins/clang/refcounting.cxx
+++ b/compilerplugins/clang/refcounting.cxx
@@ -83,10 +83,7 @@ bool isDerivedFrom(const CXXRecordDecl *decl, const char *pString) {
     if (!decl->hasDefinition()) {
         return false;
     }
-    if (// not sure what hasAnyDependentBases() does,
-        // but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1
-        !decl->hasAnyDependentBases() &&
-        !compat::forallBases(
+    if (!compat::forallBases(
             *decl,
 #if CLANG_VERSION < 30800
             BaseCheckNotSubclass,
@@ -223,14 +220,6 @@ bool containsXInterfaceSubclass(const Type* pType0) {
             {
                 return false;
             }
-            for(unsigned i=0; i<pTemplate->getTemplateArgs().size(); ++i) {
-                const TemplateArgument& rArg = pTemplate->getTemplateArgs()[i];
-                if (rArg.getKind() == TemplateArgument::ArgKind::Type &&
-                    containsXInterfaceSubclass(rArg.getAsType()))
-                {
-                    return true;
-                }
-            }
         }
     }
     if (pType->isPointerType()) {
commit e3e66f7b07a920132c17a57e5434d0a472c6a250
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Aug 26 12:35:24 2016 +0200

    Minor improvements of loplugin:staticaccess
    
    Change-Id: I731aab418fb42922208afdaa60d98ccd76377dab

diff --git a/compilerplugins/clang/staticaccess.cxx b/compilerplugins/clang/staticaccess.cxx
index 7b825f3..7fa1d39 100644
--- a/compilerplugins/clang/staticaccess.cxx
+++ b/compilerplugins/clang/staticaccess.cxx
@@ -18,7 +18,9 @@ bool isStatic(ValueDecl const * decl, bool * memberEnumerator) {
     // clang::MemberExpr::getMemberDecl is documented to return either a
     // FieldDecl or a CXXMethodDecl, but can apparently also return a VarDecl
     // (as C++ static data members are modeled by VarDecl, not FieldDecl) or an
-    // EnumConstantDecl (struct { enum {E}; } s; s.E;):
+    // EnumConstantDecl (struct { enum {E}; } s; s.E;), see
+    // <https://reviews.llvm.org/D23907> "Fix documentation of
+    // MemberExpr::getMemberDecl":
     auto fd = dyn_cast<FieldDecl>(decl);
     if (fd != nullptr) {
         *memberEnumerator = false;
@@ -27,7 +29,8 @@ bool isStatic(ValueDecl const * decl, bool * memberEnumerator) {
     auto vd = dyn_cast<VarDecl>(decl);
     if (vd != nullptr) {
         *memberEnumerator = false;
-        return vd->isStaticDataMember();
+        assert(vd->isStaticDataMember());
+        return true;
     }
     auto md = dyn_cast<CXXMethodDecl>(decl);
     if (md != nullptr) {


More information about the Libreoffice-commits mailing list