ROSE  0.11.98.0
FunctionInfo.h
1 #ifndef FUNCTION_INFO_H
2 #define FUNCTION_INFO_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_LIBRARY_IDENTIFICATION
5 
6 #include <Rose/BinaryAnalysis/Partitioner2/Partitioner.h>
7 #include <Rose/BinaryAnalysis/Partitioner2/Function.h>
8 
9 // Deprecated [Robb Matzke 2022-01-20]
10 namespace LibraryIdentification {
11 
12 // Deprecated [Robb Matzke 2022-01-20]
13 // Information about a function.
14 //
15 // Combines all the information to uniquely identify a single function in one object.
16 //
17 class FunctionInfo {
18 public:
19  // Constructor.
20  //
21  // Combines all the information required to identify a function. This constructor constructs the hash from the
22  // SgAsmFunction node. Note that currently on FNV hasher is used. This should be an option.
23  //
24  // @param[in] partitioner Required to get the basic blocks of the function
25  // @param[in] function Binary AST Function Node
26  FunctionInfo(const Rose::BinaryAnalysis::Partitioner2::Partitioner& partitioner,
28  : funcName(function->name()), binaryFunction(function) {}
29 
30  // True if the first hash is less than the second hash.
31  friend bool operator<(const FunctionInfo& lhs, const FunctionInfo& rhs) {
32  return lhs.funcHash < rhs.funcHash;
33  }
34 
35  // True if the name, function hash, and library hash are equal.
36  bool operator==(const FunctionInfo& rhs) {
37  return funcName == rhs.funcName && funcHash == rhs.funcHash && libHash == rhs.libHash;
38  }
39 
40  // The name of the function.
41  std::string funcName;
42 
43  // A hash that should uniquely identify the function.
44  std::string funcHash;
45 
46  // Hash uniquely identifying the library to which the function belongs.
47  std::string libHash;
48 
49  // Optional pointer to the function definition.
50  //
51  // Null if the function definition is not available. */
53 };
54 
55 } // namespace
56 
57 #endif
58 #endif
Partitions instructions into basic blocks and functions.
Definition: Partitioner.h:294