36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
//
|
|
// Created by erki on 16.02.21.
|
|
//
|
|
|
|
#ifndef LLVM_PROTO_OPERATIONFINDER_HPP
|
|
#define LLVM_PROTO_OPERATIONFINDER_HPP
|
|
|
|
#include <clang/ASTMatchers/ASTMatchFinder.h>
|
|
|
|
#include "OperationLog.hpp"
|
|
|
|
class OperationFinder
|
|
{
|
|
public:
|
|
explicit OperationFinder(IOperationOutput* storage);
|
|
|
|
void processArithmetic(const clang::BinaryOperator* op, const clang::SourceManager& source_manager);
|
|
void processUnaryArithmetic(const clang::UnaryOperator* op, const clang::SourceManager& source_manager);
|
|
void processFunctionCall(const clang::CallExpr* call, const clang::SourceManager& source_manager);
|
|
void processArraySubscript(const clang::ArraySubscriptExpr* subscript, const clang::SourceManager& source_manager);
|
|
|
|
void branchEntered();
|
|
void branchExited();
|
|
|
|
private:
|
|
std::unique_ptr<OperationLog::BasicOperation>
|
|
_createBasicOperationLogEntry(const std::string& opcode, const clang::Expr* source, const clang::Expr* op1, const clang::Expr* op2);
|
|
|
|
std::pair<std::string, OperationLog> _createBaseOperationLog(const clang::Stmt* stmt, const clang::SourceManager& source_manager);
|
|
|
|
int _current_branch = 0;
|
|
IOperationOutput* _storage;
|
|
};
|
|
|
|
#endif //LLVM_PROTO_OPERATIONFINDER_HPP
|