[libcxx-commits] [PATCH] D152624: [libc++][format] Improves diagnostics.
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 20 10:49:49 PDT 2023
Mordante created this revision.
Herald added a subscriber: arphaman.
Herald added a project: All.
Mordante updated this revision to Diff 530293.
Mordante added a comment.
Mordante updated this revision to Diff 530294.
Mordante updated this revision to Diff 530297.
Mordante updated this revision to Diff 530299.
Mordante updated this revision to Diff 532887.
Mordante published this revision for review.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
CI fixes.
Mordante added a comment.
CI fixes.
Mordante added a comment.
CI fixes.
Mordante added a comment.
CI fixes.
Mordante added a comment.
Rebased and minor polishing.
Improves both the compile-time and run-time errors.
At compile-time it does a bit more work to get more specific errors.
This could be done at run-time too, but that has a performance penalty.
Since it's expected most use-cases use format* instead of vformat* the
compile-time errors are more common.
For example when using
std::format_to("{:-c}", 42);
Before compile output would contain
std::__throw_format_error("The format-spec should consume the input or end with a '}'");
Now it contains
std::__throw_format_error("The format specifier does not allow the sign option");
Given a better indication the sign option is not allowed. Note the
output is still not user-friendly; C++ doesn't have good facilities to
generate nice messages from the library.
In general all messages have been reviewed and improved, using a more
consistent style and using less terms used in the standard. For example
format-spec -> format specifier
arg-id -> argument index
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D152624
Files:
libcxx/include/__chrono/formatter.h
libcxx/include/__chrono/parser_std_format_spec.h
libcxx/include/__format/format_functions.h
libcxx/include/__format/format_string.h
libcxx/include/__format/formatter_bool.h
libcxx/include/__format/formatter_char.h
libcxx/include/__format/formatter_floating_point.h
libcxx/include/__format/formatter_integer.h
libcxx/include/__format/formatter_pointer.h
libcxx/include/__format/formatter_tuple.h
libcxx/include/__format/parser_std_format_spec.h
libcxx/include/__format/range_formatter.h
libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.tests.h
libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/format.functions.tests.h
libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/format.functions.tests.h
libcxx/test/std/time/time.syn/formatter.day.pass.cpp
libcxx/test/std/time/time.syn/formatter.duration.pass.cpp
libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp
libcxx/test/std/time/time.syn/formatter.hh_mm_ss.pass.cpp
libcxx/test/std/time/time.syn/formatter.local_time.pass.cpp
libcxx/test/std/time/time.syn/formatter.month.pass.cpp
libcxx/test/std/time/time.syn/formatter.month_day.pass.cpp
libcxx/test/std/time/time.syn/formatter.month_day_last.pass.cpp
libcxx/test/std/time/time.syn/formatter.month_weekday.pass.cpp
libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp
libcxx/test/std/time/time.syn/formatter.weekday.pass.cpp
libcxx/test/std/time/time.syn/formatter.weekday_index.pass.cpp
libcxx/test/std/time/time.syn/formatter.weekday_last.pass.cpp
libcxx/test/std/time/time.syn/formatter.year.pass.cpp
libcxx/test/std/time/time.syn/formatter.year_month.pass.cpp
libcxx/test/std/time/time.syn/formatter.year_month_day.pass.cpp
libcxx/test/std/time/time.syn/formatter.year_month_day_last.pass.cpp
libcxx/test/std/time/time.syn/formatter.year_month_weekday.pass.cpp
libcxx/test/std/time/time.syn/formatter.year_month_weekday_last.pass.cpp
libcxx/test/std/utilities/format/format.functions/fill.unicode.pass.cpp
libcxx/test/std/utilities/format/format.functions/format_tests.h
libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.tests.h
libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.tests.h
libcxx/test/std/utilities/format/format.range/format.range.fmtstr/format.functions.tests.h
libcxx/test/std/utilities/format/format.range/format.range.formatter/format.functions.tests.h
libcxx/test/std/utilities/format/format.tuple/format.functions.tests.h
libcxx/test/support/format.functions.common.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152624.532887.patch
Type: text/x-patch
Size: 451787 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230620/67426afb/attachment-0001.bin>
More information about the libcxx-commits
mailing list