[all-commits] [llvm/llvm-project] 33b598: [clang][dataflow] Relax assert on existence of `th...

Eric Li via All-commits all-commits at lists.llvm.org
Wed May 25 13:58:53 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 33b598a808b9ef1a019e798f19855f203e09ad48
      https://github.com/llvm/llvm-project/commit/33b598a808b9ef1a019e798f19855f203e09ad48
  Author: Eric Li <li.zhe.hua at gmail.com>
  Date:   2022-05-25 (Wed, 25 May 2022)

  Changed paths:
    M clang/lib/Analysis/FlowSensitive/Transfer.cpp
    M clang/unittests/Analysis/FlowSensitive/TransferTest.cpp

  Log Message:
  -----------
  [clang][dataflow] Relax assert on existence of `this` pointee storage

Support for unions is incomplete (per 99f7d55e) and the `this` pointee
storage location is not set for unions. The assert in
`VisitCXXThisExpr` is then guaranteed to trigger when analyzing member
functions of a union.

This commit changes the assert to an early-return. Any expression may
be undefined, and so having a value for the `CXXThisExpr` is not a
postcondition of the transfer function.

Differential Revision: https://reviews.llvm.org/D126405


  Commit: 5520c5839016d1d98d8e01789eb17c910381bd6f
      https://github.com/llvm/llvm-project/commit/5520c5839016d1d98d8e01789eb17c910381bd6f
  Author: Eric Li <li.zhe.hua at gmail.com>
  Date:   2022-05-25 (Wed, 25 May 2022)

  Changed paths:
    M clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
    M clang/unittests/Analysis/FlowSensitive/TransferTest.cpp

  Log Message:
  -----------
  [clang][dataflow] Fix incorrect CXXThisExpr pointee for lambdas

When constructing the `Environment`, the `this` pointee is established
for a `CXXMethodDecl` by looking at its parent. However, inside of
lambdas, a `CXXThisExpr` refers to the captured `this` coming from the
enclosing member function.

When establishing the `this` pointee for a function, we check whether
the function is a lambda, and check for an enclosing member function
to establish the `this` pointee storage location.

Differential Revision: https://reviews.llvm.org/D126413


Compare: https://github.com/llvm/llvm-project/compare/67e2e6e66d0a...5520c5839016


More information about the All-commits mailing list