This is an archive of the discontinued LLVM Phabricator instance.

[clang] True `noexcept` (`-fstrict-noexcept` language dialect)
Needs ReviewPublic

Authored by lebedev.ri on Jan 11 2023, 6:06 PM.

Details

Summary

This tentatively implements the following RFC:
https://discourse.llvm.org/t/rfc-clang-true-noexcept-aka-defaults-are-often-wrong-hardcoded-defaults-are-always-wrong/67629

The idea is that when the opt-in is specified,
we turn all EH Terminate scopes into EH UB scopes,
and don't emit any std::terminate() calls,
which is the user-facing change.

This probably needs better docs,
and might be missing some pieces.

We might be able to do more to omit more destructor calls.

This is missing UBSan bits, those will be in D137381.

Diff Detail

Event Timeline

lebedev.ri created this revision.Jan 11 2023, 6:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 11 2023, 6:06 PM
lebedev.ri requested review of this revision.Jan 11 2023, 6:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 11 2023, 6:06 PM

Effectively ignore dynamic exception specifications.
Normally, they'd catch, filter and either abort or resume.
But just skipping the abort part still leaves us with the rest of
the gunk that we fail to optimize away later: https://godbolt.org/z/vh58E4ooG

Adding more docs as discussed. Further suggestions welcomed.