brintos

brintos / llvm-project-archived public Read only

0
0
Text · 793 B · 101c339 Raw
30 lines · cpp
1// RUN: %check_clang_tidy %s bugprone-exception-escape %t -- -extra-arg=-fopenmp=libomp -extra-arg=-fexceptions --2 3int thrower() {4  throw 42;5}6 7void ok_parallel() {8#pragma omp parallel9  thrower();10}11 12void bad_for_header_XFAIL(const int a) noexcept {13#pragma omp for14  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=4110218}19 20void ok_forloop(const int a) {21#pragma omp for22  for (int i = 0; i < a; i++)23    thrower();24}25 26void 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 exceptions30