compilerplugins/clang/unusedfields.cxx |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

New commits:
commit 5c6cdc5d5a1bf14155523b2817a96609068ae6ac
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Apr 18 14:50:17 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Apr 19 20:32:18 2024 +0200

    loplugin:unusedfields update for new clang AST nodes
    
    Change-Id: Icc47093ab13123e9cb2866434796c7d6e8eb38d9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166291
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/compilerplugins/clang/unusedfields.cxx 
b/compilerplugins/clang/unusedfields.cxx
index d089d11d4956..35381632755a 100644
--- a/compilerplugins/clang/unusedfields.cxx
+++ b/compilerplugins/clang/unusedfields.cxx
@@ -724,6 +724,16 @@ void UnusedFields::checkIfReadFrom(const FieldDecl* 
fieldDecl, const Expr* membe
         {
             break;
         }
+        else if (isa<DeclRefExpr>(parent)) // things like 
o3tl::convertNarrowing pass members as template params
+        {
+            bPotentiallyReadFrom = true;
+            break;
+        }
+        else if (isa<DesignatedInitExpr>(parent))
+        {
+            bPotentiallyReadFrom = true;
+            break;
+        }
         else
         {
             bPotentiallyReadFrom = true;
@@ -949,6 +959,15 @@ void UnusedFields::checkIfWrittenTo(const FieldDecl* 
fieldDecl, const Expr* memb
         {
             break;
         }
+        else if (isa<DeclRefExpr>(parent)) // things like 
o3tl::convertNarrowing pass members as template params
+        {
+            break;
+        }
+        else if (isa<DesignatedInitExpr>(parent))
+        {
+            bPotentiallyWrittenTo = true;
+            break;
+        }
         else
         {
             bPotentiallyWrittenTo = true;

Reply via email to