@@ -384,6 +384,7 @@ let transformOffsetOf (speclist, dtype) member =
384384%type <Cabs. statement list > block_element_list
385385%type <string list > local_labels local_label_names
386386%type <string list > old_parameter_list_ne
387+ %type <Cabs. for_clause * cabsloc > for_clause
387388
388389%type <Cabs. init_name > init_declarator
389390%type <Cabs. init_name list > init_declarator_list
@@ -952,9 +953,9 @@ statement_no_null:
952953 {WHILE (smooth_expression (fst $2), $4, joinLoc $1 $5, joinLoc (snd $2) $3)}
953954| DO statement WHILE paren_comma_expression SEMICOLON
954955 {DOWHILE (smooth_expression (fst $4), $2, joinLoc $1 $5, joinLoc (snd $4) $5)}
955- | FOR LPAREN for_clause opt_expression
956- SEMICOLON opt_expression RPAREN statement location
957- {FOR ($3, $4, $ 6, $8, joinLoc $1 $9 , joinLoc $2 $7 )}
956+ | FOR LPAREN for_clause location opt_expression location
957+ SEMICOLON location opt_expression location RPAREN statement location
958+ {let (fc, fc_loc) = $3 in FOR (fc, fc_loc, $5, joinLoc $4 $ 6, $9, joinLoc $8 $10, $12, joinLoc $1 $13 , joinLoc $2 $11 )}
958959| IDENT COLON attribute_nocv_list location statement_no_null
959960 {(* The only attribute that should appear here
960961 is "unused". For now, we drop this on the
@@ -989,8 +990,8 @@ statement_no_null:
989990
990991
991992for_clause :
992- opt_expression SEMICOLON { FC_EXP $1 }
993- | declaration { FC_DECL $1 }
993+ location opt_expression SEMICOLON { ( FC_EXP $2, joinLoc $1 $3) }
994+ | location declaration location { ( FC_DECL $2, joinLoc $1 $3) }
994995;
995996
996997declaration : /* ISO 6.7 .*/
0 commit comments