brintos

brintos / llvm-project-archived public Read only

0
0
Text · 493 B · 587dbe2 Raw
10 lines · cpp
1// RUN: %check_clang_tidy -std=c++17-or-later -expect-clang-tidy-error %s modernize-use-scoped-lock %t -- -- -isystem %clang_tidy_headers2 3#include <mutex>4 5void f() {6  std::lock_guard<std::mutex> dont_crash {some_nonexistant_variable};7  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use 'std::scoped_lock' instead of 'std::lock_guard' [modernize-use-scoped-lock]8  // CHECK-MESSAGES: :[[@LINE-2]]:43: error: use of undeclared identifier 'some_nonexistant_variable' [clang-diagnostic-error]9}10