aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-options.cpp
blob: 48c9bacd1b2e55683dd3c44ef4ea56c1d0bce6bf (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
39
40
41
42
43
44
45
46
47
// RUN: %check_clang_tidy -std=c++11-or-later %s bugprone-exception-escape %t -- \
// RUN:     -config="{CheckOptions: { \
// RUN:         bugprone-exception-escape.CheckDestructors: false, \
// RUN:         bugprone-exception-escape.CheckMoveMemberFunctions: false, \
// RUN:         bugprone-exception-escape.CheckMain: false, \
// RUN:         bugprone-exception-escape.CheckedSwapFunctions: '', \
// RUN:         bugprone-exception-escape.CheckNothrowFunctions: false \
// RUN:     }}" \
// RUN:     -- -fexceptions

// CHECK-MESSAGES-NOT: warning:

struct destructor {
  ~destructor() {
    throw 1;
  }
};

struct move {
    move(move&&) { throw 42; }
    move& operator=(move&&) { throw 42; }
};

void swap(int&, int&) {
  throw 1;
}

void iter_swap(int&, int&) {
  throw 1;
}

void iter_move(int&) {
  throw 1;
}

void nothrow_func() throw() {
  throw 1;
}

void noexcept_func() noexcept {
  throw 1;
}

int main() {
  throw 1;
  return 0;
}