In a class method, 'self' points to the class object, so it should be safe to pass it to objc_alloc. Also, convert '[[self alloc] init]' in a class method to 'objc_alloc_init(self)'.
rdar://problem/50855121
Paths
| Differential D62643
[CodeGen][ObjC] Convert '[self alloc]' in a class method to 'objc_alloc(self)' ClosedPublic Authored by ahatanak on May 29 2019, 9:36 PM.
Details Summary In a class method, 'self' points to the class object, so it should be safe to pass it to objc_alloc. Also, convert '[[self alloc] init]' in a class method to 'objc_alloc_init(self)'. rdar://problem/50855121
Diff Detail
Event Timeline
ahatanak marked an inline comment as done. Comment ActionsJust set isClassMessage instead of passing a separate flag to tryGenerateSpecializedMessageSend. This revision is now accepted and ready to land.Jun 3 2019, 5:09 PM Closed by commit rL362521: [CodeGen][ObjC] Convert '[self alloc]' in a class method to a call to (authored by ahatanak). · Explain WhyJun 4 2019, 9:28 AM This revision was automatically updated to reflect the committed changes. ahatanak marked 2 inline comments as done.
Revision Contents
Diff 202959 cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/test/CodeGenObjC/convert-messages-to-runtime-calls.m
cfe/trunk/test/CodeGenObjC/objc-alloc-init.m
|