- Timestamp:
- Jun 24, 2019, 10:30:47 AM (6 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:
- 84917e2
- Parents:
- 3c6e417 (diff), 9e0a360 (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/Expr.hpp
r3c6e417 r54dd994 248 248 AddressExpr( const CodeLocation & loc, const Expr * a ); 249 249 250 /// Generate AddressExpr wrapping given expression at same location 251 AddressExpr( const Expr * a ) : AddressExpr( a->location, a ) {} 252 250 253 const Expr * accept( Visitor & v ) const override { return v.visit( this ); } 251 254 private: … … 281 284 /// Cast-to-void 282 285 CastExpr( const CodeLocation & loc, const Expr * a, GeneratedFlag g = GeneratedCast ); 286 287 /// Wrap a cast expression around an existing expression (always generated) 288 CastExpr( const Expr * a, const Type * to ) : CastExpr( a->location, a, to, GeneratedCast ) {} 289 290 /// Wrap a cast-to-void expression around an existing expression (always generated) 291 CastExpr( const Expr * a ) : CastExpr( a->location, a, GeneratedCast ) {} 283 292 284 293 const Expr * accept( Visitor & v ) const override { return v.visit( this ); } -
src/AST/Init.hpp
r3c6e417 r54dd994 55 55 ConstructFlag maybeConstructed; 56 56 57 Init( const CodeLocation & loc, ConstructFlag mc ) : ParseNode( loc ), maybeConstructed( mc ) {}57 Init( const CodeLocation & loc, ConstructFlag mc ) : ParseNode( loc ), maybeConstructed( mc ) {} 58 58 59 const Init * accept( Visitor & v ) const override = 0;59 const Init * accept( Visitor & v ) const override = 0; 60 60 private: 61 61 Init * clone() const override = 0; … … 69 69 ptr<Expr> value; 70 70 71 SingleInit( const CodeLocation & loc, Expr* val, ConstructFlag mc = DoConstruct )71 SingleInit( const CodeLocation & loc, const Expr * val, ConstructFlag mc = DoConstruct ) 72 72 : Init( loc, mc ), value( val ) {} 73 73 … … 87 87 std::vector<ptr<Designation>> designations; 88 88 89 ListInit( const CodeLocation & loc, std::vector<ptr<Init>>&& is,90 std::vector<ptr<Designation>> && ds = {}, ConstructFlag mc = DoConstruct );89 ListInit( const CodeLocation & loc, std::vector<ptr<Init>> && is, 90 std::vector<ptr<Designation>> && ds = {}, ConstructFlag mc = DoConstruct ); 91 91 92 92 using iterator = std::vector<ptr<Init>>::iterator; … … 114 114 ptr<Init> init; 115 115 116 ConstructorInit( const CodeLocation& loc, Stmt* ctor, Stmt* dtor, Init* init ) 116 ConstructorInit( 117 const CodeLocation & loc, const Stmt * ctor, const Stmt * dtor, const Init * init ) 117 118 : Init( loc, DoConstruct ), ctor( ctor ), dtor( dtor ), init( init ) {} 118 119 -
src/AST/Node.hpp
r3c6e417 r54dd994 17 17 18 18 #include <cassert> 19 #include <cstddef> // for nullptr_t 19 20 #include <iosfwd> 20 21 #include <type_traits> // for remove_reference … … 181 182 } 182 183 184 ptr_base & operator=( std::nullptr_t ) { 185 if ( node ) _dec(node); 186 node = nullptr; 187 return *this; 188 } 189 183 190 ptr_base & operator=( const ptr_base & o ) { 184 191 assign(o.node); -
src/AST/Stmt.hpp
r3c6e417 r54dd994 61 61 CompoundStmt( CompoundStmt&& o ) = default; 62 62 63 void push_back( Stmt * s ) { kids.emplace_back( s ); }64 void push_front( Stmt * s ) { kids.emplace_front( s ); }63 void push_back( const Stmt * s ) { kids.emplace_back( s ); } 64 void push_front( const Stmt * s ) { kids.emplace_front( s ); } 65 65 66 66 const CompoundStmt * accept( Visitor & v ) const override { return v.visit( this ); } … … 143 143 144 144 IfStmt( const CodeLocation & loc, const Expr * cond, const Stmt * thenPart, 145 Stmt * const elsePart, std::vector<ptr<Stmt>> && inits,145 const Stmt * elsePart = nullptr, std::vector<ptr<Stmt>> && inits = {}, 146 146 std::vector<Label> && labels = {} ) 147 147 : Stmt(loc, std::move(labels)), cond(cond), thenPart(thenPart), elsePart(elsePart),
Note: See TracChangeset
for help on using the changeset viewer.