Skip to content
Snippets Groups Projects
  • Nathan Sidwell's avatar
    1f8ac759
    preprocessor: module line maps · 1f8ac759
    Nathan Sidwell authored
    This patch adds LC_MODULE as a map kind, used to indicate a c++
    module.  Unlike a regular source file, it only contains a single
    location, and the source locations in that module are represented by
    ordinary locations whose 'included_from' location is the module.
    
    It also exposes some entry points that modules will use to create
    blocks of line maps.
    
    In the original posting, I'd missed the deletion of the
    linemap_enter_macro from internal.h.  That's included here.
    
    	libcpp/
    	* include/line-map.h (enum lc_reason): Add LC_MODULE.
    	(MAP_MODULE_P): New.
    	(line_map_new_raw): Declare.
    	(linemap_enter_macro): Move declaration from internal.h
    	(linemap_module_loc, linemap_module_reparent)
    	(linemap_module_restore): Declare.
    	(linemap_lookup_macro_indec): Declare.
    	* internal.h (linemap_enter_macro): Moved to line-map.h.
    	* line-map.c (linemap_new_raw): New, broken out of ...
    	(new_linemap): ... here.  Call it.
    	(LAST_SOURCE_LINE_LOCATION): New.
    	(liemap_module_loc, linemap_module_reparent)
    	(linemap_module_restore): New.
    	(linemap_lookup_macro_index): New, broken out of ...
    	(linemap_macro_map_lookup): ... here.  Call it.
    	(linemap_dump): Add module dump.
    1f8ac759
    History
    preprocessor: module line maps
    Nathan Sidwell authored
    This patch adds LC_MODULE as a map kind, used to indicate a c++
    module.  Unlike a regular source file, it only contains a single
    location, and the source locations in that module are represented by
    ordinary locations whose 'included_from' location is the module.
    
    It also exposes some entry points that modules will use to create
    blocks of line maps.
    
    In the original posting, I'd missed the deletion of the
    linemap_enter_macro from internal.h.  That's included here.
    
    	libcpp/
    	* include/line-map.h (enum lc_reason): Add LC_MODULE.
    	(MAP_MODULE_P): New.
    	(line_map_new_raw): Declare.
    	(linemap_enter_macro): Move declaration from internal.h
    	(linemap_module_loc, linemap_module_reparent)
    	(linemap_module_restore): Declare.
    	(linemap_lookup_macro_indec): Declare.
    	* internal.h (linemap_enter_macro): Moved to line-map.h.
    	* line-map.c (linemap_new_raw): New, broken out of ...
    	(new_linemap): ... here.  Call it.
    	(LAST_SOURCE_LINE_LOCATION): New.
    	(liemap_module_loc, linemap_module_reparent)
    	(linemap_module_restore): New.
    	(linemap_lookup_macro_index): New, broken out of ...
    	(linemap_macro_map_lookup): ... here.  Call it.
    	(linemap_dump): Add module dump.