HomePhabricator

[libc++] Use [[nodiscard]] for lock_guard, as an extension

Authored by ldionne on Aug 13 2019, 4:12 AM.

Description

[libc++] Use [[nodiscard]] for lock_guard, as an extension

Summary:
D64914 added support for applying [[nodiscard]] to constructors. This
commit uses that capability to flag incorrect uses of std::lock_guard
where one forgets to actually create a variable for the lock_guard.

rdar://45790820

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits, Quuxplusone, lebedev.ri

Tags: #libc

Differential Revision: https://reviews.llvm.org/D65900

llvm-svn: 368664