[all-commits] [llvm/llvm-project] 9942a3: [libc++] Apply `[[nodiscard]]` to `unique_lock` an...

A. Jiang via All-commits all-commits at lists.llvm.org
Tue Jun 2 06:01:19 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9942a38e64b2333dc3816eebe6ac9230b1993220
      https://github.com/llvm/llvm-project/commit/9942a38e64b2333dc3816eebe6ac9230b1993220
  Author: A. Jiang <de34 at live.cn>
  Date:   2026-06-02 (Tue, 02 Jun 2026)

  Changed paths:
    M libcxx/include/__mutex/unique_lock.h
    M libcxx/include/shared_mutex
    M libcxx/test/libcxx/thread/nodiscard.verify.cpp

  Log Message:
  -----------
  [libc++] Apply `[[nodiscard]]` to `unique_lock` and `<shared_mutex>` (#200986)

`[[nodiscard]]` should be applied to functions where discarding the
return value is most likely a correctness issue.

- https://libcxx.llvm.org/CodingGuidelines.html
- https://wg21.link/thread.sharedmutex.class
- https://wg21.link/thread.sharedtimedmutex.class
- https://wg21.link/thread.lock.unique
- https://wg21.link/thread.lock.shared

Remarks:
- All constructors of `shared_lock` are marked `[[nodiscard]]`, which is
consistent with handling for constructors of `unique_lock`.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list