32 lines
1013 B
C++
32 lines
1013 B
C++
//
|
|
// Created by erki on 16.02.21.
|
|
//
|
|
|
|
#ifndef LLVM_PROTO_OPERATIONFINDER_HPP
|
|
#define LLVM_PROTO_OPERATIONFINDER_HPP
|
|
|
|
#include <clang/ASTMatchers/ASTMatchers.h>
|
|
#include <clang/ASTMatchers/ASTMatchFinder.h>
|
|
|
|
#include "OperationStorage.hpp"
|
|
|
|
class OperationFinder : public clang::ast_matchers::MatchFinder::MatchCallback
|
|
{
|
|
public:
|
|
OperationFinder(const std::string& output_dir);
|
|
|
|
void addMatcher(clang::ast_matchers::MatchFinder& finder);
|
|
|
|
void run(const clang::ast_matchers::MatchFinder::MatchResult& result) override;
|
|
private:
|
|
void _processAssignment(const clang::ast_matchers::MatchFinder::MatchResult& result);
|
|
void _processArithmetic(const clang::ast_matchers::MatchFinder::MatchResult& result);
|
|
void _processUnaryArithmetic(const clang::ast_matchers::MatchFinder::MatchResult& result);
|
|
|
|
void _processExpressionTypes(OperationStorage::Log& log, const clang::Expr* source, const clang::Expr* op1, const clang::Expr* op2);
|
|
|
|
OperationStorage _storage;
|
|
};
|
|
|
|
#endif //LLVM_PROTO_OPERATIONFINDER_HPP
|