Adding to AST

Dear all:

I am new to the clang. I am trying to parse the following expression:

int foo() unsw { }

I am able to catch the variable “unsw” in the parse::ParseDeclGroup(). After consuming the token “unsw” using ConsumeToken(), I need to add it in the AST. My understanding is that I have to add some action in the Sema, most probably in the SemaDecl.cpp. Am I in the right direction? Any hint for me to put me in the right direction.

Thanks

Agha

Yes, you're going in the right direction. You'll probably want to add a flag into the DeclSpec chunk for functions, to indicate that you parsed "unsw" (and perhaps it's source location). Then, when Sema analyzes the DeclSpec (for example, in Sema::ActOnFunctionDeclarator), it can act on the presence of "unsw".

  - Doug