public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
* [jit] Tweaks to location-handling
@ 2014-01-01  0:00 David Malcolm
  0 siblings, 0 replies; only message in thread
From: David Malcolm @ 2014-01-01  0:00 UTC (permalink / raw)
  To: jit, gcc-patches; +Cc: David Malcolm

Committed to branch dmalcolm/jit:

gcc/jit/
	* internal-api.c (gcc::jit::playback::context::handle_locations):
	Add a disabled call to line_table_dump, in case it's handy for
	debugging in the future.
	(gcc::jit::playback::context::set_tree_location): Assert that
	the location is non-NULL.
	(gcc::jit::playback::location::location): Initialize m_src_loc
	to UNKNOWN_LOCATION.  This field should always be overwritten by
	handle_locations before use, but given recent issues with bogus
	locations it seems safer to initialize it.
---
 gcc/jit/ChangeLog.jit  | 12 ++++++++++++
 gcc/jit/internal-api.c | 11 +++++++++++
 2 files changed, 23 insertions(+)

diff --git a/gcc/jit/ChangeLog.jit b/gcc/jit/ChangeLog.jit
index b0058b9..2298e49 100644
--- a/gcc/jit/ChangeLog.jit
+++ b/gcc/jit/ChangeLog.jit
@@ -1,3 +1,15 @@
+2014-03-07  David Malcolm  <dmalcolm@redhat.com>
+
+	* internal-api.c (gcc::jit::playback::context::handle_locations):
+	Add a disabled call to line_table_dump, in case it's handy for
+	debugging in the future.
+	(gcc::jit::playback::context::set_tree_location): Assert that
+	the location is non-NULL.
+	(gcc::jit::playback::location::location): Initialize m_src_loc
+	to UNKNOWN_LOCATION.  This field should always be overwritten by
+	handle_locations before use, but given recent issues with bogus
+	locations it seems safer to initialize it.
+
 2014-03-06  David Malcolm  <dmalcolm@redhat.com>
 
 	* internal-api.c (gcc::jit::recording::context::
diff --git a/gcc/jit/internal-api.c b/gcc/jit/internal-api.c
index f80c40b..1cb15ce 100644
--- a/gcc/jit/internal-api.c
+++ b/gcc/jit/internal-api.c
@@ -3723,6 +3723,15 @@ handle_locations ()
       linemap_add (line_table, LC_LEAVE, false, NULL, 0);
     }
 
+  /* line_table should now be populated; every playback::location should
+     now have an m_srcloc.  */
+
+  if (0)
+    line_table_dump (stderr,
+		     line_table,
+		     LINEMAPS_ORDINARY_USED (line_table),
+		     LINEMAPS_MACRO_USED (line_table));
+
   /* Now assign them to tree nodes as appropriate.  */
   std::pair<tree, location *> *cached_location;
 
@@ -3822,6 +3831,7 @@ void
 playback::context::
 set_tree_location (tree t, location *loc)
 {
+  gcc_assert (loc);
   m_cached_locations.safe_push (std::make_pair (t, loc));
 }
 
@@ -3899,6 +3909,7 @@ get_location (int column_num)
 }
 
 playback::location::location (source_line *line, int column_num) :
+  m_srcloc (UNKNOWN_LOCATION),
   m_line (line),
   m_column_num(column_num)
 {
-- 
1.7.11.7

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-07 13:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-01  0:00 [jit] Tweaks to location-handling David Malcolm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).