Skip to content

Commit 5150eca

Browse files
smowtonpeterschrammel
authored andcommitted
Add parameter-indices to util Makefile
1 parent 998cc63 commit 5150eca

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

src/util/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ SRC = arith_tools.cpp base_type.cpp cmdline.cpp config.cpp symbol_table.cpp \
2222
irep_ids.cpp byte_operators.cpp string2int.cpp file_util.cpp \
2323
memory_info.cpp pipe_stream.cpp irep_hash.cpp endianness_map.cpp \
2424
ssa_expr.cpp json_irep.cpp json_expr.cpp \
25-
string_utils.cpp
25+
string_utils.cpp parameter_indices.cpp
2626

2727
INCLUDES= -I ..
2828

src/util/parameter_indices.cpp

+24-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
1+
/*******************************************************************\
2+
3+
Module: Parameter indexing
4+
5+
Author: Chris Smowton, [email protected]
6+
7+
\*******************************************************************/
18

29
#include "parameter_indices.h"
310

4-
std::map<irep_idt,std::size_t> get_parameter_indices(const code_typet& fn_type)
11+
/*******************************************************************\
12+
13+
Function: get_parameter_indices
14+
15+
Inputs: Code type
16+
17+
Outputs: Map from parameter name to position
18+
19+
Purpose: Make a map useful for mapping from symbol expressions to
20+
actual or formal parameter indices.
21+
22+
\*******************************************************************/
23+
24+
std::map<irep_idt, std::size_t> get_parameter_indices(const code_typet &fn_type)
525
{
6-
std::map<irep_idt,std::size_t> parameter_indices;
7-
for (std::size_t i = 0UL; i != fn_type.parameters().size(); ++i)
8-
parameter_indices.insert({fn_type.parameters().at(i).get_identifier(),i});
26+
std::map<irep_idt, std::size_t> parameter_indices;
27+
for(std::size_t i=0; i!=fn_type.parameters().size(); ++i)
28+
parameter_indices.insert({fn_type.parameters().at(i).get_identifier(), i});
929
return parameter_indices;
1030
}

src/util/parameter_indices.h

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
#ifndef PARAMETER_INDICES_H
2-
#define PARAMETER_INDICES_H
1+
/*******************************************************************\
2+
3+
Module: Parameter indexing
4+
5+
Author: Chris Smowton, [email protected]
6+
7+
\*******************************************************************/
8+
9+
#ifndef CPROVER_UTIL_PARAMETER_INDICES_H
10+
#define CPROVER_UTIL_PARAMETER_INDICES_H
311

412
#include <unordered_map>
513
#include "std_types.h"
614

7-
std::map<irep_idt,std::size_t> get_parameter_indices(const code_typet& fn_type);
15+
std::map<irep_idt, std::size_t>
16+
get_parameter_indices(const code_typet &fn_type);
817

918
#endif

0 commit comments

Comments
 (0)