[cfe-dev] Objective-C: methods, ivars, and cleanup
David Chisnall
csdavec at swansea.ac.uk
Thu Mar 27 06:46:44 PDT 2008
One more try...
On 26 Mar 2008, at 18:29, Chris Lattner wrote:
> @@ -341,6 +345,17 @@
> return LValue::MakeAddr(CGM.GetAddrOfGlobalVar(VD, false));
> else {
> llvm::Value *V = LocalDeclMap[D];
> + // Check if it's an implicit argument
> + // TODO: Other runtimes may set non-argument hidden variables
> + if (!V) {
> + std::string VarName(D->getName());
> + llvm::Function::arg_iterator AI = CurFn->arg_begin();
> + do {
> + if(VarName == AI->getName()) {
> + return LValue::MakeAddr(AI);
> + }
> + } while(++AI);
> + }
> assert(V && "BlockVarDecl not entered in LocalDeclMap?");
>
> This is incredibly inefficient, what are you trying to accomplish
> here?
I have now fixed this (I hope) by adding the self decl from the method
to the local decls map. That gets rid if this hack for accessing
instance variables on self. It does not work for _cmd (or _call in
the Étoilé runtime). I suggest the best way of doing this is to have
a companion class for CGObjCRuntime in Sema which provides the decls
for the runtime in use at the time (pulling the code out of
ObjCActOnStartOfMethodDef). If you agree that's a sensible approach,
then I'll add this in the next patch.
I've also removed the three methods in CGObjCGNU that are not yet used.
David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang.diff
Type: application/octet-stream
Size: 39295 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080327/6c2d9bb9/attachment.obj>
More information about the cfe-dev
mailing list