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

Ziqing Luo via All-commits all-commits at lists.llvm.org
Fri Sep 11 16:50:16 PDT 2026


  Branch: refs/heads/users/ziqingluo/PR-187125348-3
  Home:   https://github.com/llvm/llvm-project
  Commit: e81e32388d55985e7b17a119b05b6aca64706562
      https://github.com/llvm/llvm-project/commit/e81e32388d55985e7b17a119b05b6aca64706562
  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: 6a7cfc8f4a87f8cb9867bb47f26be5cfc061a5a0
      https://github.com/llvm/llvm-project/commit/6a7cfc8f4a87f8cb9867bb47f26be5cfc061a5a0
  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: d9507e569268e87814e88ad71f1d91c26e47940f
      https://github.com/llvm/llvm-project/commit/d9507e569268e87814e88ad71f1d91c26e47940f
  Author: Ziqing Luo <ziqing_luo at apple.com>
  Date:   2026-09-11 (Fri, 11 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/e81e32388d55%5E...d9507e569268

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