[cfe-dev] Unneeded declarations invalidation

Douglas Gregor dgregor at apple.com
Tue Jul 21 15:32:28 PDT 2009

On Jul 21, 2009, at 3:08 PM, Abramo Bagnara wrote:

> Daniel Dunbar ha scritto:
>> On Tue, Jul 21, 2009 at 9:28 AM, Douglas Gregor<dgregor at apple.com>  
>> wrote:
>>> On Jul 21, 2009, at 7:58 AM, Abramo Bagnara wrote:
>>>> Douglas Gregor ha scritto:
>>>> The problem we have is to avoid that AST is missing some parts of  
>>>> what
>>>> GCC is able to compile. Do you think it will be feasible in some  
>>>> way?
>>>> Do you have some hints for a patch that you would be willing to  
>>>> accept
>>>> to accomplish that?
>>> I'm not sure how to proceed. Unfortunately, this is one of two GNU C
>>> extensions I can think of that Clang will *not* support (the other  
>>> is
>>> nested functions), and I can't see any way to work around this
>>> limitation. Not having to worry about variable-length structures
>>> simplifies semantic analysis and other clients (CodeGen being the  
>>> big
>>> one).
>> How hard would it be for us to actually support this extension in  
>> Sema?
>> I haven't looked or thought about it, but it doesn't seem all that
>> different from the things we already do for variable length arrays.
>> If Sema support is do-able and not too horrible, then we could  
>> provide
>> the feature but disable it when using a compiler. This would at least
>> allow clients other than the compiler to parse, analyze, etc. the
>> code.
> This is exactly what I hope and it's perfect for our needs. Although
> CodeGen will not support this extension, to have a complete AST is  
> very
> important for other kind of clients.

I can live with this, so long as we don't mangle Sema or the ASTs in  
the process. I guess we'd model this as a language flag in  
LangOptions, and doing anything that involves code generation would  
turn off this flag.

	- Doug

More information about the cfe-dev mailing list