aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-options.cpp')
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-options.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-options.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-options.cpp
new file mode 100644
index 0000000..48c9bac
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-options.cpp
@@ -0,0 +1,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;
+}