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

Noel Grandin noel.grandin at collabora.co.uk
Tue Jul 11 14:10:34 UTC 2017


 compilerplugins/clang/unusedfields.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit b533b2748e0f0ce4d5263f5f5720280c51803e25
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Jul 11 16:01:02 2017 +0200

    unusedfields plugin needs to ignore fields that have reinterpret_cast on them
    
    Change-Id: Ie8570de6a4eafc95352899fbfd1447d7c3a84e1a

diff --git a/compilerplugins/clang/unusedfields.cxx b/compilerplugins/clang/unusedfields.cxx
index 3de31c3c8ae6..72354f757d90 100644
--- a/compilerplugins/clang/unusedfields.cxx
+++ b/compilerplugins/clang/unusedfields.cxx
@@ -305,7 +305,13 @@ void UnusedFields::checkWriteOnly(const FieldDecl* fieldDecl, const Expr* member
                 return;
             break;
         }
-        if (isa<CastExpr>(parent) || isa<MemberExpr>(parent) || isa<ParenExpr>(parent) || isa<ParenListExpr>(parent)
+        if (isa<CXXReinterpretCastExpr>(parent))
+        {
+            // once we see one of these, there is not much useful we can know
+            bPotentiallyReadFrom = true;
+            break;
+        }
+        else if (isa<CastExpr>(parent) || isa<MemberExpr>(parent) || isa<ParenExpr>(parent) || isa<ParenListExpr>(parent)
 #if CLANG_VERSION >= 40000
              || isa<ArrayInitLoopExpr>(parent)
 #endif


More information about the Libreoffice-commits mailing list