[clang] [Clang] FunctionEffects: accept throw-only callees from noexcept callers (PR #238401)

Doug Wyatt via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 3 11:48:44 PST 2026


================
@@ -125,6 +130,18 @@ static bool isNoexcept(const FunctionDecl *FD) {
   return FPT && (FPT->isNothrow() || FD->hasAttr<NoThrowAttr>());
 }
 
+static bool isNoexcept(const Decl *D) {
+  if (const auto *FD = D->getAsFunction())
+    return isNoexcept(FD);
+  if (const auto *BD = dyn_cast<BlockDecl>(D)) {
+    if (auto *TSI = BD->getSignatureAsWritten()) {
+      auto *FPT = TSI->getType()->castAs<FunctionProtoType>();
+      return FPT->isNothrow() || BD->hasAttr<NoThrowAttr>();
----------------
dougsonos wrote:

This was the earlier implementation too but in any case, rewritten with getAs

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


More information about the cfe-commits mailing list