[cfe-dev] Need Help Printing Preprocessed Code and Modifying CFG
Kevin Boos
kevinaboos at gmail.com
Tue Jul 2 15:53:15 PDT 2013
Hello all,
I'm working with a Clang plugin (it must be a plugin for kernel compilation
reasons) that analyzes drivers in the Linux kernel for virtualization
security purposes.
I start by modifying the body of a function in a way that certain
statements are deleted. Then I need to print out that modified source code
so that it can be compiled and preferably human-readable. However, I want
to expand all macros so that there are minimal external symbols in the
generated code. I tried using the Rewriter class for this, but the Rewriter
apparently prints out original source code only and cannot expand macros...
*is there an alternative source printer that can print the preprocessed
code? *
For reference, when calling "printPretty()" on the function's body Stmt*,
the macros are expanded just like I want.
My second question is about actually deleting those certain statement nodes
in a CFG. I remember reading somewhere in the Clang docs that the CFG is a
constant data structure that can't be modified.* Is there a way to delete
statements from the underlying AST so that they wouldn't appear in the CFG
and also not appear in the re-printed source code? * To be clear, I'm using
the CFG for other analysis reasons, but I don't really care if the Stmt
nodes are deleted from the AST directly or from inside a CFG basic block.
Thanks in advance,
Kevin Boos
Rice University Ph.D. Candidate
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130702/62f33a01/attachment.html>
More information about the cfe-dev
mailing list