Changeset e0115286 for src/AST/Init.hpp
- Timestamp:
- May 10, 2019, 3:00:41 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 2a5e8a6
- Parents:
- 1f93c2c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Init.hpp
r1f93c2c re0115286 28 28 class Stmt; 29 29 30 /// List of designator (NameExpr, VariableExpr, and ConstantExpr) expressions that specify an 30 /// List of designator (NameExpr, VariableExpr, and ConstantExpr) expressions that specify an 31 31 /// object being initialized 32 32 class Designation final : public ParseNode { … … 34 34 std::vector<ptr<Expr>> designators; 35 35 36 Designation( const CodeLocation& loc, std::vector<ptr<Expr>>&& ds = {} ) 36 Designation( const CodeLocation& loc, std::vector<ptr<Expr>>&& ds = {} ) 37 37 : ParseNode( loc ), designators( std::move(ds) ) {} 38 38 … … 60 60 ptr<Expr> value; 61 61 62 SingleInit( const CodeLocation& loc, Expr* val, bool mc = false ) 62 SingleInit( const CodeLocation& loc, Expr* val, bool mc = false ) 63 63 : Init( loc, mc ), value( val ) {} 64 64 … … 77 77 std::vector<ptr<Designation>> designations; 78 78 79 ListInit( const CodeLocation& loc, std::vector<ptr<Init>>&& is, 79 ListInit( const CodeLocation& loc, std::vector<ptr<Init>>&& is, 80 80 std::vector<ptr<Designation>>&& ds = {}, bool mc = false ); 81 81 82 82 using iterator = std::vector<ptr<Init>>::iterator; 83 83 using const_iterator = std::vector<ptr<Init>>::const_iterator; … … 93 93 94 94 /// Either a constructor expression or a C-style initializer. 95 /// Should not be necessary to create manually; instead set `maybeConstructed` true on `SingleInit` 95 /// Should not be necessary to create manually; instead set `maybeConstructed` true on `SingleInit` 96 96 /// or `ListInit` if the object should be constructed. 97 97 class ConstructorInit final : public Init { … … 99 99 ptr<Stmt> ctor; 100 100 ptr<Stmt> dtor; 101 /// C-style initializer made up of SingleInit/ListInit nodes to use as a fallback if an 101 /// C-style initializer made up of SingleInit/ListInit nodes to use as a fallback if an 102 102 /// appropriate constructor definition is not found by the resolver. 103 103 ptr<Init> init; … … 111 111 }; 112 112 113 114 //================================================================================================= 115 /// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency 116 /// remove only if there is a better solution 117 /// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with 118 /// forward declarations 119 inline void increment( const class Init * node, Node::ref_type ref ) { node->increment( ref ); } 120 inline void decrement( const class Init * node, Node::ref_type ref ) { node->decrement( ref ); } 121 inline void increment( const class SingleInit * node, Node::ref_type ref ) { node->increment( ref ); } 122 inline void decrement( const class SingleInit * node, Node::ref_type ref ) { node->decrement( ref ); } 123 inline void increment( const class ListInit * node, Node::ref_type ref ) { node->increment( ref ); } 124 inline void decrement( const class ListInit * node, Node::ref_type ref ) { node->decrement( ref ); } 125 inline void increment( const class ConstructorInit * node, Node::ref_type ref ) { node->increment( ref ); } 126 inline void decrement( const class ConstructorInit * node, Node::ref_type ref ) { node->decrement( ref ); } 113 127 } 114 128
Note: See TracChangeset
for help on using the changeset viewer.