[PATCH] D58818: [clang-tidy] added cppcoreguidelines-use-raii-locks check
Jonas Toth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 2 13:15:48 PST 2019
JonasToth added inline comments.
================
Comment at: test/clang-tidy/cppcoreguidelines-use-raii-locks.cpp:90
+ for (auto i = 0; i < 3; i++) {
+ m.lock();
+ // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use RAII
----------------
I got another one that I think defeats the analysis:
```
while (true)
{
my_label:
m.lock();
if (some_condition)
goto my_label;
m.unlock();
}
```
Usage of `goto` can interfer and make the situation more complicated. I am not asking you to implement that correctly (not sure if even possible with pure clang-tidy) but I think a pathological example should be documented for the user.
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58818/new/
https://reviews.llvm.org/D58818
More information about the cfe-commits
mailing list