[cfe-dev] How to add a token stream filter to clang

chenrui@sunwiseinfo.com via cfe-dev cfe-dev at lists.llvm.org
Tue Apr 19 22:49:56 PDT 2016


Hi,
I want the front end to ignore some dialect token, like the following example: 

// interrupt and using is dialect extension syntax
void cint() interrupt 1 using 2
{
 ...
}

Firstly, I will extend the TokenKind.def to make 'interrupt' and 'using' be the keyword;
After the preprocessor and lexer make the code to token stream, I want to do something to filter the dialect-related tokens so that the token stream passed to the parser is clang-compatible. I don't need to extend the AST. Ignoring the dialect extensions is fine to me.

So my question is , which part should I modify or extend to implement the above functionality?

Thanks,

Chen Rui

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160420/b33d3c27/attachment.html>


More information about the cfe-dev mailing list