summaryrefslogtreecommitdiffstats
path: root/compilerplugins/clang/test
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-02-26 14:36:54 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-02-27 07:36:12 +0100
commit57ac2fcdda9fdc9f1c2840796c24783add08e38c (patch)
tree86108e78b03f294422fe5ec0472b62db244dee37 /compilerplugins/clang/test
parentm_bShowAllShapes in SdPageObjsTLV is dead (diff)
downloadcore-57ac2fcdda9fdc9f1c2840796c24783add08e38c.tar.gz
core-57ac2fcdda9fdc9f1c2840796c24783add08e38c.zip
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@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/test')
-rw-r--r--compilerplugins/clang/test/unusedfields.cxx32
1 files changed, 25 insertions, 7 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