Changeset 0d7fc00


Ignore:
Timestamp:
Jul 14, 2023, 3:44:17 PM (17 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
dbf5e18
Parents:
c25f16b
Message:

This may fix the excessive 'struct _IO_FILE;' declarations. I still don't know how to replicate it on my machine.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Validate/LinkReferenceToTypes.cpp

    rc25f16b r0d7fc00  
    7171        /// The "leaveNamespace" is handled by guard.
    7272        void enterNamespace();
    73         /// Puts the decl on the back of declsToAddBefore once traversal is
     73        /// Puts the decl on the back of declsToAddAfter once traversal is
    7474        /// outside of any namespaces.
    75         void addDeclBeforeOutside( ast::Decl const * );
     75        void addDeclAfterOutside( ast::Decl const * );
    7676};
    7777
     
    8181        GuardAction( [this](){
    8282                inNamespace = false;
    83                 declsToAddBefore.splice( declsToAddBefore.begin(), declsToAddOutside );
     83                declsToAddAfter.splice( declsToAddAfter.begin(), declsToAddOutside );
    8484        } );
    8585}
    8686
    87 void LinkTypesCore::addDeclBeforeOutside( ast::Decl const * decl ) {
     87void LinkTypesCore::addDeclAfterOutside( ast::Decl const * decl ) {
    8888        if ( inNamespace ) {
    8989                declsToAddOutside.emplace_back( decl );
    9090        } else {
    91                 declsToAddBefore.emplace_back( decl );
     91                declsToAddAfter.emplace_back( decl );
    9292        }
    9393}
     
    113113        if ( !decl || decl->location.isUnset() ) {
    114114                assert( location );
    115                 decl = new ast::EnumDecl( *location, type->name );
     115                ast::EnumDecl * mut = new ast::EnumDecl( *location, type->name );
     116                mut->linkage = ast::Linkage::Compiler;
     117                decl = mut;
    116118                symtab.addEnum( decl );
    117                 addDeclBeforeOutside( decl );
     119                addDeclAfterOutside( decl );
    118120        }
    119121
     
    135137        if ( !decl || decl->location.isUnset() ) {
    136138                assert( location );
    137                 decl = new ast::StructDecl( *location, type->name );
     139                ast::StructDecl * mut = new ast::StructDecl( *location, type->name );
     140                mut->linkage = ast::Linkage::Compiler;
     141                decl = mut;
    138142                symtab.addStruct( decl );
    139                 addDeclBeforeOutside( decl );
     143                addDeclAfterOutside( decl );
    140144        }
    141145
     
    157161        if ( !decl || decl->location.isUnset() ) {
    158162                assert( location );
    159                 decl = new ast::UnionDecl( *location, type->name );
     163                ast::UnionDecl * mut = new ast::UnionDecl( *location, type->name );
     164                mut->linkage = ast::Linkage::Compiler;
     165                decl = mut;
    160166                symtab.addUnion( decl );
    161                 addDeclBeforeOutside( decl );
     167                addDeclAfterOutside( decl );
    162168        }
    163169
Note: See TracChangeset for help on using the changeset viewer.