[4/4] RFC: abg-writer: add a missing check for emitted declarations

Message ID 20210910112325.806676-5-gprocida@google.com
State New
Headers
Series Looking at equality and hashing |

Commit Message

Giuliano Procida Sept. 10, 2021, 11:23 a.m. UTC
  Before writing out extra referenced types, the function
write_translation_unit does not check if this was an already emitted
declaration-only type.

This may actually be intentional, given the following comment.

  // We allow several *declarations* of the same class in the corpus,
  // but only one definition.

	* src/abg-writer.cc (write_translation_unit): Also check if an
	an extra referenced type is declaration-only and already
	emitted.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-writer.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/src/abg-writer.cc b/src/abg-writer.cc
index cf664720..abd5a45a 100644
--- a/src/abg-writer.cc
+++ b/src/abg-writer.cc
@@ -2484,7 +2484,7 @@  write_translation_unit(write_context&		ctxt,
 	  // We handle types which have declarations *and* function
 	  // types here.
 	  type_base_sptr t(*i, noop_deleter());
-	  if (!ctxt.type_is_emitted(t))
+	  if (!ctxt.type_is_emitted(t) && !ctxt.decl_only_type_is_emitted(t))
 	    {
 	      if (decl_base* d = get_type_declaration(*i))
 		{