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

Ambrose Leeb via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 4 09:52:49 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>();
----------------
Sirraide wrote:

> My LLM wrote a test that breaks at `ActOnBlockStmtExpr`

Oh interesting; can you open an issue for that?

> In C++:
> 
> `^int{ return 1; }` -> `BuiltinType 'int'`

Yeah, something seems pretty wrong here

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


More information about the cfe-commits mailing list