[PATCH 4/4] Pass bind_function_type_life_time a complete type.

Giuliano Procida gprocida@google.com
Tue May 5 18:06:12 GMT 2020


Calling bind_function_type_life_time with an incomplete function type
is remaining cause of incomplete pretty representations of types being
generated and cached and then later used in reports.

This patch moves the call to this function to after the type is
complete. Update test that illustrated incomplete function type.

	* src/abg-reader.cc: Move call to bind_function_type_life_time
	to end of function.
	* tests/data/test-abidiff-exit/test-fun-param-report.txt: Fix
	incomplete function type.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-reader.cc                                      | 2 +-
 tests/data/test-abidiff-exit/test-fun-param-report.txt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/abg-reader.cc b/src/abg-reader.cc
index 27bc9d51..d7c48919 100644
--- a/src/abg-reader.cc
+++ b/src/abg-reader.cc
@@ -3753,7 +3753,6 @@ build_function_type(read_context&	ctxt,
 			    : new function_type(return_type,
 						parms, size, align));
 
-  ctxt.get_translation_unit()->bind_function_type_life_time(fn_type);
   ctxt.key_type_decl(fn_type, id);
 
   for (xmlNodePtr n = node->children; n ; n = n->next)
@@ -3780,6 +3779,7 @@ build_function_type(read_context&	ctxt,
     }
 
   fn_type->set_parameters(parms);
+  ctxt.get_translation_unit()->bind_function_type_life_time(fn_type);
 
   return fn_type;
 }
diff --git a/tests/data/test-abidiff-exit/test-fun-param-report.txt b/tests/data/test-abidiff-exit/test-fun-param-report.txt
index 6bfbcf0d..295cce84 100644
--- a/tests/data/test-abidiff-exit/test-fun-param-report.txt
+++ b/tests/data/test-abidiff-exit/test-fun-param-report.txt
@@ -8,7 +8,7 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
       in pointed to type 'struct ops' at test-fun-param-v1.c:1:1:
         type size hasn't changed
         1 data member change:
-          type of 'void ()* ops::bind_class' changed:
+          type of 'void (void*, unsigned int, unsigned long int)* ops::bind_class' changed:
             in pointed to type 'function type void (void*, unsigned int, unsigned long int)':
               parameter 4 of type 'void*' was added
               parameter 5 of type 'unsigned long int' was added
-- 
2.26.2.526.g744177e7f7-goog



More information about the Libabigail mailing list