ROSE  0.9.10.47
BinaryAstHash.h
1 #ifndef ROSE_BinaryAnalysis_AstHash_H
2 #define ROSE_BinaryAnalysis_AstHash_H
3 
4 #include <MemoryMap.h>
5 #include "Combinatorics.h"
6 
7 namespace Rose {
8 namespace BinaryAnalysis {
9 
29  {
30  public:
31  // @brief Constructor just initializes output buffer
32  AstHash(Rose::Combinatorics::Hasher& in_hasher, bool includeConstants = false, bool includeAddresses = false) :
33  hasher_(in_hasher), includeConstants(includeConstants), includeAddresses(includeAddresses){}
34 
35  // @brief Generates the hash. Called by traverse
36  void visit(SgNode* n);
37 
38  // @brief Gets the Rose::Combinatorics::Hasher
39  const Rose::Combinatorics::Hasher& hasher() const { return hasher_; };
40 
41  private:
42  // @brief The reference used to the output data buffer,
43  // get the opcodes
45 
46  // @brief Include constant values in the hash, usually
47  // false to avoid linking changing pointers, and therefore
48  // the signature
49  bool includeConstants;
50 
51  // @brief Include instruction addresses in the hash, usually
52  // false to avoid different memory map changing the signature
53  bool includeAddresses;
54 
55  };
56 
57 } // namespace
58 } // namespace
59 
60 #endif
Class for traversing the AST.
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.
Definition: Cxx_Grammar.h:8672
A simple traversal that builds up a hash code for the AST.
Definition: BinaryAstHash.h:28