- Timestamp:
- May 29, 2019, 9:09:30 PM (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:
- 466fa01
- Parents:
- c786e1d (diff), d88f8b3b (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. - Location:
- src/AST
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
rc786e1d r6054b18 10 10 // Created On : Thu May 09 15::37::05 2019 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue May 28 12:00:00 201913 // Update Count : 712 // Last Modified On : Wed May 29 17:05:00 2019 13 // Update Count : 9 14 14 // 15 15 … … 25 25 #include "AST/TypeSubstitution.hpp" 26 26 27 #include "SymTab/Autogen.h" 27 28 #include "SynTree/Attribute.h" 28 29 #include "SynTree/Declaration.h" 29 30 #include "SynTree/TypeSubstitution.h" 31 32 #include "Validate/FindSpecialDecls.h" 30 33 31 34 //================================================================================================ … … 40 43 } 41 44 }; 45 46 //================================================================================================ 47 namespace { 48 49 // This is to preserve the SymTab::dereferenceOperator hack. It does not (and perhaps should not) 50 // allow us to use the same stratagy in the new ast. 51 ast::FunctionDecl * dereferenceOperator = nullptr; 52 53 } 42 54 43 55 //================================================================================================ … … 154 166 LinkageSpec::Spec( node->linkage.val ), 155 167 get<FunctionType>().accept1( node->type ), 156 get<CompoundStmt>().accept1( node->stmts ),168 {}, 157 169 get<Attribute>().acceptL( node->attributes ), 158 170 Type::FuncSpecifiers( node->funcSpec.val ) 159 171 ); 172 cache.emplace( node, decl ); 173 decl->statements = get<CompoundStmt>().accept1( node->stmts ); 160 174 decl->withExprs = get<Expression>().acceptL( node->withExprs ); 175 if ( dereferenceOperator == node ) { 176 Validate::dereferenceOperator = decl; 177 } 161 178 return declWithTypePostamble( decl, node ); 162 179 } … … 871 888 ); 872 889 873 rslt->tempDecls = get<ObjectDecl>().acceptL(node->tempDecls);874 rslt->returnDecls = get<ObjectDecl>().acceptL(node->returnDecls);875 rslt->dtors = get<Expression>().acceptL(node->dtors);876 877 890 auto expr = visitBaseExpr( node, rslt ); 878 891 this->node = expr; … … 1425 1438 old->name, 1426 1439 GET_ACCEPT_1(type, FunctionType), 1427 GET_ACCEPT_1(statements, CompoundStmt),1440 {}, 1428 1441 { old->storageClasses.val }, 1429 1442 { old->linkage.val }, … … 1432 1445 }; 1433 1446 cache.emplace( old, decl ); 1447 decl->stmts = GET_ACCEPT_1(statements, CompoundStmt); 1434 1448 decl->scopeLevel = old->scopeLevel; 1435 1449 decl->mangleName = old->mangleName; … … 1439 1453 1440 1454 this->node = decl; 1455 1456 if ( Validate::dereferenceOperator == old ) { 1457 dereferenceOperator = decl; 1458 } 1441 1459 } 1442 1460 … … 1484 1502 virtual void visit( EnumDecl * old ) override final { 1485 1503 if ( inCache( old ) ) return; 1486 auto decl = new ast:: UnionDecl(1504 auto decl = new ast::EnumDecl( 1487 1505 old->location, 1488 1506 old->name, … … 1504 1522 virtual void visit( TraitDecl * old ) override final { 1505 1523 if ( inCache( old ) ) return; 1506 auto decl = new ast:: UnionDecl(1524 auto decl = new ast::TraitDecl( 1507 1525 old->location, 1508 1526 old->name, … … 2265 2283 ); 2266 2284 2267 rslt->tempDecls = GET_ACCEPT_V(tempDecls, ObjectDecl);2268 rslt->returnDecls = GET_ACCEPT_V(returnDecls, ObjectDecl);2269 rslt->dtors = GET_ACCEPT_V(dtors, Expr);2270 2271 2285 this->node = visitBaseExpr( old, rslt ); 2272 2286 } -
src/AST/Expr.hpp
rc786e1d r6054b18 530 530 public: 531 531 ptr<ApplicationExpr> callExpr; 532 std::vector<ptr<ObjectDecl>> tempDecls;533 std::vector<ptr<ObjectDecl>> returnDecls;534 std::vector<ptr<Expr>> dtors;535 532 536 533 ImplicitCopyCtorExpr( const CodeLocation& loc, const ApplicationExpr * call ) 537 : Expr( loc, call->result ) , tempDecls(), returnDecls(), dtors(){ assert( call ); }534 : Expr( loc, call->result ) { assert( call ); } 538 535 539 536 const Expr * accept( Visitor & v ) const override { return v.visit( this ); } -
src/AST/Pass.impl.hpp
rc786e1d r6054b18 1319 1319 } 1320 1320 maybe_accept( node, &ImplicitCopyCtorExpr::callExpr ); 1321 maybe_accept( node, &ImplicitCopyCtorExpr::tempDecls );1322 maybe_accept( node, &ImplicitCopyCtorExpr::returnDecls );1323 maybe_accept( node, &ImplicitCopyCtorExpr::dtors );1324 1321 ) 1325 1322 -
src/AST/Print.cpp
rc786e1d r6054b18 1023 1023 os << "Implicit Copy Constructor Expression:" << endl << indent; 1024 1024 safe_print( node->callExpr ); 1025 os << endl << indent-1 << "... with temporaries:" << endl;1026 printAll( node->tempDecls );1027 os << endl << indent-1 << "... with return temporaries:" << endl;1028 printAll( node->returnDecls );1029 1025 --indent; 1030 1026 postprint( node );
Note: See TracChangeset
for help on using the changeset viewer.