@@ -21,43 +21,52 @@ void unwindsett::parse_unwind(const std::string &unwind)
2121 global_limit = unsafe_string2unsigned (unwind);
2222}
2323
24- void unwindsett::parse_unwindset ( const std::string &unwindset )
24+ void unwindsett::parse_unwindset_one_loop ( std::string val )
2525{
26- std::vector<std::string> unwindset_loops =
27- split_string (unwindset, ' , ' , true , true ) ;
26+ unsigned thread_nr = 0 ;
27+ bool thread_nr_set = false ;
2828
29- for ( auto & val : unwindset_loops )
29+ if (!val. empty () && isdigit ( val[ 0 ]) && val. find ( " : " ) != std::string::npos )
3030 {
31- unsigned thread_nr = 0 ;
32- bool thread_nr_set = false ;
33-
34- if (!val.empty () && isdigit (val[0 ]) && val.find (" :" ) != std::string::npos)
35- {
36- std::string nr = val.substr (0 , val.find (" :" ));
37- thread_nr = unsafe_string2unsigned (nr);
38- thread_nr_set = true ;
39- val.erase (0 , nr.size () + 1 );
40- }
41-
42- if (val.rfind (" :" ) != std::string::npos)
43- {
44- std::string id = val.substr (0 , val.rfind (" :" ));
45- std::string uw_string = val.substr (val.rfind (" :" ) + 1 );
46-
47- // the below initialisation makes g++-5 happy
48- optionalt<unsigned > uw (0 );
49-
50- if (uw_string.empty ())
51- uw = { };
52- else
53- uw = unsafe_string2unsigned (uw_string);
54-
55- if (thread_nr_set)
56- thread_loop_map[std::pair<irep_idt, unsigned >(id, thread_nr)] = uw;
57- else
58- loop_map[id] = uw;
59- }
31+ std::string nr = val.substr (0 , val.find (" :" ));
32+ thread_nr = unsafe_string2unsigned (nr);
33+ thread_nr_set = true ;
34+ val.erase (0 , nr.size () + 1 );
6035 }
36+
37+ if (val.rfind (" :" ) != std::string::npos)
38+ {
39+ std::string id = val.substr (0 , val.rfind (" :" ));
40+ std::string uw_string = val.substr (val.rfind (" :" ) + 1 );
41+
42+ // the below initialisation makes g++-5 happy
43+ optionalt<unsigned > uw (0 );
44+
45+ if (uw_string.empty ())
46+ uw = {};
47+ else
48+ uw = unsafe_string2unsigned (uw_string);
49+
50+ if (thread_nr_set)
51+ thread_loop_map[std::pair<irep_idt, unsigned >(id, thread_nr)] = uw;
52+ else
53+ loop_map[id] = uw;
54+ }
55+ }
56+
57+ void unwindsett::parse_unwindset (const std::string &unwindset)
58+ {
59+ std::vector<std::string> unwindset_elements =
60+ split_string (unwindset, ' ,' , true , true );
61+
62+ for (auto &element : unwindset_elements)
63+ parse_unwindset_one_loop (element);
64+ }
65+
66+ void unwindsett::parse_unwindset (const std::list<std::string> &unwindset)
67+ {
68+ for (auto &element : unwindset)
69+ parse_unwindset (element);
6170}
6271
6372optionalt<unsigned >
0 commit comments