[cfe-dev] Fast enumeration

David Chisnall csdavec at swansea.ac.uk
Tue Feb 3 13:16:48 PST 2009


Hi Everyone,

I've got this patch in my local branch for fast enumeration on the GNU  
runtime, and I've tested it with GNUstep.  The GNU Objective-C runtime  
doesn't provide this function, but other libraries do.  Since it is  
exactly the same as the Apple runtime implementation, I wonder if it  
would be better for CGObjC.cpp to just call this directly.  It's  
technically runtime-specific, but I doubt anyone is going to want to  
implement exactly the same function and give it a different name just  
to be different, and if they do then they can add this in their  
runtime and everyone's happy:

void (*objc_enumerationMutation)(id) = my_really_stupid_function_name;

David

===================================================================
--- lib/CodeGen/CGObjCGNU.cpp	(revision 63634)
+++ lib/CodeGen/CGObjCGNU.cpp	(working copy)
@@ -994,7 +989,8 @@
  }

  llvm::Function *CGObjCGNU::EnumerationMutationFunction() {
-  return 0;
+  return  
(llvm 
::Function*)TheModule.getOrInsertFunction("objc_enumerationMutation",
+    llvm::Type::VoidTy, IdTy, NULL);
  }

  void CGObjCGNU::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction  
&CGF,




More information about the cfe-dev mailing list