This is an archive of the discontinued LLVM Phabricator instance.

Add noreturn attribute to non-returning functions
ClosedPublic

Authored by hiraditya on Feb 23 2021, 11:17 AM.

Diff Detail

Event Timeline

hiraditya requested review of this revision.Feb 23 2021, 11:17 AM
hiraditya created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 23 2021, 11:17 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
zoecarver accepted this revision.Mar 8 2021, 10:42 AM
zoecarver added a subscriber: zoecarver.

This LGTM. I think this matches __basic_string_common and __vector_base_common and friends.

This revision is now accepted and ready to land.Mar 8 2021, 10:42 AM

Sorry, I didn't mean to accept this as libc++. Please wait for a second review.

I did a grep for void __throw and verified that every other instance is attributed, except for:

  • __throw_if_valueless in <variant>: this is good and intentional
  • void __throw_runtime_error(const char* msg) in src/locale.cpp: what's the deal with this one? should you attribute it as well?

I did a grep for void __throw and verified that every other instance is attributed, except for:

  • __throw_if_valueless in <variant>: this is good and intentional
  • void __throw_runtime_error(const char* msg) in src/locale.cpp: what's the deal with this one? should you attribute it as well?

__throw_runtime_error is attributed with noreturn https://github.com/llvm/llvm-project/blob/main/libcxx/src/locale.cpp#L132

  • void __throw_runtime_error(const char* msg) in src/locale.cpp: what's the deal with this one? should you attribute it as well?

__throw_runtime_error is attributed with noreturn https://github.com/llvm/llvm-project/blob/main/libcxx/src/locale.cpp#L132

No, I meant this version: https://github.com/llvm/llvm-project/blob/main/libcxx/src/locale.cpp#L6270

  • void __throw_runtime_error(const char* msg) in src/locale.cpp: what's the deal with this one? should you attribute it as well?

__throw_runtime_error is attributed with noreturn https://github.com/llvm/llvm-project/blob/main/libcxx/src/locale.cpp#L132

No, I meant this version: https://github.com/llvm/llvm-project/blob/main/libcxx/src/locale.cpp#L6270

The declaration already has the attribute so we don't need it here. https://github.com/llvm/llvm-project/blob/main/libcxx/include/stdexcept#L217

Quuxplusone accepted this revision.Mar 10 2021, 1:33 PM

Ah, sneaky. Anyway, ship it! :)

This revision was automatically updated to reflect the committed changes.