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

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.


Reviewers: mclow.lists, EricWF

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

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368664 91177308-0d34-0410-b5e6-96231b3b80d8
4 files changed