Changes in src/SynTree/Expression.cc [849720f:e67991f]
- File:
-
- 1 edited
-
src/SynTree/Expression.cc (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
r849720f re67991f 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : T hr Aug 15 13:43:00201913 // Update Count : 6 411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 19 18:10:55 2019 13 // Update Count : 60 14 14 // 15 15 … … 19 19 #include <iostream> // for ostream, operator<<, basic_ostream 20 20 #include <list> // for list, _List_iterator, list<>::co... 21 #include <set> // for set22 21 23 22 #include "Common/utility.h" // for maybeClone, cloneAll, deleteAll … … 64 63 } 65 64 66 bool Expression::get_lvalue() const {67 return false;68 }69 70 65 void Expression::print( std::ostream & os, Indenter indent ) const { 71 66 printInferParams( inferParams, os, indent+1, 0 ); … … 139 134 } 140 135 141 bool VariableExpr::get_lvalue() const {142 // It isn't always an lvalue, but it is never an rvalue.143 return true;144 }145 146 136 VariableExpr * VariableExpr::functionPointer( FunctionDecl * func ) { 147 137 VariableExpr * funcExpr = new VariableExpr( func ); … … 262 252 } 263 253 254 AttrExpr::AttrExpr( Expression * attr, Expression * expr_ ) : 255 Expression(), attr( attr ), expr(expr_), type(0), isType(false) { 256 } 257 258 AttrExpr::AttrExpr( Expression * attr, Type * type_ ) : 259 Expression(), attr( attr ), expr(0), type(type_), isType(true) { 260 } 261 262 AttrExpr::AttrExpr( const AttrExpr & other ) : 263 Expression( other ), attr( maybeClone( other.attr ) ), expr( maybeClone( other.expr ) ), type( maybeClone( other.type ) ), isType( other.isType ) { 264 } 265 266 AttrExpr::~AttrExpr() { 267 delete attr; 268 delete expr; 269 delete type; 270 } 271 272 void AttrExpr::print( std::ostream & os, Indenter indent) const { 273 os << "Attr "; 274 attr->print( os, indent+1); 275 if ( isType || expr ) { 276 os << "applied to: "; 277 if (isType) type->print(os, indent+1); 278 else expr->print(os, indent+1); 279 } // if 280 Expression::print( os, indent ); 281 } 282 264 283 CastExpr::CastExpr( Expression * arg, Type * toType, bool isGenerated ) : arg(arg), isGenerated( isGenerated ) { 265 284 set_result(toType); … … 275 294 CastExpr::~CastExpr() { 276 295 delete arg; 277 }278 279 bool CastExpr::get_lvalue() const {280 // This is actually wrong by C, but it works with our current set-up.281 return arg->get_lvalue();282 296 } 283 297 … … 362 376 } 363 377 364 bool UntypedMemberExpr::get_lvalue() const {365 return aggregate->get_lvalue();366 }367 368 378 void UntypedMemberExpr::print( std::ostream & os, Indenter indent ) const { 369 379 os << "Untyped Member Expression, with field: " << std::endl << indent+1; … … 395 405 // don't delete the member declaration, since it points somewhere else in the tree 396 406 delete aggregate; 397 }398 399 bool MemberExpr::get_lvalue() const {400 // This is actually wrong by C, but it works with our current set-up.401 return true;402 407 } 403 408 … … 452 457 } 453 458 454 bool UntypedExpr::get_lvalue() const {455 // from src/GenPoly/Lvalue.cc: isIntrinsicReference456 static std::set<std::string> lvalueFunctions = { "*?", "?[?]" };457 std::string fname = InitTweak::getFunctionName( const_cast< UntypedExpr * >( this ) );458 return lvalueFunctions.count(fname);459 }460 459 461 460 void UntypedExpr::print( std::ostream & os, Indenter indent ) const { … … 516 515 delete arg2; 517 516 delete arg3; 518 }519 520 bool ConditionalExpr::get_lvalue() const {521 return false;522 517 } 523 518 … … 578 573 } 579 574 580 bool ConstructorExpr::get_lvalue() const {581 return false;582 }583 584 575 void ConstructorExpr::print( std::ostream & os, Indenter indent ) const { 585 576 os << "Constructor Expression: " << std::endl << indent+1; … … 599 590 CompoundLiteralExpr::~CompoundLiteralExpr() { 600 591 delete initializer; 601 }602 603 bool CompoundLiteralExpr::get_lvalue() const {604 return true;605 592 } 606 593 … … 654 641 result = new VoidType( Type::Qualifiers() ); 655 642 } 656 }657 bool StmtExpr::get_lvalue() const {658 return false;659 643 } 660 644 void StmtExpr::print( std::ostream & os, Indenter indent ) const {
Note:
See TracChangeset
for help on using the changeset viewer.