Changeset 0e42794 for src/AST/Pass.impl.hpp
- Timestamp:
- Jun 5, 2019, 11:24:10 AM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- d4b6638
- Parents:
- 93744b5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Pass.impl.hpp
r93744b5 r0e42794 398 398 VISIT( 399 399 { 400 guard_ indexerguard { *this };400 guard_symtab guard { *this }; 401 401 maybe_accept( node, &ObjectDecl::type ); 402 402 } … … 406 406 ) 407 407 408 __pass:: indexer::addId( pass, 0, node );408 __pass::symtab::addId( pass, 0, node ); 409 409 410 410 VISIT_END( DeclWithType, node ); … … 417 417 VISIT_START( node ); 418 418 419 __pass:: indexer::addId( pass, 0, node );419 __pass::symtab::addId( pass, 0, node ); 420 420 421 421 VISIT(maybe_accept( node, &FunctionDecl::withExprs );) 422 422 { 423 423 // with clause introduces a level of scope (for the with expression members). 424 // with clause exprs are added to the indexerbefore parameters so that parameters424 // with clause exprs are added to the symbol table before parameters so that parameters 425 425 // shadow with exprs and not the other way around. 426 guard_ indexerguard { *this };427 __pass:: indexer::addWith( pass, 0, node->withExprs, node );426 guard_symtab guard { *this }; 427 __pass::symtab::addWith( pass, 0, node->withExprs, node ); 428 428 { 429 guard_ indexerguard { *this };429 guard_symtab guard { *this }; 430 430 // implicit add __func__ identifier as specified in the C manual 6.4.2.2 431 431 static ast::ObjectDecl func( … … 436 436 ) 437 437 ); 438 __pass:: indexer::addId( pass, 0, &func );438 __pass::symtab::addId( pass, 0, &func ); 439 439 VISIT( 440 440 maybe_accept( node, &FunctionDecl::type ); … … 460 460 // make up a forward declaration and add it before processing the members 461 461 // needs to be on the heap because addStruct saves the pointer 462 __pass:: indexer::addStructFwd( pass, 0, node );463 464 VISIT({ 465 guard_ indexerguard { * this };462 __pass::symtab::addStructFwd( pass, 0, node ); 463 464 VISIT({ 465 guard_symtab guard { * this }; 466 466 maybe_accept( node, &StructDecl::params ); 467 467 maybe_accept( node, &StructDecl::members ); … … 469 469 470 470 // this addition replaces the forward declaration 471 __pass:: indexer::addStruct( pass, 0, node );471 __pass::symtab::addStruct( pass, 0, node ); 472 472 473 473 VISIT_END( Decl, node ); … … 481 481 482 482 // make up a forward declaration and add it before processing the members 483 __pass:: indexer::addUnionFwd( pass, 0, node );484 485 VISIT({ 486 guard_ indexerguard { * this };483 __pass::symtab::addUnionFwd( pass, 0, node ); 484 485 VISIT({ 486 guard_symtab guard { * this }; 487 487 maybe_accept( node, &UnionDecl::params ); 488 488 maybe_accept( node, &UnionDecl::members ); 489 489 }) 490 490 491 __pass:: indexer::addUnion( pass, 0, node );491 __pass::symtab::addUnion( pass, 0, node ); 492 492 493 493 VISIT_END( Decl, node ); … … 500 500 VISIT_START( node ); 501 501 502 __pass:: indexer::addEnum( pass, 0, node );502 __pass::symtab::addEnum( pass, 0, node ); 503 503 504 504 VISIT( … … 518 518 519 519 VISIT({ 520 guard_ indexerguard { *this };520 guard_symtab guard { *this }; 521 521 maybe_accept( node, &TraitDecl::params ); 522 522 maybe_accept( node, &TraitDecl::members ); 523 523 }) 524 524 525 __pass:: indexer::addTrait( pass, 0, node );525 __pass::symtab::addTrait( pass, 0, node ); 526 526 527 527 VISIT_END( Decl, node ); … … 535 535 536 536 VISIT({ 537 guard_ indexerguard { *this };537 guard_symtab guard { *this }; 538 538 maybe_accept( node, &TypeDecl::params ); 539 539 maybe_accept( node, &TypeDecl::base ); … … 543 543 // note that assertions come after the type is added to the symtab, since they are not part of the type proper 544 544 // and may depend on the type itself 545 __pass:: indexer::addType( pass, 0, node );545 __pass::symtab::addType( pass, 0, node ); 546 546 547 547 VISIT( … … 549 549 550 550 { 551 guard_ indexerguard { *this };551 guard_symtab guard { *this }; 552 552 maybe_accept( node, &TypeDecl::init ); 553 553 } … … 564 564 565 565 VISIT({ 566 guard_ indexerguard { *this };566 guard_symtab guard { *this }; 567 567 maybe_accept( node, &TypedefDecl::params ); 568 568 maybe_accept( node, &TypedefDecl::base ); 569 569 }) 570 570 571 __pass:: indexer::addType( pass, 0, node );571 __pass::symtab::addType( pass, 0, node ); 572 572 573 573 VISIT( maybe_accept( node, &TypedefDecl::assertions ); ) … … 611 611 // do not enter a new scope if inFunction is true - needs to check old state before the assignment 612 612 auto guard1 = makeFuncGuard( [this, inFunction = this->inFunction]() { 613 if ( ! inFunction ) __pass:: indexer::enter(pass, 0);613 if ( ! inFunction ) __pass::symtab::enter(pass, 0); 614 614 }, [this, inFunction = this->inFunction]() { 615 if ( ! inFunction ) __pass:: indexer::leave(pass, 0);615 if ( ! inFunction ) __pass::symtab::leave(pass, 0); 616 616 }); 617 617 ValueGuard< bool > guard2( inFunction ); … … 669 669 VISIT({ 670 670 // if statements introduce a level of scope (for the initialization) 671 guard_ indexerguard { *this };671 guard_symtab guard { *this }; 672 672 maybe_accept( node, &IfStmt::inits ); 673 673 maybe_accept( node, &IfStmt::cond ); … … 687 687 VISIT({ 688 688 // while statements introduce a level of scope (for the initialization) 689 guard_ indexerguard { *this };689 guard_symtab guard { *this }; 690 690 maybe_accept( node, &WhileStmt::inits ); 691 691 maybe_accept( node, &WhileStmt::cond ); … … 704 704 VISIT({ 705 705 // for statements introduce a level of scope (for the initialization) 706 guard_ indexerguard { *this };706 guard_symtab guard { *this }; 707 707 maybe_accept( node, &ForStmt::inits ); 708 708 maybe_accept( node, &ForStmt::cond ); … … 800 800 VISIT({ 801 801 // catch statements introduce a level of scope (for the caught exception) 802 guard_ indexerguard { *this };802 guard_symtab guard { *this }; 803 803 maybe_accept( node, &CatchStmt::decl ); 804 804 maybe_accept( node, &CatchStmt::cond ); … … 901 901 { 902 902 // catch statements introduce a level of scope (for the caught exception) 903 guard_ indexerguard { *this };904 __pass:: indexer::addWith( pass, 0, node->exprs, node );903 guard_symtab guard { *this }; 904 __pass::symtab::addWith( pass, 0, node->exprs, node ); 905 905 maybe_accept( node, &WithStmt::stmt ); 906 906 } … … 953 953 VISIT( 954 954 { 955 guard_ indexerguard { *this };955 guard_symtab guard { *this }; 956 956 maybe_accept( node, &ApplicationExpr::result ); 957 957 } … … 971 971 VISIT( 972 972 { 973 guard_ indexerguard { *this };973 guard_symtab guard { *this }; 974 974 maybe_accept( node, &UntypedExpr::result ); 975 975 } … … 988 988 989 989 VISIT({ 990 guard_ indexerguard { *this };990 guard_symtab guard { *this }; 991 991 maybe_accept( node, &NameExpr::result ); 992 992 }) … … 1002 1002 1003 1003 VISIT({ 1004 guard_ indexerguard { *this };1004 guard_symtab guard { *this }; 1005 1005 maybe_accept( node, &CastExpr::result ); 1006 1006 } … … 1018 1018 1019 1019 VISIT({ 1020 guard_ indexerguard { *this };1020 guard_symtab guard { *this }; 1021 1021 maybe_accept( node, &KeywordCastExpr::result ); 1022 1022 } … … 1034 1034 1035 1035 VISIT({ 1036 guard_ indexerguard { *this };1036 guard_symtab guard { *this }; 1037 1037 maybe_accept( node, &VirtualCastExpr::result ); 1038 1038 } … … 1050 1050 1051 1051 VISIT({ 1052 guard_ indexerguard { *this };1052 guard_symtab guard { *this }; 1053 1053 maybe_accept( node, &AddressExpr::result ); 1054 1054 } … … 1066 1066 1067 1067 VISIT({ 1068 guard_ indexerguard { *this };1068 guard_symtab guard { *this }; 1069 1069 maybe_accept( node, &LabelAddressExpr::result ); 1070 1070 }) … … 1080 1080 1081 1081 VISIT({ 1082 guard_ indexerguard { *this };1082 guard_symtab guard { *this }; 1083 1083 maybe_accept( node, &UntypedMemberExpr::result ); 1084 1084 } … … 1097 1097 1098 1098 VISIT({ 1099 guard_ indexerguard { *this };1099 guard_symtab guard { *this }; 1100 1100 maybe_accept( node, &MemberExpr::result ); 1101 1101 } … … 1113 1113 1114 1114 VISIT({ 1115 guard_ indexerguard { *this };1115 guard_symtab guard { *this }; 1116 1116 maybe_accept( node, &VariableExpr::result ); 1117 1117 }) … … 1127 1127 1128 1128 VISIT({ 1129 guard_ indexerguard { *this };1129 guard_symtab guard { *this }; 1130 1130 maybe_accept( node, &ConstantExpr::result ); 1131 1131 }) … … 1141 1141 1142 1142 VISIT({ 1143 guard_ indexerguard { *this };1143 guard_symtab guard { *this }; 1144 1144 maybe_accept( node, &SizeofExpr::result ); 1145 1145 } … … 1161 1161 1162 1162 VISIT({ 1163 guard_ indexerguard { *this };1163 guard_symtab guard { *this }; 1164 1164 maybe_accept( node, &AlignofExpr::result ); 1165 1165 } … … 1181 1181 1182 1182 VISIT({ 1183 guard_ indexerguard { *this };1183 guard_symtab guard { *this }; 1184 1184 maybe_accept( node, &UntypedOffsetofExpr::result ); 1185 1185 } … … 1197 1197 1198 1198 VISIT({ 1199 guard_ indexerguard { *this };1199 guard_symtab guard { *this }; 1200 1200 maybe_accept( node, &OffsetofExpr::result ); 1201 1201 } … … 1213 1213 1214 1214 VISIT({ 1215 guard_ indexerguard { *this };1215 guard_symtab guard { *this }; 1216 1216 maybe_accept( node, &OffsetPackExpr::result ); 1217 1217 } … … 1229 1229 1230 1230 VISIT({ 1231 guard_ indexerguard { *this };1231 guard_symtab guard { *this }; 1232 1232 maybe_accept( node, &LogicalExpr::result ); 1233 1233 } … … 1246 1246 1247 1247 VISIT({ 1248 guard_ indexerguard { *this };1248 guard_symtab guard { *this }; 1249 1249 maybe_accept( node, &ConditionalExpr::result ); 1250 1250 } … … 1264 1264 1265 1265 VISIT({ 1266 guard_ indexerguard { *this };1266 guard_symtab guard { *this }; 1267 1267 maybe_accept( node, &CommaExpr::result ); 1268 1268 } … … 1281 1281 1282 1282 VISIT({ 1283 guard_ indexerguard { *this };1283 guard_symtab guard { *this }; 1284 1284 maybe_accept( node, &TypeExpr::result ); 1285 1285 } … … 1297 1297 1298 1298 VISIT({ 1299 guard_ indexerguard { *this };1299 guard_symtab guard { *this }; 1300 1300 maybe_accept( node, &AsmExpr::result ); 1301 1301 } … … 1315 1315 1316 1316 VISIT({ 1317 guard_ indexerguard { *this };1317 guard_symtab guard { *this }; 1318 1318 maybe_accept( node, &ImplicitCopyCtorExpr::result ); 1319 1319 } … … 1331 1331 1332 1332 VISIT({ 1333 guard_ indexerguard { *this };1333 guard_symtab guard { *this }; 1334 1334 maybe_accept( node, &ConstructorExpr::result ); 1335 1335 } … … 1347 1347 1348 1348 VISIT({ 1349 guard_ indexerguard { *this };1349 guard_symtab guard { *this }; 1350 1350 maybe_accept( node, &CompoundLiteralExpr::result ); 1351 1351 } … … 1363 1363 1364 1364 VISIT({ 1365 guard_ indexerguard { *this };1365 guard_symtab guard { *this }; 1366 1366 maybe_accept( node, &RangeExpr::result ); 1367 1367 } … … 1380 1380 1381 1381 VISIT({ 1382 guard_ indexerguard { *this };1382 guard_symtab guard { *this }; 1383 1383 maybe_accept( node, &UntypedTupleExpr::result ); 1384 1384 } … … 1396 1396 1397 1397 VISIT({ 1398 guard_ indexerguard { *this };1398 guard_symtab guard { *this }; 1399 1399 maybe_accept( node, &TupleExpr::result ); 1400 1400 } … … 1412 1412 1413 1413 VISIT({ 1414 guard_ indexerguard { *this };1414 guard_symtab guard { *this }; 1415 1415 maybe_accept( node, &TupleIndexExpr::result ); 1416 1416 } … … 1428 1428 1429 1429 VISIT({ 1430 guard_ indexerguard { *this };1430 guard_symtab guard { *this }; 1431 1431 maybe_accept( node, &TupleAssignExpr::result ); 1432 1432 } … … 1454 1454 1455 1455 { 1456 guard_ indexerguard { *this };1456 guard_symtab guard { *this }; 1457 1457 maybe_accept( node, &StmtExpr::result ); 1458 1458 } … … 1472 1472 1473 1473 VISIT({ 1474 guard_ indexerguard { *this };1474 guard_symtab guard { *this }; 1475 1475 maybe_accept( node, &UniqueExpr::result ); 1476 1476 } … … 1488 1488 1489 1489 VISIT({ 1490 guard_ indexerguard { *this };1490 guard_symtab guard { *this }; 1491 1491 maybe_accept( node, &UntypedInitExpr::result ); 1492 1492 } … … 1505 1505 1506 1506 VISIT({ 1507 guard_ indexerguard { *this };1507 guard_symtab guard { *this }; 1508 1508 maybe_accept( node, &InitExpr::result ); 1509 1509 } … … 1522 1522 1523 1523 VISIT({ 1524 guard_ indexerguard { *this };1524 guard_symtab guard { *this }; 1525 1525 maybe_accept( node, &DeletedExpr::result ); 1526 1526 } … … 1539 1539 1540 1540 VISIT({ 1541 guard_ indexerguard { *this };1541 guard_symtab guard { *this }; 1542 1542 maybe_accept( node, &DefaultArgExpr::result ); 1543 1543 } … … 1555 1555 1556 1556 VISIT({ 1557 guard_ indexerguard { *this };1557 guard_symtab guard { *this }; 1558 1558 maybe_accept( node, &GenericExpr::result ); 1559 1559 } … … 1566 1566 const Type * type = nullptr; 1567 1567 if( assoc.type ) { 1568 guard_ indexerguard { *this };1568 guard_symtab guard { *this }; 1569 1569 type = assoc.type->accept( *this ); 1570 1570 if( type != assoc.type ) mutated = true; … … 1682 1682 VISIT_START( node ); 1683 1683 1684 __pass:: indexer::addStruct( pass, 0, node->name );1685 1686 VISIT({ 1687 guard_ indexerguard { *this };1684 __pass::symtab::addStruct( pass, 0, node->name ); 1685 1686 VISIT({ 1687 guard_symtab guard { *this }; 1688 1688 maybe_accept( node, &StructInstType::forall ); 1689 1689 maybe_accept( node, &StructInstType::params ); … … 1699 1699 VISIT_START( node ); 1700 1700 1701 __pass:: indexer::addStruct( pass, 0, node->name );1701 __pass::symtab::addStruct( pass, 0, node->name ); 1702 1702 1703 1703 { 1704 guard_ indexerguard { *this };1704 guard_symtab guard { *this }; 1705 1705 maybe_accept( node, &UnionInstType::forall ); 1706 1706 maybe_accept( node, &UnionInstType::params ); … … 1893 1893 std::unordered_map< std::string, ast::ptr< ast::Type > > new_map; 1894 1894 for ( const auto & p : node->typeEnv ) { 1895 guard_ indexerguard { *this };1895 guard_symtab guard { *this }; 1896 1896 auto new_node = p.second->accept( *this ); 1897 1897 if (new_node != p.second) mutated = false; … … 1909 1909 std::unordered_map< std::string, ast::ptr< ast::Expr > > new_map; 1910 1910 for ( const auto & p : node->varEnv ) { 1911 guard_ indexerguard { *this };1911 guard_symtab guard { *this }; 1912 1912 auto new_node = p.second->accept( *this ); 1913 1913 if (new_node != p.second) mutated = false;
Note: See TracChangeset
for help on using the changeset viewer.