[libcxx-commits] [libcxx] [libc++] Handle Clang function effect analysis in hardening assertions (PR #177447)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 23 07:31:46 PST 2026


ldionne wrote:

> What's the plan here? Do we plan to support `-Wfunction-effects` more generally? If no, why is this special? If yes, IMO this requires an RFC, since I expect it will impact quite a bit of code in the library.

I think we should try to support `-Wfunction-effects` at least minimally, yes. Otherwise, that extension is basically useless. The fundamental problem is that with hardening, we're making functions that are arguably non-blocking potentially blocking (as far as the analysis can tell, at least).

> I expect it will impact quite a bit of code in the library

That's not my expectation. The extension is supposed to work with existing code pretty much out of the box, it's just that we did something unusual with hardening (and in particular the observe mode), which is that we added calls into the C++ runtime from places that were previously simple "frontend" functions, like `std::span`. I don't expect that we'd have to change code beyond what's done in this patch, and if we do, then I agree that we should consider whether the extension is worth supporting more generally. I'm happy to write a RFC if you feel that this change mandates it, though.

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


More information about the libcxx-commits mailing list