Changes in / [a83044fb:d148778]
- Location:
- src
- Files:
-
- 16 edited
-
AST/Convert.cpp (modified) (22 diffs)
-
AST/Decl.cpp (modified) (2 diffs)
-
AST/Decl.hpp (modified) (1 diff)
-
AST/Expr.cpp (modified) (1 diff)
-
AST/Expr.hpp (modified) (5 diffs)
-
AST/Fwd.hpp (modified) (1 diff)
-
AST/Node.cpp (modified) (2 diffs)
-
AST/Pass.impl.hpp (modified) (16 diffs)
-
AST/Stmt.hpp (modified) (1 diff)
-
AST/module.mk (modified) (3 diffs)
-
Common/Eval.cc (modified) (1 diff)
-
Makefile.am (modified) (1 diff)
-
Makefile.in (modified) (17 diffs)
-
Tuples/TupleExpansion.cc (modified) (1 diff)
-
include/cassert (modified) (1 diff)
-
main.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
ra83044fb rd148778 10 10 // Created On : Thu May 09 15::37::05 2019 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue May 21 15:30:00 201913 // Update Count : 512 // Last Modified On : Fri May 17 16:01:00 2019 13 // Update Count : 4 14 14 // 15 15 … … 108 108 109 109 private: 110 void declPostamble( Declaration * decl, const ast::Decl * node ) {111 decl->location = node->location;112 // name comes from constructor113 // linkage comes from constructor114 decl->extension = node->extension;115 decl->uniqueId = node->uniqueId;116 // storageClasses comes from constructor117 this->node = decl;118 }119 120 const ast::DeclWithType * declWithTypePostamble (121 DeclarationWithType * decl, const ast::DeclWithType * node ) {122 declPostamble( decl, node );123 decl->mangleName = node->mangleName;124 decl->scopeLevel = node->scopeLevel;125 decl->asmName = get<Expression>().accept1( node->asmName );126 // attributes comes from constructor127 decl->isDeleted = node->isDeleted;128 // fs comes from constructor129 return nullptr;130 }131 132 110 const ast::DeclWithType * visit( const ast::ObjectDecl * node ) override final { 133 auto decl = new ObjectDecl( 134 node->name, 135 Type::StorageClasses( node->storage.val ), 136 LinkageSpec::Spec( node->linkage.val ), 137 get<Expression>().accept1( node->bitfieldWidth ), 138 get<Type>().accept1( node->type ), 139 get<Initializer>().accept1( node->init ), 140 get<Attribute>().acceptL( node->attributes ), 141 Type::FuncSpecifiers( node->funcSpec.val ) 142 ); 143 return declWithTypePostamble( decl, node ); 111 (void)node; 112 return nullptr; 144 113 } 145 114 146 115 const ast::DeclWithType * visit( const ast::FunctionDecl * node ) override final { 147 auto decl = new FunctionDecl( 148 node->name, 149 Type::StorageClasses( node->storage.val ), 150 LinkageSpec::Spec( node->linkage.val ), 151 get<FunctionType>().accept1( node->type ), 152 get<CompoundStmt>().accept1( node->stmts ), 153 get<Attribute>().acceptL( node->attributes ), 154 Type::FuncSpecifiers( node->funcSpec.val ) 155 ); 156 decl->withExprs = get<Expression>().acceptL( node->withExprs ); 157 return declWithTypePostamble( decl, node ); 158 } 159 160 // NamedTypeDecl 161 const ast::Decl * namedTypePostamble( NamedTypeDecl * decl, const ast::NamedTypeDecl * node ) { 162 declPostamble( decl, node ); 163 // base comes from constructor 164 decl->parameters = get<TypeDecl>().acceptL( node->params ); 165 decl->assertions = get<DeclarationWithType>().acceptL( node->assertions ); 116 (void)node; 117 return nullptr; 118 } 119 120 const ast::Decl * visit( const ast::StructDecl * node ) override final { 121 (void)node; 122 return nullptr; 123 } 124 125 const ast::Decl * visit( const ast::UnionDecl * node ) override final { 126 (void)node; 127 return nullptr; 128 } 129 130 const ast::Decl * visit( const ast::EnumDecl * node ) override final { 131 (void)node; 132 return nullptr; 133 } 134 135 const ast::Decl * visit( const ast::TraitDecl * node ) override final { 136 (void)node; 166 137 return nullptr; 167 138 } 168 139 169 140 const ast::Decl * visit( const ast::TypeDecl * node ) override final { 170 TypeDecl::Kind kind; 171 switch (node->kind) { 172 case ast::TypeVar::Dtype: 173 kind = TypeDecl::Dtype; 174 break; 175 case ast::TypeVar::Ftype: 176 kind = TypeDecl::Ftype; 177 break; 178 case ast::TypeVar::Ttype: 179 kind = TypeDecl::Ttype; 180 break; 181 default: 182 assertf(false, "Invalid ast::TypeVar::Kind: %d\n", node->kind); 183 }; 184 auto decl = new TypeDecl( 185 node->name, 186 Type::StorageClasses( node->storage.val ), 187 get<Type>().accept1( node->base ), 188 kind, 189 node->sized, 190 get<Type>().accept1( node->init ) 191 ); 192 return namedTypePostamble( decl, node ); 141 (void)node; 142 return nullptr; 193 143 } 194 144 195 145 const ast::Decl * visit( const ast::TypedefDecl * node ) override final { 196 auto decl = new TypedefDecl( 197 node->name, 198 node->location, 199 Type::StorageClasses( node->storage.val ), 200 get<Type>().accept1( node->base ), 201 LinkageSpec::Spec( node->linkage.val ) 202 ); 203 return namedTypePostamble( decl, node ); 204 } 205 206 const ast::Decl * aggregatePostamble( AggregateDecl * decl, const ast::AggregateDecl * node ) { 207 decl->members = get<Declaration>().acceptL( node->members ); 208 decl->parameters = get<TypeDecl>().acceptL( node->params ); 209 decl->body = node->body; 210 // attributes come from constructor 211 // TODO: Need caching for: decl->parent = node->parent; 212 return nullptr; 213 } 214 215 const ast::Decl * visit( const ast::StructDecl * node ) override final { 216 auto decl = new StructDecl( 217 node->name, 218 node->kind, 219 get<Attribute>().acceptL( node->attributes ), 220 LinkageSpec::Spec( node->linkage.val ) 221 ); 222 return aggregatePostamble( decl, node ); 223 } 224 225 const ast::Decl * visit( const ast::UnionDecl * node ) override final { 226 auto decl = new UnionDecl( 227 node->name, 228 get<Attribute>().acceptL( node->attributes ), 229 LinkageSpec::Spec( node->linkage.val ) 230 ); 231 return aggregatePostamble( decl, node ); 232 } 233 234 const ast::Decl * visit( const ast::EnumDecl * node ) override final { 235 auto decl = new EnumDecl( 236 node->name, 237 get<Attribute>().acceptL( node->attributes ), 238 LinkageSpec::Spec( node->linkage.val ) 239 ); 240 return aggregatePostamble( decl, node ); 241 } 242 243 const ast::Decl * visit( const ast::TraitDecl * node ) override final { 244 auto decl = new TraitDecl( 245 node->name, 246 {}, 247 LinkageSpec::Spec( node->linkage.val ) 248 ); 249 return aggregatePostamble( decl, node ); 146 (void)node; 147 return nullptr; 250 148 } 251 149 252 150 const ast::AsmDecl * visit( const ast::AsmDecl * node ) override final { 253 auto decl = new AsmDecl( get<AsmStmt>().accept1( node->stmt ) ); 254 declPostamble( decl, node ); 151 (void)node; 255 152 return nullptr; 256 153 } 257 154 258 155 const ast::StaticAssertDecl * visit( const ast::StaticAssertDecl * node ) override final { 259 auto decl = new StaticAssertDecl( 260 get<Expression>().accept1( node->cond ), 261 get<ConstantExpr>().accept1( node->msg ) 262 ); 263 declPostamble( decl, node ); 264 return nullptr; 265 } 266 267 const ast::Stmt * stmtPostamble( Statement * stmt, const ast::Stmt * node ) { 268 stmt->location = node->location; 269 stmt->labels = makeLabelL( stmt, node->labels ); 270 this->node = stmt; 156 (void)node; 271 157 return nullptr; 272 158 } … … 274 160 const ast::CompoundStmt * visit( const ast::CompoundStmt * node ) override final { 275 161 auto stmt = new CompoundStmt( get<Statement>().acceptL( node->kids ) ); 276 stmtPostamble( stmt, node ); 162 stmt->location = node->location; 163 stmt->labels = makeLabelL( stmt, node->labels ); 164 this->node = stmt; 277 165 return nullptr; 278 166 } … … 280 168 const ast::Stmt * visit( const ast::ExprStmt * node ) override final { 281 169 auto stmt = new ExprStmt( get<Expression>().accept1( node->expr ) ); 282 return stmtPostamble( stmt, node ); 170 stmt->location = node->location; 171 stmt->labels = makeLabelL( stmt, node->labels ); 172 this->node = stmt; 173 return nullptr; 283 174 } 284 175 … … 292 183 makeLabelL( nullptr, node->gotoLabels ) // What are these labelling? 293 184 ); 294 return stmtPostamble( stmt, node ); 185 stmt->location = node->location; 186 stmt->labels = makeLabelL( stmt, node->labels ); 187 this->node = stmt; 188 return nullptr; 295 189 } 296 190 297 191 const ast::Stmt * visit( const ast::DirectiveStmt * node ) override final { 298 192 auto stmt = new DirectiveStmt( node->directive ); 299 return stmtPostamble( stmt, node ); 193 stmt->location = node->location; 194 stmt->labels = makeLabelL( stmt, node->labels ); 195 this->node = stmt; 196 return nullptr; 300 197 } 301 198 … … 307 204 get<Statement>().acceptL( node->inits ) 308 205 ); 309 return stmtPostamble( stmt, node ); 206 stmt->location = node->location; 207 stmt->labels = makeLabelL( stmt, node->labels ); 208 this->node = stmt; 209 return nullptr; 310 210 } 311 211 … … 315 215 get<Statement>().acceptL( node->stmts ) 316 216 ); 317 return stmtPostamble( stmt, node ); 217 stmt->location = node->location; 218 stmt->labels = makeLabelL( stmt, node->labels ); 219 this->node = stmt; 220 return nullptr; 318 221 } 319 222 … … 324 227 node->isDefault() 325 228 ); 326 return stmtPostamble( stmt, node ); 229 stmt->location = node->location; 230 stmt->labels = makeLabelL( stmt, node->labels ); 231 this->node = stmt; 232 return nullptr; 327 233 } 328 234 … … 335 241 node->isDoWhile 336 242 ); 337 return stmtPostamble( stmt, node ); 243 stmt->location = node->location; 244 stmt->labels = makeLabelL( stmt, node->labels ); 245 this->node = stmt; 246 return nullptr; 338 247 } 339 248 … … 345 254 get<Statement>().accept1( node->body ) 346 255 ); 347 return stmtPostamble( stmt, node ); 256 stmt->location = node->location; 257 stmt->labels = makeLabelL( stmt, node->labels ); 258 this->node = stmt; 259 return nullptr; 348 260 } 349 261 … … 374 286 stmt->target = makeLabel( stmt, node->target ); 375 287 } 376 return stmtPostamble( stmt, node ); 288 stmt->location = node->location; 289 stmt->labels = makeLabelL( stmt, node->labels ); 290 this->node = stmt; 291 return nullptr; 377 292 } 378 293 379 294 const ast::Stmt * visit( const ast::ReturnStmt * node ) override final { 380 295 auto stmt = new ReturnStmt( get<Expression>().accept1( node->expr ) ); 381 return stmtPostamble( stmt, node ); 296 stmt->location = node->location; 297 stmt->labels = makeLabelL( stmt, node->labels ); 298 this->node = stmt; 299 return nullptr; 382 300 } 383 301 … … 399 317 get<Expression>().accept1( node->target ) 400 318 ); 401 return stmtPostamble( stmt, node ); 319 stmt->location = node->location; 320 stmt->labels = makeLabelL( stmt, node->labels ); 321 this->node = stmt; 322 return nullptr; 402 323 } 403 324 … … 409 330 get<FinallyStmt>().accept1( node->finally ) 410 331 ); 411 return stmtPostamble( stmt, node ); 332 stmt->location = node->location; 333 stmt->labels = makeLabelL( stmt, node->labels ); 334 this->node = stmt; 335 return nullptr; 412 336 } 413 337 … … 430 354 get<Statement>().accept1( node->body ) 431 355 ); 432 return stmtPostamble( stmt, node ); 356 stmt->location = node->location; 357 stmt->labels = makeLabelL( stmt, node->labels ); 358 this->node = stmt; 359 return nullptr; 433 360 } 434 361 435 362 const ast::Stmt * visit( const ast::FinallyStmt * node ) override final { 436 363 auto stmt = new FinallyStmt( get<CompoundStmt>().accept1( node->body ) ); 437 return stmtPostamble( stmt, node ); 364 stmt->location = node->location; 365 stmt->labels = makeLabelL( stmt, node->labels ); 366 this->node = stmt; 367 return nullptr; 438 368 } 439 369 … … 443 373 for ( auto clause : node->clauses ) { 444 374 stmt->clauses.push_back({{ 445 get<Expression>().accept1( clause.target.func ),446 get<Expression>().acceptL( clause.target.arg s ),375 get<Expression>().accept1( clause.target.function ), 376 get<Expression>().acceptL( clause.target.arguments ), 447 377 }, 448 378 get<Statement>().accept1( clause.stmt ), … … 459 389 get<Expression>().accept1( node->orElse.cond ), 460 390 }; 461 return stmtPostamble( stmt, node ); 391 stmt->location = node->location; 392 stmt->labels = makeLabelL( stmt, node->labels ); 393 this->node = stmt; 394 return nullptr; 462 395 } 463 396 … … 467 400 get<Statement>().accept1( node->stmt ) 468 401 ); 469 return stmtPostamble( stmt, node ); 402 stmt->location = node->location; 403 stmt->labels = makeLabelL( stmt, node->labels ); 404 this->node = stmt; 405 return nullptr; 470 406 } 471 407 472 408 const ast::NullStmt * visit( const ast::NullStmt * node ) override final { 473 409 auto stmt = new NullStmt(); 474 stmtPostamble( stmt, node ); 410 stmt->location = node->location; 411 stmt->labels = makeLabelL( stmt, node->labels ); 412 this->node = stmt; 475 413 return nullptr; 476 414 } … … 478 416 const ast::Stmt * visit( const ast::DeclStmt * node ) override final { 479 417 auto stmt = new DeclStmt( get<Declaration>().accept1( node->decl ) ); 480 return stmtPostamble( stmt, node ); 418 stmt->location = node->location; 419 stmt->labels = makeLabelL( stmt, node->labels ); 420 this->node = stmt; 421 return nullptr; 481 422 } 482 423 … … 486 427 } 487 428 488 TypeSubstitution * convertTypeSubstitution(const ast::TypeSubstitution * src) {489 490 TypeSubstitution *rslt = new TypeSubstitution();491 492 for (decltype(src->begin()) src_i = src->begin(); src_i != src->end(); src_i++) {493 rslt->add( src_i->first,494 get<Type>().accept1(src_i->second) );495 }496 497 for (decltype(src->beginVar()) src_i = src->beginVar(); src_i != src->endVar(); src_i++) {498 rslt->addVar( src_i->first,499 get<Expression>().accept1(src_i->second) );500 }501 502 return rslt;503 }504 505 void convertInferUnion(std::map<UniqueId,ParamEntry> &tgtInferParams,506 std::vector<UniqueId> &tgtResnSlots,507 const ast::Expr::InferUnion &srcInferred ) {508 509 assert( tgtInferParams.empty() );510 assert( tgtResnSlots.empty() );511 512 if ( srcInferred.mode == ast::Expr::InferUnion::Params ) {513 const ast::InferredParams &srcParams = srcInferred.inferParamsConst();514 for (auto srcParam : srcParams) {515 tgtInferParams[srcParam.first] = ParamEntry(516 srcParam.second.decl,517 get<Type>().accept1(srcParam.second.actualType),518 get<Type>().accept1(srcParam.second.formalType),519 get<Expression>().accept1(srcParam.second.expr)520 );521 }522 } else if ( srcInferred.mode == ast::Expr::InferUnion::Slots ) {523 const ast::ResnSlots &srcSlots = srcInferred.resnSlotsConst();524 for (auto srcSlot : srcSlots) {525 tgtResnSlots.push_back(srcSlot);526 }527 }528 }529 530 Expression * visitBaseExpr(const ast::Expr * src, Expression * tgt) {531 532 tgt->location = src->location;533 534 tgt->result = get<Type>().accept1(src->result);535 tgt->env = convertTypeSubstitution(src->env);536 537 tgt->extension = src->extension;538 convertInferUnion(tgt->inferParams, tgt->resnSlots, src->inferred);539 540 return tgt;541 }542 543 429 const ast::Expr * visit( const ast::ApplicationExpr * node ) override final { 544 auto expr = visitBaseExpr( node, 545 new ApplicationExpr( 546 get<Expression>().accept1(node->func), 547 get<Expression>().acceptL(node->args) 548 ) 549 ); 550 this->node = expr; 430 (void)node; 551 431 return nullptr; 552 432 } 553 433 554 434 const ast::Expr * visit( const ast::UntypedExpr * node ) override final { 555 auto expr = visitBaseExpr( node, 556 new UntypedExpr( 557 get<Expression>().accept1(node->func), 558 get<Expression>().acceptL(node->args) 559 ) 560 ); 561 this->node = expr; 435 (void)node; 562 436 return nullptr; 563 437 } 564 438 565 439 const ast::Expr * visit( const ast::NameExpr * node ) override final { 566 auto expr = visitBaseExpr( node, 567 new NameExpr( 568 node->name 569 ) 570 ); 571 this->node = expr; 440 (void)node; 572 441 return nullptr; 573 442 } … … 1367 1236 getAccept1<ast::Expr>(old_i->second) ); 1368 1237 } 1369 1370 return rslt; 1371 } 1372 1373 void convertInferUnion(ast::Expr::InferUnion &newInferred, 1374 const std::map<UniqueId,ParamEntry> &oldInferParams, 1375 const std::vector<UniqueId> &oldResnSlots) { 1376 1377 assert( oldInferParams.empty() || oldResnSlots.empty() ); 1378 assert( newInferred.mode == ast::Expr::InferUnion::Empty ); 1379 1380 if ( !oldInferParams.empty() ) { 1381 ast::InferredParams &tgt = newInferred.inferParams(); 1382 for (auto old : oldInferParams) { 1383 tgt[old.first] = ast::ParamEntry( 1384 old.second.decl, 1385 getAccept1<ast::Type>(old.second.actualType), 1386 getAccept1<ast::Type>(old.second.formalType), 1387 getAccept1<ast::Expr>(old.second.expr) 1388 ); 1389 } 1390 } else if ( !oldResnSlots.empty() ) { 1391 ast::ResnSlots &tgt = newInferred.resnSlots(); 1392 for (auto old : oldResnSlots) { 1393 tgt.push_back(old); 1394 } 1395 } 1238 } 1239 1240 void convertInferUnion(ast::Expr::InferUnion &nwInferred, InferredParams oldInferParams, const std::vector<UniqueId> &oldResnSlots) { 1241 1242 (void) nwInferred; 1243 (void) oldInferParams; 1244 (void) oldResnSlots; 1245 1246 // TODO 1396 1247 } 1397 1248 … … 1407 1258 } 1408 1259 1409 virtual void visit( ApplicationExpr * old ) override final { 1410 this->node = visitBaseExpr( old, 1411 new ast::ApplicationExpr( 1412 old->location, 1413 GET_ACCEPT_1(function, Expr), 1414 GET_ACCEPT_V(args, Expr) 1415 ) 1416 ); 1417 } 1418 1419 virtual void visit( UntypedExpr * old ) override final { 1420 this->node = visitBaseExpr( old, 1421 new ast::UntypedExpr( 1422 old->location, 1423 GET_ACCEPT_1(function, Expr), 1424 GET_ACCEPT_V(args, Expr) 1425 ) 1426 ); 1260 virtual void visit( ApplicationExpr * ) override final { 1261 // TODO 1262 } 1263 1264 virtual void visit( UntypedExpr * ) override final { 1265 // TODO 1427 1266 } 1428 1267 … … 1436 1275 } 1437 1276 1438 virtual void visit( CastExpr * old ) override final { 1439 this->node = visitBaseExpr( old, 1440 new ast::CastExpr( 1441 old->location, 1442 nullptr, // cast's "to" type is expr's result type; converted in visitBaseExpr 1443 old->isGenerated ? ast::GeneratedCast : ast::ExplicitCast 1444 ) 1445 ); 1277 virtual void visit( CastExpr * ) override final { 1278 // TODO ... (rest) 1446 1279 } 1447 1280 -
src/AST/Decl.cpp
ra83044fb rd148778 81 81 auto result = eval( init->value ); 82 82 if ( ! result.second ) { 83 SemanticError( init->location, ::toString( "Non-constexpr in initialization of "83 SemanticError( init->location, toString( "Non-constexpr in initialization of " 84 84 "enumerator: ", field ) ); 85 85 } … … 87 87 } 88 88 if ( enumValues.count( field->name ) != 0 ) { 89 SemanticError( location, ::toString( "Enum ", name, " has multiple members with the " "name ", field->name ) );89 SemanticError( location, toString( "Enum ", name, " has multiple members with the " "name ", field->name ) ); 90 90 } 91 91 enumValues[ field->name ] = crntVal; -
src/AST/Decl.hpp
ra83044fb rd148778 329 329 class StaticAssertDecl : public Decl { 330 330 public: 331 ptr<Expr> cond ;331 ptr<Expr> condition; 332 332 ptr<ConstantExpr> msg; // string literal 333 333 334 334 StaticAssertDecl( const CodeLocation & loc, const Expr * condition, const ConstantExpr * msg ) 335 : Decl( loc, "", {}, {} ), cond ( condition ), msg( msg ) {}335 : Decl( loc, "", {}, {} ), condition( condition ), msg( msg ) {} 336 336 337 337 const StaticAssertDecl * accept( Visitor &v ) const override { return v.visit( this ); } -
src/AST/Expr.cpp
ra83044fb rd148778 22 22 #include "Stmt.hpp" 23 23 #include "Type.hpp" 24 #include "Common/utility.h"25 24 #include "Common/SemanticError.h" 26 25 #include "GenPoly/Lvalue.h" // for referencesPermissable -
src/AST/Expr.hpp
ra83044fb rd148778 106 106 case Params: assert(!"Cannot return to resnSlots from Params"); 107 107 } 108 return *((ResnSlots*)nullptr);109 }110 111 const ResnSlots& resnSlotsConst() const {112 if (mode == Slots) {113 return data.resnSlots;114 }115 assert(!"Mode was not already resnSlots");116 return *((ResnSlots*)nullptr);117 108 } 118 109 … … 123 114 case Params: return data.inferParams; 124 115 } 125 return *((InferredParams*)nullptr);126 }127 128 const InferredParams& inferParamsConst() const {129 if (mode == Params) {130 return data.inferParams;131 }132 assert(!"Mode was not already Params");133 return *((InferredParams*)nullptr);134 116 } 135 117 }; … … 521 503 }; 522 504 523 /// The application of a function to a set of parameters, along with a set of copy constructor 505 /// The application of a function to a set of parameters, along with a set of copy constructor 524 506 /// calls, one for each argument 525 507 class ImplicitCopyCtorExpr final : public Expr { … … 621 603 }; 622 604 623 /// A multiple- or mass-assignment operation, or a tuple ctor/dtor expression. 624 /// multiple-assignment: both sides of the assignment have tuple type, 605 /// A multiple- or mass-assignment operation, or a tuple ctor/dtor expression. 606 /// multiple-assignment: both sides of the assignment have tuple type, 625 607 /// e.g. `[a, b, c] = [d, e, f];` 626 608 /// mass-assignment: left-hand side has tuple type and right-hand side does not: … … 630 612 ptr<StmtExpr> stmtExpr; 631 613 632 TupleAssignExpr( 633 const CodeLocation & loc, std::vector<ptr<Expr>> && assigns, 614 TupleAssignExpr( 615 const CodeLocation & loc, std::vector<ptr<Expr>> && assigns, 634 616 std::vector<ptr<ObjectDecl>> && tempDecls ); 635 617 636 618 const Expr * accept( Visitor & v ) const override { return v.visit( this ); } 637 619 private: -
src/AST/Fwd.hpp
ra83044fb rd148778 131 131 class TypeSubstitution; 132 132 133 std::string toString( const Node * ); 134 135 template < typename ... Params > 136 std::string toString( const Params & ... params ); 137 133 138 typedef unsigned int UniqueId; 134 139 -
src/AST/Node.cpp
ra83044fb rd148778 16 16 #include "Node.hpp" 17 17 #include "Fwd.hpp" 18 19 #include <iostream>20 18 21 19 #include "Attribute.hpp" … … 44 42 assign( r ); 45 43 return r; 46 }47 48 std::ostream & ast::operator<< ( std::ostream & out, const ast::Node * node ) {49 (void)node;50 #warning unimplemented51 assertf(false, "Unimplemented");52 return out;53 44 } 54 45 -
src/AST/Pass.impl.hpp
ra83044fb rd148778 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ast::Pass.impl.hpp --7 // Pass.impl.hpp -- 8 8 // 9 9 // Author : Thierry Delisle … … 121 121 template< typename pass_t > 122 122 template< typename node_t > 123 auto ast::Pass< pass_t >::call_accept( const node_t * node )123 auto Pass< pass_t >::call_accept( const node_t * node ) 124 124 -> typename std::enable_if< 125 125 !std::is_base_of<ast::Expr, node_t>::value && … … 139 139 140 140 template< typename pass_t > 141 const ast::Expr * ast::Pass< pass_t >::call_accept( const ast::Expr * expr ) {141 const ast::Expr * Pass< pass_t >::call_accept( const ast::Expr * expr ) { 142 142 __pedantic_pass_assert( __visit_children() ); 143 143 __pedantic_pass_assert( expr ); … … 152 152 153 153 template< typename pass_t > 154 const ast::Stmt * ast::Pass< pass_t >::call_accept( const ast::Stmt * stmt ) {154 const ast::Stmt * Pass< pass_t >::call_accept( const ast::Stmt * stmt ) { 155 155 __pedantic_pass_assert( __visit_children() ); 156 156 __pedantic_pass_assert( stmt ); … … 204 204 template< typename pass_t > 205 205 template< template <class...> class container_t > 206 container_t< ptr<Stmt> > ast::Pass< pass_t >::call_accept( const container_t< ptr<Stmt> > & statements ) {206 container_t< ptr<Stmt> > Pass< pass_t >::call_accept( const container_t< ptr<Stmt> > & statements ) { 207 207 __pedantic_pass_assert( __visit_children() ); 208 208 if( statements.empty() ) return {}; … … 270 270 template< typename pass_t > 271 271 template< template <class...> class container_t, typename node_t > 272 container_t< ast::ptr<node_t> > ast::Pass< pass_t >::call_accept( const container_t< ast::ptr<node_t> > & container ) {272 container_t< ast::ptr<node_t> > Pass< pass_t >::call_accept( const container_t< ast::ptr<node_t> > & container ) { 273 273 __pedantic_pass_assert( __visit_children() ); 274 274 if( container.empty() ) return {}; … … 301 301 template< typename pass_t > 302 302 template<typename node_t, typename parent_t, typename child_t> 303 void ast::Pass< pass_t >::maybe_accept(303 void Pass< pass_t >::maybe_accept( 304 304 const node_t * & parent, 305 305 child_t parent_t::*child … … 571 571 __pass::indexer::addType( pass, 0, node ); 572 572 573 VISIT( maybe_accept( node, &TypedefDecl::assertions ); )573 maybe_accept( node, &TypedefDecl::assertions ); 574 574 575 575 VISIT_END( Decl, node ); … … 596 596 597 597 VISIT( 598 maybe_accept( node, &StaticAssertDecl::cond );599 maybe_accept( node, &StaticAssertDecl::msg );598 maybe_accept( node, &StaticAssertDecl::condition ); 599 maybe_accept( node, &StaticAssertDecl::msg ); 600 600 ) 601 601 … … 626 626 // ExprStmt 627 627 template< typename pass_t > 628 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ExprStmt * node ) {628 const ast::Stmt * ast::Pass< pass_t >::visit( const ExprStmt * node ) { 629 629 VISIT_START( node ); 630 630 … … 666 666 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::IfStmt * node ) { 667 667 VISIT_START( node ); 668 669 668 VISIT({ 670 669 // if statements introduce a level of scope (for the initialization) … … 675 674 maybe_accept( node, &IfStmt::elsePart ); 676 675 }) 677 678 676 VISIT_END( Stmt, node ); 679 677 } … … 682 680 // WhileStmt 683 681 template< typename pass_t > 684 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::WhileStmt * node ) {682 const ast::Stmt * ast::Pass< pass_t >::visit( const WhileStmt * node ) { 685 683 VISIT_START( node ); 686 684 … … 835 833 // } 836 834 837 VISIT({838 std::vector<WaitForStmt::Clause> new_clauses;839 new_clauses.reserve( node->clauses.size() );840 bool mutated = false;841 for( const auto & clause : node->clauses ) {842 843 Expr * func = clause.target.func ? clause.target.func->accept(*this) : nullptr;844 if(func != clause.target.func) mutated = true;845 846 std::vector<ptr<Expr>> new_args;847 new_args.reserve(clause.target.args.size());848 for( const auto & arg : clause.target.args ) {849 auto a = arg->accept(*this);850 new_args.push_back( a );851 if( a != arg ) mutated = true;852 }853 854 Stmt * stmt = clause.stmt ? clause.stmt->accept(*this) : nullptr;855 if(stmt != clause.stmt) mutated = true;856 857 Expr * cond = clause.cond ? clause.cond->accept(*this) : nullptr;858 if(cond != clause.cond) mutated = true;859 860 new_clauses.push_back( WaitForStmt::Clause{ {func, std::move(new_args) }, stmt, cond } );861 }862 863 if(mutated) {864 auto n = mutate(node);865 n->clauses = std::move( new_clauses );866 node = n;867 }868 })869 870 835 #define maybe_accept(field) \ 871 836 if(node->field) { \ … … 945 910 } 946 911 947 //-------------------------------------------------------------------------- 948 // ApplicationExpr 949 template< typename pass_t > 950 const ast::Expr * ast::Pass< pass_t >::visit( const ast::ApplicationExpr * node ) { 951 VISIT_START( node ); 952 953 VISIT( 954 { 955 guard_indexer guard { *this }; 956 maybe_accept( node, &ApplicationExpr::result ); 957 } 958 maybe_accept( node, &ApplicationExpr::func ); 959 maybe_accept( node, &ApplicationExpr::args ); 960 ) 961 962 VISIT_END( Expr, node ); 963 } 964 965 //-------------------------------------------------------------------------- 966 // UntypedExpr 967 template< typename pass_t > 968 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UntypedExpr * node ) { 969 VISIT_START( node ); 970 971 VISIT( 972 { 973 guard_indexer guard { *this }; 974 maybe_accept( node, &UntypedExpr::result ); 975 } 976 977 maybe_accept( node, &UntypedExpr::args ); 978 ) 979 980 VISIT_END( Expr, node ); 981 } 982 983 //-------------------------------------------------------------------------- 984 // NameExpr 985 template< typename pass_t > 986 const ast::Expr * ast::Pass< pass_t >::visit( const ast::NameExpr * node ) { 987 VISIT_START( node ); 988 989 VISIT({ 990 guard_indexer guard { *this }; 991 maybe_accept( node, &NameExpr::result ); 992 }) 993 994 VISIT_END( Expr, node ); 995 } 996 997 //-------------------------------------------------------------------------- 998 // CastExpr 999 template< typename pass_t > 1000 const ast::Expr * ast::Pass< pass_t >::visit( const ast::CastExpr * node ) { 1001 VISIT_START( node ); 1002 1003 VISIT({ 1004 guard_indexer guard { *this }; 1005 maybe_accept( node, &CastExpr::result ); 1006 } 1007 maybe_accept( node, &CastExpr::arg ); 1008 ) 1009 1010 VISIT_END( Expr, node ); 1011 } 1012 1013 //-------------------------------------------------------------------------- 1014 // KeywordCastExpr 1015 template< typename pass_t > 1016 const ast::Expr * ast::Pass< pass_t >::visit( const ast::KeywordCastExpr * node ) { 1017 VISIT_START( node ); 1018 1019 VISIT({ 1020 guard_indexer guard { *this }; 1021 maybe_accept( node, &KeywordCastExpr::result ); 1022 } 1023 maybe_accept( node, &KeywordCastExpr::arg ); 1024 ) 1025 1026 VISIT_END( Expr, node ); 1027 } 1028 1029 //-------------------------------------------------------------------------- 1030 // VirtualCastExpr 1031 template< typename pass_t > 1032 const ast::Expr * ast::Pass< pass_t >::visit( const ast::VirtualCastExpr * node ) { 1033 VISIT_START( node ); 1034 1035 VISIT({ 1036 guard_indexer guard { *this }; 1037 maybe_accept( node, &VirtualCastExpr::result ); 1038 } 1039 maybe_accept( node, &VirtualCastExpr::arg ); 1040 ) 1041 1042 VISIT_END( Expr, node ); 1043 } 1044 1045 //-------------------------------------------------------------------------- 1046 // AddressExpr 1047 template< typename pass_t > 1048 const ast::Expr * ast::Pass< pass_t >::visit( const ast::AddressExpr * node ) { 1049 VISIT_START( node ); 1050 1051 VISIT({ 1052 guard_indexer guard { *this }; 1053 maybe_accept( node, &AddressExpr::result ); 1054 } 1055 maybe_accept( node, &AddressExpr::arg ); 1056 ) 1057 1058 VISIT_END( Expr, node ); 1059 } 1060 1061 //-------------------------------------------------------------------------- 1062 // LabelAddressExpr 1063 template< typename pass_t > 1064 const ast::Expr * ast::Pass< pass_t >::visit( const ast::LabelAddressExpr * node ) { 1065 VISIT_START( node ); 1066 1067 VISIT({ 1068 guard_indexer guard { *this }; 1069 maybe_accept( node, &LabelAddressExpr::result ); 1070 }) 1071 1072 VISIT_END( Expr, node ); 1073 } 1074 1075 //-------------------------------------------------------------------------- 1076 // UntypedMemberExpr 1077 template< typename pass_t > 1078 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UntypedMemberExpr * node ) { 1079 VISIT_START( node ); 1080 1081 VISIT({ 1082 guard_indexer guard { *this }; 1083 maybe_accept( node, &UntypedMemberExpr::result ); 1084 } 1085 maybe_accept( node, &UntypedMemberExpr::aggregate ); 1086 maybe_accept( node, &UntypedMemberExpr::member ); 1087 ) 1088 1089 VISIT_END( Expr, node ); 1090 } 1091 1092 //-------------------------------------------------------------------------- 1093 // MemberExpr 1094 template< typename pass_t > 1095 const ast::Expr * ast::Pass< pass_t >::visit( const ast::MemberExpr * node ) { 1096 VISIT_START( node ); 1097 1098 VISIT({ 1099 guard_indexer guard { *this }; 1100 maybe_accept( node, &MemberExpr::result ); 1101 } 1102 maybe_accept( node, &MemberExpr::aggregate ); 1103 ) 1104 1105 VISIT_END( Expr, node ); 1106 } 1107 1108 //-------------------------------------------------------------------------- 1109 // VariableExpr 1110 template< typename pass_t > 1111 const ast::Expr * ast::Pass< pass_t >::visit( const ast::VariableExpr * node ) { 1112 VISIT_START( node ); 1113 1114 VISIT({ 1115 guard_indexer guard { *this }; 1116 maybe_accept( node, &VariableExpr::result ); 1117 }) 1118 1119 VISIT_END( Expr, node ); 1120 } 1121 1122 //-------------------------------------------------------------------------- 1123 // ConstantExpr 1124 template< typename pass_t > 1125 const ast::Expr * ast::Pass< pass_t >::visit( const ast::ConstantExpr * node ) { 1126 VISIT_START( node ); 1127 1128 VISIT({ 1129 guard_indexer guard { *this }; 1130 maybe_accept( node, &ConstantExpr::result ); 1131 }) 1132 1133 VISIT_END( Expr, node ); 1134 } 1135 1136 //-------------------------------------------------------------------------- 1137 // SizeofExpr 1138 template< typename pass_t > 1139 const ast::Expr * ast::Pass< pass_t >::visit( const ast::SizeofExpr * node ) { 1140 VISIT_START( node ); 1141 1142 VISIT({ 1143 guard_indexer guard { *this }; 1144 maybe_accept( node, &SizeofExpr::result ); 1145 } 1146 if ( node->type ) { 1147 maybe_accept( node, &SizeofExpr::type ); 1148 } else { 1149 maybe_accept( node, &SizeofExpr::expr ); 1150 } 1151 ) 1152 1153 VISIT_END( Expr, node ); 1154 } 1155 1156 //-------------------------------------------------------------------------- 1157 // AlignofExpr 1158 template< typename pass_t > 1159 const ast::Expr * ast::Pass< pass_t >::visit( const ast::AlignofExpr * node ) { 1160 VISIT_START( node ); 1161 1162 VISIT({ 1163 guard_indexer guard { *this }; 1164 maybe_accept( node, &AlignofExpr::result ); 1165 } 1166 if ( node->type ) { 1167 maybe_accept( node, &AlignofExpr::type ); 1168 } else { 1169 maybe_accept( node, &AlignofExpr::expr ); 1170 } 1171 ) 1172 1173 VISIT_END( Expr, node ); 1174 } 1175 1176 //-------------------------------------------------------------------------- 1177 // UntypedOffsetofExpr 1178 template< typename pass_t > 1179 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UntypedOffsetofExpr * node ) { 1180 VISIT_START( node ); 1181 1182 VISIT({ 1183 guard_indexer guard { *this }; 1184 maybe_accept( node, &UntypedOffsetofExpr::result ); 1185 } 1186 maybe_accept( node, &UntypedOffsetofExpr::type ); 1187 ) 1188 1189 VISIT_END( Expr, node ); 1190 } 1191 1192 //-------------------------------------------------------------------------- 1193 // OffsetofExpr 1194 template< typename pass_t > 1195 const ast::Expr * ast::Pass< pass_t >::visit( const ast::OffsetofExpr * node ) { 1196 VISIT_START( node ); 1197 1198 VISIT({ 1199 guard_indexer guard { *this }; 1200 maybe_accept( node, &OffsetofExpr::result ); 1201 } 1202 maybe_accept( node, &OffsetofExpr::type ); 1203 ) 1204 1205 VISIT_END( Expr, node ); 1206 } 1207 1208 //-------------------------------------------------------------------------- 1209 // OffsetPackExpr 1210 template< typename pass_t > 1211 const ast::Expr * ast::Pass< pass_t >::visit( const ast::OffsetPackExpr * node ) { 1212 VISIT_START( node ); 1213 1214 VISIT({ 1215 guard_indexer guard { *this }; 1216 maybe_accept( node, &OffsetPackExpr::result ); 1217 } 1218 maybe_accept( node, &OffsetPackExpr::type ); 1219 ) 1220 1221 VISIT_END( Expr, node ); 1222 } 1223 1224 //-------------------------------------------------------------------------- 1225 // LogicalExpr 1226 template< typename pass_t > 1227 const ast::Expr * ast::Pass< pass_t >::visit( const ast::LogicalExpr * node ) { 1228 VISIT_START( node ); 1229 1230 VISIT({ 1231 guard_indexer guard { *this }; 1232 maybe_accept( node, &LogicalExpr::result ); 1233 } 1234 maybe_accept( node, &LogicalExpr::arg1 ); 1235 maybe_accept( node, &LogicalExpr::arg2 ); 1236 ) 1237 1238 VISIT_END( Expr, node ); 1239 } 1240 1241 //-------------------------------------------------------------------------- 1242 // ConditionalExpr 1243 template< typename pass_t > 1244 const ast::Expr * ast::Pass< pass_t >::visit( const ast::ConditionalExpr * node ) { 1245 VISIT_START( node ); 1246 1247 VISIT({ 1248 guard_indexer guard { *this }; 1249 maybe_accept( node, &ConditionalExpr::result ); 1250 } 1251 maybe_accept( node, &ConditionalExpr::arg1 ); 1252 maybe_accept( node, &ConditionalExpr::arg2 ); 1253 maybe_accept( node, &ConditionalExpr::arg3 ); 1254 ) 1255 1256 VISIT_END( Expr, node ); 1257 } 1258 1259 //-------------------------------------------------------------------------- 1260 // CommaExpr 1261 template< typename pass_t > 1262 const ast::Expr * ast::Pass< pass_t >::visit( const ast::CommaExpr * node ) { 1263 VISIT_START( node ); 1264 1265 VISIT({ 1266 guard_indexer guard { *this }; 1267 maybe_accept( node, &CommaExpr::result ); 1268 } 1269 maybe_accept( node, &CommaExpr::arg1 ); 1270 maybe_accept( node, &CommaExpr::arg2 ); 1271 ) 1272 1273 VISIT_END( Expr, node ); 1274 } 1275 1276 //-------------------------------------------------------------------------- 1277 // TypeExpr 1278 template< typename pass_t > 1279 const ast::Expr * ast::Pass< pass_t >::visit( const ast::TypeExpr * node ) { 1280 VISIT_START( node ); 1281 1282 VISIT({ 1283 guard_indexer guard { *this }; 1284 maybe_accept( node, &TypeExpr::result ); 1285 } 1286 maybe_accept( node, &TypeExpr::type ); 1287 ) 1288 1289 VISIT_END( Expr, node ); 1290 } 1291 1292 //-------------------------------------------------------------------------- 1293 // AsmExpr 1294 template< typename pass_t > 1295 const ast::Expr * ast::Pass< pass_t >::visit( const ast::AsmExpr * node ) { 1296 VISIT_START( node ); 1297 1298 VISIT({ 1299 guard_indexer guard { *this }; 1300 maybe_accept( node, &AsmExpr::result ); 1301 } 1302 maybe_accept( node, &AsmExpr::inout ); 1303 maybe_accept( node, &AsmExpr::constraint ); 1304 maybe_accept( node, &AsmExpr::operand ); 1305 ) 1306 1307 VISIT_END( Expr, node ); 1308 } 1309 1310 //-------------------------------------------------------------------------- 1311 // ImplicitCopyCtorExpr 1312 template< typename pass_t > 1313 const ast::Expr * ast::Pass< pass_t >::visit( const ast::ImplicitCopyCtorExpr * node ) { 1314 VISIT_START( node ); 1315 1316 VISIT({ 1317 guard_indexer guard { *this }; 1318 maybe_accept( node, &ImplicitCopyCtorExpr::result ); 1319 } 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 ) 1325 1326 VISIT_END( Expr, node ); 1327 } 1328 1329 //-------------------------------------------------------------------------- 1330 // ConstructorExpr 1331 template< typename pass_t > 1332 const ast::Expr * ast::Pass< pass_t >::visit( const ast::ConstructorExpr * node ) { 1333 VISIT_START( node ); 1334 1335 VISIT({ 1336 guard_indexer guard { *this }; 1337 maybe_accept( node, &ConstructorExpr::result ); 1338 } 1339 maybe_accept( node, &ConstructorExpr::callExpr ); 1340 ) 1341 1342 VISIT_END( Expr, node ); 1343 } 1344 1345 //-------------------------------------------------------------------------- 1346 // CompoundLiteralExpr 1347 template< typename pass_t > 1348 const ast::Expr * ast::Pass< pass_t >::visit( const ast::CompoundLiteralExpr * node ) { 1349 VISIT_START( node ); 1350 1351 VISIT({ 1352 guard_indexer guard { *this }; 1353 maybe_accept( node, &CompoundLiteralExpr::result ); 1354 } 1355 maybe_accept( node, &CompoundLiteralExpr::init ); 1356 ) 1357 1358 VISIT_END( Expr, node ); 1359 } 1360 1361 //-------------------------------------------------------------------------- 1362 // RangeExpr 1363 template< typename pass_t > 1364 const ast::Expr * ast::Pass< pass_t >::visit( const ast::RangeExpr * node ) { 1365 VISIT_START( node ); 1366 1367 VISIT({ 1368 guard_indexer guard { *this }; 1369 maybe_accept( node, &RangeExpr::result ); 1370 } 1371 maybe_accept( node, &RangeExpr::low ); 1372 maybe_accept( node, &RangeExpr::high ); 1373 ) 1374 1375 VISIT_END( Expr, node ); 1376 } 1377 1378 //-------------------------------------------------------------------------- 1379 // UntypedTupleExpr 1380 template< typename pass_t > 1381 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UntypedTupleExpr * node ) { 1382 VISIT_START( node ); 1383 1384 VISIT({ 1385 guard_indexer guard { *this }; 1386 maybe_accept( node, &UntypedTupleExpr::result ); 1387 } 1388 maybe_accept( node, &UntypedTupleExpr::exprs ); 1389 ) 1390 1391 VISIT_END( Expr, node ); 1392 } 1393 1394 //-------------------------------------------------------------------------- 1395 // TupleExpr 1396 template< typename pass_t > 1397 const ast::Expr * ast::Pass< pass_t >::visit( const ast::TupleExpr * node ) { 1398 VISIT_START( node ); 1399 1400 VISIT({ 1401 guard_indexer guard { *this }; 1402 maybe_accept( node, &TupleExpr::result ); 1403 } 1404 maybe_accept( node, &TupleExpr::exprs ); 1405 ) 1406 1407 VISIT_END( Expr, node ); 1408 } 1409 1410 //-------------------------------------------------------------------------- 1411 // TupleIndexExpr 1412 template< typename pass_t > 1413 const ast::Expr * ast::Pass< pass_t >::visit( const ast::TupleIndexExpr * node ) { 1414 VISIT_START( node ); 1415 1416 VISIT({ 1417 guard_indexer guard { *this }; 1418 maybe_accept( node, &TupleIndexExpr::result ); 1419 } 1420 maybe_accept( node, &TupleIndexExpr::tuple ); 1421 ) 1422 1423 VISIT_END( Expr, node ); 1424 } 1425 1426 //-------------------------------------------------------------------------- 1427 // TupleAssignExpr 1428 template< typename pass_t > 1429 const ast::Expr * ast::Pass< pass_t >::visit( const ast::TupleAssignExpr * node ) { 1430 VISIT_START( node ); 1431 1432 VISIT({ 1433 guard_indexer guard { *this }; 1434 maybe_accept( node, &TupleAssignExpr::result ); 1435 } 1436 maybe_accept( node, &TupleAssignExpr::stmtExpr ); 1437 ) 1438 1439 VISIT_END( Expr, node ); 1440 } 1441 1442 //-------------------------------------------------------------------------- 1443 // StmtExpr 1444 template< typename pass_t > 1445 const ast::Expr * ast::Pass< pass_t >::visit( const ast::StmtExpr * node ) { 1446 VISIT_START( node ); 1447 1448 VISIT(// don't want statements from outer CompoundStmts to be added to this StmtExpr 1449 // get the stmts that will need to be spliced in 1450 auto stmts_before = __pass::stmtsToAddBefore( pass, 0); 1451 auto stmts_after = __pass::stmtsToAddAfter ( pass, 0); 1452 1453 // These may be modified by subnode but most be restored once we exit this statemnet. 1454 ValueGuardPtr< const ast::TypeSubstitution * > __old_env( __pass::env( pass, 0) ); 1455 ValueGuardPtr< typename std::remove_pointer< decltype(stmts_before) >::type > __old_decls_before( stmts_before ); 1456 ValueGuardPtr< typename std::remove_pointer< decltype(stmts_after ) >::type > __old_decls_after ( stmts_after ); 1457 1458 { 1459 guard_indexer guard { *this }; 1460 maybe_accept( node, &StmtExpr::result ); 1461 } 1462 maybe_accept( node, &StmtExpr::stmts ); 1463 maybe_accept( node, &StmtExpr::returnDecls ); 1464 maybe_accept( node, &StmtExpr::dtors ); 1465 ) 1466 1467 VISIT_END( Expr, node ); 1468 } 1469 1470 //-------------------------------------------------------------------------- 1471 // UniqueExpr 1472 template< typename pass_t > 1473 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UniqueExpr * node ) { 1474 VISIT_START( node ); 1475 1476 VISIT({ 1477 guard_indexer guard { *this }; 1478 maybe_accept( node, &UniqueExpr::result ); 1479 } 1480 maybe_accept( node, &UniqueExpr::expr ); 1481 ) 1482 1483 VISIT_END( Expr, node ); 1484 } 1485 1486 //-------------------------------------------------------------------------- 1487 // UntypedInitExpr 1488 template< typename pass_t > 1489 const ast::Expr * ast::Pass< pass_t >::visit( const ast::UntypedInitExpr * node ) { 1490 VISIT_START( node ); 1491 1492 VISIT({ 1493 guard_indexer guard { *this }; 1494 maybe_accept( node, &UntypedInitExpr::result ); 1495 } 1496 maybe_accept( node, &UntypedInitExpr::expr ); 1497 // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver. 1498 ) 1499 1500 VISIT_END( Expr, node ); 1501 } 1502 1503 //-------------------------------------------------------------------------- 1504 // InitExpr 1505 template< typename pass_t > 1506 const ast::Expr * ast::Pass< pass_t >::visit( const ast::InitExpr * node ) { 1507 VISIT_START( node ); 1508 1509 VISIT({ 1510 guard_indexer guard { *this }; 1511 maybe_accept( node, &InitExpr::result ); 1512 } 1513 maybe_accept( node, &InitExpr::expr ); 1514 maybe_accept( node, &InitExpr::designation ); 1515 ) 1516 1517 VISIT_END( Expr, node ); 1518 } 1519 1520 //-------------------------------------------------------------------------- 1521 // DeletedExpr 1522 template< typename pass_t > 1523 const ast::Expr * ast::Pass< pass_t >::visit( const ast::DeletedExpr * node ) { 1524 VISIT_START( node ); 1525 1526 VISIT({ 1527 guard_indexer guard { *this }; 1528 maybe_accept( node, &DeletedExpr::result ); 1529 } 1530 maybe_accept( node, &DeletedExpr::expr ); 1531 // don't visit deleteStmt, because it is a pointer to somewhere else in the tree. 1532 ) 1533 1534 VISIT_END( Expr, node ); 1535 } 1536 1537 //-------------------------------------------------------------------------- 1538 // DefaultArgExpr 1539 template< typename pass_t > 1540 const ast::Expr * ast::Pass< pass_t >::visit( const ast::DefaultArgExpr * node ) { 1541 VISIT_START( node ); 1542 1543 VISIT({ 1544 guard_indexer guard { *this }; 1545 maybe_accept( node, &DefaultArgExpr::result ); 1546 } 1547 maybe_accept( node, &DefaultArgExpr::expr ); 1548 ) 1549 1550 VISIT_END( Expr, node ); 1551 } 1552 1553 //-------------------------------------------------------------------------- 1554 // GenericExpr 1555 template< typename pass_t > 1556 const ast::Expr * ast::Pass< pass_t >::visit( const ast::GenericExpr * node ) { 1557 VISIT_START( node ); 1558 1559 VISIT({ 1560 guard_indexer guard { *this }; 1561 maybe_accept( node, &GenericExpr::result ); 1562 } 1563 maybe_accept( node, &GenericExpr::control ); 1564 1565 std::vector<GenericExpr::Association> new_kids; 1566 new_kids.reserve(node->associations.size()); 1567 bool mutated = false; 1568 for( const auto & assoc : node->associations ) { 1569 Type * type = nullptr; 1570 if( assoc.type ) { 1571 guard_indexer guard { *this }; 1572 type = assoc.type->accept( *this ); 1573 if( type != assoc.type ) mutated = true; 1574 } 1575 Expr * expr = nullptr; 1576 if( assoc.expr ) { 1577 expr = assoc.expr->accept( *this ); 1578 if( expr != assoc.expr ) mutated = true; 1579 } 1580 new_kids.emplace_back( type, expr ); 1581 } 1582 1583 if(mutated) { 1584 auto n = mutate(node); 1585 n->associations = std::move( new_kids ); 1586 node = n; 1587 } 1588 ) 1589 1590 VISIT_END( Expr, node ); 1591 } 1592 1593 //-------------------------------------------------------------------------- 1594 // VoidType 1595 template< typename pass_t > 1596 const ast::Type * ast::Pass< pass_t >::visit( const ast::VoidType * node ) { 1597 VISIT_START( node ); 1598 1599 VISIT_END( Type, node ); 1600 } 1601 1602 //-------------------------------------------------------------------------- 1603 // BasicType 1604 template< typename pass_t > 1605 const ast::Type * ast::Pass< pass_t >::visit( const ast::BasicType * node ) { 1606 VISIT_START( node ); 1607 1608 VISIT_END( Type, node ); 1609 } 1610 1611 //-------------------------------------------------------------------------- 1612 // PointerType 1613 template< typename pass_t > 1614 const ast::Type * ast::Pass< pass_t >::visit( const ast::PointerType * node ) { 1615 VISIT_START( node ); 1616 1617 VISIT( 1618 // xxx - should PointerType visit/mutate dimension? 1619 maybe_accept( node, &PointerType::base ); 1620 ) 1621 1622 VISIT_END( Type, node ); 1623 } 1624 1625 //-------------------------------------------------------------------------- 1626 // ArrayType 1627 template< typename pass_t > 1628 const ast::Type * ast::Pass< pass_t >::visit( const ast::ArrayType * node ) { 1629 VISIT_START( node ); 1630 1631 VISIT( 1632 maybe_accept( node, &ArrayType::dimension ); 1633 maybe_accept( node, &ArrayType::base ); 1634 ) 1635 1636 VISIT_END( Type, node ); 1637 } 1638 1639 //-------------------------------------------------------------------------- 1640 // ReferenceType 1641 template< typename pass_t > 1642 const ast::Type * ast::Pass< pass_t >::visit( const ast::ReferenceType * node ) { 1643 VISIT_START( node ); 1644 1645 VISIT( 1646 maybe_accept( node, &ReferenceType::base ); 1647 ) 1648 1649 VISIT_END( Type, node ); 1650 } 1651 1652 //-------------------------------------------------------------------------- 1653 // QualifiedType 1654 template< typename pass_t > 1655 const ast::Type * ast::Pass< pass_t >::visit( const ast::QualifiedType * node ) { 1656 VISIT_START( node ); 1657 1658 VISIT( 1659 maybe_accept( node, &QualifiedType::parent ); 1660 maybe_accept( node, &QualifiedType::child ); 1661 ) 1662 1663 VISIT_END( Type, node ); 1664 } 1665 1666 //-------------------------------------------------------------------------- 1667 // FunctionType 1668 template< typename pass_t > 1669 const ast::Type * ast::Pass< pass_t >::visit( const ast::FunctionType * node ) { 1670 VISIT_START( node ); 1671 1672 VISIT( 1673 maybe_accept( node, &FunctionType::forall ); 1674 maybe_accept( node, &FunctionType::returns ); 1675 maybe_accept( node, &FunctionType::params ); 1676 ) 1677 1678 VISIT_END( Type, node ); 1679 } 1680 1681 //-------------------------------------------------------------------------- 1682 // StructInstType 1683 template< typename pass_t > 1684 const ast::Type * ast::Pass< pass_t >::visit( const ast::StructInstType * node ) { 1685 VISIT_START( node ); 1686 1687 __pass::indexer::addStruct( node->name, 0, pass ); 1688 1689 VISIT({ 1690 guard_indexer guard { *this }; 1691 maybe_accept( node, &StructInstType::forall ); 1692 maybe_accept( node, &StructInstType::params ); 1693 }) 1694 1695 VISIT_END( Type, node ); 1696 } 1697 1698 //-------------------------------------------------------------------------- 1699 // UnionInstType 1700 template< typename pass_t > 1701 const ast::Type * ast::Pass< pass_t >::visit( const ast::UnionInstType * node ) { 1702 VISIT_START( node ); 1703 1704 __pass::indexer::addStruct( node->name, 0, pass ); 1705 1706 { 1707 guard_indexer guard { *this }; 1708 maybe_accept( node, &UnionInstType::forall ); 1709 maybe_accept( node, &UnionInstType::params ); 1710 } 1711 1712 VISIT_END( Type, node ); 1713 } 1714 1715 //-------------------------------------------------------------------------- 1716 // EnumInstType 1717 template< typename pass_t > 1718 const ast::Type * ast::Pass< pass_t >::visit( const ast::EnumInstType * node ) { 1719 VISIT_START( node ); 1720 1721 VISIT( 1722 maybe_accept( node, &EnumInstType::forall ); 1723 maybe_accept( node, &EnumInstType::params ); 1724 ) 1725 1726 VISIT_END( Type, node ); 1727 } 1728 1729 //-------------------------------------------------------------------------- 1730 // TraitInstType 1731 template< typename pass_t > 1732 const ast::Type * ast::Pass< pass_t >::visit( const ast::TraitInstType * node ) { 1733 VISIT_START( node ); 1734 1735 VISIT( 1736 maybe_accept( node, &TraitInstType::forall ); 1737 maybe_accept( node, &TraitInstType::params ); 1738 ) 1739 1740 VISIT_END( Type, node ); 1741 } 1742 1743 //-------------------------------------------------------------------------- 1744 // TypeInstType 1745 template< typename pass_t > 1746 const ast::Type * ast::Pass< pass_t >::visit( const ast::TypeInstType * node ) { 1747 VISIT_START( node ); 1748 1749 VISIT( 1750 maybe_accept( node, &TypeInstType::forall ); 1751 maybe_accept( node, &TypeInstType::params ); 1752 ) 1753 1754 VISIT_END( Type, node ); 1755 } 1756 1757 //-------------------------------------------------------------------------- 1758 // TupleType 1759 template< typename pass_t > 1760 const ast::Type * ast::Pass< pass_t >::visit( const ast::TupleType * node ) { 1761 VISIT_START( node ); 1762 1763 VISIT( 1764 maybe_accept( node, &TupleType::types ); 1765 maybe_accept( node, &TupleType::members ); 1766 ) 1767 1768 VISIT_END( Type, node ); 1769 } 1770 1771 //-------------------------------------------------------------------------- 1772 // TypeofType 1773 template< typename pass_t > 1774 const ast::Type * ast::Pass< pass_t >::visit( const ast::TypeofType * node ) { 1775 VISIT_START( node ); 1776 1777 VISIT( 1778 maybe_accept( node, &TypeofType::expr ); 1779 ) 1780 1781 VISIT_END( Type, node ); 1782 } 1783 1784 //-------------------------------------------------------------------------- 1785 // VarArgsType 1786 template< typename pass_t > 1787 const ast::Type * ast::Pass< pass_t >::visit( const ast::VarArgsType * node ) { 1788 VISIT_START( node ); 1789 1790 VISIT_END( Type, node ); 1791 } 1792 1793 //-------------------------------------------------------------------------- 1794 // ZeroType 1795 template< typename pass_t > 1796 const ast::Type * ast::Pass< pass_t >::visit( const ast::ZeroType * node ) { 1797 VISIT_START( node ); 1798 1799 VISIT_END( Type, node ); 1800 } 1801 1802 //-------------------------------------------------------------------------- 1803 // OneType 1804 template< typename pass_t > 1805 const ast::Type * ast::Pass< pass_t >::visit( const ast::OneType * node ) { 1806 VISIT_START( node ); 1807 1808 VISIT_END( Type, node ); 1809 } 1810 1811 //-------------------------------------------------------------------------- 1812 // GlobalScopeType 1813 template< typename pass_t > 1814 const ast::Type * ast::Pass< pass_t >::visit( const ast::GlobalScopeType * node ) { 1815 VISIT_START( node ); 1816 1817 VISIT_END( Type, node ); 1818 } 1819 1820 1821 //-------------------------------------------------------------------------- 1822 // Designation 1823 template< typename pass_t > 1824 const ast::Designation * ast::Pass< pass_t >::visit( const ast::Designation * node ) { 1825 VISIT_START( node ); 1826 1827 VISIT( maybe_accept( node, &Designation::designators ); ) 1828 1829 VISIT_END( Designation, node ); 1830 } 912 913 914 915 1831 916 1832 917 //-------------------------------------------------------------------------- … … 1885 970 } 1886 971 1887 // //--------------------------------------------------------------------------1888 // //TypeSubstitution1889 //template< typename pass_t >1890 //const ast::TypeSubstitution * ast::Pass< pass_t >::visit( const ast::TypeSubstitution * node ) {1891 //VISIT_START( node );1892 1893 //VISIT(1894 //{1895 //bool mutated = false;1896 //std::unordered_map< std::string, ast::ptr< ast::Type > > new_map;1897 //for ( const auto & p : node->typeEnv ) {1898 //guard_indexer guard { *this };1899 //auto new_node = p.second->accept( *this );1900 //if (new_node != p.second) mutated = false;1901 //new_map.insert({ p.first, new_node });1902 //}1903 //if (mutated) {1904 //auto new_node = mutate( node );1905 //new_node->typeEnv.swap( new_map );1906 //node = new_node;1907 //}1908 //}1909 1910 //{1911 //bool mutated = false;1912 //std::unordered_map< std::string, ast::ptr< ast::Expr > > new_map;1913 //for ( const auto & p : node->varEnv ) {1914 //guard_indexer guard { *this };1915 //auto new_node = p.second->accept( *this );1916 //if (new_node != p.second) mutated = false;1917 //new_map.insert({ p.first, new_node });1918 //}1919 //if (mutated) {1920 //auto new_node = mutate( node );1921 //new_node->varEnv.swap( new_map );1922 //node = new_node;1923 //}1924 //}1925 //)1926 1927 //VISIT_END( TypeSubstitution, node );1928 //}972 //-------------------------------------------------------------------------- 973 // TypeSubstitution 974 template< typename pass_t > 975 const ast::TypeSubstitution * ast::Pass< pass_t >::visit( const ast::TypeSubstitution * node ) { 976 VISIT_START( node ); 977 978 VISIT( 979 { 980 bool mutated = false; 981 std::unordered_map< std::string, ast::ptr< ast::Type > > new_map; 982 for ( const auto & p : node->typeEnv ) { 983 guard_indexer guard { *this }; 984 auto new_node = p.second->accept( *this ); 985 if (new_node != p.second) mutated = false; 986 new_map.insert({ p.first, new_node }); 987 } 988 if (mutated) { 989 auto new_node = mutate( node ); 990 new_node->typeEnv.swap( new_map ); 991 node = new_node; 992 } 993 } 994 995 { 996 bool mutated = false; 997 std::unordered_map< std::string, ast::ptr< ast::Expr > > new_map; 998 for ( const auto & p : node->varEnv ) { 999 guard_indexer guard { *this }; 1000 auto new_node = p.second->accept( *this ); 1001 if (new_node != p.second) mutated = false; 1002 new_map.insert({ p.first, new_node }); 1003 } 1004 if (mutated) { 1005 auto new_node = mutate( node ); 1006 new_node->varEnv.swap( new_map ); 1007 node = new_node; 1008 } 1009 } 1010 ) 1011 1012 VISIT_END( TypeSubstitution, node ); 1013 } 1929 1014 1930 1015 #undef VISIT_START -
src/AST/Stmt.hpp
ra83044fb rd148778 330 330 public: 331 331 struct Target { 332 ptr<Expr> func ;333 std::vector<ptr<Expr>> arg s;332 ptr<Expr> function; 333 std::vector<ptr<Expr>> arguments; 334 334 }; 335 335 -
src/AST/module.mk
ra83044fb rd148778 1 ######################### -*- Mode: Makefile-Gmake -*- ######################## 1 ######################### -*- Mode: Makefile-Gmake -*- 2 ######################## 2 3 ## 3 4 ## Cforall Version 1.0.0 Copyright (C) 2019 University of Waterloo … … 16 17 17 18 SRC_AST = \ 18 AST/Attribute.cpp \ 19 AST/Convert.cpp \ 20 AST/Decl.cpp \ 21 AST/DeclReplacer.cpp \ 22 AST/Expr.cpp \ 23 AST/Init.cpp \ 24 AST/LinkageSpec.cpp \ 25 AST/Node.cpp \ 26 AST/Stmt.cpp \ 27 AST/Type.cpp \ 28 AST/TypeSubstitution.cpp 19 AST/Convert.cpp \ 20 AST/Node.cpp \ 21 AST/TypeSubstitution.cpp 29 22 30 23 … … 32 25 SRC += $(SRC_AST) 33 26 SRCDEMANGLE += $(SRC_AST) 27 -
src/Common/Eval.cc
ra83044fb rd148778 90 90 } 91 91 92 std::pair<long long int, bool> eval(const ast::Expr * expr) {93 #warning not implemented94 return { 0, false };95 }96 97 92 // Local Variables: // 98 93 // tab-width: 4 // -
src/Makefile.am
ra83044fb rd148778 37 37 endif 38 38 39 include AST/module.mk40 39 include CodeGen/module.mk 41 40 include CodeTools/module.mk -
src/Makefile.in
ra83044fb rd148778 16 16 17 17 ######################## -*- Mode: Makefile-Automake -*- ###################### 18 ###############################################################################19 20 ######################### -*- Mode: Makefile-Gmake -*- ########################21 18 ############################################################################### 22 19 … … 165 162 libdemangle_a_LIBADD = 166 163 am__dirstamp = $(am__leading_dot)dirstamp 167 am__objects_1 = AST/Attribute.$(OBJEXT) AST/Convert.$(OBJEXT) \ 168 AST/Decl.$(OBJEXT) AST/DeclReplacer.$(OBJEXT) \ 169 AST/Expr.$(OBJEXT) AST/Init.$(OBJEXT) \ 170 AST/LinkageSpec.$(OBJEXT) AST/Node.$(OBJEXT) \ 171 AST/Stmt.$(OBJEXT) AST/Type.$(OBJEXT) \ 172 AST/TypeSubstitution.$(OBJEXT) 173 am__objects_2 = CodeGen/CodeGenerator.$(OBJEXT) \ 164 am__objects_1 = CodeGen/CodeGenerator.$(OBJEXT) \ 174 165 CodeGen/FixMain.$(OBJEXT) CodeGen/GenType.$(OBJEXT) \ 175 166 CodeGen/OperatorTable.$(OBJEXT) 176 am__objects_ 3= Common/Assert.$(OBJEXT) Common/Eval.$(OBJEXT) \167 am__objects_2 = Common/Assert.$(OBJEXT) Common/Eval.$(OBJEXT) \ 177 168 Common/PassVisitor.$(OBJEXT) Common/SemanticError.$(OBJEXT) \ 178 169 Common/Stats/Counter.$(OBJEXT) Common/Stats/Heap.$(OBJEXT) \ 179 170 Common/Stats/Stats.$(OBJEXT) Common/Stats/Time.$(OBJEXT) \ 180 171 Common/UniqueName.$(OBJEXT) 181 am__objects_ 4= ControlStruct/ForExprMutator.$(OBJEXT) \172 am__objects_3 = ControlStruct/ForExprMutator.$(OBJEXT) \ 182 173 ControlStruct/LabelFixer.$(OBJEXT) \ 183 174 ControlStruct/LabelGenerator.$(OBJEXT) \ 184 175 ControlStruct/MLEMutator.$(OBJEXT) \ 185 176 ControlStruct/Mutate.$(OBJEXT) 186 am__objects_ 5= ResolvExpr/AdjustExprType.$(OBJEXT) \177 am__objects_4 = ResolvExpr/AdjustExprType.$(OBJEXT) \ 187 178 ResolvExpr/Alternative.$(OBJEXT) \ 188 179 ResolvExpr/AlternativeFinder.$(OBJEXT) \ … … 202 193 ResolvExpr/TypeEnvironment.$(OBJEXT) \ 203 194 ResolvExpr/Unify.$(OBJEXT) 204 am__objects_ 6= SymTab/Autogen.$(OBJEXT) SymTab/FixFunction.$(OBJEXT) \195 am__objects_5 = SymTab/Autogen.$(OBJEXT) SymTab/FixFunction.$(OBJEXT) \ 205 196 SymTab/Indexer.$(OBJEXT) SymTab/Mangler.$(OBJEXT) \ 206 197 SymTab/ManglerCommon.$(OBJEXT) SymTab/Validate.$(OBJEXT) 207 am__objects_ 7= SynTree/Type.$(OBJEXT) SynTree/VoidType.$(OBJEXT) \198 am__objects_6 = SynTree/Type.$(OBJEXT) SynTree/VoidType.$(OBJEXT) \ 208 199 SynTree/BasicType.$(OBJEXT) SynTree/PointerType.$(OBJEXT) \ 209 200 SynTree/ArrayType.$(OBJEXT) SynTree/ReferenceType.$(OBJEXT) \ … … 225 216 SynTree/TypeSubstitution.$(OBJEXT) SynTree/Attribute.$(OBJEXT) \ 226 217 SynTree/DeclReplacer.$(OBJEXT) 227 am__objects_ 8= CompilationState.$(OBJEXT) $(am__objects_1) \228 $(am__objects_2) Concurrency/Keywords.$(OBJEXT) \229 $(am__objects_3) $(am__objects_4)GenPoly/GenPoly.$(OBJEXT) \218 am__objects_7 = CompilationState.$(OBJEXT) $(am__objects_1) \ 219 Concurrency/Keywords.$(OBJEXT) $(am__objects_2) \ 220 $(am__objects_3) GenPoly/GenPoly.$(OBJEXT) \ 230 221 GenPoly/Lvalue.$(OBJEXT) InitTweak/GenInit.$(OBJEXT) \ 231 222 InitTweak/InitTweak.$(OBJEXT) Parser/LinkageSpec.$(OBJEXT) \ 232 $(am__objects_ 5) $(am__objects_6) SymTab/Demangle.$(OBJEXT) \233 $(am__objects_ 7) Tuples/TupleAssignment.$(OBJEXT) \223 $(am__objects_4) $(am__objects_5) SymTab/Demangle.$(OBJEXT) \ 224 $(am__objects_6) Tuples/TupleAssignment.$(OBJEXT) \ 234 225 Tuples/TupleExpansion.$(OBJEXT) Tuples/Explode.$(OBJEXT) \ 235 226 Validate/HandleAttributes.$(OBJEXT) 236 am_libdemangle_a_OBJECTS = $(am__objects_ 8)227 am_libdemangle_a_OBJECTS = $(am__objects_7) 237 228 libdemangle_a_OBJECTS = $(am_libdemangle_a_OBJECTS) 238 229 am__installdirs = "$(DESTDIR)$(cfa_cpplibdir)" 239 230 PROGRAMS = $(cfa_cpplib_PROGRAMS) 240 am__objects_ 9= main.$(OBJEXT) MakeLibCfa.$(OBJEXT) \241 CompilationState.$(OBJEXT) $(am__objects_1) $(am__objects_2)\231 am__objects_8 = main.$(OBJEXT) MakeLibCfa.$(OBJEXT) \ 232 CompilationState.$(OBJEXT) $(am__objects_1) \ 242 233 CodeGen/Generate.$(OBJEXT) CodeGen/FixNames.$(OBJEXT) \ 243 234 CodeTools/DeclStats.$(OBJEXT) \ 244 235 CodeTools/ResolvProtoDump.$(OBJEXT) \ 245 236 CodeTools/TrackLoc.$(OBJEXT) Concurrency/Keywords.$(OBJEXT) \ 246 Concurrency/Waitfor.$(OBJEXT) $(am__objects_ 3) \247 Common/DebugMalloc.$(OBJEXT) $(am__objects_ 4) \237 Concurrency/Waitfor.$(OBJEXT) $(am__objects_2) \ 238 Common/DebugMalloc.$(OBJEXT) $(am__objects_3) \ 248 239 ControlStruct/ExceptTranslate.$(OBJEXT) GenPoly/Box.$(OBJEXT) \ 249 240 GenPoly/GenPoly.$(OBJEXT) GenPoly/ScrubTyVars.$(OBJEXT) \ … … 259 250 Parser/InitializerNode.$(OBJEXT) Parser/TypeData.$(OBJEXT) \ 260 251 Parser/LinkageSpec.$(OBJEXT) Parser/parserutility.$(OBJEXT) \ 261 $(am__objects_ 5) ResolvExpr/AlternativePrinter.$(OBJEXT) \262 $(am__objects_ 6) $(am__objects_7) \252 $(am__objects_4) ResolvExpr/AlternativePrinter.$(OBJEXT) \ 253 $(am__objects_5) $(am__objects_6) \ 263 254 Tuples/TupleAssignment.$(OBJEXT) \ 264 255 Tuples/TupleExpansion.$(OBJEXT) Tuples/Explode.$(OBJEXT) \ 265 256 Validate/HandleAttributes.$(OBJEXT) \ 266 257 Virtual/ExpandCasts.$(OBJEXT) 267 am____driver_cfa_cpp_OBJECTS = $(am__objects_ 9)258 am____driver_cfa_cpp_OBJECTS = $(am__objects_8) 268 259 ___driver_cfa_cpp_OBJECTS = $(am____driver_cfa_cpp_OBJECTS) 269 260 am__DEPENDENCIES_1 = … … 375 366 ETAGS = etags 376 367 CTAGS = ctags 377 am__DIST_COMMON = $(srcdir)/ AST/module.mk $(srcdir)/CodeGen/module.mk \368 am__DIST_COMMON = $(srcdir)/CodeGen/module.mk \ 378 369 $(srcdir)/CodeTools/module.mk $(srcdir)/Common/module.mk \ 379 370 $(srcdir)/Concurrency/module.mk \ … … 535 526 AUTOMAKE_OPTIONS = foreign subdir-objects 536 527 ACLOCAL_AMFLAGS = -I automake 537 SRC = main.cc MakeLibCfa.cc CompilationState.cc $(SRC_ AST) \538 $(SRC_CODEGEN) CodeGen/Generate.cc CodeGen/FixNames.cc \539 CodeTools/ DeclStats.cc CodeTools/ResolvProtoDump.cc \540 Co deTools/TrackLoc.cc Concurrency/Keywords.cc\541 Co ncurrency/Waitfor.cc $(SRC_COMMON) Common/DebugMalloc.cc\542 $(SRC_CONTROLSTRUCT) ControlStruct/ExceptTranslate.cc \543 GenPoly/ Box.cc GenPoly/GenPoly.cc GenPoly/ScrubTyVars.cc \544 GenPoly/ Lvalue.cc GenPoly/Specialize.cc \545 GenPoly/ FindFunction.cc GenPoly/InstantiateGeneric.cc \546 InitTweak/ GenInit.cc InitTweak/FixInit.cc \547 InitTweak/ FixGlobalInit.cc InitTweak/InitTweak.cc\548 Parser/ parser.yy Parser/lex.ll Parser/TypedefTable.cc \549 Parser/ ParseNode.cc Parser/DeclarationNode.cc \550 Parser/ ExpressionNode.cc Parser/StatementNode.cc \551 Parser/ InitializerNode.cc Parser/TypeData.cc \552 Parser/ LinkageSpec.cc Parser/parserutility.cc\553 $(SRC_RESOLVEXPR) ResolvExpr/AlternativePrinter.cc\554 $(SRC_SYMTAB) $(SRC_SYNTREE) Tuples/TupleAssignment.cc \555 Tuples/ TupleExpansion.cc Tuples/Explode.cc \556 V alidate/HandleAttributes.cc Virtual/ExpandCasts.cc557 SRCDEMANGLE = CompilationState.cc $(SRC_ AST) $(SRC_CODEGEN) \528 SRC = main.cc MakeLibCfa.cc CompilationState.cc $(SRC_CODEGEN) \ 529 CodeGen/Generate.cc CodeGen/FixNames.cc CodeTools/DeclStats.cc \ 530 CodeTools/ResolvProtoDump.cc CodeTools/TrackLoc.cc \ 531 Concurrency/Keywords.cc Concurrency/Waitfor.cc $(SRC_COMMON) \ 532 Common/DebugMalloc.cc $(SRC_CONTROLSTRUCT) \ 533 ControlStruct/ExceptTranslate.cc GenPoly/Box.cc \ 534 GenPoly/GenPoly.cc GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc \ 535 GenPoly/Specialize.cc GenPoly/FindFunction.cc \ 536 GenPoly/InstantiateGeneric.cc InitTweak/GenInit.cc \ 537 InitTweak/FixInit.cc InitTweak/FixGlobalInit.cc \ 538 InitTweak/InitTweak.cc Parser/parser.yy Parser/lex.ll \ 539 Parser/TypedefTable.cc Parser/ParseNode.cc \ 540 Parser/DeclarationNode.cc Parser/ExpressionNode.cc \ 541 Parser/StatementNode.cc Parser/InitializerNode.cc \ 542 Parser/TypeData.cc Parser/LinkageSpec.cc \ 543 Parser/parserutility.cc $(SRC_RESOLVEXPR) \ 544 ResolvExpr/AlternativePrinter.cc $(SRC_SYMTAB) $(SRC_SYNTREE) \ 545 Tuples/TupleAssignment.cc Tuples/TupleExpansion.cc \ 546 Tuples/Explode.cc Validate/HandleAttributes.cc \ 547 Virtual/ExpandCasts.cc 548 SRCDEMANGLE = CompilationState.cc $(SRC_CODEGEN) \ 558 549 Concurrency/Keywords.cc $(SRC_COMMON) $(SRC_CONTROLSTRUCT) \ 559 550 GenPoly/GenPoly.cc GenPoly/Lvalue.cc InitTweak/GenInit.cc \ … … 568 559 @WITH_LIBTCMALLOC_TRUE@LIBTCMALLOC = -ltcmalloc 569 560 @WITH_LIBTCMALLOC_TRUE@TCMALLOCFLAG = -DTCMALLOC 570 SRC_AST = \571 AST/Attribute.cpp \572 AST/Convert.cpp \573 AST/Decl.cpp \574 AST/DeclReplacer.cpp \575 AST/Expr.cpp \576 AST/Init.cpp \577 AST/LinkageSpec.cpp \578 AST/Node.cpp \579 AST/Stmt.cpp \580 AST/Type.cpp \581 AST/TypeSubstitution.cpp582 583 561 SRC_CODEGEN = \ 584 562 CodeGen/CodeGenerator.cc \ … … 689 667 690 668 .SUFFIXES: 691 .SUFFIXES: .cc . cpp .ll .lo .o .obj .yy692 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/ AST/module.mk $(srcdir)/CodeGen/module.mk $(srcdir)/CodeTools/module.mk $(srcdir)/Concurrency/module.mk $(srcdir)/Common/module.mk $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk $(srcdir)/InitTweak/module.mk $(srcdir)/Parser/module.mk $(srcdir)/ResolvExpr/module.mk $(srcdir)/SymTab/module.mk $(srcdir)/SynTree/module.mk $(srcdir)/Tuples/module.mk $(srcdir)/Validate/module.mk $(srcdir)/Virtual/module.mk $(am__configure_deps)669 .SUFFIXES: .cc .ll .lo .o .obj .yy 670 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/CodeGen/module.mk $(srcdir)/CodeTools/module.mk $(srcdir)/Concurrency/module.mk $(srcdir)/Common/module.mk $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk $(srcdir)/InitTweak/module.mk $(srcdir)/Parser/module.mk $(srcdir)/ResolvExpr/module.mk $(srcdir)/SymTab/module.mk $(srcdir)/SynTree/module.mk $(srcdir)/Tuples/module.mk $(srcdir)/Validate/module.mk $(srcdir)/Virtual/module.mk $(am__configure_deps) 693 671 @for dep in $?; do \ 694 672 case '$(am__configure_deps)' in \ … … 710 688 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 711 689 esac; 712 $(srcdir)/ AST/module.mk $(srcdir)/CodeGen/module.mk $(srcdir)/CodeTools/module.mk $(srcdir)/Concurrency/module.mk $(srcdir)/Common/module.mk $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk $(srcdir)/InitTweak/module.mk $(srcdir)/Parser/module.mk $(srcdir)/ResolvExpr/module.mk $(srcdir)/SymTab/module.mk $(srcdir)/SynTree/module.mk $(srcdir)/Tuples/module.mk $(srcdir)/Validate/module.mk $(srcdir)/Virtual/module.mk $(am__empty):690 $(srcdir)/CodeGen/module.mk $(srcdir)/CodeTools/module.mk $(srcdir)/Concurrency/module.mk $(srcdir)/Common/module.mk $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk $(srcdir)/InitTweak/module.mk $(srcdir)/Parser/module.mk $(srcdir)/ResolvExpr/module.mk $(srcdir)/SymTab/module.mk $(srcdir)/SynTree/module.mk $(srcdir)/Tuples/module.mk $(srcdir)/Validate/module.mk $(srcdir)/Virtual/module.mk $(am__empty): 713 691 714 692 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) … … 723 701 clean-noinstLIBRARIES: 724 702 -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) 725 AST/$(am__dirstamp):726 @$(MKDIR_P) AST727 @: > AST/$(am__dirstamp)728 AST/$(DEPDIR)/$(am__dirstamp):729 @$(MKDIR_P) AST/$(DEPDIR)730 @: > AST/$(DEPDIR)/$(am__dirstamp)731 AST/Attribute.$(OBJEXT): AST/$(am__dirstamp) \732 AST/$(DEPDIR)/$(am__dirstamp)733 AST/Convert.$(OBJEXT): AST/$(am__dirstamp) \734 AST/$(DEPDIR)/$(am__dirstamp)735 AST/Decl.$(OBJEXT): AST/$(am__dirstamp) AST/$(DEPDIR)/$(am__dirstamp)736 AST/DeclReplacer.$(OBJEXT): AST/$(am__dirstamp) \737 AST/$(DEPDIR)/$(am__dirstamp)738 AST/Expr.$(OBJEXT): AST/$(am__dirstamp) AST/$(DEPDIR)/$(am__dirstamp)739 AST/Init.$(OBJEXT): AST/$(am__dirstamp) AST/$(DEPDIR)/$(am__dirstamp)740 AST/LinkageSpec.$(OBJEXT): AST/$(am__dirstamp) \741 AST/$(DEPDIR)/$(am__dirstamp)742 AST/Node.$(OBJEXT): AST/$(am__dirstamp) AST/$(DEPDIR)/$(am__dirstamp)743 AST/Stmt.$(OBJEXT): AST/$(am__dirstamp) AST/$(DEPDIR)/$(am__dirstamp)744 AST/Type.$(OBJEXT): AST/$(am__dirstamp) AST/$(DEPDIR)/$(am__dirstamp)745 AST/TypeSubstitution.$(OBJEXT): AST/$(am__dirstamp) \746 AST/$(DEPDIR)/$(am__dirstamp)747 703 CodeGen/$(am__dirstamp): 748 704 @$(MKDIR_P) CodeGen … … 1141 1097 mostlyclean-compile: 1142 1098 -rm -f *.$(OBJEXT) 1143 -rm -f AST/*.$(OBJEXT)1144 1099 -rm -f CodeGen/*.$(OBJEXT) 1145 1100 -rm -f CodeTools/*.$(OBJEXT) … … 1164 1119 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MakeLibCfa.Po@am__quote@ 1165 1120 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ 1166 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Attribute.Po@am__quote@1167 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Convert.Po@am__quote@1168 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Decl.Po@am__quote@1169 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/DeclReplacer.Po@am__quote@1170 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Expr.Po@am__quote@1171 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Init.Po@am__quote@1172 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/LinkageSpec.Po@am__quote@1173 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Node.Po@am__quote@1174 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Stmt.Po@am__quote@1175 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Type.Po@am__quote@1176 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/TypeSubstitution.Po@am__quote@1177 1121 @AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/CodeGenerator.Po@am__quote@ 1178 1122 @AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/FixMain.Po@am__quote@ … … 1317 1261 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< 1318 1262 1319 .cpp.o:1320 @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\1321 @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\1322 @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po1323 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@1324 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@1325 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<1326 1327 .cpp.obj:1328 @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\1329 @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\1330 @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po1331 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@1332 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@1333 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`1334 1335 .cpp.lo:1336 @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\1337 @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\1338 @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo1339 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@1340 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@1341 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<1342 1343 1263 .ll.cc: 1344 1264 $(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) … … 1473 1393 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 1474 1394 -rm -f ../driver/$(am__dirstamp) 1475 -rm -f AST/$(DEPDIR)/$(am__dirstamp)1476 -rm -f AST/$(am__dirstamp)1477 1395 -rm -f CodeGen/$(DEPDIR)/$(am__dirstamp) 1478 1396 -rm -f CodeGen/$(am__dirstamp) … … 1520 1438 1521 1439 distclean: distclean-am 1522 -rm -rf ./$(DEPDIR) AST/$(DEPDIR)CodeGen/$(DEPDIR) CodeTools/$(DEPDIR) Common/$(DEPDIR) Common/Stats/$(DEPDIR) Concurrency/$(DEPDIR) ControlStruct/$(DEPDIR) GenPoly/$(DEPDIR) InitTweak/$(DEPDIR) Parser/$(DEPDIR) ResolvExpr/$(DEPDIR) SymTab/$(DEPDIR) SynTree/$(DEPDIR) Tuples/$(DEPDIR) Validate/$(DEPDIR) Virtual/$(DEPDIR)1440 -rm -rf ./$(DEPDIR) CodeGen/$(DEPDIR) CodeTools/$(DEPDIR) Common/$(DEPDIR) Common/Stats/$(DEPDIR) Concurrency/$(DEPDIR) ControlStruct/$(DEPDIR) GenPoly/$(DEPDIR) InitTweak/$(DEPDIR) Parser/$(DEPDIR) ResolvExpr/$(DEPDIR) SymTab/$(DEPDIR) SynTree/$(DEPDIR) Tuples/$(DEPDIR) Validate/$(DEPDIR) Virtual/$(DEPDIR) 1523 1441 -rm -f Makefile 1524 1442 distclean-am: clean-am distclean-compile distclean-generic \ … … 1566 1484 1567 1485 maintainer-clean: maintainer-clean-am 1568 -rm -rf ./$(DEPDIR) AST/$(DEPDIR)CodeGen/$(DEPDIR) CodeTools/$(DEPDIR) Common/$(DEPDIR) Common/Stats/$(DEPDIR) Concurrency/$(DEPDIR) ControlStruct/$(DEPDIR) GenPoly/$(DEPDIR) InitTweak/$(DEPDIR) Parser/$(DEPDIR) ResolvExpr/$(DEPDIR) SymTab/$(DEPDIR) SynTree/$(DEPDIR) Tuples/$(DEPDIR) Validate/$(DEPDIR) Virtual/$(DEPDIR)1486 -rm -rf ./$(DEPDIR) CodeGen/$(DEPDIR) CodeTools/$(DEPDIR) Common/$(DEPDIR) Common/Stats/$(DEPDIR) Concurrency/$(DEPDIR) ControlStruct/$(DEPDIR) GenPoly/$(DEPDIR) InitTweak/$(DEPDIR) Parser/$(DEPDIR) ResolvExpr/$(DEPDIR) SymTab/$(DEPDIR) SynTree/$(DEPDIR) Tuples/$(DEPDIR) Validate/$(DEPDIR) Virtual/$(DEPDIR) 1569 1487 -rm -f Makefile 1570 1488 maintainer-clean-am: distclean-am maintainer-clean-generic -
src/Tuples/TupleExpansion.cc
ra83044fb rd148778 353 353 } 354 354 355 const ast::TypeInstType * isTtype( const ast::Type * type ) {356 #warning unimplemented357 return nullptr;358 }359 360 355 namespace { 361 356 /// determines if impurity (read: side-effects) may exist in a piece of code. Currently gives a very crude approximation, wherein any function call expression means the code may be impure -
src/include/cassert
ra83044fb rd148778 19 19 20 20 #include_next <cassert> 21 22 #include <string>23 24 template < typename ... Params >25 std::string toString( const Params & ... params );26 21 27 22 #ifdef NDEBUG -
src/main.cc
ra83044fb rd148778 40 40 #include "Common/Stats.h" 41 41 #include "Common/PassVisitor.h" 42 // #include "AST/Pass.hpp" 42 43 #include "Common/SemanticError.h" // for SemanticError 43 44 #include "Common/UnimplementedError.h" // for UnimplementedError
Note:
See TracChangeset
for help on using the changeset viewer.