[cfe-dev] How to correlate macro expansions with AST nodes?

Richard via cfe-dev cfe-dev at lists.llvm.org
Sat Jan 8 16:37:20 PST 2022


#
Hi Team,

If I'm writing a clang-tidy check that focuses on replacing macros
with a more suitable modern construct, it's easy to analyze the macro
definitions by using the PP callbacks.  From the callbacks I can also
monitor the macro expansions, but the callback only gives me a
SourceRange for the expansion.

Is there a way I can correlate the SourceRange to the appropriate
nodes in the AST for further analysis?

Thanks,
-- Richard

-- 
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
             The Terminals Wiki <http://terminals-wiki.org>
     The Computer Graphics Museum <http://ComputerGraphicsMuseum.org>
  Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com>


More information about the cfe-dev mailing list