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

Issue 4410045: [pph] Rebuild compilation context from PPH images (5/6) (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years ago by Diego Novillo
Modified:
13 years ago
Reviewers:
CC:
Lawrence Crowl, gcc-patches_gcc.gnu.org
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+13 lines, -2 lines) Patch
M gcc/cp/class.c View 2 chunks +13 lines, -2 lines 0 comments Download

Messages

Total messages: 1
Diego Novillo
13 years ago (2011-04-14 19:41:44 UTC) #1
This patch factors out the allocation of sorted_fields_type into a new
function so it can be called from the PPH reader.

    
    	* class.c (sorted_fields_type_new): Factor out of ...
    	(finish_struct_1): ... here.

diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 1325260..b040449 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5536,6 +5536,18 @@ determine_key_method (tree type)
   return;
 }
 
+
+/* Allocate and return an instance of struct sorted_fields_type with
+   N fields.  */
+
+struct sorted_fields_type *
+sorted_fields_type_new (int n)
+{
+  return ggc_alloc_sorted_fields_type (sizeof (struct sorted_fields_type)
+				       + n * sizeof (tree));
+}
+
+
 /* Perform processing required when the definition of T (a class type)
    is complete.  */
 
@@ -5665,8 +5677,7 @@ finish_struct_1 (tree t)
   n_fields = count_fields (TYPE_FIELDS (t));
   if (n_fields > 7)
     {
-      struct sorted_fields_type *field_vec = ggc_alloc_sorted_fields_type
-	 (sizeof (struct sorted_fields_type) + n_fields * sizeof (tree));
+      struct sorted_fields_type *field_vec = sorted_fields_type_new (n_fields);
       field_vec->len = n_fields;
       add_fields_to_record_type (TYPE_FIELDS (t), field_vec, 0);
       qsort (field_vec->elts, n_fields, sizeof (tree),


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

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