[all-commits] [llvm/llvm-project] 76e4c9: clang-extra: fix incorrect use of std::lock_guard ...
Conrad Poelman via All-commits
all-commits at lists.llvm.org
Mon Feb 22 12:08:27 PST 2021
Branch: refs/heads/release/12.x
Home: https://github.com/llvm/llvm-project
Commit: 76e4c93ea42b3d23907611d14e347bfeae8d4b0a
https://github.com/llvm/llvm-project/commit/76e4c93ea42b3d23907611d14e347bfeae8d4b0a
Author: Conrad Poelman <cpgithub at stellarscience.com>
Date: 2021-02-22 (Mon, 22 Feb 2021)
Changed paths:
M clang-tools-extra/clangd/support/Function.h
Log Message:
-----------
clang-extra: fix incorrect use of std::lock_guard by adding variable name (identified by MSVC [[nodiscard]] error)
`std::lock_guard` is an RAII class that needs a variable name whose scope determines the guard's lifetime. This particular usage lacked a variable name, meaning the guard could be destroyed before the line that it was indented to protect.
This line was identified by building clang with the latest MSVC preview release, which declares the std::lock_guard constructor to be `[[nodiscard]]` to draw attention to such issues.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D95725
(cherry picked from commit 0b70c86e2007d3f32968f0a7d9efe8eab3bf0f0a)
More information about the All-commits
mailing list