[cfe-dev] get live variables in a refactoring tool

Manuel Klimek klimek at google.com
Mon May 4 03:35:15 PDT 2015


Heya, I think you're the first one to try this out - I've had it on my TODO
list for a long time, but it's never made it to the top.

On Mon, May 4, 2015 at 12:33 PM Pei-Shiang Hung <pshung807 at gmail.com> wrote:

> Dears,
>
> I'm writing a refactoring tool with clang libtooling.
>
> What I need is to rewrite source code according to live variable
> information. For example, for each basic block in a function, dump its
> live-out variables.
>
> I know it would be quite easily if I'm writing an analysis checker.
>
> void checkASTCodeBody(const Decl *D, AnalysisManager& mgr,
>                     BugReporter &BR) const {
> if (LiveVariables* L = mgr.getAnalysis<LiveVariables>(D)) {
>   L->dumpBlockLiveness(mgr.getSourceManager());
> }
> }
>
> simplely call mgr.getAnalysis(D) to get LiveVariables of this
> function. then, dump each block.
>
> But, I'm writing a standalone refactoring tool. How can I construct an
> AnalysisManager object?
> Are there any reference?
>
> Thank a lot.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150504/e2831884/attachment.html>


More information about the cfe-dev mailing list