Changes in src/SymTab/Validate.cc [361bf01:09867ec]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Validate.cc
r361bf01 r09867ec 271 271 }; 272 272 273 struct ArrayLength : public WithIndexer{273 struct InitializerLength { 274 274 /// for array types without an explicit length, compute the length and store it so that it 275 275 /// is known to the rest of the phases. For example, … … 282 282 283 283 void previsit( ObjectDecl * objDecl ); 284 }; 285 286 struct ArrayLength : public WithIndexer { 287 static void computeLength( std::list< Declaration * > & translationUnit ); 288 284 289 void previsit( ArrayType * arrayType ); 285 290 }; … … 382 387 FixObjectType::fix, translationUnit); 383 388 } 384 Stats::Time::TimeCall("Array Length", 385 ArrayLength::computeLength, translationUnit); 389 Stats::Time::TimeCall("Initializer Length", 390 InitializerLength::computeLength, translationUnit); 391 if (!useNewAST) { 392 Stats::Time::TimeCall("Array Length", 393 ArrayLength::computeLength, translationUnit); 394 } 386 395 Stats::Time::TimeCall("Find Special Declarations", 387 396 Validate::findSpecialDecls, translationUnit); … … 1332 1341 } 1333 1342 1343 void InitializerLength::computeLength( std::list< Declaration * > & translationUnit ) { 1344 PassVisitor<InitializerLength> len; 1345 acceptAll( translationUnit, len ); 1346 } 1347 1334 1348 void ArrayLength::computeLength( std::list< Declaration * > & translationUnit ) { 1335 1349 PassVisitor<ArrayLength> len; … … 1337 1351 } 1338 1352 1339 void ArrayLength::previsit( ObjectDecl * objDecl ) {1353 void InitializerLength::previsit( ObjectDecl * objDecl ) { 1340 1354 if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->type ) ) { 1341 1355 if ( at->dimension ) return; … … 1347 1361 1348 1362 void ArrayLength::previsit( ArrayType * type ) { 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 } 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 ); 1359 1371 } 1360 1372 } … … 1462 1474 } 1463 1475 } 1476 1477 /* 1464 1478 1465 1479 /// Associates forward declarations of aggregates with their definitions … … 1844 1858 } 1845 1859 }; 1860 */ 1846 1861 } // anonymous namespace 1847 1862 1863 /* 1848 1864 const ast::Type * validateType( 1849 1865 const CodeLocation & loc, const ast::Type * type, const ast::SymbolTable & symtab ) { … … 1854 1870 return type->accept( lrt )->accept( fpd ); 1855 1871 } 1872 */ 1856 1873 1857 1874 } // namespace SymTab
Note: See TracChangeset
for help on using the changeset viewer.