[cfe-commits] r41801 - in /cfe/trunk: AST/Decl.cpp Parse/ParseObjc.cpp Sema/Sema.h Sema/SemaDecl.cpp include/clang/AST/Decl.h include/clang/Parse/Action.h include/clang/Parse/Parser.h

Steve Naroff snaroff at apple.com
Mon Sep 10 16:02:10 PDT 2007


On Sep 10, 2007, at 2:19 PM, Chris Lattner wrote:

>
> On Sep 10, 2007, at 1:47 PM, Devang Patel wrote:
>
>>
>> On Sep 10, 2007, at 1:33 PM, Fariborz Jahanian wrote:
>>
>>> +  /// Insert collected methods declarations into the @interface
>>> object.
>>> +  Actions.ObjcAddMethodsToClass(interfaceDecl, &allMethods[0],
>>> allMethods.size());
>> ...
>>> +void Sema::ObjcAddMethodsToClass(DeclTy *ClassDecl,
>>> +				 DeclTy **allMethods, unsigned allNum) {
>>
>> Is there a reason to not pass SmallVector reference directly ?
>
> Passing it like this allows the implementation in the client to not
> use a smallvector: it could use a vector or a C array if it chose to.
>

Isn't ownership the key API issue here?

That is, even if we passed in the SmallVector, it is typically a  
short-lived stack object. This means the Action hook would still need  
extract all the elements from the SmallVector (which is what passing  
the <DeclTy **, unsigned> tuple is doing.

It seems like handing the SmallVector directly to the actions method  
is more error prone (not simply an issue of choice).

snaroff

> -Chris
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list