aboutsummaryrefslogtreecommitdiff
path: root/libcpp/internal.h
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-11-17 08:01:50 -0800
committerNathan Sidwell <nathan@acm.org>2020-11-17 08:10:56 -0800
commit1f8ac759918729e9402c3154c8e5110bfd4c6459 (patch)
tree0ede00b154e9db9f3f6ff98ce76a902bfaa0d86b /libcpp/internal.h
parent6b91b3e9df171970a907638d9b2e0bca1e792975 (diff)
downloadgcc-1f8ac759918729e9402c3154c8e5110bfd4c6459.zip
gcc-1f8ac759918729e9402c3154c8e5110bfd4c6459.tar.gz
gcc-1f8ac759918729e9402c3154c8e5110bfd4c6459.tar.bz2
preprocessor: module line maps
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.
Diffstat (limited to 'libcpp/internal.h')
-rw-r--r--libcpp/internal.h24
1 files changed, 1 insertions, 23 deletions
diff --git a/libcpp/internal.h b/libcpp/internal.h
index d7780e4..3f5bafb 100644
--- a/libcpp/internal.h
+++ b/libcpp/internal.h
@@ -868,29 +868,7 @@ ufputs (const unsigned char *s, FILE *f)
return fputs ((const char *)s, f);
}
- /* In line-map.c. */
-
-/* Create a macro map. A macro map encodes source locations of tokens
- that are part of a macro replacement-list, at a macro expansion
- point. See the extensive comments of struct line_map and struct
- line_map_macro, in line-map.h.
-
- This map shall be created when the macro is expanded. The map
- encodes the source location of the expansion point of the macro as
- well as the "original" source location of each token that is part
- of the macro replacement-list. If a macro is defined but never
- expanded, it has no macro map. SET is the set of maps the macro
- map should be part of. MACRO_NODE is the macro which the new macro
- map should encode source locations for. EXPANSION is the location
- of the expansion point of MACRO. For function-like macros
- invocations, it's best to make it point to the closing parenthesis
- of the macro, rather than the the location of the first character
- of the macro. NUM_TOKENS is the number of tokens that are part of
- the replacement-list of MACRO. */
-const line_map_macro *linemap_enter_macro (class line_maps *,
- struct cpp_hashnode*,
- location_t,
- unsigned int);
+/* In line-map.c. */
/* Create and return a virtual location for a token that is part of a
macro expansion-list at a macro expansion point. See the comment