From c9858b725bdb0fe459d89e0d2aa9c7e391989cba Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 30 Oct 2019 11:26:16 +0100 Subject: Clarify current loplugin:stringadd behavior Change-Id: Ie5fb84e2b9afddcf86c86364811f0c4f5b90c82e Reviewed-on: https://gerrit.libreoffice.org/81748 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- compilerplugins/clang/test/stringadd.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'compilerplugins/clang') diff --git a/compilerplugins/clang/test/stringadd.cxx b/compilerplugins/clang/test/stringadd.cxx index f36bbbca999e..00582f2db459 100644 --- a/compilerplugins/clang/test/stringadd.cxx +++ b/compilerplugins/clang/test/stringadd.cxx @@ -65,6 +65,17 @@ void f3(OUString aStr, int nFirstContent) // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}} aFirstStr += "..."; } +void f4(int i) +{ + OUString s("xxx"); + // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}} + s += "xxx"; + ++i; + // any other kind of statement breaks the chain (at least for now) + s += "xxx"; + // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}} + s += "xxx"; +} } namespace test2 -- cgit v1.2.3