2727
2828struct ActionElt ;
2929using Actions = std::vector<ActionElt>;
30+ decltype (AssociatedAction::NO_TUPLE_ELT) NO_TUPLE_ELT =
31+ AssociatedAction::NO_TUPLE_ELT;
3032
3133struct ActionElt {
3234 AssociatedAction::Action actionType;
@@ -40,7 +42,7 @@ struct ActionElt {
4042 ActionElt (AssociatedAction::Action actionType,
4143 const std::string& inId,
4244 const std::string& actedUponId,
43- int tupleEltIdx = - 1 ,
45+ int tupleEltIdx = NO_TUPLE_ELT ,
4446 const Actions& subActions = {})
4547 : actionType(actionType),
4648 inId (inId),
@@ -74,7 +76,7 @@ static void addAction(Context* context, Actions& actions, const AstNode* ast,
7476 actions.emplace_back (act->action (),
7577 idToStr (context, ast->id ()),
7678 idToStr (context, act->id ()),
77- act->hasTupleEltIdx () ? act->tupleEltIndex () : - 1 ,
79+ act->hasTupleEltIdx () ? act->tupleEltIndex () : NO_TUPLE_ELT ,
7880 subActions);
7981}
8082
@@ -202,7 +204,7 @@ static void testActions(const char* test,
202204 assert (M);
203205 assert (M->numStmts () >= 1 );
204206
205- const Function* func = M->stmt (M->numStmts ()- 1 )->toFunction ();
207+ const Function* func = M->stmt (M->numStmts () - 1 )->toFunction ();
206208 assert (func);
207209
208210 printf (" uAST:\n " );
@@ -2041,7 +2043,7 @@ static void test27a() {
20412043 {
20422044 {AssociatedAction::NEW_INIT, " M.test@2" , " " },
20432045 {AssociatedAction::MOVE_INIT, " r" , " " },
2044- {AssociatedAction::INIT_OTHER, " x" , " " , - 1 , {
2046+ {AssociatedAction::INIT_OTHER, " x" , " " , NO_TUPLE_ELT , {
20452047 {AssociatedAction::ASSIGN, " x" , " M.test@4" },
20462048 {AssociatedAction::COPY_INIT, " x" , " M.test@5" },
20472049 }},
@@ -2067,11 +2069,11 @@ static void test27b() {
20672069 {
20682070 {AssociatedAction::NEW_INIT, " M.test@2" , " " },
20692071 {AssociatedAction::MOVE_INIT, " r" , " " },
2070- {AssociatedAction::INIT_OTHER, " tup" , " " , - 1 , {
2072+ {AssociatedAction::INIT_OTHER, " tup" , " " , NO_TUPLE_ELT , {
20712073 {AssociatedAction::ASSIGN, " tup" , " M.test@4" },
20722074 {AssociatedAction::MOVE_INIT, " tup" , " M.test@5" },
20732075 }},
2074- {AssociatedAction::COPY_INIT, " x" , " " , - 1 , {
2076+ {AssociatedAction::COPY_INIT, " x" , " " , NO_TUPLE_ELT , {
20752077 {AssociatedAction::ASSIGN, " x" , " x" , 0 },
20762078 {AssociatedAction::COPY_INIT, " x" , " x" , 1 },
20772079 }},
@@ -2095,7 +2097,7 @@ static void test27c() {
20952097 {
20962098 {AssociatedAction::NEW_INIT, " M.test@2" , " " },
20972099 {AssociatedAction::MOVE_INIT, " r" , " " },
2098- {AssociatedAction::INIT_OTHER, " x" , " " , - 1 , {
2100+ {AssociatedAction::INIT_OTHER, " x" , " " , NO_TUPLE_ELT , {
20992101 {AssociatedAction::ASSIGN, " x" , " M.test@4" },
21002102 {AssociatedAction::MOVE_INIT, " x" , " M.test@5" },
21012103 }},
@@ -2121,11 +2123,11 @@ static void test28() {
21212123 {
21222124 {AssociatedAction::NEW_INIT, " M.test@2" , " " },
21232125 {AssociatedAction::MOVE_INIT, " r" , " " },
2124- {AssociatedAction::INIT_OTHER, " x" , " " , - 1 , {
2126+ {AssociatedAction::INIT_OTHER, " x" , " " , NO_TUPLE_ELT , {
21252127 {AssociatedAction::ASSIGN, " x" , " M.test@4" },
21262128 {AssociatedAction::MOVE_INIT, " x" , " M.test@5" },
21272129 }},
2128- {AssociatedAction::COPY_INIT, " y" , " " , - 1 , {
2130+ {AssociatedAction::COPY_INIT, " y" , " " , NO_TUPLE_ELT , {
21292131 {AssociatedAction::ASSIGN, " y" , " y" , 0 },
21302132 {AssociatedAction::COPY_INIT, " y" , " y" , 1 },
21312133 }},
@@ -2150,7 +2152,7 @@ static void test29() {
21502152 {
21512153 {AssociatedAction::NEW_INIT, " M.test@2" , " " },
21522154 {AssociatedAction::MOVE_INIT, " r" , " " },
2153- {AssociatedAction::INIT_OTHER, " y" , " " , - 1 , {
2155+ {AssociatedAction::INIT_OTHER, " y" , " " , NO_TUPLE_ELT , {
21542156 {AssociatedAction::ASSIGN, " y" , " y" , 0 },
21552157 {AssociatedAction::COPY_INIT, " y" , " y" , 1 },
21562158 }},
@@ -2170,7 +2172,7 @@ static void test30() {
21702172 }
21712173 )"""" ,
21722174 {
2173- {AssociatedAction::INIT_OTHER, " M.test@5" , " " , - 1 , {
2175+ {AssociatedAction::INIT_OTHER, " M.test@5" , " " , NO_TUPLE_ELT , {
21742176 {AssociatedAction::ASSIGN, " M.test@5" , " M.test@2" },
21752177 {AssociatedAction::COPY_INIT, " M.test@5" , " M.test@3" },
21762178 }},
@@ -2198,7 +2200,7 @@ static void test31() {
21982200 {
21992201 {AssociatedAction::NEW_INIT, " M.test@2" , " " },
22002202 {AssociatedAction::MOVE_INIT, " r" , " " },
2201- {AssociatedAction::INIT_OTHER, " tup" , " " , - 1 , {
2203+ {AssociatedAction::INIT_OTHER, " tup" , " " , NO_TUPLE_ELT , {
22022204 {AssociatedAction::ASSIGN, " tup" , " M.test@4" },
22032205 {AssociatedAction::MOVE_INIT, " tup" , " M.test@5" },
22042206 }},
@@ -2231,7 +2233,7 @@ static void test32() {
22312233 {
22322234 {AssociatedAction::NEW_INIT, " M.test@2" , " " },
22332235 {AssociatedAction::MOVE_INIT, " r" , " " },
2234- {AssociatedAction::INIT_OTHER, " tup" , " " , - 1 , {
2236+ {AssociatedAction::INIT_OTHER, " tup" , " " , NO_TUPLE_ELT , {
22352237 {AssociatedAction::ASSIGN, " tup" , " M.test@4" },
22362238 {AssociatedAction::MOVE_INIT, " tup" , " M.test@5" },
22372239 }},
@@ -2263,7 +2265,7 @@ static void test33() {
22632265 {
22642266 {AssociatedAction::NEW_INIT, " M.test@2" , " " },
22652267 {AssociatedAction::MOVE_INIT, " r" , " " },
2266- {AssociatedAction::INIT_OTHER, " tup" , " " , - 1 , {
2268+ {AssociatedAction::INIT_OTHER, " tup" , " " , NO_TUPLE_ELT , {
22672269 {AssociatedAction::ASSIGN, " tup" , " M.test@4" },
22682270 {AssociatedAction::MOVE_INIT, " tup" , " M.test@5" },
22692271 }},
@@ -2291,7 +2293,7 @@ static void test34() {
22912293 {
22922294 {AssociatedAction::NEW_INIT, " M.test@2" , " " },
22932295 {AssociatedAction::MOVE_INIT, " r" , " " },
2294- {AssociatedAction::INIT_OTHER, " tup" , " " , - 1 , {
2296+ {AssociatedAction::INIT_OTHER, " tup" , " " , NO_TUPLE_ELT , {
22952297 {AssociatedAction::ASSIGN, " tup" , " M.test@4" },
22962298 {AssociatedAction::MOVE_INIT, " tup" , " M.test@5" },
22972299 }},
@@ -2314,7 +2316,7 @@ static void test35a() {
23142316 }
23152317 )"""" ,
23162318 {
2317- {AssociatedAction::INIT_OTHER, " x" , " " , - 1 , {
2319+ {AssociatedAction::INIT_OTHER, " x" , " " , NO_TUPLE_ELT , {
23182320 {AssociatedAction::MOVE_INIT, " x" , " M.test@6" },
23192321 {AssociatedAction::MOVE_INIT, " x" , " M.test@7" },
23202322 }},
@@ -2335,7 +2337,7 @@ static void test35b() {
23352337 }
23362338 )"""" ,
23372339 {
2338- {AssociatedAction::INIT_OTHER, " x" , " " , - 1 , {
2340+ {AssociatedAction::INIT_OTHER, " x" , " " , NO_TUPLE_ELT , {
23392341 {AssociatedAction::MOVE_INIT, " x" , " M.test@8" },
23402342 {AssociatedAction::MOVE_INIT, " x" , " M.test@9" },
23412343 }},
0 commit comments