simplify postfixincrementfix plugin using parentStmt()

Change-Id: I93fa422afe7f3e1e10576dd64af9d57b2302f44e
This commit is contained in:
Luboš Luňák
2013-06-20 00:31:37 +02:00
parent ade47d3d67
commit 81b58bb075
2 changed files with 27 additions and 67 deletions

View File

@@ -23,14 +23,11 @@ class PostfixIncrementFix
public:
explicit PostfixIncrementFix( CompilerInstance& compiler, Rewriter& rewriter );
virtual void run() override;
bool VisitFunctionDecl( const FunctionDecl* declaration );
bool VisitCXXOperatorCallExpr( const CXXOperatorCallExpr* op );
private:
typedef std::vector< const Stmt* > StmtParents;
void fixPostfixOperator( const CXXOperatorCallExpr* op, StmtParents& parents );
void fixPostfixOperators( const Stmt* stmt, StmtParents& parents );
bool canChangePostfixToPrefix( const CXXOperatorCallExpr* op, StmtParents& parents, int parent_pos );
bool canChangeInConditionStatement( const CXXOperatorCallExpr* op, const Expr* condition,
const StmtParents& parents, unsigned int parent_pos );
void fixPostfixOperator( const CXXOperatorCallExpr* op );
void fixPostfixOperators( const Stmt* stmt );
bool canChangePostfixToPrefix( const Stmt* stmt, const CXXOperatorCallExpr* op );
bool shouldDoChange( const Expr* op );
};