tdf#130857 qt weld: Support "Insert Breaks" dialog
[LibreOffice.git] / compilerplugins / clang / test / collapseif.cxx
blob6f865847391805a585226f4012b245f441df0ce5
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 int f1(int x)
14 // expected-error@+1 {{nested if should be collapsed into one statement 9 9 [loplugin:collapseif]}}
15 if (x == 1)
16 if (x == 2)
17 return 1;
19 // expected-error@+1 {{nested if should be collapsed into one statement 9 9 [loplugin:collapseif]}}
20 if (x == 1)
22 if (x == 2)
23 return 1;
26 // no warning expected
27 if (x == 1)
29 // comment here prevents warning
30 if (x == 2)
31 return 1;
34 // no warning expected
35 if (x == 1)
37 if (x == 2)
38 return 1;
40 else
41 return 3;
43 // no warning expected
44 if (x == 1)
46 if (x == 2)
47 return 1;
48 else
49 return 3;
52 return 2;
55 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */