summaryrefslogtreecommitdiff
path: root/libcpp/line-map.c
diff options
context:
space:
mode:
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-16 10:33:27 +0000
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-16 10:33:27 +0000
commita4cfdfed6839584bcde0c2c884e3dd55476adaa3 (patch)
tree2b9dadc35640ecec96428e5e73e233c98df2477d /libcpp/line-map.c
parentc4884451cad7af65335e5a3dfbd99a75a50110e7 (diff)
downloadgcc-a4cfdfed6839584bcde0c2c884e3dd55476adaa3.tar.gz
Support location tracking for built-in macro tokens
When a built-in macro is expanded, the location of the token in the epansion list is the location of the expansion point of the built-in macro. This patch creates a virtual location for that token instead, effectively tracking locations of tokens resulting from built-in macro tokens. libcpp/ * include/line-map.h (line_maps::builtin_location): New data member. (line_map_init): Add a new parameter to initialize the new line_maps::builtin_location data member. * line-map.c (linemap_init): Initialize the line_maps::builtin_location data member. * macro.c (builtin_macro): Create a macro map and track the token resulting from the expansion of a built-in macro. gcc/ * input.h (is_location_from_builtin_token): New function declaration. * input.c (is_location_from_builtin_token): New function definition. * toplev.c (general_init): Tell libcpp what the pre-defined spelling location for built-in tokens is. Signed-off-by: Dodji Seketeli <dodji@redhat.com> git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212637 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/line-map.c')
-rw-r--r--libcpp/line-map.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index f9a7658cbdb..a4055c29c74 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -175,13 +175,15 @@ location_adhoc_data_fini (struct line_maps *set)
/* Initialize a line map set. */
void
-linemap_init (struct line_maps *set)
+linemap_init (struct line_maps *set,
+ source_location builtin_location)
{
memset (set, 0, sizeof (struct line_maps));
set->highest_location = RESERVED_LOCATION_COUNT - 1;
set->highest_line = RESERVED_LOCATION_COUNT - 1;
set->location_adhoc_data_map.htab =
htab_create (100, location_adhoc_data_hash, location_adhoc_data_eq, NULL);
+ set->builtin_location = builtin_location;
}
/* Check for and warn about line_maps entered but not exited. */