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
clang.diff
Description: Binary data
_______________________________________________ cfe-dev mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
