retdec
get_name_of_param.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_LLVMIR2HLL_SEMANTICS_SEMANTICS_IMPL_SUPPORT_GET_NAME_OF_PARAM_H
8 #define RETDEC_LLVMIR2HLL_SEMANTICS_SEMANTICS_IMPL_SUPPORT_GET_NAME_OF_PARAM_H
9 
10 #include <cstddef>
11 #include <optional>
12 #include <string>
13 #include <unordered_map>
14 
18 #define ADD_PARAM_NAME(funcName, paramPos, paramName) \
19  funcParamNamesMap[FuncParamPosPair(funcName, paramPos)] = paramName;
20 
21 namespace retdec {
22 namespace llvmir2hll {
23 namespace semantics {
24 
26 using FuncParamPosPair = std::pair<std::string, unsigned>;
27 
32  std::size_t operator()(const FuncParamPosPair &p) const {
33  return std::hash<std::string>()(p.first) + p.second;
34  }
35 };
36 
39 using FuncParamNamesMap = std::unordered_map<FuncParamPosPair, std::string,
41 
42 std::optional<std::string> getNameOfParamFromMap(const std::string &funcName,
43  unsigned paramPos, const FuncParamNamesMap &map);
44 
45 } // namespace semantics
46 } // namespace llvmir2hll
47 } // namespace retdec
48 
49 #endif
A library providing API for working with back-end IR.
std::unordered_map< FuncParamPosPair, std::string, FuncParamPosPairHasher > FuncParamNamesMap
Definition: get_name_of_param.h:40
std::optional< std::string > getNameOfParamFromMap(const std::string &funcName, unsigned paramPos, const FuncParamNamesMap &map)
Returns the name of the given parameter from the given map.
Definition: get_name_of_param.cpp:16
std::pair< std::string, unsigned > FuncParamPosPair
A pair of function name and parameter position.
Definition: get_name_of_param.h:26
Definition: archive_wrapper.h:19
A hashing functor for FuncParamPosPair.
Definition: get_name_of_param.h:31
std::size_t operator()(const FuncParamPosPair &p) const
Definition: get_name_of_param.h:32