[all-commits] [llvm/llvm-project] 82e314: [analyzer] Fix false positive for mutexes inheriti...

Arseniy Zaostrovnykh via All-commits all-commits at lists.llvm.org
Wed Aug 28 02:30:40 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 82e314e3664d2c8768212e74f751187d51950b87
      https://github.com/llvm/llvm-project/commit/82e314e3664d2c8768212e74f751187d51950b87
  Author: Arseniy Zaostrovnykh <necto.ne at gmail.com>
  Date:   2024-08-28 (Wed, 28 Aug 2024)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
    M clang/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp
    M clang/lib/StaticAnalyzer/Core/CallEvent.cpp
    M clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
    M clang/test/Analysis/block-in-critical-section-inheritance.cpp
    A clang/test/Analysis/block-in-critical-section-nested-namespace.cpp

  Log Message:
  -----------
  [analyzer] Fix false positive for mutexes inheriting mutex_base (#106240)

If a mutex interface is split in inheritance chain, e.g. struct mutex
has `unlock` and inherits `lock` from __mutex_base then calls m.lock()
and m.unlock() have different "this" targets: m and the __mutex_base of
m, which used to confuse the `ActiveCritSections` list.

Taking base region canonicalizes the region used to identify a critical
section and enables search in ActiveCritSections list regardless of
which class the callee is the member of.

This likely fixes #104241

CPP-5541



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list