Changeset bf4b4cf for src/SynTree
- Timestamp:
- Oct 2, 2017, 4:53:32 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- d29fa5f
- Parents:
- 50377a4
- git-author:
- Rob Schluntz <rschlunt@…> (10/02/17 16:53:28)
- git-committer:
- Rob Schluntz <rschlunt@…> (10/02/17 16:53:32)
- Location:
- src/SynTree
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/AddressExpr.cc
r50377a4 rbf4b4cf 40 40 } 41 41 42 AddressExpr::AddressExpr( Expression *arg , Expression *_aname ) : Expression( _aname), arg( arg ) {42 AddressExpr::AddressExpr( Expression *arg ) : Expression(), arg( arg ) { 43 43 if ( arg->has_result() ) { 44 44 if ( arg->get_result()->get_lvalue() ) { -
src/SynTree/CommaExpr.cc
r50377a4 rbf4b4cf 21 21 #include "Type.h" // for Type 22 22 23 CommaExpr::CommaExpr( Expression *arg1, Expression *arg2 , Expression *_aname)24 : Expression( _aname), arg1( arg1 ), arg2( arg2 ) {23 CommaExpr::CommaExpr( Expression *arg1, Expression *arg2 ) 24 : Expression(), arg1( arg1 ), arg2( arg2 ) { 25 25 // xxx - result of a comma expression is never an lvalue, so should set lvalue 26 26 // to false on all result types. Actually doing this causes some strange things -
src/SynTree/Expression.cc
r50377a4 rbf4b4cf 33 33 #include "GenPoly/Lvalue.h" 34 34 35 Expression::Expression( Expression *_aname ) : result( 0 ), env( 0 ), argName( _aname) {}36 37 Expression::Expression( const Expression &other ) : BaseSyntaxNode( other ), result( maybeClone( other.result ) ), env( maybeClone( other.env ) ), argName( maybeClone( other.get_argName() ) ),extension( other.extension ) {35 Expression::Expression() : result( 0 ), env( 0 ) {} 36 37 Expression::Expression( const Expression &other ) : BaseSyntaxNode( other ), result( maybeClone( other.result ) ), env( maybeClone( other.env ) ), extension( other.extension ) { 38 38 } 39 39 40 40 Expression::~Expression() { 41 41 delete env; 42 delete argName; // xxx -- there's a problem in cloning ConstantExpr I still don't know how to fix43 42 delete result; 44 43 } … … 55 54 } 56 55 57 ConstantExpr::ConstantExpr( Constant _c , Expression *_aname ) : Expression( _aname), constant( _c ) {56 ConstantExpr::ConstantExpr( Constant _c ) : Expression(), constant( _c ) { 58 57 set_result( constant.get_type()->clone() ); 59 58 } … … 70 69 } 71 70 72 VariableExpr::VariableExpr( DeclarationWithType *_var , Expression *_aname ) : Expression( _aname), var( _var ) {71 VariableExpr::VariableExpr( DeclarationWithType *_var ) : Expression(), var( _var ) { 73 72 assert( var ); 74 73 assert( var->get_type() ); … … 97 96 } 98 97 99 SizeofExpr::SizeofExpr( Expression *expr_ , Expression *_aname) :100 Expression( _aname), expr(expr_), type(0), isType(false) {98 SizeofExpr::SizeofExpr( Expression *expr_ ) : 99 Expression(), expr(expr_), type(0), isType(false) { 101 100 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 102 101 } 103 102 104 SizeofExpr::SizeofExpr( Type *type_ , Expression *_aname) :105 Expression( _aname), expr(0), type(type_), isType(true) {103 SizeofExpr::SizeofExpr( Type *type_ ) : 104 Expression(), expr(0), type(type_), isType(true) { 106 105 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 107 106 } … … 123 122 } 124 123 125 AlignofExpr::AlignofExpr( Expression *expr_ , Expression *_aname) :126 Expression( _aname), expr(expr_), type(0), isType(false) {124 AlignofExpr::AlignofExpr( Expression *expr_ ) : 125 Expression(), expr(expr_), type(0), isType(false) { 127 126 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 128 127 } 129 128 130 AlignofExpr::AlignofExpr( Type *type_ , Expression *_aname) :131 Expression( _aname), expr(0), type(type_), isType(true) {129 AlignofExpr::AlignofExpr( Type *type_ ) : 130 Expression(), expr(0), type(type_), isType(true) { 132 131 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 133 132 } … … 149 148 } 150 149 151 UntypedOffsetofExpr::UntypedOffsetofExpr( Type *type, const std::string &member , Expression *_aname) :152 Expression( _aname), type(type), member(member) {150 UntypedOffsetofExpr::UntypedOffsetofExpr( Type *type, const std::string &member ) : 151 Expression(), type(type), member(member) { 153 152 assert( type ); 154 153 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); … … 168 167 } 169 168 170 OffsetofExpr::OffsetofExpr( Type *type, DeclarationWithType *member , Expression *_aname) :171 Expression( _aname), type(type), member(member) {169 OffsetofExpr::OffsetofExpr( Type *type, DeclarationWithType *member ) : 170 Expression(), type(type), member(member) { 172 171 assert( member ); 173 172 assert( type ); … … 188 187 } 189 188 190 OffsetPackExpr::OffsetPackExpr( StructInstType *type , Expression *aname_ ) : Expression( aname_), type( type ) {189 OffsetPackExpr::OffsetPackExpr( StructInstType *type ) : Expression(), type( type ) { 191 190 assert( type ); 192 191 set_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) ); … … 203 202 } 204 203 205 AttrExpr::AttrExpr( Expression *attr, Expression *expr_ , Expression *_aname) :206 Expression( _aname), attr( attr ), expr(expr_), type(0), isType(false) {207 } 208 209 AttrExpr::AttrExpr( Expression *attr, Type *type_ , Expression *_aname) :210 Expression( _aname), attr( attr ), expr(0), type(type_), isType(true) {204 AttrExpr::AttrExpr( Expression *attr, Expression *expr_ ) : 205 Expression(), attr( attr ), expr(expr_), type(0), isType(false) { 206 } 207 208 AttrExpr::AttrExpr( Expression *attr, Type *type_ ) : 209 Expression(), attr( attr ), expr(0), type(type_), isType(true) { 211 210 } 212 211 … … 232 231 } 233 232 234 CastExpr::CastExpr( Expression *arg_, Type *toType , Expression *_aname ) : Expression( _aname), arg(arg_) {233 CastExpr::CastExpr( Expression *arg_, Type *toType ) : Expression(), arg(arg_) { 235 234 set_result(toType); 236 235 } 237 236 238 CastExpr::CastExpr( Expression *arg_ , Expression *_aname ) : Expression( _aname), arg(arg_) {237 CastExpr::CastExpr( Expression *arg_ ) : Expression(), arg(arg_) { 239 238 set_result( new VoidType( Type::Qualifiers() ) ); 240 239 } … … 284 283 } 285 284 286 UntypedMemberExpr::UntypedMemberExpr( Expression * member, Expression *aggregate , Expression *_aname) :287 Expression( _aname), member(member), aggregate(aggregate) {285 UntypedMemberExpr::UntypedMemberExpr( Expression * member, Expression *aggregate ) : 286 Expression(), member(member), aggregate(aggregate) { 288 287 assert( aggregate ); 289 288 } … … 321 320 322 321 323 MemberExpr::MemberExpr( DeclarationWithType *member, Expression *aggregate , Expression *_aname) :324 Expression( _aname), member(member), aggregate(aggregate) {322 MemberExpr::MemberExpr( DeclarationWithType *member, Expression *aggregate ) : 323 Expression(), member(member), aggregate(aggregate) { 325 324 assert( member ); 326 325 assert( aggregate ); … … 351 350 } 352 351 353 UntypedExpr::UntypedExpr( Expression * _function, const std::list<Expression *> &_args, Expression *_aname) :354 Expression( _aname ), function(_function), args(_args) {}352 UntypedExpr::UntypedExpr( Expression *function, const std::list<Expression *> &args ) : 353 Expression(), function(function), args(args) {} 355 354 356 355 UntypedExpr::UntypedExpr( const UntypedExpr &other ) : … … 402 401 } 403 402 404 NameExpr::NameExpr( std::string name , Expression *_aname ) : Expression( _aname), name(name) {403 NameExpr::NameExpr( std::string name ) : Expression(), name(name) { 405 404 assertf(name != "0", "Zero is not a valid name"); 406 405 assertf(name != "1", "One is not a valid name"); … … 417 416 } 418 417 419 LogicalExpr::LogicalExpr( Expression *arg1_, Expression *arg2_, bool andp , Expression *_aname) :420 Expression( _aname), arg1(arg1_), arg2(arg2_), isAnd(andp) {418 LogicalExpr::LogicalExpr( Expression *arg1_, Expression *arg2_, bool andp ) : 419 Expression(), arg1(arg1_), arg2(arg2_), isAnd(andp) { 421 420 set_result( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) ); 422 421 } … … 439 438 } 440 439 441 ConditionalExpr::ConditionalExpr( Expression * arg1, Expression * arg2, Expression * arg3 , Expression *_aname) :442 Expression( _aname), arg1(arg1), arg2(arg2), arg3(arg3) {}440 ConditionalExpr::ConditionalExpr( Expression * arg1, Expression * arg2, Expression * arg3 ) : 441 Expression(), arg1(arg1), arg2(arg2), arg3(arg3) {} 443 442 444 443 ConditionalExpr::ConditionalExpr( const ConditionalExpr &other ) : -
src/SynTree/Expression.h
r50377a4 rbf4b4cf 36 36 Type * result; 37 37 TypeSubstitution * env; 38 Expression * argName; // if expression is used as an argument, it can be "designated" by this name39 38 bool extension = false; 40 39 41 Expression( Expression * _aname = nullptr);40 Expression(); 42 41 Expression( const Expression & other ); 43 42 virtual ~Expression(); … … 50 49 TypeSubstitution * get_env() const { return env; } 51 50 void set_env( TypeSubstitution * newValue ) { env = newValue; } 52 Expression * get_argName() const { return argName; }53 void set_argName( Expression * name ) { argName = name; }54 51 bool get_extension() const { return extension; } 55 52 Expression * set_extension( bool exten ) { extension = exten; return this; } … … 112 109 std::list<Expression*> args; 113 110 114 UntypedExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() , Expression *_aname = nullptr);111 UntypedExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() ); 115 112 UntypedExpr( const UntypedExpr & other ); 116 113 virtual ~UntypedExpr(); … … 137 134 std::string name; 138 135 139 NameExpr( std::string name , Expression *_aname = nullptr);136 NameExpr( std::string name ); 140 137 NameExpr( const NameExpr & other ); 141 138 virtual ~NameExpr(); … … 158 155 Expression * arg; 159 156 160 AddressExpr( Expression * arg , Expression *_aname = nullptr);157 AddressExpr( Expression * arg ); 161 158 AddressExpr( const AddressExpr & other ); 162 159 virtual ~AddressExpr(); … … 192 189 Expression * arg; 193 190 194 CastExpr( Expression * arg , Expression *_aname = nullptr);195 CastExpr( Expression * arg, Type * toType , Expression *_aname = nullptr);191 CastExpr( Expression * arg ); 192 CastExpr( Expression * arg, Type * toType ); 196 193 CastExpr( const CastExpr & other ); 197 194 virtual ~CastExpr(); … … 230 227 Expression * aggregate; 231 228 232 UntypedMemberExpr( Expression * member, Expression * aggregate , Expression *_aname = nullptr);229 UntypedMemberExpr( Expression * member, Expression * aggregate ); 233 230 UntypedMemberExpr( const UntypedMemberExpr & other ); 234 231 virtual ~UntypedMemberExpr(); … … 252 249 Expression * aggregate; 253 250 254 MemberExpr( DeclarationWithType * member, Expression * aggregate , Expression *_aname = nullptr);251 MemberExpr( DeclarationWithType * member, Expression * aggregate ); 255 252 MemberExpr( const MemberExpr & other ); 256 253 virtual ~MemberExpr(); … … 273 270 DeclarationWithType * var; 274 271 275 VariableExpr( DeclarationWithType * var , Expression *_aname = nullptr);272 VariableExpr( DeclarationWithType * var ); 276 273 VariableExpr( const VariableExpr & other ); 277 274 virtual ~VariableExpr(); … … 293 290 Constant constant; 294 291 295 ConstantExpr( Constant constant , Expression *_aname = nullptr);292 ConstantExpr( Constant constant ); 296 293 ConstantExpr( const ConstantExpr & other ); 297 294 virtual ~ConstantExpr(); … … 313 310 bool isType; 314 311 315 SizeofExpr( Expression * expr , Expression *_aname = nullptr);312 SizeofExpr( Expression * expr ); 316 313 SizeofExpr( const SizeofExpr & other ); 317 SizeofExpr( Type * type , Expression *_aname = nullptr);314 SizeofExpr( Type * type ); 318 315 virtual ~SizeofExpr(); 319 316 … … 338 335 bool isType; 339 336 340 AlignofExpr( Expression * expr , Expression *_aname = nullptr);337 AlignofExpr( Expression * expr ); 341 338 AlignofExpr( const AlignofExpr & other ); 342 AlignofExpr( Type * type , Expression *_aname = nullptr);339 AlignofExpr( Type * type ); 343 340 virtual ~AlignofExpr(); 344 341 … … 362 359 std::string member; 363 360 364 UntypedOffsetofExpr( Type * type, const std::string & member , Expression *_aname = nullptr);361 UntypedOffsetofExpr( Type * type, const std::string & member ); 365 362 UntypedOffsetofExpr( const UntypedOffsetofExpr & other ); 366 363 virtual ~UntypedOffsetofExpr(); … … 383 380 DeclarationWithType * member; 384 381 385 OffsetofExpr( Type * type, DeclarationWithType * member , Expression *_aname = nullptr);382 OffsetofExpr( Type * type, DeclarationWithType * member ); 386 383 OffsetofExpr( const OffsetofExpr & other ); 387 384 virtual ~OffsetofExpr(); … … 403 400 StructInstType * type; 404 401 405 OffsetPackExpr( StructInstType * type _, Expression * aname_ = 0);402 OffsetPackExpr( StructInstType * type ); 406 403 OffsetPackExpr( const OffsetPackExpr & other ); 407 404 virtual ~OffsetPackExpr(); … … 424 421 bool isType; 425 422 426 AttrExpr(Expression * attr, Expression * expr , Expression *_aname = nullptr);423 AttrExpr(Expression * attr, Expression * expr ); 427 424 AttrExpr( const AttrExpr & other ); 428 AttrExpr( Expression * attr, Type * type , Expression *_aname = nullptr);425 AttrExpr( Expression * attr, Type * type ); 429 426 virtual ~AttrExpr(); 430 427 … … 450 447 Expression * arg2; 451 448 452 LogicalExpr( Expression * arg1, Expression * arg2, bool andp = true , Expression *_aname = nullptr);449 LogicalExpr( Expression * arg1, Expression * arg2, bool andp = true ); 453 450 LogicalExpr( const LogicalExpr & other ); 454 451 virtual ~LogicalExpr(); … … 476 473 Expression * arg3; 477 474 478 ConditionalExpr( Expression * arg1, Expression * arg2, Expression * arg3 , Expression *_aname = nullptr);475 ConditionalExpr( Expression * arg1, Expression * arg2, Expression * arg3 ); 479 476 ConditionalExpr( const ConditionalExpr & other ); 480 477 virtual ~ConditionalExpr(); … … 499 496 Expression * arg2; 500 497 501 CommaExpr( Expression * arg1, Expression * arg2 , Expression *_aname = nullptr);498 CommaExpr( Expression * arg1, Expression * arg2 ); 502 499 CommaExpr( const CommaExpr & other ); 503 500 virtual ~CommaExpr(); … … 646 643 std::list<Expression*> exprs; 647 644 648 UntypedTupleExpr( const std::list< Expression * > & exprs , Expression *_aname = nullptr);645 UntypedTupleExpr( const std::list< Expression * > & exprs ); 649 646 UntypedTupleExpr( const UntypedTupleExpr & other ); 650 647 virtual ~UntypedTupleExpr(); … … 663 660 std::list<Expression*> exprs; 664 661 665 TupleExpr( const std::list< Expression * > & exprs , Expression *_aname = nullptr);662 TupleExpr( const std::list< Expression * > & exprs ); 666 663 TupleExpr( const TupleExpr & other ); 667 664 virtual ~TupleExpr(); … … 701 698 StmtExpr * stmtExpr = nullptr; 702 699 703 TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls , Expression * _aname = nullptr);700 TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls ); 704 701 TupleAssignExpr( const TupleAssignExpr & other ); 705 702 virtual ~TupleAssignExpr(); -
src/SynTree/TupleExpr.cc
r50377a4 rbf4b4cf 28 28 #include "Type.h" // for TupleType, Type 29 29 30 UntypedTupleExpr::UntypedTupleExpr( const std::list< Expression * > & exprs , Expression *_aname ) : Expression( _aname), exprs( exprs ) {30 UntypedTupleExpr::UntypedTupleExpr( const std::list< Expression * > & exprs ) : Expression(), exprs( exprs ) { 31 31 } 32 32 … … 45 45 } 46 46 47 TupleExpr::TupleExpr( const std::list< Expression * > & exprs , Expression *_aname ) : Expression( _aname), exprs( exprs ) {47 TupleExpr::TupleExpr( const std::list< Expression * > & exprs ) : Expression(), exprs( exprs ) { 48 48 set_result( Tuples::makeTupleType( exprs ) ); 49 49 } … … 86 86 } 87 87 88 TupleAssignExpr::TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls , Expression * _aname ) : Expression( _aname) {88 TupleAssignExpr::TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls ) : Expression() { 89 89 // convert internally into a StmtExpr which contains the declarations and produces the tuple of the assignments 90 90 set_result( Tuples::makeTupleType( assigns ) );
Note: See TracChangeset
for help on using the changeset viewer.