diff options
Diffstat (limited to 'gcc/treelang/tree1.c')
-rw-r--r-- | gcc/treelang/tree1.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/gcc/treelang/tree1.c b/gcc/treelang/tree1.c index a734615..26ef3bc 100644 --- a/gcc/treelang/tree1.c +++ b/gcc/treelang/tree1.c @@ -129,7 +129,6 @@ treelang_handle_option (size_t scode, const char *arg ATTRIBUTE_UNUSED, default: gcc_unreachable (); - } return 1; @@ -140,12 +139,11 @@ treelang_handle_option (size_t scode, const char *arg ATTRIBUTE_UNUSED, bool treelang_init (void) { +#ifndef USE_MAPPED_LOCATION input_filename = main_input_filename; - input_line = 1; - - /* Init decls etc. */ - - treelang_init_decl_processing (); +#else + linemap_add (&line_table, LC_ENTER, false, main_input_filename, 1); +#endif /* This error will not happen from GCC as it will always create a fake input file. */ @@ -167,6 +165,14 @@ treelang_init (void) exit (1); } +#ifdef USE_MAPPED_LOCATION + linemap_add (&line_table, LC_RENAME, false, "<built-in>", 1); + linemap_line_start (&line_table, 0, 1); +#endif + + /* Init decls, etc. */ + treelang_init_decl_processing (); + return true; } @@ -183,9 +189,21 @@ treelang_finish (void) void treelang_parse_file (int debug_flag ATTRIBUTE_UNUSED) { +#ifdef USE_MAPPED_LOCATION + source_location s; + linemap_add (&line_table, LC_RENAME, false, main_input_filename, 1); + s = linemap_line_start (&line_table, 1, 80); + input_location = s; +#else + input_line = 1; +#endif + treelang_debug (); yyparse (); cgraph_finalize_compilation_unit (); +#ifdef USE_MAPPED_LOCATION + linemap_add (&line_table, LC_LEAVE, false, NULL, 0); +#endif cgraph_optimize (); } @@ -257,10 +275,8 @@ insert_tree_name (struct prod_token_parm_item *prod) sanity_check (prod); if (lookup_tree_name (prod)) { - fprintf (stderr, "%s:%i:%i duplicate name %s\n", - tok->tp.tok.location.file, tok->tp.tok.location.line, - tok->tp.tok.charno, tok->tp.tok.chars); - errorcount++; + error ("%HDuplicate name %q.*s.", &tok->tp.tok.location, + tok->tp.tok.length, tok->tp.tok.chars); return 1; } prod->tp.pro.next = symbol_table; |