[cfe-dev] ParamDecls missing from function DeclContext

Douglas Gregor dgregor at apple.com
Tue May 15 07:36:10 PDT 2012


On May 15, 2012, at 12:40 AM, Abramo Bagnara wrote:

> Il 15/05/2012 05:52, Douglas Gregor ha scritto:
>> 
>> On May 14, 2012, at 8:34 AM, Abramo Bagnara wrote:
>> 
>>> 
>>> I've just verified that:
>>> 
>>> 1) anonymous parameters are not added to its function definition DeclContext
>>> 
>>> 2) parameters are not added to its function declaration DeclContext
>>> 
>>> Are both 1 and 2 deliberate choices?
>> 
>> No, I don't think they are deliberate choices.
> 
> Ok, we'll provide a fix for this.

Thanks!

> Another much related issue is shown by the following:
> 
> void sort(int (*compare)(int x, int y), int* x);
> 
> Which should be the correct context of ParmVarDecl's inside FunctionType
> (i.e. int x and int y)?


The DeclContext notion breaks down a little bit here, because we don't create a context for FunctionTypes (and shouldn't). I'd rather that the inner ParmVarDecls be in the 'sort's FunctionDecl.

	- Doug



More information about the cfe-dev mailing list