[cfe-dev] Delete a parameter of a FunctionDecl

Eli Friedman eli.friedman at gmail.com
Mon Jul 29 10:56:07 PDT 2013


On Sat, Jul 27, 2013 at 6:07 AM, lostknight <thanhtuan at aces.snu.ac.kr> wrote:
> I'm trying to write a simple source to source translator. At some point of
> time, I visit a function and translate it into another language, but this
> language does not support some parameter. For now I tell the
> printer(DeclPrinter) not to print it, and in some case, where an parameter
> needs to be replaced by another, I also use printer to print the proper
> string. But I guess there must be a way alternate the AST directly.

Generally, the way we suggest performing source-to-source translation
is using the rewriter: instead of modifying the AST, just write out
the changes you want directly to the output file.  The AST is not
designed to be modified in the way you are attempting.

-Eli



More information about the cfe-dev mailing list