summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/test/unusedfields.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-07-06 08:33:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-06 13:00:56 +0200
commit4f7b2ca221efe9f198994c98ac4603c9e4688f11 (patch)
treee97f4e99d774af4ddfde25e311d07eb9710a57fa /compilerplugins/clang/test/unusedfields.cxx
parent330a022e8bcd413d0bdc0b45916503ddfee5d0cc (diff)
loplugin:unusedfields in sc
found a couple more by running make build-nocheck to exclude testing code Also, teach unusedfields loplugin about operator<<, since referring to a field in an ostream operator<< does not indicate a real use, it's normally for debugging Change-Id: I3dce22bf5afda2fd09e01de9bf1d0ef85e535aa8 Reviewed-on: https://gerrit.libreoffice.org/39625 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.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/compilerplugins/clang/test/unusedfields.cxx b/compilerplugins/clang/test/unusedfields.cxx
index c2c1eb53559d..a82da80a73df 100644
--- a/compilerplugins/clang/test/unusedfields.cxx
+++ b/compilerplugins/clang/test/unusedfields.cxx
@@ -8,6 +8,7 @@
*/
#include <vector>
+#include <ostream>
struct Foo
// expected-error@-1 {{read m_foo1 [loplugin:unusedfields]}}
@@ -33,6 +34,7 @@ struct Bar
std::vector<int> m_bar6;
int m_bar7[5];
int m_bar8;
+ int m_barstream;
// 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) {}
@@ -74,4 +76,11 @@ struct Bar
}
};
+// check that we __dont__ see a read of m_barstream
+std::ostream& operator<<(std::ostream& s, Bar const & bar)
+{
+ s << bar.m_barstream;
+ return s;
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */