[PATCH] D37005: Add include/clang/Tooling/ASTDiff/ASTPatch.h

2017-08-25 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment. I don't think AST manipulation is the right way to do patching. You've already hit the limitations here in this patch where you can't really remove a statement unless its parent is a `CompoundStmt`. I think the right way to do AST patching is to take a 3rd AST(lets cal

[PATCH] D37005: Add include/clang/Tooling/ASTDiff/ASTPatch.h

2017-08-22 Thread Johannes Altmanninger via Phabricator via cfe-commits
johannes created this revision. Herald added subscribers: mgorny, klimek. This adds a functions to remove AST nodes. It works for Decl, and for Stmt nodes that are children of a CompoundStmt. Sometimes it is not possible to remove a Decl from its context despite DeclContext.containsDecl() returni