[cfe-dev] Revising the function prototype

Douglas Gregor dgregor at apple.com
Wed May 18 09:04:05 PDT 2011


On May 18, 2011, at 6:36 AM, Zheng Wang wrote:

> Hi,
> 
> I want to revise the prototype of a FunctionDecl object. Is there any example in Clang that I can have a look?

No. Clang avoids mutating its ASTs in this way, since doing so is likely to break invariants in the AST.

> For example,
> 
> the original prototype of a FunctionDecl object is:
> 
> (int, int, double*) 
> 
> and I want to change it to:
> 
> (int, int, long, long, double*)
> 
> 
> I have managed to change the parameters of the FunctionDecl and I am not sure how to revise the prototype.

You would have to update both the function's type and the TypeSourceInfo that describes the type as it was written in the source.

	- Doug




More information about the cfe-dev mailing list