Changeset 849720f for src/SynTree
- Timestamp:
- Sep 23, 2019, 4:59:33 PM (5 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:
- 4a60488, b4f8808
- Parents:
- abec2f8
- Location:
- src/SynTree
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/ApplicationExpr.cc
rabec2f8 r849720f 25 25 #include "Declaration.h" // for Declaration 26 26 #include "Expression.h" // for ParamEntry, ApplicationExpr, Expression 27 #include "InitTweak/InitTweak.h" // for getFunction 27 28 #include "ResolvExpr/typeops.h" // for extractResultType 28 29 #include "Type.h" // for Type, PointerType, FunctionType … … 77 78 78 79 bool ApplicationExpr::get_lvalue() const { 79 return result->get_lvalue(); 80 // from src/GenPoly/Lvalue.cc: isIntrinsicReference 81 static std::set<std::string> lvalueFunctions = { "*?", "?[?]" }; 82 if ( const DeclarationWithType * func = InitTweak::getFunction( this ) ) { 83 return func->linkage == LinkageSpec::Intrinsic && lvalueFunctions.count(func->name); 84 } 85 return false; 80 86 } 81 87 -
src/SynTree/CommaExpr.cc
rabec2f8 r849720f 40 40 41 41 bool CommaExpr::get_lvalue() const { 42 // xxx - as above, shouldn't be an lvalue but that information is used anyways.43 return result->get_lvalue();42 // This is wrong by C, but the current implementation uses it. 43 return arg2->get_lvalue(); 44 44 } 45 45 -
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 { -
src/SynTree/Expression.h
rabec2f8 r849720f 275 275 virtual ~UntypedMemberExpr(); 276 276 277 bool get_lvalue() const final; 278 277 279 Expression * get_member() const { return member; } 278 280 void set_member( Expression * newValue ) { member = newValue; } -
src/SynTree/TupleExpr.cc
rabec2f8 r849720f 58 58 59 59 bool TupleExpr::get_lvalue() const { 60 return result->get_lvalue();60 return false; 61 61 } 62 62 … … 83 83 84 84 bool TupleIndexExpr::get_lvalue() const { 85 assert( result->get_lvalue() ); 86 return true; 85 return tuple->get_lvalue(); 87 86 } 88 87
Note: See TracChangeset
for help on using the changeset viewer.