diff mbox

[pph] Detect state mutation in DECLs/TYPEs [4/8] (issue5172046)

Message ID 20111003152342.5D5A21DA1C2@topo.tor.corp.google.com
State New
Headers show

Commit Message

Diego Novillo Oct. 3, 2011, 3:23 p.m. UTC
Somewhat unrelated to state mutation, but I needed these changes while
debugging the code.  This adds more debugging information to
cp_debug_parser.

I will be sending these debugging changes for review for trunk.


Tested on x86_64.  Committed to branch.


Diego.
	* parser.c (cp_debug_parser): Add location information on
	the about-to-be-parsed token.
diff mbox

Patch

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 1a0ed89..5b87275 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -466,6 +466,8 @@  void
 cp_debug_parser (FILE *file, cp_parser *parser)
 {
   const size_t window_size = 20;
+  cp_token *token;
+  expanded_location eloc;
 
   if (file == NULL)
     file = stderr;
@@ -531,6 +533,15 @@  cp_debug_parser (FILE *file, cp_parser *parser)
   fprintf (file, "Number of template parameter lists for the current "
 	   "declaration: %u\n", parser->num_template_parameter_lists);
   cp_debug_parser_tokens (file, parser, window_size);
+  token = parser->lexer->next_token;
+  fprintf (file, "Next token to parse:\n");
+  fprintf (file, "\tToken:  ");
+  cp_lexer_print_token (file, token);
+  eloc = expand_location (token->location);
+  fprintf (file, "\n\tFile:   %s\n", eloc.file);
+  fprintf (file, "\tLine:   %d\n", eloc.line);
+  fprintf (file, "\tColumn: %d\n", eloc.column);
+
 }