[cfe-commits] r42957 - in /cfe/trunk: Parse/ParseObjc.cpp Sema/ASTStreamer.cpp Sema/Sema.h Sema/SemaDecl.cpp include/clang/Parse/Action.h

Chris Lattner clattner at apple.com
Thu Oct 18 15:16:40 PDT 2007


On Oct 13, 2007, at 5:58 PM, Steve Naroff wrote:
> Author: snaroff
> Date: Sat Oct 13 19:58:41 2007
> New Revision: 42957
> - Added Sema::AddFactoryMethodToGlobalPool and  
> Sema::AddInstanceMethodToGlobalPool and DenseMaps. This will allow  
> us to efficiently lookup a method from a selector given no type  
> information (for the "id" data type).

Hi Steve,

> ====================================================================== 
> ========
> --- cfe/trunk/Parse/ParseObjc.cpp (original)
> +++ cfe/trunk/Parse/ParseObjc.cpp Sat Oct 13 19:58:41 2007
> @@ -266,9 +266,10 @@
>        ParseDeclarationOrFunctionDefinition();
>      }
>    }
> +  if (allMethods.size())
> +    /// Insert collected methods declarations into the @interface  
> object.
> +    Actions.ActOnAddMethodsToObjcDecl(CurScope, interfaceDecl,
> +                                      &allMethods[0],  
> allMethods.size());
>  }

Minor nit-pick: Please use '!container.empty()' instead of  
'container.size()' to check to see if it's empty.  It doesn't matter  
at all in this case, but size() is linear time for some containers  
and empty is always constant time.  It's just a good habit to be in :)

-Chris



More information about the cfe-commits mailing list