[all-commits] [llvm/llvm-project] ca19ab: [NFCI][analyzer] invalidateRegions: require explic...

Donát Nagy via All-commits all-commits at lists.llvm.org
Mon Nov 3 04:51:36 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ca19ab97b9cb0104965319dda9400ad4955662ae
      https://github.com/llvm/llvm-project/commit/ca19ab97b9cb0104965319dda9400ad4955662ae
  Author: Donát Nagy <donat.nagy at ericsson.com>
  Date:   2025-11-03 (Mon, 03 Nov 2025)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
    M clang/lib/StaticAnalyzer/Core/CallEvent.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp

  Log Message:
  -----------
  [NFCI][analyzer] invalidateRegions: require explicit State (#164434)

The method `CallEvent::invalidateRegions()` takes (an unsigned
`BlockCount` and) a `ProgramStateRef` which was previously defaulted to
`nullptr` -- and when the state argument was `nullptr`, the method used
the "inner" state of the `CallEvent` as a starting point for the
invalidation.

My recent commit 0f6f13bdccd3345522b7d38294a72b802b6ffc28 turned the
"inner" state of the `CallEvent` into a hidden `protected`
implementation detail; so this commit follows that direction by removing
the "defaults to the inner state" behavior from `invalidateRegions` to
avoid exposing the inner state through this channel.

The method `CallEvent::invalidateRegions()` was only called in two
locations, only one of those was relying on the existence of the default
argument value, and even there it was easy to explicitly pass the
`State` object.

This commit also eliminates a footgun: with the old logic, if some code
had tried to pass a state explicitly (presumably because the "inner"
state of the call was obsolete) but that "new" state happened to be
`nullptr`, then `invalidateRegions` would have silently used the inner
state attached to the call. However, I reviewed the call sites and don't
think that it was actually possible to reach this buggy execution path.



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