[cfe-dev] Access specifiers and anonymous unions

Abramo Bagnara abramo.bagnara at gmail.com
Tue Jun 1 03:56:00 PDT 2010


Il 31/05/2010 20:42, John McCall ha scritto:
> 
> On May 31, 2010, at 7:21 AM, Abramo Bagnara wrote:
> 
>> Il 28/05/2010 19:53, John McCall ha scritto:
>>>>
>>>> To represent correctly the above we might decide to have a node for
>>>> access specifiers at the same level of other decls.
>>>
>>> Yes, I've been wanting something like this for some time.
>>
>> Would it be OK if we derive from Decl a new class modeling syntactic
>> access specifiers occurring in the list of member specifiers of a C++
>> class definition?
>>
>> What about the name AccessSpecDecl ?
> 
> Decl actually has a lot of space overhead, and if we put these in the decl chain
> we have to instantiate them, etc.  If we want to be really space-conserving, we
> could just add an array of little structs to CXXRecordDecl::DefinitionData.
> On the other hand, that would make them much more difficult to use;  I'm torn.
> 
>> Deriving from Decl already provides space for storing the access
>> specifier (cannot be AS_none) and the corresponding source location.
>> While at it, should we also provide a source location for the ':' ?
> 
> Probably not necessary.
> 
>> Am I right if I say that all code visiting CXXRecordDecl as a
>> declaration context will automatically ignore this new class (which is
>> actually a good thing)?
> 
> Well, if they were Decls, lookup would ignore them because they wouldn't
> be NamedDecls, but they'd still show up in the lexical decl chain.  That's
> probably fine.

I've attached the patch that introduces AccessSpecDecl for your approval.

Of course it passes all tests.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AccessSpec.patch
Type: text/x-patch
Size: 13377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100601/5392c152/attachment.bin>


More information about the cfe-dev mailing list