JonasToth added inline comments.
================ Comment at: test/clang-tidy/cppcoreguidelines-use-raii-locks.cpp:4 +// Mock implementation of std::mutex +namespace std { +struct mutex { ---------------- lewmpk wrote: > JonasToth wrote: > > Please add more tests > > > > What happens for this? > > ``` > > void foo() { > > std::mutex m; > > m.lock(); > > m.unlock(); > > m.lock(); > > m.unlock(); > > m.try_lock(); > > m.lock(); > > m.unlock(); > > } > > ``` > > > > - Please add tests for templates, where the lock-type is a template > > parameter > > - please add tests where the locking happens within macros > > - please add tests for usage within loops > > - where cases like `std::mutex m1; std::mutex &m2 = m1; // usage`. This > > should not be diagnosed, right? > I've added a test case for your example, templates, macros and loops. > I can't catch the case `std::mutex m1; std::mutex &m2 = m1; // usage`, but i > can catch trivial cases. Yes, your not supposed to catch those. But i feel things like this should be documented. In theory catching this particular case is possible (we do similar analysis for `const`. But it is totally acceptable to leave as is! 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