This is an archive of the discontinued LLVM Phabricator instance.

[clang][docs] Clarify the semantics of -fexceptions
ClosedPublic

Authored by asb on Mar 8 2023, 2:52 AM.

Details

Summary

As noted in #6126 the documentation for -fexceptions appears to imply that unwind information is always generated, which isn't the case.

Diff Detail

Event Timeline

asb created this revision.Mar 8 2023, 2:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2023, 2:52 AM
asb requested review of this revision.Mar 8 2023, 2:52 AM

I'd prefer to focus the documentation more generically on exceptions, not unwind information specifically. -fexceptions makes code generation change in other ways, and "unwind information" doesn't exist on all targets where exception handling is relevant.

asb added a comment.EditedMar 8 2023, 12:07 PM

What do you think about e.g. "Allow exceptions to be thrown through Clang compiled stack frames (on many targets, this will enable unwind information for functions that might have an exception thrown through them). This is on by default in x86-64"? Or were you thinking of something else?

Something like that, sure.

Is it actually on by default on x86-64? I don't think the default is target-specific, I think it's just on for default for C++ dialects, and off by default for non-C++ dialects.

asb added a comment.Mar 8 2023, 12:42 PM

I don't see anything x86_64 specific for OPT_fexceptions handling in clang/lib/Driver/ToolChains/Clang.cpp. So perhaps "For most targets, this is enabled by default for C++." It's disabled for the ps4/ps5 toolchains and xcore, hence the "most targets" qualifier.

asb updated this revision to Diff 505060.Mar 14 2023, 5:54 AM

Adjust wording based on discussion.

This revision is now accepted and ready to land.Mar 14 2023, 12:24 PM
This revision was landed with ongoing or failed builds.Mar 14 2023, 12:54 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 14 2023, 12:54 PM