- Timestamp:
- Jan 19, 2024, 2:42:58 AM (2 years ago)
- Branches:
- master
- Children:
- f988834
- Parents:
- 8b4faf6
- Location:
- src/AST
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Expr.cpp
r8b4faf6 r59c8dff 307 307 } 308 308 309 // 310 311 // --- EnumPosExpr 312 EnumPosExpr::EnumPosExpr( const CodeLocation & loc, const EnumInstType * ty) 313 : Expr( loc, new BasicType{ BasicType::UnsignedInt }), type( ty ) { 314 assert( ty ); 315 } 316 317 EnumPosExpr::EnumPosExpr( const CodeLocation & loc, const Expr * expr ) 318 : Expr( loc, new BasicType{ BasicType::UnsignedInt }), expr(expr) { 319 assert( expr ); 320 } 321 322 309 323 // --- LogicalExpr 310 324 -
src/AST/Expr.hpp
r8b4faf6 r59c8dff 548 548 }; 549 549 550 class EnumPosExpr final : public Expr { 551 public: 552 ptr<EnumInstType> type; 553 ptr<Expr> expr; 554 555 EnumPosExpr( const CodeLocation & loc, const EnumInstType * ty ); 556 EnumPosExpr( const CodeLocation & loc, const Expr * expr ); 557 const Expr * accept( Visitor & v ) const override { return v.visit( this ); } 558 private: 559 EnumPosExpr * clone() const override { return new EnumPosExpr{ *this }; } 560 MUTATE_FRIEND 561 }; 562 550 563 /// Variants of short-circuiting logical expression 551 564 enum LogicalFlag { OrExpr, AndExpr }; -
src/AST/Fwd.hpp
r8b4faf6 r59c8dff 89 89 class OffsetofExpr; 90 90 class OffsetPackExpr; 91 class EnumPosExpr; 91 92 class LogicalExpr; 92 93 class ConditionalExpr; -
src/AST/Node.cpp
r8b4faf6 r59c8dff 232 232 template class ast::ptr_base< ast::OffsetPackExpr, ast::Node::ref_type::weak >; 233 233 template class ast::ptr_base< ast::OffsetPackExpr, ast::Node::ref_type::strong >; 234 template class ast::ptr_base< ast::EnumPosExpr, ast::Node::ref_type::weak >; 235 template class ast::ptr_base< ast::EnumPosExpr, ast::Node::ref_type::strong >; 234 236 template class ast::ptr_base< ast::LogicalExpr, ast::Node::ref_type::weak >; 235 237 template class ast::ptr_base< ast::LogicalExpr, ast::Node::ref_type::strong >; -
src/AST/Pass.hpp
r8b4faf6 r59c8dff 191 191 const ast::Expr * visit( const ast::OffsetofExpr * ) override final; 192 192 const ast::Expr * visit( const ast::OffsetPackExpr * ) override final; 193 const ast::Expr * visit( const ast::EnumPosExpr * ) override final; 193 194 const ast::Expr * visit( const ast::LogicalExpr * ) override final; 194 195 const ast::Expr * visit( const ast::ConditionalExpr * ) override final; -
src/AST/Pass.impl.hpp
r8b4faf6 r59c8dff 1452 1452 1453 1453 //-------------------------------------------------------------------------- 1454 // EnumPosExpr 1455 template< typename core_t> 1456 const ast::Expr * ast::Pass< core_t >::visit( const ast::EnumPosExpr * node ) { 1457 VISIT_START( node ); 1458 1459 if ( __visit_children() ) { 1460 guard_symtab guard { *this }; 1461 maybe_accept( node, &EnumPosExpr::type ); 1462 maybe_accept( node, &EnumPosExpr::expr ); 1463 } 1464 1465 VISIT_END( Expr, node ); 1466 } 1467 1468 //-------------------------------------------------------------------------- 1454 1469 // LogicalExpr 1455 1470 template< typename core_t > -
src/AST/Print.cpp
r8b4faf6 r59c8dff 1183 1183 } 1184 1184 1185 virtual const ast::Expr * visit( const ast::EnumPosExpr * node ) override final { 1186 os << "Enum Position Expression on: "; 1187 ++indent; 1188 safe_print( node->type ); 1189 --indent; 1190 postprint( node ); 1191 return node; 1192 } 1193 1185 1194 virtual const ast::Expr * visit( const ast::LogicalExpr * node ) override final { 1186 1195 os << "Short-circuited operation (" << (node->isAnd ? "and" : "or") << ") on: "; -
src/AST/Visitor.hpp
r8b4faf6 r59c8dff 79 79 virtual const ast::Expr * visit( const ast::OffsetofExpr * ) = 0; 80 80 virtual const ast::Expr * visit( const ast::OffsetPackExpr * ) = 0; 81 virtual const ast::Expr * visit( const ast::EnumPosExpr * ) = 0; 81 82 virtual const ast::Expr * visit( const ast::LogicalExpr * ) = 0; 82 83 virtual const ast::Expr * visit( const ast::ConditionalExpr * ) = 0;
Note:
See TracChangeset
for help on using the changeset viewer.