diff --git a/infer/tests/codetoanalyze/cpp/threadsafety/basics.cpp b/infer/tests/codetoanalyze/cpp/threadsafety/basics.cpp index 2f0ab5bca..03ba778ff 100644 --- a/infer/tests/codetoanalyze/cpp/threadsafety/basics.cpp +++ b/infer/tests/codetoanalyze/cpp/threadsafety/basics.cpp @@ -44,11 +44,15 @@ class Basic { int get4() { return suspiciously_read; } + int get5() { return get_private_suspiciously_read(); } + private: int well_guarded; int suspiciously_read; int suspiciously_written; int not_guarded; std::mutex mutex_; + + int get_private_suspiciously_read() { return suspiciously_read; } }; } diff --git a/infer/tests/codetoanalyze/cpp/threadsafety/issues.exp b/infer/tests/codetoanalyze/cpp/threadsafety/issues.exp index 6c9fa2616..c04cd5a0a 100644 --- a/infer/tests/codetoanalyze/cpp/threadsafety/issues.exp +++ b/infer/tests/codetoanalyze/cpp/threadsafety/issues.exp @@ -1,5 +1,6 @@ codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_get2, 3, THREAD_SAFETY_VIOLATION, [,access to `suspiciously_written`,,access to `suspiciously_written`] codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_get4, 0, THREAD_SAFETY_VIOLATION, [,access to `suspiciously_read`,,access to `suspiciously_read`] +codetoanalyze/cpp/threadsafety/basics.cpp, basics::Basic_get5, 0, THREAD_SAFETY_VIOLATION, [,call to basics::Basic_get_private_suspiciously_read,access to `suspiciously_read`,,access to `suspiciously_read`] codetoanalyze/cpp/threadsafety/lock_guard.cpp, basics::LockGuard_get2, 3, THREAD_SAFETY_VIOLATION, [,access to `suspiciously_written`,,access to `suspiciously_written`] codetoanalyze/cpp/threadsafety/lock_guard.cpp, basics::LockGuard_get4, 0, THREAD_SAFETY_VIOLATION, [,access to `suspiciously_read`,,access to `suspiciously_read`] codetoanalyze/cpp/threadsafety/lock_guard.cpp, basics::LockGuard_test1, 2, THREAD_SAFETY_VIOLATION, [,access to `suspiciously_read`,,access to `suspiciously_read`]