The variants of advance_current_object() and descend_into_subtype() in ast2firm must...
authorChristoph Mallon <christoph.mallon@gmx.de>
Mon, 5 Sep 2011 11:04:03 +0000 (13:04 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Mon, 5 Sep 2011 11:04:03 +0000 (13:04 +0200)
ast2firm.c
entity.c
entity_t.h
parser.c

index d9cf3f5..c9fb6e0 100644 (file)
@@ -3688,8 +3688,8 @@ static void descend_into_subtype(type_path_t *path)
        size_t len;
 
        if (is_type_compound(top_type)) {
-               compound_t *compound = top_type->compound.compound;
-               entity_t   *entry    = compound->members.entities;
+               compound_t *const compound = top_type->compound.compound;
+               entity_t   *const entry    = skip_unnamed_bitfields(compound->members.entities);
 
                top->compound_entry = entry;
                top->index          = 0;
@@ -3827,7 +3827,7 @@ static void advance_current_object(type_path_t *path)
                entity_t *entry = top->compound_entry;
 
                top->index++;
-               entry               = entry->base.next;
+               entry               = skip_unnamed_bitfields(entry->base.next);
                top->compound_entry = entry;
                if (entry != NULL) {
                        assert(entry->kind == ENTITY_COMPOUND_MEMBER);
index 23fab8b..528e3a1 100644 (file)
--- a/entity.c
+++ b/entity.c
@@ -104,3 +104,13 @@ elf_visibility_tag_t get_elf_visibility_from_string(const char *string)
                return ELF_VISIBILITY_ERROR;
        }
 }
+
+entity_t *skip_unnamed_bitfields(entity_t *entry)
+{
+       for (; entry != NULL; entry = entry->base.next) {
+               assert(entry->kind == ENTITY_COMPOUND_MEMBER);
+               if (!entry->compound_member.bitfield || entry->base.symbol != NULL)
+                       break;
+       }
+       return entry;
+}
index 2f4e892..4094caa 100644 (file)
@@ -312,4 +312,6 @@ entity_t *allocate_entity_zero(entity_kind_t, entity_namespace_t, symbol_t*);
 
 elf_visibility_tag_t get_elf_visibility_from_string(const char *string);
 
+entity_t *skip_unnamed_bitfields(entity_t*);
+
 #endif
index 2f97ebb..463a444 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -1821,16 +1821,6 @@ static type_path_entry_t *append_to_type_path(type_path_t *path)
        return result;
 }
 
-static entity_t *skip_unnamed_bitfields(entity_t *entry)
-{
-       for (; entry != NULL; entry = entry->base.next) {
-               assert(entry->kind == ENTITY_COMPOUND_MEMBER);
-               if (!entry->compound_member.bitfield || entry->base.symbol != NULL)
-                       break;
-       }
-       return entry;
-}
-
 /**
  * Descending into a sub-type. Enter the scope of the current top_type.
  */