ROSE 0.11.145.63
AstHash.h
1#ifndef ROSE_BinaryAnalysis_AstHash_H
2#define ROSE_BinaryAnalysis_AstHash_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5
6#include <Rose/BinaryAnalysis/MemoryMap.h>
7#include <Rose/BinaryAnalysis/Partitioner2/BasicBlock.h>
8#include "Combinatorics.h"
9
10namespace Rose {
11namespace BinaryAnalysis {
12
32 {
33 public:
34 // @brief Constructor just initializes output buffer
35 AstHash(boost::shared_ptr<Rose::Combinatorics::Hasher> in_hasher, bool includeConstants = false, bool includeAddresses = false) :
36 hasher_(in_hasher), includeConstants(includeConstants), includeAddresses(includeAddresses){}
37
38 // @brief Generates the hash. Called by traverse
39 void visit(SgNode* n);
40
41 // @brief For the Partitioner Interface, traverses a basic block
43
44 // @brief Gets the Rose::Combinatorics::Hasher
45 const boost::shared_ptr<Rose::Combinatorics::Hasher> hasher() const { return hasher_; };
46
47 private:
48 // @brief The reference used to the output data buffer,
49 // get the opcodes
50 boost::shared_ptr<Rose::Combinatorics::Hasher> hasher_;
51
52 // @brief Include constant values in the hash, usually
53 // false to avoid linking changing pointers, and therefore
54 // the signature
55 bool includeConstants;
56
57 // @brief Include instruction addresses in the hash, usually
58 // false to avoid different memory map changing the signature
59 bool includeAddresses;
60
61 };
62
63} // namespace
64} // namespace
65
66#endif
67#endif
Class for traversing the AST.
A simple traversal that builds up a hash code for the AST.
Definition AstHash.h:32
void visit(SgNode *n)
this method is called at every traversed node.
This class represents the base class for all IR nodes within Sage III.
The ROSE library.