Ignore:
Timestamp:
Jul 25, 2022, 3:17:25 PM (3 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
b0d9ff7
Parents:
4e2befe3 (diff), ffec1bf (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into qualifiedEnum

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Validate/ReplaceTypedef.cpp

    r4e2befe3 rdef751f  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ReplaceTypedef.cpp --
     7// ReplaceTypedef.cpp -- Fill in all typedefs with the underlying type.
    88//
    99// Author           : Andrew Beach
    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.