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

Noel Grandin noel at peralex.com
Fri Apr 15 12:09:28 UTC 2016


 compilerplugins/clang/badstatics.cxx |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

New commits:
commit 4ff087565baf6e540667494a7fe3a229d66b1886
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Apr 14 15:07:57 2016 +0200

    update badstatics plugin to look for VclPtr<> statics
    
    maybe we should create a "StaticVclPtr<>" class that checks if VCL is
    still "alive" before destructing the object?
    
    Change-Id: If8619f689c29294efa19c37ec782fa07acec728d
    Reviewed-on: https://gerrit.libreoffice.org/24085
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>

diff --git a/compilerplugins/clang/badstatics.cxx b/compilerplugins/clang/badstatics.cxx
index 46590e5..ecc9300 100644
--- a/compilerplugins/clang/badstatics.cxx
+++ b/compilerplugins/clang/badstatics.cxx
@@ -51,6 +51,7 @@ public:
         if (   type.Class("Image").GlobalNamespace()
             || type.Class("Bitmap").GlobalNamespace()
             || type.Class("BitmapEx").GlobalNamespace()
+            || type.Class("VclPtr").GlobalNamespace()
            )
         {
             return std::make_pair(true, chain);
@@ -145,6 +146,22 @@ public:
             {
                 return true;
             }
+            // TODO: check these VclPtr<> static fields
+            if (   name == "xPreviousWindow"    // vcl/source/window/winproc.cxx
+                || name == "vDev"               // sdext/source/pdfimport/wrapper/wrapper.cxx
+                || name == "s_xEmptyController" // svx/source/fmcomp/gridcell.cxx
+                || name == "xCell"              // svx/source/table/svdotable.cxx
+                || name == "pPixOut"            // sw/source/core/txtnode/fntcache.cxx
+                || name == "mpCareWindow"       // sw/source/core/view/viewsh.cxx
+               )
+            {
+                return true;
+            }
+            // ignore pointers, nothing happens to them on shutdown
+            QualType const pCanonical(pVarDecl->getType().getUnqualifiedType().getCanonicalType());
+            if (pCanonical->isPointerType()) {
+                return true;
+            }
             std::vector<FieldDecl const*> pad;
             auto const ret(isBadStaticType(pVarDecl->getType(), pad,
                             std::vector<QualType>()));


More information about the Libreoffice-commits mailing list