[clang] [Clang] FunctionEffects: accept throw-only callees from noexcept callers (PR #238401)
Ambrose Leeb via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 5 15:51:26 PST 2026
================
@@ -88,12 +88,17 @@ struct Violation {
SourceLocation Loc;
const Decl *Callee =
nullptr; // Only valid for ViolationIDs Calls{Decl,Expr}WithoutEffect.
+ // True if the violation is, or is solely due to, an exception which
+ // propagates out of the function uncaught. A noexcept caller turns such an
+ // exception into termination, so it need not treat the callee as unsafe.
+ bool ThrowOnly = false;
----------------
Sirraide wrote:
> That seems to mean that `nonthrowing`/`throwing` would be analysis-only attributes, stored in the analysis' data structures. Tomorrow I'll look for more elegant/extensible representations.
Yeah, that’s more or less what I had in mind. A function declared `noexcept` would then have a `nonthrowing` effect.
https://github.com/llvm/llvm-project/pull/238401
More information about the cfe-commits
mailing list