Changeset 183

Show
Ignore:
Timestamp:
05/20/07 15:09:11 (2 years ago)
Author:
ant_39
Message:
  • Emit line information.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/gcc/gcc/algol60/Make-lang.in

    r166 r183  
    9191                algol60/label.h algol60/symbol.h algol60/type.h algol60/statement.h\ 
    9292                algol60/expression.h algol60/for-elmt.h algol60/for-elmt.i\ 
     93                algol60/cursor.h algol60/cursor.i\ 
    9394                algol60/statement.i algol60/expression.i algol60/desig-expr.i\ 
    9495                algol60/type.i algol60/symbol.i\ 
  • trunk/gcc/gcc/algol60/al60l-bind.c

    r182 r183  
    4141#include "visitor.h" 
    4242#include "a60_symtab.h" 
     43#include "cursor.h" 
    4344 
    4445struct struct_al60l_bind_state_t 
     
    544545// ------------------------------------ 
    545546 
     547static void 
     548private_set_location (tree node, cursor_t * cursor) 
     549{ 
     550  if (cursor == NULL) 
     551    return; 
     552 
     553  location_t loc; 
     554  cursor_to_loc (cursor, &loc); 
     555  SET_EXPR_LOCATION (node, loc); 
     556} 
     557 
    546558tree 
    547559stmt_build_generic (statement_t * statement, al60l_bind_state_t * state) 
    548560{ 
    549   return (tree)a60_visitor_dispatch (state->statement_build_generic, statement, statement, state); 
     561  tree ret = a60_visitor_dispatch (state->statement_build_generic, statement, statement, state); 
     562  private_set_location (ret, stmt_cursor (statement)); 
     563  return ret; 
    550564} 
    551565 
     
    877891  int len = estr_length (s) + 1; // +1 for trailing zero 
    878892  tree ret = build_string_literal (len, estr_cstr (s)); 
     893  private_set_location (ret, expr_cursor (self)); 
    879894  return ret; 
    880895} 
     
    909924  tree expf = expr_build_generic (expr_if_falseb (self), data); 
    910925  tree ret  = build3 (COND_EXPR, ttt, cond, expt, expf); 
     926  private_set_location (ret, expr_cursor (self)); 
    911927  return ret; 
    912928} 
     
    920936  tree op2 = expr_build_generic (expr_binary_right (self), data); 
    921937  tree ret = build2 (op, ttt, op1, op2); 
     938  private_set_location (ret, expr_cursor (self)); 
    922939  return ret; 
    923940} 
     
    930947  tree op1 = expr_build_generic (expr_unary_operand (self), data); 
    931948  tree ret = build1 (op, ttt, op1); 
     949  private_set_location (ret, expr_cursor (self)); 
    932950  return ret; 
    933951} 
     
    936954private_expr_build_ardiv (expression_t * self, void * data) 
    937955{ 
    938   tree exp =  private_expr_build_binary_generic (self, data, RDIV_EXPR); 
     956  tree ret =  private_expr_build_binary_generic (self, data, RDIV_EXPR); 
    939957  // int / int also yields real.  We must cast the operands explicitly 
    940958  // to allow for this. 
    941959  if (types_same (expr_type (expr_binary_left (self)), type_int ())) 
    942960    { 
    943       tree tmp = TREE_OPERAND (exp, 0); 
    944       TREE_OPERAND (exp, 0) = build1 (FLOAT_EXPR, TREE_TYPE (exp), tmp); 
     961      tree tmp = TREE_OPERAND (ret, 0); 
     962      TREE_OPERAND (ret, 0) = build1 (FLOAT_EXPR, TREE_TYPE (ret), tmp); 
    945963    } 
    946964 
    947965  if (types_same (expr_type (expr_binary_right (self)), type_int ())) 
    948966    { 
    949       tree tmp = TREE_OPERAND (exp, 1); 
    950       TREE_OPERAND (exp, 1) = build1 (FLOAT_EXPR, TREE_TYPE (exp), tmp); 
    951     } 
    952  
    953   return exp; 
     967      tree tmp = TREE_OPERAND (ret, 1); 
     968      TREE_OPERAND (ret, 1) = build1 (FLOAT_EXPR, TREE_TYPE (ret), tmp); 
     969    } 
     970 
     971  private_set_location (ret, expr_cursor (self)); 
     972  return ret; 
    954973} 
    955974 
     
    10001019  expression_t * e = new_expr_call_sym (c, l, args, sym); 
    10011020 
    1002   return expr_build_generic (e, data); 
     1021  tree ret = expr_build_generic (e, data); 
     1022  private_set_location (ret, expr_cursor (self)); 
     1023  return ret; 
    10031024} 
    10041025 
     
    10111032  expression_t * e1 = new_expr_unary (c, euk_not, expr_binary_left (self)); 
    10121033  expression_t * e2 = new_expr_binary (c, ebk_lor, e1, expr_binary_right (self)); 
    1013   return expr_build_generic (e2, data); 
     1034  tree ret = expr_build_generic (e2, data); 
     1035  private_set_location (ret, expr_cursor (self)); 
     1036  return ret; 
    10141037} 
    10151038 
     
    10541077    { 
    10551078    case euk_uminus: 
    1056   return private_expr_build_unary_generic (self, data, NEGATE_EXPR); 
     1079      return private_expr_build_unary_generic (self, data, NEGATE_EXPR); 
    10571080    case euk_not: 
    1058   return private_expr_build_unary_generic (self, data, TRUTH_NOT_EXPR); 
     1081      return private_expr_build_unary_generic (self, data, TRUTH_NOT_EXPR); 
    10591082    }; 
    10601083  gcc_unreachable (); 
     
    10811104  arg_list = nreverse (arg_list); 
    10821105 
    1083   tree call_expr = build_function_call_expr (proc_decl, arg_list); 
    1084   TREE_SIDE_EFFECTS (call_expr) = 1; 
    1085   TREE_USED (call_expr) = 1; 
    1086  
    1087   return call_expr; 
     1106  tree ret = build_function_call_expr (proc_decl, arg_list); 
     1107  TREE_SIDE_EFFECTS (ret) = 1; 
     1108  TREE_USED (ret) = 1; 
     1109 
     1110  private_set_location (ret, expr_cursor (self)); 
     1111  return ret; 
    10881112} 
    10891113 
     
    10921116{ 
    10931117  symbol_t * sym = expr_symbol (self); 
    1094   tree array = symbol_extra (sym); 
     1118  tree ret = symbol_extra (sym); 
    10951119  type_t * t = symbol_type (sym); 
    1096   gcc_assert (array != NULL); 
     1120  gcc_assert (ret != NULL); 
    10971121  gcc_assert (t != NULL); 
    10981122 
     
    11041128      t = type_host (t); 
    11051129      tree type = type_build_generic (t, data); 
    1106       array = build4 (ARRAY_REF, type, array, idx_tree, NULL_TREE, NULL_TREE); 
     1130      ret = build4 (ARRAY_REF, type, ret, idx_tree, NULL_TREE, NULL_TREE); 
    11071131    } 
    11081132  delete_slist_it (it); 
    11091133 
    1110   return array; 
     1134  private_set_location (ret, expr_cursor (self)); 
     1135  return ret; 
    11111136} 
    11121137