summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/test/unusedfields.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-06-30 11:08:36 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-30 19:50:30 +0200
commit979d58c9a96884e36d1585df0c04c89b1f53fa99 (patch)
treebce40aad53ac5123a2864da59b8d889b8a51e577 /compilerplugins/clang/test/unusedfields.cxx
parent3c1fc723ff622d8a541fa26a3397ca4258332e4a (diff)
loplugin:unusedfields in toolkit..xmloff
Change-Id: I4964ff97e0a1735dc08c6ad204cae0b08e9ffc2c Reviewed-on: https://gerrit.libreoffice.org/39406 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/test/unusedfields.cxx')
-rw-r--r--compilerplugins/clang/test/unusedfields.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/compilerplugins/clang/test/unusedfields.cxx b/compilerplugins/clang/test/unusedfields.cxx
index a66b7a6e7eca..c2c1eb53559d 100644
--- a/compilerplugins/clang/test/unusedfields.cxx
+++ b/compilerplugins/clang/test/unusedfields.cxx
@@ -21,6 +21,7 @@ struct Bar
// expected-error@-3 {{read m_bar5 [loplugin:unusedfields]}}
// expected-error@-4 {{read m_bar6 [loplugin:unusedfields]}}
// expected-error@-5 {{read m_barfunctionpointer [loplugin:unusedfields]}}
+// expected-error@-6 {{read m_bar8 [loplugin:unusedfields]}}
{
int m_bar1;
int m_bar2 = 1;
@@ -31,6 +32,7 @@ struct Bar
int m_bar5;
std::vector<int> m_bar6;
int m_bar7[5];
+ int m_bar8;
// 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) {}
@@ -61,7 +63,15 @@ struct Bar
// check that we see reads of a field when used in ranged-for
void bar6() { for (auto i : m_bar6) { (void)i; } }
+ // check that we see don't see reads of array fields
void bar7() { m_bar7[3] = 1; }
+
+ // check that we see reads when a field is used in an array expression
+ char bar8()
+ {
+ char tmp[5];
+ return tmp[m_bar8];
+ }
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */