[all-commits] [llvm/llvm-project] b80024: [analyzer][NFCI] Remove ad-hoc program point taggi...

Donát Nagy via All-commits all-commits at lists.llvm.org
Fri Jun 6 05:35:08 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b80024e0f4bea449f5c1373436cd61096dd6613b
      https://github.com/llvm/llvm-project/commit/b80024e0f4bea449f5c1373436cd61096dd6613b
  Author: Donát Nagy <donat.nagy at ericsson.com>
  Date:   2025-06-06 (Fri, 06 Jun 2025)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Core/Checker.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
    M clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
    M clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h
    M clang/lib/StaticAnalyzer/Core/BugReporter.cpp
    M clang/lib/StaticAnalyzer/Core/Checker.cpp

  Log Message:
  -----------
  [analyzer][NFCI] Remove ad-hoc program point tagging (#142980)

Previously some checkers attached explicitly created program point tags
to some of the exploded graph nodes that they created. In most of the
checkers this ad-hoc tagging only affected the debug dump of the
exploded graph (and they weren't too relevant for debugging) so this
commit removes them.

There were two checkers where the tagging _did_ have a functional role:
- In `RetainCountChecker` the presence of tags were checked by
`RefCountReportVisitor`.
- In `DynamicTypePropagation` the checker sometimes wanted to create two
identical nodes and had to apply an explicit tag on the second one to
avoid "caching out".
 
In these two situations I preserved the tags but switched to using
`SimpleProgramPointTag` instead of `CheckerProgramPointTag` because
`CheckerProgramPointTag` didn't provide enough benefits to justify its
existence.

Note that this commit depends on the earlier commit "[analyzer] Fix
tagging of PostAllocatorCall" ec96c0c072ef3f78813c378949c00e1c07aa44e5
and would introduce crashes when cherry-picked onto a branch that
doesn't contain that commit.

For more details about the background see the discourse thread
https://discourse.llvm.org/t/role-of-programpointtag-in-the-static-analyzer/

As a tangentially related changes, this commit also adds some comments
to document the surprising behavior of `CheckerContext::addTransition`
and an assertion in the constructor of `PathSensitiveBugReport` to get a
more readable crash dump in the case when the report is constructed with
`nullptr` as the `ErrorNode`. (This can happen due to "caching out".)



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