[Libreoffice-commits] core.git: compilerplugins/clang
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Feb 27 06:36:40 UTC 2019
compilerplugins/clang/test/unusedfields.cxx | 32 +++++++++++++++++++++-------
compilerplugins/clang/unusedfields.cxx | 2 -
2 files changed, 26 insertions(+), 8 deletions(-)
New commits:
commit 57ac2fcdda9fdc9f1c2840796c24783add08e38c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Feb 26 14:36:54 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Feb 27 07:36:12 2019 +0100
loplugin:unusedfields fix read/write when dealing with r<<= and >>=
Change-Id: I103bcc2f21741d0a52a0bdf053fdbddf5a3e9ea0
Reviewed-on: https://gerrit.libreoffice.org/68387
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/compilerplugins/clang/test/unusedfields.cxx b/compilerplugins/clang/test/unusedfields.cxx
index d756272f792c..6b4c64623c52 100644
--- a/compilerplugins/clang/test/unusedfields.cxx
+++ b/compilerplugins/clang/test/unusedfields.cxx
@@ -30,13 +30,15 @@ struct Bar
// expected-error at -5 {{read m_barfunctionpointer [loplugin:unusedfields]}}
// expected-error at -6 {{read m_bar8 [loplugin:unusedfields]}}
// expected-error at -7 {{read m_bar10 [loplugin:unusedfields]}}
-// expected-error at -8 {{write m_bar1 [loplugin:unusedfields]}}
-// expected-error at -9 {{write m_bar2 [loplugin:unusedfields]}}
-// expected-error at -10 {{write m_bar3 [loplugin:unusedfields]}}
-// expected-error at -11 {{write m_bar3b [loplugin:unusedfields]}}
-// expected-error at -12 {{write m_bar4 [loplugin:unusedfields]}}
-// expected-error at -13 {{write m_bar7 [loplugin:unusedfields]}}
-// expected-error at -14 {{write m_bar9 [loplugin:unusedfields]}}
+// expected-error at -8 {{read m_bar11 [loplugin:unusedfields]}}
+// expected-error at -9 {{write m_bar1 [loplugin:unusedfields]}}
+// expected-error at -10 {{write m_bar2 [loplugin:unusedfields]}}
+// expected-error at -11 {{write m_bar3 [loplugin:unusedfields]}}
+// expected-error at -12 {{write m_bar3b [loplugin:unusedfields]}}
+// expected-error at -13 {{write m_bar4 [loplugin:unusedfields]}}
+// expected-error at -14 {{write m_bar7 [loplugin:unusedfields]}}
+// expected-error at -15 {{write m_bar9 [loplugin:unusedfields]}}
+// expected-error at -16 {{write m_bar12 [loplugin:unusedfields]}}
{
int m_bar1;
int m_bar2 = 1;
@@ -51,6 +53,8 @@ struct Bar
int m_barstream;
sal_Int32 m_bar9;
sal_Int32 m_bar10;
+ css::uno::Any m_bar11;
+ css::uno::Any m_bar12;
// check that we see reads of fields like m_foo1 when referred to via constructor initializer
Bar(Foo const & foo) : m_bar1(foo.m_foo1) {}
@@ -104,6 +108,20 @@ struct Bar
css::uno::Any any;
any <<= m_bar10;
}
+
+ // check that we see reads of the LHS when calling operator>>=
+ void bar11()
+ {
+ int x;
+ m_bar11 >>= x;
+ }
+
+ // check that we see writes of the LHS when calling operator<<=
+ void bar12()
+ {
+ int x;
+ m_bar12 <<= x;
+ }
};
// check that we __dont__ see a read of m_barstream
diff --git a/compilerplugins/clang/unusedfields.cxx b/compilerplugins/clang/unusedfields.cxx
index 4f7a49648a10..a0796fe95547 100644
--- a/compilerplugins/clang/unusedfields.cxx
+++ b/compilerplugins/clang/unusedfields.cxx
@@ -594,7 +594,7 @@ void UnusedFields::checkIfReadFrom(const FieldDecl* fieldDecl, const Expr* membe
const bool assignmentOp = op == OO_Equal || op == OO_StarEqual ||
op == OO_SlashEqual || op == OO_PercentEqual ||
op == OO_PlusEqual || op == OO_MinusEqual ||
- op == OO_LessLessEqual || op == OO_GreaterGreaterEqual ||
+ op == OO_LessLessEqual ||
op == OO_AmpEqual || op == OO_CaretEqual ||
op == OO_PipeEqual;
if (operatorCallExpr->getArg(0) == child && assignmentOp)
More information about the Libreoffice-commits
mailing list