Changeset af75a87 for src/Validate


Ignore:
Timestamp:
Jul 13, 2022, 2:51:18 PM (22 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
1932e8a
Parents:
d4b37ab
Message:

Adjusted typedef replacement, attributes should be filtered with better timing now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Validate/ReplaceTypedef.cpp

    rd4b37ab raf75a87  
    1010// Created On       : Tue Jun 29 14:59:00 2022
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Jul 12 14:17:00 2022
    13 // Update Count     : 0
     12// Last Modified On : Wed Jul 13 14:45:00 2022
     13// Update Count     : 1
    1414//
    1515
     
    6363        void previsit( ast::TraitDecl const * );
    6464
    65         void previsit( ast::FunctionType const * );
    66 
    6765        template<typename AggrDecl>
    6866        void addImplicitTypedef( AggrDecl * aggDecl );
     
    7876        CodeLocation const * nearestLocation = nullptr;
    7977        int scopeLevel;
    80         bool inFunctionType = false;
     78        bool isAtFunctionTop = false;
    8179};
    8280
     
    105103                ast::Type * ret = ast::deepCopy( def->second.first->base );
    106104                ret->qualifiers |= type->qualifiers;
    107                 // GCC ignores certain attributes if they arrive by typedef,
    108                 // this mimics that.
    109                 // TODO: This might cover too much, it should just cover arguments
    110                 //   and return values of a function.
    111                 if ( visitor->isInFunction() ) {
     105                // We ignore certain attributes on function parameters if they arrive
     106                // by typedef. GCC appears to do the same thing.
     107                if ( isAtFunctionTop ) {
    112108                        erase_if( ret->attributes, isNonParameterAttribute );
    113109                }
     
    207203        GuardScope( typedefNames );
    208204        GuardScope( typedeclNames );
     205        GuardValue( isAtFunctionTop ) = true;
    209206}
    210207
     
    262259        GuardScope( typedefNames );
    263260        GuardScope( typedeclNames );
     261        GuardValue( isAtFunctionTop ) = false;
    264262        scopeLevel += 1;
    265263}
     
    292290        GuardScope( typedefNames );
    293291        GuardScope( typedeclNames );
    294 }
    295 
    296 void ReplaceTypedefCore::previsit( ast::FunctionType const * ) {
    297         GuardValue( inFunctionType ) = true;
    298292}
    299293
Note: See TracChangeset for help on using the changeset viewer.