[PATCH] D58818: [clang-tidy] added cppcoreguidelines-use-raii-locks check

Lewis Clark via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 3 04:30:03 PST 2019


lewmpk marked an inline comment as done.
lewmpk 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
----------------
JonasToth wrote:
> 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.
why would this defeat the analysis?


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