Ignore:
Timestamp:
Dec 1, 2024, 9:04:12 PM (10 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
eae8b37
Parents:
3e2e9b2 (diff), 1c0a3a4 (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' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/ResolveTypeof.cpp

    r3e2e9b2 r509ec82  
    8888        FixArrayDimension(const ResolveContext & context) : context( context ) {}
    8989
    90         const ast::ArrayType * previsit (const ast::ArrayType * arrayType) {
    91                 if (!arrayType->dimension) return arrayType;
    92                 auto mutType = mutate(arrayType);
     90        template< typename PtrType >
     91        const PtrType * previsitImpl( const PtrType * type ) {
     92                // Note: resolving dimension expressions seems to require duplicate logic,
     93                // here and Resolver.cpp: handlePtrType
     94
     95                if (!type->dimension) return type;
     96                auto mutType = mutate(type);
    9397                auto globalSizeType = context.global.sizeType;
    9498                ast::ptr<ast::Type> sizetype = globalSizeType ? globalSizeType : new ast::BasicType( ast::BasicKind::LongUnsignedInt );
    95                 mutType->dimension = findSingleExpression(arrayType->dimension, sizetype, context );
     99                mutType->dimension = findSingleExpression(type->dimension, sizetype, context );
    96100
    97101                if (InitTweak::isConstExpr(mutType->dimension)) {
     
    102106                }
    103107                return mutType;
     108        }
     109
     110        const ast::ArrayType * previsit (const ast::ArrayType * arrayType) {
     111                return previsitImpl( arrayType );
     112        }
     113
     114        const ast::PointerType * previsit (const ast::PointerType * pointerType) {
     115                return previsitImpl( pointerType );
    104116        }
    105117};
Note: See TracChangeset for help on using the changeset viewer.