Changeset 849720f for src/SynTree/Expression.cc
- Timestamp:
- Sep 23, 2019, 4:59:33 PM (4 years ago)
- Branches:
- arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 4a60488, b4f8808
- Parents:
- abec2f8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
rabec2f8 r849720f 19 19 #include <iostream> // for ostream, operator<<, basic_ostream 20 20 #include <list> // for list, _List_iterator, list<>::co... 21 #include <set> // for set 21 22 22 23 #include "Common/utility.h" // for maybeClone, cloneAll, deleteAll … … 64 65 65 66 bool Expression::get_lvalue() const { 66 assert( !result->get_lvalue() );67 67 return false; 68 68 } … … 140 140 141 141 bool VariableExpr::get_lvalue() const { 142 return result->get_lvalue(); 142 // It isn't always an lvalue, but it is never an rvalue. 143 return true; 143 144 } 144 145 … … 277 278 278 279 bool CastExpr::get_lvalue() const { 279 return result->get_lvalue(); 280 // This is actually wrong by C, but it works with our current set-up. 281 return arg->get_lvalue(); 280 282 } 281 283 … … 360 362 } 361 363 364 bool UntypedMemberExpr::get_lvalue() const { 365 return aggregate->get_lvalue(); 366 } 367 362 368 void UntypedMemberExpr::print( std::ostream & os, Indenter indent ) const { 363 369 os << "Untyped Member Expression, with field: " << std::endl << indent+1; … … 392 398 393 399 bool MemberExpr::get_lvalue() const { 394 assert( result->get_lvalue() );400 // This is actually wrong by C, but it works with our current set-up. 395 401 return true; 396 402 } … … 447 453 448 454 bool UntypedExpr::get_lvalue() const { 449 return result->get_lvalue(); 455 // from src/GenPoly/Lvalue.cc: isIntrinsicReference 456 static std::set<std::string> lvalueFunctions = { "*?", "?[?]" }; 457 std::string fname = InitTweak::getFunctionName( const_cast< UntypedExpr * >( this ) ); 458 return lvalueFunctions.count(fname); 450 459 } 451 460 … … 510 519 511 520 bool ConditionalExpr::get_lvalue() const { 512 return result->get_lvalue();521 return false; 513 522 } 514 523 … … 570 579 571 580 bool ConstructorExpr::get_lvalue() const { 572 return result->get_lvalue();581 return false; 573 582 } 574 583 … … 593 602 594 603 bool CompoundLiteralExpr::get_lvalue() const { 595 assert( result->get_lvalue() );596 604 return true; 597 605 } … … 648 656 } 649 657 bool StmtExpr::get_lvalue() const { 650 return result->get_lvalue();658 return false; 651 659 } 652 660 void StmtExpr::print( std::ostream & os, Indenter indent ) const {
Note: See TracChangeset
for help on using the changeset viewer.