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