comparison libcc1/libcc1plugin.cc @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* Library interface to C front end 1 /* Library interface to C front end
2 Copyright (C) 2014-2018 Free Software Foundation, Inc. 2 Copyright (C) 2014-2020 Free Software Foundation, Inc.
3 3
4 This file is part of GCC. 4 This file is part of GCC.
5 5
6 GCC is free software; you can redistribute it and/or modify it under 6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free 7 the terms of the GNU General Public License as published by the Free
185 tree_node **slot = preserved.find_slot (t, INSERT); 185 tree_node **slot = preserved.find_slot (t, INSERT);
186 *slot = t; 186 *slot = t;
187 return t; 187 return t;
188 } 188 }
189 189
190 source_location get_source_location (const char *filename, 190 location_t get_location_t (const char *filename,
191 unsigned int line_number) 191 unsigned int line_number)
192 { 192 {
193 if (filename == NULL) 193 if (filename == NULL)
194 return UNKNOWN_LOCATION; 194 return UNKNOWN_LOCATION;
195 195
196 filename = intern_filename (filename); 196 filename = intern_filename (filename);
197 linemap_add (line_table, LC_ENTER, false, filename, line_number); 197 linemap_add (line_table, LC_ENTER, false, filename, line_number);
198 source_location loc = linemap_line_start (line_table, line_number, 0); 198 location_t loc = linemap_line_start (line_table, line_number, 0);
199 linemap_add (line_table, LC_LEAVE, false, NULL, 0); 199 linemap_add (line_table, LC_LEAVE, false, NULL, 0);
200 return loc; 200 return loc;
201 } 201 }
202 202
203 private: 203 private:
395 395
396 default: 396 default:
397 abort (); 397 abort ();
398 } 398 }
399 399
400 source_location loc = ctx->get_source_location (filename, line_number); 400 location_t loc = ctx->get_location_t (filename, line_number);
401 401
402 decl = build_decl (loc, code, identifier, sym_type); 402 decl = build_decl (loc, code, identifier, sym_type);
403 TREE_USED (decl) = 1; 403 TREE_USED (decl) = 1;
404 TREE_ADDRESSABLE (decl) = 1; 404 TREE_ADDRESSABLE (decl) = 1;
405 405
446 const char *name, gcc_type tagged_type, 446 const char *name, gcc_type tagged_type,
447 const char *filename, unsigned int line_number) 447 const char *filename, unsigned int line_number)
448 { 448 {
449 plugin_context *ctx = static_cast<plugin_context *> (self); 449 plugin_context *ctx = static_cast<plugin_context *> (self);
450 tree t = convert_in (tagged_type), x; 450 tree t = convert_in (tagged_type), x;
451 c_pushtag (ctx->get_source_location (filename, line_number), 451 c_pushtag (ctx->get_location_t (filename, line_number),
452 get_identifier (name), t); 452 get_identifier (name), t);
453 453
454 /* Propagate the newly-added type name so that previously-created 454 /* Propagate the newly-added type name so that previously-created
455 variant types are not disconnected from their main variants. */ 455 variant types are not disconnected from their main variants. */
456 for (x = TYPE_MAIN_VARIANT (t); x; x = TYPE_NEXT_VARIANT (x)) 456 for (x = TYPE_MAIN_VARIANT (t); x; x = TYPE_NEXT_VARIANT (x))
882 plugin_context *ctx = static_cast<plugin_context *> (self); 882 plugin_context *ctx = static_cast<plugin_context *> (self);
883 tree cst, decl; 883 tree cst, decl;
884 tree type = convert_in (type_in); 884 tree type = convert_in (type_in);
885 885
886 cst = build_int_cst (type, value); 886 cst = build_int_cst (type, value);
887 decl = build_decl (ctx->get_source_location (filename, line_number), 887 decl = build_decl (ctx->get_location_t (filename, line_number),
888 CONST_DECL, get_identifier (name), type); 888 CONST_DECL, get_identifier (name), type);
889 DECL_INITIAL (decl) = cst; 889 DECL_INITIAL (decl) = cst;
890 pushdecl_safe (decl); 890 pushdecl_safe (decl);
891 891
892 return 1; 892 return 1;