I'm currently trying to build a clang tool that extracts a Stmt into a new function. For this I need a
way to get all variables that are read from/written to but not declared inside the statement. These
variables would then become the functions arguments/return value.
llvm::CodeExtractor seems to do this on a lower level. Is there a clang equivalent that works on the
clang AST so it can be used for source-to-source transformation? I could just manually traverse the
AST and check for any reads/writes to variables not declared in the statement, but I got the feeling
that I would probably overlook lots of legitimate cases.
Thanks in advance!