[PATCH] D57936: [CodeGenObjC] When available, emit a direct call to objc_alloc_init(cls) instead of [objc_alloc(cls) init]
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 7 19:11:38 PST 2019
rjmccall added inline comments.
Comment at: clang/lib/CodeGen/CGObjC.cpp:459
+ llvm::Value *Receiver =
+ CGF.CGM.getObjCRuntime().GetClass(CGF, ObjTy->getInterface());
+ return CGF.EmitObjCAllocInit(Receiver, CGF.ConvertType(OME->getType()));
You might need to check for a `super` message send, which can be a class message send in a class method.
Also, I think `getInterface()` can return null here, although it might need to be contrived to fit the other requirements. `Class<SomeProtocol>`, where that protocol declares `+alloc`? If there isn't a way to just emit the receiver pointer of a normal message send from an `ObjCMessageExpr`, that's really too bad.
CHANGES SINCE LAST ACTION
More information about the cfe-commits