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
----------------
lewmpk wrote:
> 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?
Because `goto` allows you to reorder you code-locations, so the ordering of 
what comes before what is not so ez.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58818/new/

https://reviews.llvm.org/D58818



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to