[all-commits] [llvm/llvm-project] 339282: [analyzer] Refactor MallocChecker to use `BindExpr...

Pavel Skripkin via All-commits all-commits at lists.llvm.org
Sun Sep 15 21:48:28 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 339282d49f5310a2837da45c0ccc19da15675554
      https://github.com/llvm/llvm-project/commit/339282d49f5310a2837da45c0ccc19da15675554
  Author: Pavel Skripkin <paskripkin at gmail.com>
  Date:   2024-09-16 (Mon, 16 Sep 2024)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicExtent.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
    M clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp
    M clang/lib/StaticAnalyzer/Core/DynamicExtent.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
    M clang/lib/StaticAnalyzer/Core/SValBuilder.cpp
    M clang/test/Analysis/NewDelete-checker-test.cpp
    M clang/test/Analysis/NewDelete-intersections.mm
    M clang/test/Analysis/malloc-interprocedural.c

  Log Message:
  -----------
  [analyzer] Refactor MallocChecker to use `BindExpr` in `evalCall` (#106081)

PR refactors `MallocChecker` to not violate invariant of `BindExpr`,
which should be called only during `evalCall` to avoid conflicts.

To achieve this, most of `postCall` logic was moved to `evalCall` with
addition return value binding in case of processing of allocation
functions. Check functions prototypes was changed to use `State` with
bound return value.

`checkDelim` logic was left in `postCall` to avoid conflicts with
`StreamChecker` which also evaluates `getline` and friends.

PR also introduces breaking change in the unlikely case when the
definition of an allocation function (e.g. `malloc()`) is visible: now
checker does not try to inline allocation functions and assumes their
initial semantics.

Closes #73830



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