Page MenuHomePhabricator

[analyzer] Fix body farm for Obj-C++ properties
ClosedPublic

Authored by vsavchenko on Mar 23 2021, 8:54 AM.

Details

Summary

When property is declared in a superclass (or in a protocol),
it still can be of CXXRecord type and Sema could've already
generated a body for us. This patch joins two branches and
two ways of acquiring IVar in order to reuse the existing code.
And prevent us from generating l-value to r-value casts for
C++ types.

rdar://67416721

Diff Detail

Event Timeline

vsavchenko created this revision.Mar 23 2021, 8:54 AM
vsavchenko requested review of this revision.Mar 23 2021, 8:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 23 2021, 8:54 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
steakhal resigned from this revision.Mar 23 2021, 9:07 AM

I'm not familiar with Objective-C.

NoQ added inline comments.Apr 6 2021, 9:56 AM
clang/lib/Analysis/BodyFarm.cpp
757

At this point Prop may contain a completely unrelated property decl. It doesn't necessarily correspond to the IVar or have the right name. We keep it after the end of the loop and use it later. This doesn't sound right.

vsavchenko added inline comments.Apr 6 2021, 11:06 AM
clang/lib/Analysis/BodyFarm.cpp
757

It is actually intentional. To reuse that bit of code that used to be under if(!IVar) condition.

Set Prop and IVar at the same time

vsavchenko marked an inline comment as done.Apr 6 2021, 11:44 AM
NoQ accepted this revision.Apr 6 2021, 2:39 PM

Great, thanks!~

This revision is now accepted and ready to land.Apr 6 2021, 2:39 PM
This revision was automatically updated to reflect the committed changes.