[PATCH] D144331: [libc++][format] Implements formatter thread::id.

Mark de Wever via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 7 09:38:20 PDT 2023


Mordante marked 4 inline comments as done.
Mordante added a comment.
Herald added projects: clang, clang-format.
Herald added a subscriber: cfe-commits.
Herald added reviewers: rymiel, HazardyKnusperkeks, owenpan, MyDeveloperDay.

Thanks for the review!



================
Comment at: libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/format.functions.tests.h:17
+template <class CharT, class TestFunction, class ExceptionTest>
+void format_tests(TestFunction check, ExceptionTest check_exception) {
+  // Note the output of std::thread::id is unspecified. The output text is the
----------------
ldionne wrote:
> ```
> std::stringstream s; s << id;
> assert(s.str() == std::format("{}", id);
> ```
As discussed this change is already done in `stream.pass.cpp`.


================
Comment at: libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp:27
 #include "test_macros.h"
 
+template <class CharT>
----------------
ldionne wrote:
> While we're at it, can we also test the output stream version on an empty `std::thread::id`?
Based on [thread.thread.id]/1
```
An object of type thread​::​id provides a unique identifier for each thread of execution and a single distinct value for all thread objects that do not represent a thread of execution ([thread.thread.class]).
Each thread of execution has an associated thread​::​id object that is not equal to the thread​::​id object of any other thread of execution and that is not equal to the thread​::​id object of any thread object that does not represent threads of execution.
```
That value is unspecified and may differ between implementations; I expect it will be different.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144331/new/

https://reviews.llvm.org/D144331



More information about the cfe-commits mailing list