aboutsummaryrefslogtreecommitdiff
path: root/gcc/diagnostic-format-json.cc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2022-06-22 05:54:30 -0700
committerNathan Sidwell <nathan@acm.org>2022-06-23 05:16:24 -0700
commitc01fe6729e607fd064eb27db2a9420aedb75ffd4 (patch)
treedaa6ef569dd5d8f3efb9bff77f98118a7a3b16e4 /gcc/diagnostic-format-json.cc
parent509cdb441614eab2a0fe90a970a927538b832bcd (diff)
downloadgcc-c01fe6729e607fd064eb27db2a9420aedb75ffd4.zip
gcc-c01fe6729e607fd064eb27db2a9420aedb75ffd4.tar.gz
gcc-c01fe6729e607fd064eb27db2a9420aedb75ffd4.tar.bz2
c++: Prune unneeded macro locations
This implements garbage collection on locations within macro expansions, when streaming out a CMI. When doing the reachability walks, we now note which macro locations we need and then only write those locations. The complication here is that every macro expansion location has an independently calculated offset. This complicates writing, but reading remains the same -- the macro locations of a CMI continue to form a contiguous block. For std headers this reduced the number of macro maps by 40% and the number of locations by 16%. For a GMF including iostream, it reduced it by 80% and 60% respectively. Ordinary locations are still transformed en-mass. They are somewhat more complicated to apply a similar optimization to. gcc/cp/ * module.cc (struct macro_info): New. (struct macro_traits): New. (macro_remap, macro_table): New globals. (depset::hash::find_dependencies): Note namespace location. (module_for_macro_loc): Adjust. (module_state::note_location): New. (module_state::Write_location): Note location when not streaming. Adjust macro location streaming. (module_state::read_location): Adjust macro location streaming. (module_state::write_init_maps): New. (module_state::write_prepare_maps): Reimplement macro map preparation. (module_state::write_macro_maps): Reimplement. (module_state::read_macro_maps): Likewise. (module_state::write_begin): Adjust. gcc/testsuite/ * g++.dg/modules/loc-prune-1.C: New. * g++.dg/modules/loc-prune-2.C: New. * g++.dg/modules/loc-prune-3.C: New. * g++.dg/modules/pr98718_a.C: Adjust. * g++.dg/modules/pr98718_b.C: Adjust.
Diffstat (limited to 'gcc/diagnostic-format-json.cc')
0 files changed, 0 insertions, 0 deletions