This is an archive of the discontinued LLVM Phabricator instance.

[libc] add noexcept to external function headers
ClosedPublic

Authored by michaelrj on Jan 5 2023, 3:23 PM.

Details

Summary

To improve code generation for C++ code that directly includes our
headers, the external function definitions will now be marked noexcept.
This may not be necessary for the internal definitions since we build
with the -fno-exceptions flag.

Diff Detail

Event Timeline

michaelrj created this revision.Jan 5 2023, 3:23 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJan 5 2023, 3:23 PM
michaelrj requested review of this revision.Jan 5 2023, 3:23 PM
sivachandra added inline comments.Jan 5 2023, 3:41 PM
libc/include/__llvm-libc-common.h
35

Nit: The other names like _Noreturn are actually C keywords. In this case, though the identifier names prefixed with _<Capital letter> are allowed for standard library use, we should probably obscure this a little more into __NOEXCEPT similar to __BEGIN_C_DECLS.

michaelrj updated this revision to Diff 486701.Jan 5 2023, 3:44 PM

change the noexcept macro name to avoid collisions

sivachandra accepted this revision.Jan 5 2023, 11:20 PM
This revision is now accepted and ready to land.Jan 5 2023, 11:20 PM
michaelrj updated this revision to Diff 486947.Jan 6 2023, 11:41 AM
michaelrj marked an inline comment as done.

rebase before land

This revision was landed with ongoing or failed builds.Jan 6 2023, 11:43 AM
This revision was automatically updated to reflect the committed changes.