[cfe-dev] Determining if ObjCIvarDecl is in multi-declaration

Chris Lattner clattner at apple.com
Wed Apr 23 22:56:36 PDT 2008


On Apr 23, 2008, at 9:58 AM, Emerson Murphy-Hill wrote:

> On Apr 23, 2008, at 9:42 AM, Chris Lattner wrote:
>
>>
>> On Apr 23, 2008, at 9:22 AM, Emerson Murphy-Hill wrote:
>>
>>> Suppose I have an objective-c interface:
>>>
>>> @interface C {
>>>   int x,y;
>>> };
>>>
>>> I parse it, and have an ObjCIvarDecl for x.  How can I determine  
>>> that x is in a multi-declaration?  I could check which  
>>> ObjCIvarDecls' locations overlap, but is there an easier way?
>>>
>>
>> What else do you need to know?  What action would you take based on  
>> whether it was a multi declaration or not?
>>
>> Capturing this information is quite straight-forward, but it is  
>> good to have the whole picture in mind before doing something like  
>> this.
>>
>> -Chris
>
> I'm removing an instance variable.  In the current code, if it's a  
> multi-decl, I just give up, which is what spawned this question.   
> Ideally, I'd like to be able to remove an inst var from a multi-decl  
> as easily as from a single decl.
>

Okay, so you need more information, or some amount of fuzziness to do  
this.  Specifically, if you have:


int *X, ***Y[10];

Even if you know that X/Y are multi-declaration, you'll have to have  
some way of handling the *'s and the array suffix.  Because types are  
unique'd, they don't have location information.  Handling this sort of  
thing will require some amount of fuzzy editting: could fuzzy editting  
be used to scan for the comma also?

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080423/6012c7b4/attachment.html>


More information about the cfe-dev mailing list