[all-commits] [llvm/llvm-project] 81e471: [SSAF][PointerFlow] Factor out and make the pointe...

Ziqing Luo via All-commits all-commits at lists.llvm.org
Sat Sep 12 12:14:45 PDT 2026


  Branch: refs/heads/users/ziqingluo/PR-187125348-3
  Home:   https://github.com/llvm/llvm-project
  Commit: 81e4717aeca65241db7f18c24a35f12b192a24eb
      https://github.com/llvm/llvm-project/commit/81e4717aeca65241db7f18c24a35f12b192a24eb
  Author: Ziqing Luo <ziqing_luo at apple.com>
  Date:   2026-09-10 (Thu, 10 Sep 2026)

  Changed paths:
    A clang/include/clang/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowPairs.h
    M clang/lib/ScalableStaticAnalysis/Analyses/CMakeLists.txt
    M clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowExtractor.cpp
    A clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowPairs.cpp
    M clang/lib/ScalableStaticAnalysis/Analyses/SSAFAnalysesCommon.h
    A clang/unittests/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowPairsTest.cpp
    M clang/unittests/ScalableStaticAnalysis/CMakeLists.txt
    M llvm/utils/gn/secondary/clang/lib/ScalableStaticAnalysis/Analyses/BUILD.gn
    M llvm/utils/gn/secondary/clang/unittests/ScalableStaticAnalysis/BUILD.gn

  Log Message:
  -----------
  [SSAF][PointerFlow] Factor out and make the pointer-flow matching reusable

The PointerFlowExtractor matches AST nodes representing pointer-flows
and converts them to entity-based data structures directly. This
commit divides this procedure into two steps: 1) match and represent
AST nodes as PointerFlowPairs; 2) convert PointerFlowPairs to
entity-based edges. Therefore, other SSAF tools may use
PointerFlowPairs.

The refactoring also improves coverage: it separates pointer-type
checking from structural matching, so structural matching alone now
discovers cases that were previously missed due to overly aggressive
type checking (e.g. a record-typed call argument or return value
initialized with a braced-init-list).

Along the way, this also fixes a bug for unnamed bit-fields.

First patch for
rdar://187125348


  Commit: dc7fb830f80daa8c9254b9fab821310a64118966
      https://github.com/llvm/llvm-project/commit/dc7fb830f80daa8c9254b9fab821310a64118966
  Author: Ziqing Luo <ziqing_luo at apple.com>
  Date:   2026-09-10 (Thu, 10 Sep 2026)

  Changed paths:
    M clang/include/clang/ScalableStaticAnalysis/Analyses/EntityPointerLevel/EntityPointerLevel.h
    M clang/include/clang/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowPairs.h
    M clang/lib/ScalableStaticAnalysis/Analyses/EntityPointerLevel/EntityPointerLevel.cpp
    M clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowExtractor.cpp

  Log Message:
  -----------
  [SSAF][PointerFlow] Drop unused TUSummaryExtractor param from translateDeclPointerLevel

TUSummaryExtractor is only needed to mint EntityIds when building an
EntityPointerLevel; translateDeclPointerLevel just walks the Expr and
returns raw DeclPointerLevels, so it never touched Extractor.

This is the second patch the radar below depends on:
rdar://187125348


  Commit: 0fb9994a6c838cc7b1d68340b49358250b70d36d
      https://github.com/llvm/llvm-project/commit/0fb9994a6c838cc7b1d68340b49358250b70d36d
  Author: Ziqing Luo <ziqing_luo at apple.com>
  Date:   2026-09-12 (Sat, 12 Sep 2026)

  Changed paths:
    M clang/lib/ScalableStaticAnalysis/SourceTransformation/CMakeLists.txt
    M clang/lib/ScalableStaticAnalysis/SourceTransformation/Transformations/CppBoundedBuffers.cpp
    M clang/unittests/ScalableStaticAnalysis/SourceTransformation/CppBoundedBuffersTest.cpp
    M llvm/utils/gn/secondary/clang/lib/ScalableStaticAnalysis/SourceTransformation/BUILD.gn

  Log Message:
  -----------
  [SSAF][clang-reforge] Retrofit expressions after CppBoundedBuffers decl rewrites

PR #210457 introduces declaration rewriting.  When CppBoundedBuffers
rewrites a declaration or return type to a bounded_ptr/bounded_array,
some of the existing uses of that entity needs retrofit.

This commit creates expression rewrites for the following patterns:

- Append '.data()' to call arguments when necessary parameter is not
  transformed but argument is transformed.
- Append '.as_bounded<T>()' to call arguments when both parameter and
  argument are transformed but element types are not identical.
- Rewrite '&e[i]' to '(e + i)' and '&*e'/'&(*e)' to 'e', if 'e' is
  transformed.
- Rewrite '(T*)e', 'static_cast<T*>(e)', and 'reinterpret_cast<T*>(e)'
  to 'e.as_bounded<T>()', if 'e' is transformed.

The 3rd step of
rdar://187125348


Compare: https://github.com/llvm/llvm-project/compare/b7e0daffa335...0fb9994a6c83

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