Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r09867ec r3e5dd913  
    271271        };
    272272
    273         struct InitializerLength {
     273        struct ArrayLength : public WithIndexer {
    274274                /// for array types without an explicit length, compute the length and store it so that it
    275275                /// is known to the rest of the phases. For example,
     
    282282
    283283                void previsit( ObjectDecl * objDecl );
    284         };
    285 
    286         struct ArrayLength : public WithIndexer {
    287                 static void computeLength( std::list< Declaration * > & translationUnit );
    288 
    289284                void previsit( ArrayType * arrayType );
    290285        };
     
    387382                                        FixObjectType::fix, translationUnit);
    388383                        }
    389                         Stats::Time::TimeCall("Initializer Length",
    390                                 InitializerLength::computeLength, translationUnit);
    391                         if (!useNewAST) {
    392                                 Stats::Time::TimeCall("Array Length",
    393                                         ArrayLength::computeLength, translationUnit);
    394                         }
     384                        Stats::Time::TimeCall("Array Length",
     385                                ArrayLength::computeLength, translationUnit);
    395386                        Stats::Time::TimeCall("Find Special Declarations",
    396387                                Validate::findSpecialDecls, translationUnit);
     
    13411332        }
    13421333
    1343         void InitializerLength::computeLength( std::list< Declaration * > & translationUnit ) {
    1344                 PassVisitor<InitializerLength> len;
    1345                 acceptAll( translationUnit, len );
    1346         }
    1347 
    13481334        void ArrayLength::computeLength( std::list< Declaration * > & translationUnit ) {
    13491335                PassVisitor<ArrayLength> len;
     
    13511337        }
    13521338
    1353         void InitializerLength::previsit( ObjectDecl * objDecl ) {
     1339        void ArrayLength::previsit( ObjectDecl * objDecl ) {
    13541340                if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->type ) ) {
    13551341                        if ( at->dimension ) return;
     
    13611347
    13621348        void ArrayLength::previsit( ArrayType * type ) {
    1363                 if ( type->dimension ) {
    1364                         // need to resolve array dimensions early so that constructor code can correctly determine
    1365                         // if a type is a VLA (and hence whether its elements need to be constructed)
    1366                         ResolvExpr::findSingleExpression( type->dimension, Validate::SizeType->clone(), indexer );
    1367 
    1368                         // must re-evaluate whether a type is a VLA, now that more information is available
    1369                         // (e.g. the dimension may have been an enumerator, which was unknown prior to this step)
    1370                         type->isVarLen = ! InitTweak::isConstExpr( type->dimension );
     1349                if (!useNewAST) {
     1350                        if ( type->dimension ) {
     1351                                // need to resolve array dimensions early so that constructor code can correctly determine
     1352                                // if a type is a VLA (and hence whether its elements need to be constructed)
     1353                                ResolvExpr::findSingleExpression( type->dimension, Validate::SizeType->clone(), indexer );
     1354
     1355                                // must re-evaluate whether a type is a VLA, now that more information is available
     1356                                // (e.g. the dimension may have been an enumerator, which was unknown prior to this step)
     1357                                type->isVarLen = ! InitTweak::isConstExpr( type->dimension );
     1358                        }
    13711359                }
    13721360        }
Note: See TracChangeset for help on using the changeset viewer.