public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++] make TYPE_DECLs public for builtin type and templates
@ 2014-06-30 22:28 Jan Hubicka
  2014-07-01 23:10 ` Jason Merrill
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Hubicka @ 2014-06-30 22:28 UTC (permalink / raw)
  To: gcc-patches, jason

Jason,
I made a verifier that types not considered anonymous are not built
from types that are anonymous and that public types have TREE_PUBLIC
flag on their TYPE_DECLS (as that seem to be what tree.h says).

This catches two cases in C++ FE and several other cases elsewhere.
Does something like this make sense? I think bulitin_types are
generally public, but I am not quite sure about templates.

Honza

	* decl.c (record_builtin_type): Make builting types public.
	* pt.c (reduce_template_parm_level): Make TYPE_DECL public.
Index: decl.c
===================================================================
--- decl.c	(revision 212098)
+++ decl.c	(working copy)
@@ -3591,6 +3591,7 @@ record_builtin_type (enum rid rid_index,
       tdecl = build_decl (BUILTINS_LOCATION, TYPE_DECL, tname, type);
       DECL_ARTIFICIAL (tdecl) = 1;
       SET_IDENTIFIER_GLOBAL_VALUE (tname, tdecl);
+      TREE_PUBLIC (tdecl) = true;
     }
   if (rname)
     {
@@ -3598,6 +3599,7 @@ record_builtin_type (enum rid rid_index,
 	{
 	  tdecl = build_decl (BUILTINS_LOCATION, TYPE_DECL, rname, type);
 	  DECL_ARTIFICIAL (tdecl) = 1;
+	  TREE_PUBLIC (tdecl) = true;
 	}
       SET_IDENTIFIER_GLOBAL_VALUE (rname, tdecl);
     }
Index: pt.c
===================================================================
--- pt.c	(revision 212098)
+++ pt.c	(working copy)
@@ -3623,6 +3623,8 @@ reduce_template_parm_level (tree index,
 			 TREE_CODE (orig_decl), DECL_NAME (orig_decl), type);
       TREE_CONSTANT (decl) = TREE_CONSTANT (orig_decl);
       TREE_READONLY (decl) = TREE_READONLY (orig_decl);
+      if (TREE_CODE (decl) == TYPE_DECL)
+        TREE_PUBLIC (decl) = 1;
       DECL_ARTIFICIAL (decl) = 1;
       SET_DECL_TEMPLATE_PARM_P (decl);
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-06 18:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-30 22:28 [C++] make TYPE_DECLs public for builtin type and templates Jan Hubicka
2014-07-01 23:10 ` Jason Merrill
2014-07-02  2:42   ` Jan Hubicka
2014-07-06 18:41     ` Jason Merrill

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).