[clang][dataflow] Relax assert on existence of `this` pointee storage
authorEric Li <li.zhe.hua@gmail.com>
Wed, 25 May 2022 19:21:08 +0000 (19:21 +0000)
committerEric Li <li.zhe.hua@gmail.com>
Wed, 25 May 2022 20:58:02 +0000 (20:58 +0000)
commit33b598a808b9ef1a019e798f19855f203e09ad48
tree90a0d78cb1eb72dd4ae920678dcdc6dc5dcf73e1
parent67e2e6e66d0aedb3a2b88fcd0f97957e3cf5ea36
[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
clang/lib/Analysis/FlowSensitive/Transfer.cpp
clang/unittests/Analysis/FlowSensitive/TransferTest.cpp