update credits
[LibreOffice.git] / compilerplugins / clang / postfixincrementfix.hxx
blob29756cf690c628db73b730d65fdabfa530dc148c
1 /*
2 * This file is part of the LibreOffice project.
4 * Based on LLVM/Clang.
6 * This file is distributed under the University of Illinois Open Source
7 * License. See LICENSE.TXT for details.
9 */
11 #ifndef POSTFIXINCREMENTFIX_H
12 #define POSTFIXINCREMENTFIX_H
14 #include "plugin.hxx"
16 namespace loplugin
19 class PostfixIncrementFix
20 : public RecursiveASTVisitor< PostfixIncrementFix >
21 , public RewritePlugin
23 public:
24 explicit PostfixIncrementFix( CompilerInstance& compiler, Rewriter& rewriter );
25 virtual void run() override;
26 bool VisitFunctionDecl( const FunctionDecl* declaration );
27 private:
28 typedef std::vector< const Stmt* > StmtParents;
29 void fixPostfixOperator( const CXXOperatorCallExpr* op, StmtParents& parents );
30 void fixPostfixOperators( const Stmt* stmt, StmtParents& parents );
31 bool canChangePostfixToPrefix( const CXXOperatorCallExpr* op, StmtParents& parents, int parent_pos );
32 bool canChangeInConditionStatement( const CXXOperatorCallExpr* op, const Expr* condition,
33 const StmtParents& parents, unsigned int parent_pos );
34 bool shouldDoChange( const Expr* op );
37 } // namespace
39 #endif // POSTFIXINCREMENTFIX_H