summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compilerplugins/clang/test/unusedfields.cxx32
-rw-r--r--compilerplugins/clang/unusedfields.cxx2
2 files changed, 26 insertions, 8 deletions
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@-5 {{read m_barfunctionpointer [loplugin:unusedfields]}}
// expected-error@-6 {{read m_bar8 [loplugin:unusedfields]}}
// expected-error@-7 {{read m_bar10 [loplugin:unusedfields]}}
-// expected-error@-8 {{write m_bar1 [loplugin:unusedfields]}}
-// expected-error@-9 {{write m_bar2 [loplugin:unusedfields]}}
-// expected-error@-10 {{write m_bar3 [loplugin:unusedfields]}}
-// expected-error@-11 {{write m_bar3b [loplugin:unusedfields]}}
-// expected-error@-12 {{write m_bar4 [loplugin:unusedfields]}}
-// expected-error@-13 {{write m_bar7 [loplugin:unusedfields]}}
-// expected-error@-14 {{write m_bar9 [loplugin:unusedfields]}}
+// expected-error@-8 {{read m_bar11 [loplugin:unusedfields]}}
+// expected-error@-9 {{write m_bar1 [loplugin:unusedfields]}}
+// expected-error@-10 {{write m_bar2 [loplugin:unusedfields]}}
+// expected-error@-11 {{write m_bar3 [loplugin:unusedfields]}}
+// expected-error@-12 {{write m_bar3b [loplugin:unusedfields]}}
+// expected-error@-13 {{write m_bar4 [loplugin:unusedfields]}}
+// expected-error@-14 {{write m_bar7 [loplugin:unusedfields]}}
+// expected-error@-15 {{write m_bar9 [loplugin:unusedfields]}}
+// expected-error@-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)