https://github.com/cpp-engine updated 
https://github.com/llvm/llvm-project/pull/226488

>From b513dc568af3516f0f5eb70245073bfcd055b608 Mon Sep 17 00:00:00 2001
From: Agaev G <[email protected]>
Date: Fri, 25 Sep 2026 13:04:11 +0000
Subject: [PATCH 1/2] [clang-tidy] Fix performance-noexcept-move-constructor
 for implicit noexcept(false)

---
 .../performance/NoexceptFunctionBaseCheck.cpp | 17 ++++++++-------
 .../performance/noexcept-move-constructor.cpp | 21 +++++++++++++++++++
 2 files changed, 31 insertions(+), 7 deletions(-)

diff --git 
a/clang-tools-extra/clang-tidy/performance/NoexceptFunctionBaseCheck.cpp 
b/clang-tools-extra/clang-tidy/performance/NoexceptFunctionBaseCheck.cpp
index 33d80615fb19f..32d85e18dff95 100644
--- a/clang-tools-extra/clang-tidy/performance/NoexceptFunctionBaseCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/NoexceptFunctionBaseCheck.cpp
@@ -26,13 +26,16 @@ void NoexceptFunctionBaseCheck::check(const 
MatchFinder::MatchResult &Result) {
 
   // Don't complain about nothrow(false), but complain on nothrow(expr)
   // where expr evaluates to false.
-  const auto *ProtoType = FuncDecl->getType()->castAs<FunctionProtoType>();
-  const Expr *NoexceptExpr = ProtoType->getNoexceptExpr();
-  if (NoexceptExpr) {
-    NoexceptExpr = NoexceptExpr->IgnoreImplicit();
-    if (!isa<CXXBoolLiteralExpr>(NoexceptExpr))
-      reportNoexceptEvaluatedToFalse(FuncDecl, NoexceptExpr);
-    return;
+  const auto ExceptionSpecSourceRange = 
FuncDecl->getExceptionSpecSourceRange();
+  if (ExceptionSpecSourceRange.isValid()) {
+    const auto *ProtoType = FuncDecl->getType()->castAs<FunctionProtoType>();
+    const Expr *NoexceptExpr = ProtoType->getNoexceptExpr();
+    if (NoexceptExpr) {
+      NoexceptExpr = NoexceptExpr->IgnoreImplicit();
+      if (!isa<CXXBoolLiteralExpr>(NoexceptExpr))
+        reportNoexceptEvaluatedToFalse(FuncDecl, NoexceptExpr);
+      return;
+    }
   }
 
   const auto Diag = reportMissingNoexcept(FuncDecl);
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp
index 76e1d9e493421..42a1287163d92 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp
@@ -2,6 +2,8 @@
 // RUN: %check_clang_tidy -std=c++17-or-later -check-suffixes=,ERR %s 
performance-noexcept-move-constructor %t \
 // RUN:                   -- --fix-errors -- -fexceptions -DENABLE_ERROR
 
+#include <utility>
+
 namespace std
 {
   template <typename T>
@@ -181,6 +183,25 @@ struct O : virtual IntWrapper, ThrowOnAnything {
   // CHECK-FIXES: O &operator=(O &&)  noexcept = default;
 };
 
+struct P {
+  P() = default;
+
+  P(P &&) = default;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: move constructors should be 
marked noexcept [performance-noexcept-move-constructor]
+  // CHECK-FIXES: P(P &&)  noexcept = default;
+  P &operator=(P &&) = default;
+  // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: move assignment operators should 
be marked noexcept [performance-noexcept-move-constructor]
+  // CHECK-FIXES: P &operator=(P &&)  noexcept = default;
+
+  InheritFromThrowOnAnything IFF;
+};
+
+void p() {
+  P P1{};
+  P P2{std::move(P1)};
+  P P3 = std::move(P2);
+}
+
 class OK {};
 
 void f() {

>From 0a62218f1ea96122dd7e611898ed515d6df0dcfc Mon Sep 17 00:00:00 2001
From: "Agaev G." <[email protected]>
Date: Sun, 27 Sep 2026 17:14:55 +0400
Subject: [PATCH 2/2] [clang-tidy] Fix test and add a release note

---
 clang-tools-extra/docs/ReleaseNotes.md                        | 4 ++++
 .../checkers/performance/noexcept-move-constructor.cpp        | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/clang-tools-extra/docs/ReleaseNotes.md 
b/clang-tools-extra/docs/ReleaseNotes.md
index 0441aef375c54..535baf66b2453 100644
--- a/clang-tools-extra/docs/ReleaseNotes.md
+++ b/clang-tools-extra/docs/ReleaseNotes.md
@@ -322,6 +322,10 @@ infrastructure are described first, followed by 
tool-specific sections.
   <clang-tidy/checks/readability/use-std-min-max>` check by fixing spurious
   trailing semicolons and lost comments when the `if` body has no braces.
 
+- Improved {doc}`noexcept-move-constructors
+  <clang-tidy/checks/performance/noexcept-move-constructor>` check by fixing
+  false positives for implicitly declared noexcept(false).
+
 #### Removed checks
 
 - Removed the deprecated `zircon-temporary-objects` check. Users should 
migrate to
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp
index 42a1287163d92..1b705aada6c2b 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp
@@ -199,7 +199,7 @@ struct P {
 void p() {
   P P1{};
   P P2{std::move(P1)};
-  P P3 = std::move(P2);
+  P1 = std::move(P2);
 }
 
 class OK {};

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to