building Code from clangAST

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

building Code from clangAST

saman parser
Hello All
I'm new in clang and llvm please help me.
I'm writing a c++ code obfuscator. I'm applying some data and control obfuscations.
So I know how to parse code and build AST tree.. but I don't know how to convert my modified AST tree to code again. can anyone write a sample code? clang is a jungle of code and it's hard to find a way by just reading codes. thanks in advanced..
Reply | Threaded
Open this post in threaded view
|

Re: building Code from clangAST

Gabor Kozar-2
Hi,

I'm not really clear on why would you need to obfuscate C++ code, but check out clang-format (http://clang.llvm.org/docs/ClangFormat.html), might help you with what you need.

As far as I know there is no direct way to write the AST back to C++ code, and so I think you'll need to make do with the Rewriter and/or tooling::Replacement classes. See the doxygen documentation for details.

Gabor


2013/5/21 saman parser <[hidden email]>
Hello All
I'm new in clang and llvm please help me.
I'm writing a c++ code obfuscator. I'm applying some data and control
obfuscations.
So I know how to parse code and build AST tree.. but I don't know how to
convert my modified AST tree to code again. can anyone write a sample code?
clang is a jungle of code and it's hard to find a way by just reading codes.
thanks in advanced..



--
View this message in context: http://clang-developers.42468.n3.nabble.com/building-Code-from-clangAST-tp4032234.html
Sent from the Clang Developers mailing list archive at Nabble.com.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev