[all-commits] [llvm/llvm-project] 081cc0: [WebKit Checkers] Add alpha.webkit.UnborrowedLocal...

geoffreygaren via All-commits all-commits at lists.llvm.org
Tue Sep 22 22:27:52 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 081cc091b90248c62607c34eff91e7afbf252129
      https://github.com/llvm/llvm-project/commit/081cc091b90248c62607c34eff91e7afbf252129
  Author: geoffreygaren <ggaren at apple.com>
  Date:   2026-09-22 (Tue, 22 Sep 2026)

  Changed paths:
    M clang/docs/analyzer/checkers.md
    M clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
    M clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp
    M clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.h
    M clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
    M clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h
    M clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefCallArgsChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefLocalVarsChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefSafetyModel.cpp
    M clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefSafetyModel.h
    A clang/test/Analysis/Checkers/WebKit/mock-canborrow.h
    A clang/test/Analysis/Checkers/WebKit/unborrowed-local-vars-cxx23.cpp
    A clang/test/Analysis/Checkers/WebKit/unborrowed-local-vars.cpp
    M clang/test/Analysis/Checkers/WebKit/uncounted-local-vars.cpp

  Log Message:
  -----------
  [WebKit Checkers] Add alpha.webkit.UnborrowedLocalVarsChecker (#225274)

This is a new checker that requires a Borrow<T> when using a
pointer/reference/view that is lifetimebound to a CanBorrow type.

A CanBorrow type is a type that tracks views into its interior at
runtime, and calls crashIfBorrowed() when it invalidates such views.
Vector is the motivating example.

A design description is available at:
https://github.com/WebKit/WebKit/wiki/SaferCPP:-Borrowed-Pointer-Use-After-Destruction

I implemented UnborrowedLocalVarsChecker in terms of the existing
alpha.webkit.*LocalVarsChecker system because the requirement to hold an
overlooking smart-pointer-like-thing is pretty similar.

In some cases where the new checker is stricter than the existing
checker, this patch conditionalizes the strictness. The plan is to
upgrade existing checkers in a follow-up patch.

Assisted-by: Claude



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