summaryrefslogtreecommitdiffstats
path: root/tools/clang-tidy/test/readability-braces-around-statements.cpp
blob: ce456ec2e3e90c137027e6cbc2d2c7c1bbbe70b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
void do_something(const char *) {}

bool cond(const char *) {
  return false;
}

void test() {
if (cond("if0") /*comment*/) do_something("same-line");

if (cond("if1") /*comment*/)
  do_something("next-line");

  if (!1) return;
  if (!2) { return; }

  if (!3)
    return;

  if (!4) {
    return;
  }
}

void foo() {
if (1) while (2) if (3) for (;;) do ; while(false) /**/;/**/
}

void f() {}

void foo2() {
  constexpr bool a = true;
  if constexpr (a) {
    f();
  } else {
    f();
  }
}