bump product version to 6.3.0.0.beta1
[LibreOffice.git] / compilerplugins / clang / test / sequentialassign.cxx
blobe656e1a7a304cc1cec32e5f3168a9bc403984c4a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <rtl/ustring.hxx>
12 namespace test1
14 void f(OUString s1)
16 OUString s2 = s1;
17 // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:sequentialassign]}}
18 s2 = s2.getToken(0, '(');
22 namespace test2
24 OUString s2;
25 void f(OUString s1)
27 s2 = s1;
28 // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:sequentialassign]}}
29 s2 = s2.getToken(0, '(');
33 namespace test3
35 struct VolumeInfo
37 OUString getFileSystemName();
39 OUString aNullURL("");
40 void f(VolumeInfo _aVolumeInfo)
42 OUString aFileSysName(aNullURL);
43 // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:sequentialassign]}}
44 aFileSysName = _aVolumeInfo.getFileSystemName();
48 namespace test4
50 struct B3DVector
52 B3DVector getPerpendicular();
54 void f(B3DVector aNewVPN)
56 B3DVector aNewToTheRight = aNewVPN;
57 // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:sequentialassign]}}
58 aNewToTheRight = aNewToTheRight.getPerpendicular();
62 namespace test5
64 void f(OUString s, int x)
66 int nPos = x;
67 // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:sequentialassign]}}
68 nPos = s.indexOf("x", nPos);
72 namespace test6
74 void f()
76 OUString s2("xxxx");
77 s2 = s2.getToken(0, '('); // no warning expected
81 namespace test7
83 class Class1
85 OUString m_field1;
86 void foo(Class1& rOther)
88 OUString s = rOther.m_field1;
89 // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:sequentialassign]}}
90 s = s.copy(1, 2);
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */