Walk pointer_to and reference_to chain in free_lang_data

Jan Hubicka hubicka@ucw.cz
Thu Aug 23 12:00:00 GMT 2018


> >   tree type_decl = build_decl (input_location, TYPE_DECL,                       
> >                                get_identifier ("__asan_global"), ret);          
> >   DECL_IGNORED_P (type_decl) = 1;                                               
> >   DECL_ARTIFICIAL (type_decl) = 1;                                              
> >   TYPE_FIELDS (ret) = fields[0];                                                
> >   TYPE_NAME (ret) = type_decl;                                                  
> >   TYPE_STUB_DECL (ret) = type_decl;                                             
> > 
> > It seems to me that setting TYPE_NAME to identifier node would be easier.
> 
> Yeah.  I probably added the DECL_INGORED_P to most of those so indeed
> type_decls are somewhat pointless.

OK, I have tried to remove them and it passes bootstrap/regtest x86-64.
Looks sane?

Honza

	* asan.c (asan_global_struct): Turn TYPE_NAME into identifier.
	(ubsan_get_type_descriptor_type,
	ubsan_get_source_location_type,
	ubsan_create_data): Likewise.
Index: asan.c
===================================================================
--- asan.c	(revision 263696)
+++ asan.c	(working copy)
@@ -2515,13 +2515,8 @@ asan_global_struct (void)
       if (i)
 	DECL_CHAIN (fields[i - 1]) = fields[i];
     }
-  tree type_decl = build_decl (input_location, TYPE_DECL,
-			       get_identifier ("__asan_global"), ret);
-  DECL_IGNORED_P (type_decl) = 1;
-  DECL_ARTIFICIAL (type_decl) = 1;
   TYPE_FIELDS (ret) = fields[0];
-  TYPE_NAME (ret) = type_decl;
-  TYPE_STUB_DECL (ret) = type_decl;
+  TYPE_NAME (ret) = get_identifier ("__asan_global");
   layout_type (ret);
   return ret;
 }
Index: ubsan.c
===================================================================
--- ubsan.c	(revision 263696)
+++ ubsan.c	(working copy)
@@ -221,14 +221,8 @@ ubsan_get_type_descriptor_type (void)
       if (i)
 	DECL_CHAIN (fields[i - 1]) = fields[i];
     }
-  tree type_decl = build_decl (input_location, TYPE_DECL,
-			       get_identifier ("__ubsan_type_descriptor"),
-			       ret);
-  DECL_IGNORED_P (type_decl) = 1;
-  DECL_ARTIFICIAL (type_decl) = 1;
   TYPE_FIELDS (ret) = fields[0];
-  TYPE_NAME (ret) = type_decl;
-  TYPE_STUB_DECL (ret) = type_decl;
+  TYPE_NAME (ret) = get_identifier ("__ubsan_type_descriptor");
   layout_type (ret);
   ubsan_type_descriptor_type = ret;
   return ret;
@@ -269,14 +263,8 @@ ubsan_get_source_location_type (void)
       if (i)
 	DECL_CHAIN (fields[i - 1]) = fields[i];
     }
-  tree type_decl = build_decl (input_location, TYPE_DECL,
-			       get_identifier ("__ubsan_source_location"),
-			       ret);
-  DECL_IGNORED_P (type_decl) = 1;
-  DECL_ARTIFICIAL (type_decl) = 1;
   TYPE_FIELDS (ret) = fields[0];
-  TYPE_NAME (ret) = type_decl;
-  TYPE_STUB_DECL (ret) = type_decl;
+  TYPE_NAME (ret) = get_identifier ("__ubsan_source_location");
   layout_type (ret);
   ubsan_source_location_type = ret;
   return ret;
@@ -586,13 +574,8 @@ ubsan_create_data (const char *name, int
     }
   va_end (args);
 
-  tree type_decl = build_decl (input_location, TYPE_DECL,
-			       get_identifier (name), ret);
-  DECL_IGNORED_P (type_decl) = 1;
-  DECL_ARTIFICIAL (type_decl) = 1;
   TYPE_FIELDS (ret) = fields[0];
-  TYPE_NAME (ret) = type_decl;
-  TYPE_STUB_DECL (ret) = type_decl;
+  TYPE_NAME (ret) = get_identifier (name);
   layout_type (ret);
 
   /* Now, fill in the type.  */



More information about the Gcc-patches mailing list