Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(18)

Issue 6195056: [C++ Patch and pubnames 2/2] Adjust c decl pretty printer to match demangler

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 11 months ago by saugustine
Modified:
9 years, 7 months ago
Reviewers:
CC:
gcc-patches_gcc.gnu.org
Base URL:
svn+ssh://gcc.gnu.org/svn/gcc/trunk/gcc/
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+5 lines, -3 lines) Patch
M c-family/c-pretty-print.c View 2 chunks +2 lines, -2 lines 0 comments Download
M cp/error.c View 2 chunks +3 lines, -1 line 0 comments Download

Messages

Total messages: 1
saugustine
12 years, 11 months ago (2012-05-08 00:10:04 UTC) #1
This is the second in the series of patches to make c decl pretty printing
more closely match the demangler. A full explanation is here:

http://gcc.gnu.org/ml/gcc-patches/2012-05/msg00512.html

OK for mainline?

Sterling

2012-05-07   Sterling Augustine  <saugustine@google.com>

	* c-family/c-pretty-print.c (pp_c_specifier_qualifier_list): Move
	call to pp_c_type_qualifier_list from start to end of function.
	* cp/error.c (dump_decl): Change "{anonymous}" to "(anonymous
	namespace)"
	(lang_decl_name): Handle "(anonymous namespace)" correctly.

Index: c-family/c-pretty-print.c
===================================================================
--- c-family/c-pretty-print.c	(revision 187271)
+++ c-family/c-pretty-print.c	(working copy)
@@ -446,8 +446,6 @@ pp_c_specifier_qualifier_list (c_pretty_printer *p
 {
   const enum tree_code code = TREE_CODE (t);
 
-  if (TREE_CODE (t) != POINTER_TYPE)
-    pp_c_type_qualifier_list (pp, t);
   switch (code)
     {
     case REFERENCE_TYPE:
@@ -494,6 +492,8 @@ pp_c_specifier_qualifier_list (c_pretty_printer *p
       pp_simple_type_specifier (pp, t);
       break;
     }
+  if (TREE_CODE (t) != POINTER_TYPE)
+    pp_c_type_qualifier_list (pp, t);
 }
 
 /* parameter-type-list:
Index: cp/error.c
===================================================================
--- cp/error.c	(revision 187271)
+++ cp/error.c	(working copy)
@@ -1028,7 +1028,7 @@ dump_decl (tree t, int flags)
 	    dump_scope (CP_DECL_CONTEXT (t), flags);
 	  flags &= ~TFF_UNQUALIFIED_NAME;
 	  if (DECL_NAME (t) == NULL_TREE)
-	    pp_cxx_ws_string (cxx_pp, M_("{anonymous}"));
+	    pp_cxx_ws_string (cxx_pp, M_("(anonymous namespace)"));
 	  else
 	    pp_cxx_tree_identifier (cxx_pp, DECL_NAME (t));
 	}
@@ -2596,6 +2596,8 @@ lang_decl_name (tree decl, int v, bool translate)
 
   if (TREE_CODE (decl) == FUNCTION_DECL)
     dump_function_name (decl, TFF_PLAIN_IDENTIFIER);
+  else if (DECL_NAME (decl) == NULL && TREE_CODE (decl) == NAMESPACE_DECL)
+    pp_string (cxx_pp, M_("(anonymous namespace)"));
   else
     dump_decl (DECL_NAME (decl), TFF_PLAIN_IDENTIFIER);
 

--
This patch is available for review at http://codereview.appspot.com/6195056
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b