[cfe-dev] [clang] Extracting code into new function?

Reid Kleckner via cfe-dev cfe-dev at lists.llvm.org
Wed Jun 15 11:11:27 PDT 2016


Look at OpenMP and CapturedStmt:
http://clang.llvm.org/doxygen/classclang_1_1CapturedStmt.html#details

On Thu, Jun 9, 2016 at 2:13 AM, David Kretzmer via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi,
>
> 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!
> David
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160615/089ba850/attachment.html>


More information about the cfe-dev mailing list