lewmpk marked 7 inline comments as done.
lewmpk added inline comments.
================
Comment at: test/clang-tidy/cppcoreguidelines-use-raii-locks.cpp:4
+// Mock implementation of std::mutex
+namespace std {
+struct mutex {
----------------
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.
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58818/new/
https://reviews.llvm.org/D58818
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits