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