This is an archive of the discontinued LLVM Phabricator instance.

[libc++][format] Improves compile-time diagnostics.
ClosedPublic

Authored by Mordante on Jul 15 2023, 2:48 AM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Commits
rGcf931d4fa56e: [libc++][format] Improves compile-time diagnostics.
Summary

Then a std-format-spec option is invalid for a type the compile-time
validation will detect its usage and issue a diagnostic. Before it
validated after parsing the entire std-format-spec, which meant the
diagnostic was less precise. It would be possible to do this validation
run-time but that has a performance overhead. When using the format
family of functions, this would be unneeded overhead; the validation was
done at run-time. For the vformat family it would give better
diagnostics.

To avoid paying what you don't use, it has been decided to aim for the
better performance. It's more likely users will use the format family of
functions.

Depends on D155264

Diff Detail

Event Timeline

Mordante created this revision.Jul 15 2023, 2:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 15 2023, 2:48 AM
Mordante published this revision for review.Jul 15 2023, 5:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 15 2023, 5:43 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante added inline comments.
libcxx/include/__format/parser_std_format_spec.h
344

Use braces here.

@ldionne this will be done before landing, just not something I wanted to do when splitting the patch.

ldionne accepted this revision.Jul 18 2023, 10:03 AM

LGTM w/ nitpicks.

libcxx/include/__format/parser_std_format_spec.h
316
318
This revision is now accepted and ready to land.Jul 18 2023, 10:03 AM
Mordante marked 2 inline comments as done.Jul 18 2023, 11:45 AM
This revision was automatically updated to reflect the committed changes.