// // Created by erki on 02.03.21. // #include "OperationFinderAstVisitor.hpp" #include "OperationFinder.hpp" OperationFinderAstVisitor::OperationFinderAstVisitor(OperationFinder* op_finder) : _context(nullptr) , _op_finder(op_finder) { } void OperationFinderAstVisitor::NewContext(clang::ASTContext* context) { _context = context; } bool OperationFinderAstVisitor::VisitForStmt(clang::ForStmt* stmt) { assert(_context); return true; } bool OperationFinderAstVisitor::VisitBinaryOperator(clang::BinaryOperator* op) { assert(_context); if (!op->isCompoundAssignmentOp()) { _op_finder->processArithmetic(op, _context->getSourceManager()); } return true; } bool OperationFinderAstVisitor::VisitUnaryOperator(clang::UnaryOperator* op) { assert(_context); _op_finder->processUnaryArithmetic(op, _context->getSourceManager()); return true; } bool OperationFinderAstVisitor::dataTraverseStmtPre(clang::Stmt* stmt) { assert(_context); return true; } bool OperationFinderAstVisitor::dataTraverseStmtPost(clang::Stmt* stmt) { assert(_context); return true; }