Changeset b2da0574


Ignore:
Timestamp:
Apr 18, 2018, 5:15:19 PM (4 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, with_gc
Children:
2ae16219
Parents:
f74eb47
Message:

Fix missing struct definition for empty struct with chained variable declarations.

  • turn off body flag on chained declarations
  • check body flag when extracting aggregates
  • update Indexer to check body flag on aggregates
Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rf74eb47 rb2da0574  
    924924                                delete newType->aggInst.aggregate->enumeration.constants;
    925925                                newType->aggInst.aggregate->enumeration.constants = nullptr;
     926                                newType->aggInst.aggregate->enumeration.body = false;
    926927                        } else {
    927928                                assert( newType->aggInst.aggregate->kind == TypeData::Aggregate );
    928929                                delete newType->aggInst.aggregate->aggregate.fields;
    929930                                newType->aggInst.aggregate->aggregate.fields = nullptr;
     931                                newType->aggInst.aggregate->aggregate.body = false;
    930932                        } // if
    931933                        // don't hoist twice
  • src/Parser/TypeData.cc

    rf74eb47 rb2da0574  
    490490        switch ( td->kind ) {
    491491          case TypeData::Aggregate:
    492                 if ( ! toplevel && td->aggregate.fields ) {
     492                if ( ! toplevel && td->aggregate.body ) {
    493493                        ret = td->clone();
    494494                } // if
    495495                break;
    496496          case TypeData::Enum:
    497                 if ( ! toplevel && td->enumeration.constants ) {
     497                if ( ! toplevel && td->enumeration.body ) {
    498498                        ret = td->clone();
    499499                } // if
  • src/SymTab/Indexer.cc

    rf74eb47 rb2da0574  
    501501
    502502        bool addedDeclConflicts( AggregateDecl *existing, AggregateDecl *added ) {
    503                 if ( existing->get_members().empty() ) {
     503                if ( ! existing->body ) {
    504504                        return false;
    505                 } else if ( ! added->get_members().empty() ) {
     505                } else if ( added->body ) {
    506506                        SemanticError( added, "redeclaration of " );
    507507                } // if
  • src/SymTab/Validate.cc

    rf74eb47 rb2da0574  
    316316
    317317        void HoistStruct::previsit( EnumInstType * inst ) {
    318                 if ( inst->baseEnum ) {
     318                if ( inst->baseEnum && inst->baseEnum->body ) {
    319319                        declsToAddBefore.push_front( inst->baseEnum );
    320320                }
     
    322322
    323323        void HoistStruct::previsit( StructInstType * inst ) {
    324                 if ( inst->baseStruct ) {
     324                if ( inst->baseStruct && inst->baseStruct->body ) {
    325325                        declsToAddBefore.push_front( inst->baseStruct );
    326326                }
     
    328328
    329329        void HoistStruct::previsit( UnionInstType * inst ) {
    330                 if ( inst->baseUnion ) {
     330                if ( inst->baseUnion && inst->baseUnion->body ) {
    331331                        declsToAddBefore.push_front( inst->baseUnion );
    332332                }
Note: See TracChangeset for help on using the changeset viewer.