summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/test/stringadd.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-10-28 10:35:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-28 12:07:54 +0100
commitbc539bd3c04964471af6b5ca54264215c8995696 (patch)
treec37af5b9fb3dc0b8677fc8dd535fb8e93ad6039d /compilerplugins/clang/test/stringadd.cxx
parent9f78a4174e5099ad3af65a23e158a51c1afca54d (diff)
loplugin:stringadd improve detection
if one side of the expression is a compile-time-constant, we don't need to worry about side-effects on the other side Change-Id: Iee71ea51b327ef244bf39f128f921ac325d74e2b Reviewed-on: https://gerrit.libreoffice.org/81589 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/test/stringadd.cxx')
-rw-r--r--compilerplugins/clang/test/stringadd.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/compilerplugins/clang/test/stringadd.cxx b/compilerplugins/clang/test/stringadd.cxx
index a8469026e509..f36bbbca999e 100644
--- a/compilerplugins/clang/test/stringadd.cxx
+++ b/compilerplugins/clang/test/stringadd.cxx
@@ -99,6 +99,13 @@ void f(Bar b1, Bar& b2, Bar* b3)
// expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}}
s3 += b3->m_field;
}
+OUString side_effect();
+void f2()
+{
+ OUString sRet = "xxx";
+ // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}}
+ sRet += side_effect();
+}
}
// no warning expected
@@ -117,17 +124,10 @@ void f()
namespace test5
{
OUString side_effect();
-int side_effect2();
void f()
{
- OUString sRet = "xxx";
- sRet += side_effect();
- sRet += OUString::number(side_effect2());
-}
-void g()
-{
OUString sRet = side_effect();
- sRet += "xxx";
+ sRet += side_effect();
}
}