Diagnosing alternative operator spellings & digraphs from a plugin

I’m interested in writing a plugin to disallow alternative spelling/digraphs for operators and tokens. However I haven’t been able to find a way to access this information from a PluginASTAction.

I see that the digraphs (<: %: etc.) are handled in Lexer.cpp, but perhaps the only way to get the original spelling is Lexer::getSpelling(). Would I be able to get access to the Lexer, SourceLocation, SourceManager, etc. from a PluginASTAction in order to call this?

I also found the CXX_KEYWORD_OPERATORs in TokenKinds.def, but it looks like these get mapped to the same token kinds as the regular operator spellings so I’m not sure how to distinguish them after the AST is built.

Any recommendations would be appreciated, thanks!
Jacob

You don’t need a plugin for the alternate spellings, just use –fno-operator-names. If you really need to detect them, find the IdentiferInfo object, and check isCPlusPlusOperatorKeyword.

I don’t see anything Digraph specific however…