nss: upgrade to release 3.73
[LibreOffice.git] / compilerplugins / clang / test / elidestringvar.cxx
blob3e8e6592bbae1863ebb7e48c5b2b1e5cdf9db75d
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 "sal/config.h"
12 #include "rtl/ustring.hxx"
14 OUString f(sal_Unicode c, int n)
16 OUString s1(c);
17 // expected-note@+1 {{literal 'rtl::OUString' variable defined here [loplugin:elidestringvar]}}
18 OUString s2('a');
19 // expected-note@+1 {{literal 'rtl::OUString' variable defined here [loplugin:elidestringvar]}}
20 OUString s3(u'a');
21 static constexpr OUStringLiteral s4lit(u"a");
22 // expected-note@+1 {{literal 'rtl::OUString' variable defined here [loplugin:elidestringvar]}}
23 OUString s4 = s4lit;
24 switch (n)
26 case 1:
27 return s1;
28 case 2:
29 // expected-error@+1 {{replace single use of literal 'rtl::OUString' variable with a literal [loplugin:elidestringvar]}}
30 return s2;
31 case 3:
32 // expected-error@+1 {{replace single use of literal 'rtl::OUString' variable with a literal [loplugin:elidestringvar]}}
33 return s3;
34 default:
35 // expected-error@+1 {{replace single use of literal 'rtl::OUString' variable with a literal [loplugin:elidestringvar]}}
36 return s4;
40 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */