1 // RUN: %check_clang_tidy %s bugprone-exception-escape %t -- -extra-arg=-fopenmp=libomp -extra-arg=-fexceptions --
2 
thrower()3 int thrower() {
4   throw 42;
5 }
6 
ok_parallel()7 void ok_parallel() {
8 #pragma omp parallel
9   thrower();
10 }
11 
bad_for_header_XFAIL(const int a)12 void bad_for_header_XFAIL(const int a) noexcept {
13 #pragma omp for
14   for (int i = 0; i < thrower(); i++)
15     ;
16   // FIXME: this really should be caught by bugprone-exception-escape.
17   // https://bugs.llvm.org/show_bug.cgi?id=41102
18 }
19 
ok_forloop(const int a)20 void ok_forloop(const int a) {
21 #pragma omp for
22   for (int i = 0; i < a; i++)
23     thrower();
24 }
25 
some_exception_just_so_that_check_clang_tidy_shuts_up()26 void some_exception_just_so_that_check_clang_tidy_shuts_up() noexcept {
27   thrower();
28 }
29 // CHECK-MESSAGES: :[[@LINE-3]]:6: warning: an exception may be thrown in function 'some_exception_just_so_that_check_clang_tidy_shuts_up' which should not throw exceptions
30