[clang-tools-extra] [clang-tidy] Add AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 4 03:29:39 PDT 2025


================
@@ -0,0 +1,63 @@
+// RUN: %check_clang_tidy %s performance-noexcept-move-constructor %t -- -- -fexceptions
+
+// RUN: %check_clang_tidy -check-suffix=CONFIG %s performance-noexcept-move-constructor,performance-noexcept-destructor %t -- \
+// RUN: -config="{CheckOptions: {performance-noexcept-move-constructor.AllowFalseEvaluated: true}}" \
+// RUN: -- -fexceptions
+
+namespace std
+{
+  template <typename T>
+  struct is_nothrow_move_constructible
+  {
+    static constexpr bool value = __is_nothrow_constructible(T, __add_rvalue_reference(T));
+  };
+} // namespace std
+
+struct ThrowOnAnything {
+  ThrowOnAnything() noexcept(false);
+  ThrowOnAnything(ThrowOnAnything&&) noexcept(false);
+  // CHECK-MESSAGES-NOT: :[[@LINE-1]]:3: warning: move constructors should be marked noexcept
+  // CHECK-MESSAGES-CONFIG-NOT: :[[@LINE-2]]:3: warning: move constructors should be marked noexcept
----------------
vbvictor wrote:

CHECK-MESSAGES-NOT considered deprecated because by default FileCheck triggers if there was output that was expected by CHECK-MESSAGES.
So this could be removed in whole file

https://github.com/llvm/llvm-project/pull/126897


More information about the cfe-commits mailing list