This is an archive of the discontinued LLVM Phabricator instance.

[clang][dataflow] Relax assert on existence of `this` pointee storage
ClosedPublic

Authored by li.zhe.hua on May 25 2022, 12:21 PM.

Details

Summary

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.

Diff Detail

Event Timeline

li.zhe.hua created this revision.May 25 2022, 12:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2022, 12:21 PM
li.zhe.hua requested review of this revision.May 25 2022, 12:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2022, 12:21 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
ymandel accepted this revision.May 25 2022, 1:21 PM

Please wait for at least one more "accept". thanks!

This revision is now accepted and ready to land.May 25 2022, 1:21 PM
sgatev accepted this revision.May 25 2022, 1:27 PM
sgatev added inline comments.
clang/lib/Analysis/FlowSensitive/Transfer.cpp
282–285

Please document when that could happen.

clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
3181–3190
li.zhe.hua marked 2 inline comments as done.

Address reviewer comments.

Accidentally a word...

This revision was landed with ongoing or failed builds.May 25 2022, 1:58 PM
This revision was automatically updated to reflect the committed changes.