Changeset 330d933 for src/SynTree
- Timestamp:
- Aug 25, 2019, 8:48:51 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:
- 2aab69b, 5a43ab8
- Parents:
- f9bf142 (diff), bbb1b35 (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/SynTree
- Files:
-
- 2 added
- 9 edited
-
AddressExpr.cc (modified) (1 diff)
-
ApplicationExpr.cc (modified) (2 diffs)
-
BasicType.cc (modified) (2 diffs)
-
CommaExpr.cc (modified) (2 diffs)
-
Expression.cc (modified) (10 diffs)
-
Expression.h (modified) (14 diffs)
-
TopLvalue.cc (added)
-
TopLvalue.h (added)
-
TupleExpr.cc (modified) (3 diffs)
-
Type.cc (modified) (4 diffs)
-
module.mk (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/AddressExpr.cc
rf9bf142 r330d933 42 42 AddressExpr::AddressExpr( Expression *arg ) : Expression(), arg( arg ) { 43 43 if ( arg->result ) { 44 if ( arg-> result->get_lvalue() ) {44 if ( arg->get_lvalue() ) { 45 45 // lvalue, retains all layers of reference and gains a pointer inside the references 46 46 set_result( addrType( arg->result ) ); -
src/SynTree/ApplicationExpr.cc
rf9bf142 r330d933 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Tue Apr 26 12:41:06 201613 // Update Count : 411 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Aug 12 14:28:00 2019 13 // Update Count : 5 14 14 // 15 15 … … 76 76 } 77 77 78 bool ApplicationExpr::get_lvalue() const { 79 return result->get_lvalue(); 80 } 81 78 82 void ApplicationExpr::print( std::ostream &os, Indenter indent ) const { 79 83 os << "Application of" << std::endl << indent+1; -
src/SynTree/BasicType.cc
rf9bf142 r330d933 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jan 31 21:37:36201913 // Update Count : 1 212 // Last Modified On : Sun Aug 4 21:07:44 2019 13 // Update Count : 13 14 14 // 15 15 … … 31 31 bool BasicType::isInteger() const { 32 32 return kind <= UnsignedInt128; 33 #if 034 switch ( kind ) {35 case Bool:36 case Char:37 case SignedChar:38 case UnsignedChar:39 case ShortSignedInt:40 case ShortUnsignedInt:41 case SignedInt:42 case UnsignedInt:43 case LongSignedInt:44 case LongUnsignedInt:45 case LongLongSignedInt:46 case LongLongUnsignedInt:47 case SignedInt128:48 case UnsignedInt128:49 return true;50 case Float:51 case Double:52 case LongDouble:53 case FloatComplex:54 case DoubleComplex:55 case LongDoubleComplex:56 case FloatImaginary:57 case DoubleImaginary:58 case LongDoubleImaginary:59 case Float80:60 case Float128:61 return false;62 case NUMBER_OF_BASIC_TYPES:63 assert( false );64 } // switch65 assert( false );66 return false;67 #endif68 33 } 69 34 -
src/SynTree/CommaExpr.cc
rf9bf142 r330d933 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Mon May 02 15:19:44201613 // Update Count : 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Arg 12 16:11:00 2016 13 // Update Count : 2 14 14 // 15 15 … … 39 39 } 40 40 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(); 44 } 45 41 46 void CommaExpr::print( std::ostream &os, Indenter indent ) const { 42 47 os << "Comma Expression:" << std::endl; -
src/SynTree/Expression.cc
rf9bf142 r330d933 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Th u Jul 25 22:21:48201913 // Update Count : 6 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Aug 15 13:43:00 2019 13 // Update Count : 64 14 14 // 15 15 … … 63 63 } 64 64 65 bool Expression::get_lvalue() const { 66 assert( !result->get_lvalue() ); 67 return false; 68 } 69 65 70 void Expression::print( std::ostream & os, Indenter indent ) const { 66 71 printInferParams( inferParams, os, indent+1, 0 ); … … 134 139 } 135 140 141 bool VariableExpr::get_lvalue() const { 142 return result->get_lvalue(); 143 } 144 136 145 VariableExpr * VariableExpr::functionPointer( FunctionDecl * func ) { 137 146 VariableExpr * funcExpr = new VariableExpr( func ); … … 265 274 CastExpr::~CastExpr() { 266 275 delete arg; 276 } 277 278 bool CastExpr::get_lvalue() const { 279 return result->get_lvalue(); 267 280 } 268 281 … … 376 389 // don't delete the member declaration, since it points somewhere else in the tree 377 390 delete aggregate; 391 } 392 393 bool MemberExpr::get_lvalue() const { 394 assert( result->get_lvalue() ); 395 return true; 378 396 } 379 397 … … 428 446 } 429 447 448 bool UntypedExpr::get_lvalue() const { 449 return result->get_lvalue(); 450 } 430 451 431 452 void UntypedExpr::print( std::ostream & os, Indenter indent ) const { … … 486 507 delete arg2; 487 508 delete arg3; 509 } 510 511 bool ConditionalExpr::get_lvalue() const { 512 return result->get_lvalue(); 488 513 } 489 514 … … 544 569 } 545 570 571 bool ConstructorExpr::get_lvalue() const { 572 return result->get_lvalue(); 573 } 574 546 575 void ConstructorExpr::print( std::ostream & os, Indenter indent ) const { 547 576 os << "Constructor Expression: " << std::endl << indent+1; … … 561 590 CompoundLiteralExpr::~CompoundLiteralExpr() { 562 591 delete initializer; 592 } 593 594 bool CompoundLiteralExpr::get_lvalue() const { 595 assert( result->get_lvalue() ); 596 return true; 563 597 } 564 598 … … 612 646 result = new VoidType( Type::Qualifiers() ); 613 647 } 648 } 649 bool StmtExpr::get_lvalue() const { 650 return result->get_lvalue(); 614 651 } 615 652 void StmtExpr::print( std::ostream & os, Indenter indent ) const { -
src/SynTree/Expression.h
rf9bf142 r330d933 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Th u Jul 25 22:21:44201913 // Update Count : 5 011 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Aug 15 13:46:00 2019 13 // Update Count : 54 14 14 // 15 15 … … 71 71 const Type * get_result() const { return result; } 72 72 void set_result( Type * newValue ) { result = newValue; } 73 virtual bool get_lvalue() const; 73 74 74 75 TypeSubstitution * get_env() const { return env; } … … 98 99 virtual ~ApplicationExpr(); 99 100 101 bool get_lvalue() const final; 102 100 103 Expression * get_function() const { return function; } 101 104 void set_function( Expression * newValue ) { function = newValue; } … … 120 123 UntypedExpr( const UntypedExpr & other ); 121 124 virtual ~UntypedExpr(); 125 126 bool get_lvalue() const final; 122 127 123 128 Expression * get_function() const { return function; } … … 208 213 virtual ~CastExpr(); 209 214 215 bool get_lvalue() const final; 216 210 217 Expression * get_arg() const { return arg; } 211 218 void set_arg( Expression * newValue ) { arg = newValue; } … … 291 298 virtual ~MemberExpr(); 292 299 300 bool get_lvalue() const final; 301 293 302 DeclarationWithType * get_member() const { return member; } 294 303 void set_member( DeclarationWithType * newValue ) { member = newValue; } … … 313 322 VariableExpr( const VariableExpr & other ); 314 323 virtual ~VariableExpr(); 324 325 bool get_lvalue() const final; 315 326 316 327 DeclarationWithType * get_var() const { return var; } … … 500 511 virtual ~ConditionalExpr(); 501 512 513 bool get_lvalue() const final; 514 502 515 Expression * get_arg1() const { return arg1; } 503 516 void set_arg1( Expression * newValue ) { arg1 = newValue; } … … 524 537 virtual ~CommaExpr(); 525 538 539 bool get_lvalue() const final; 540 526 541 Expression * get_arg1() const { return arg1; } 527 542 void set_arg1( Expression * newValue ) { arg1 = newValue; } … … 610 625 ~ConstructorExpr(); 611 626 627 bool get_lvalue() const final; 628 612 629 Expression * get_callExpr() const { return callExpr; } 613 630 void set_callExpr( Expression * newValue ) { callExpr = newValue; } … … 628 645 CompoundLiteralExpr( const CompoundLiteralExpr & other ); 629 646 virtual ~CompoundLiteralExpr(); 647 648 bool get_lvalue() const final; 630 649 631 650 Initializer * get_initializer() const { return initializer; } … … 686 705 virtual ~TupleExpr(); 687 706 707 bool get_lvalue() const final; 708 688 709 std::list<Expression*>& get_exprs() { return exprs; } 689 710 … … 704 725 TupleIndexExpr( const TupleIndexExpr & other ); 705 726 virtual ~TupleIndexExpr(); 727 728 bool get_lvalue() const final; 706 729 707 730 Expression * get_tuple() const { return tuple; } … … 753 776 StmtExpr( const StmtExpr & other ); 754 777 virtual ~StmtExpr(); 778 779 bool get_lvalue() const final; 755 780 756 781 CompoundStmt * get_statements() const { return statements; } -
src/SynTree/TupleExpr.cc
rf9bf142 r330d933 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Mar 17 09:42:29 201713 // Update Count : 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Aug 14 14:34:00 2019 13 // Update Count : 5 14 14 // 15 15 … … 57 57 } 58 58 59 bool TupleExpr::get_lvalue() const { 60 return result->get_lvalue(); 61 } 62 59 63 void TupleExpr::print( std::ostream &os, Indenter indent ) const { 60 64 os << "Tuple:" << std::endl; … … 76 80 TupleIndexExpr::~TupleIndexExpr() { 77 81 delete tuple; 82 } 83 84 bool TupleIndexExpr::get_lvalue() const { 85 assert( result->get_lvalue() ); 86 return true; 78 87 } 79 88 -
src/SynTree/Type.cc
rf9bf142 r330d933 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 : Fri Jul 12 15:48:00201913 // Update Count : 4 411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Aug 4 21:05:07 2019 13 // Update Count : 45 14 14 // 15 15 #include "Type.h" … … 24 24 using namespace std; 25 25 26 const char *BasicType::typeNames[] = { 27 #if 0 28 "_Bool", 29 "char", 30 "signed char", 31 "unsigned char", 32 "signed short int", 33 "unsigned short int", 34 "signed int", 35 "unsigned int", 36 "signed long int", 37 "unsigned long int", 38 "signed long long int", 39 "unsigned long long int", 40 "float", 41 "double", 42 "long double", 43 "float _Complex", 44 "double _Complex", 45 "long double _Complex", 46 "float _Imaginary", 47 "double _Imaginary", 48 "long double _Imaginary", 49 "__int128", 50 "unsigned __int128", 51 "__float80", 52 "__float128", 53 "_Float16", 54 "_Float32", 55 "_Float32x", 56 "_Float64", 57 "_Float64x", 58 "_Float128", 59 "_Float128x", 60 "_Float16 _Complex", 61 "_Float32 _Complex", 62 "_Float32x _Complex", 63 "_Float64 _Complex", 64 "_Float64x _Complex", 65 "_Float128 _Complex", 66 "_Float128x _Complex", 67 #endif 26 const char * BasicType::typeNames[] = { 68 27 "_Bool", 69 28 "char", … … 107 66 }; 108 67 static_assert( 109 sizeof(BasicType::typeNames) /sizeof(BasicType::typeNames[0]) == BasicType::NUMBER_OF_BASIC_TYPES,68 sizeof(BasicType::typeNames) / sizeof(BasicType::typeNames[0]) == BasicType::NUMBER_OF_BASIC_TYPES, 110 69 "Each basic type name should have a corresponding kind enum value" 111 70 ); … … 152 111 TypeSubstitution Type::genericSubstitution() const { assertf( false, "Non-aggregate type: %s", toCString( this ) ); } 153 112 154 void Type::print( std::ostream & os, Indenter indent ) const {113 void Type::print( std::ostream & os, Indenter indent ) const { 155 114 if ( ! forall.empty() ) { 156 115 os << "forall" << std::endl; -
src/SynTree/module.mk
rf9bf142 r330d933 49 49 SynTree/TypeSubstitution.cc \ 50 50 SynTree/Attribute.cc \ 51 SynTree/DeclReplacer.cc 51 SynTree/DeclReplacer.cc \ 52 SynTree/TopLvalue.cc 52 53 53 54 SRC += $(SRC_SYNTREE)
Note:
See TracChangeset
for help on using the changeset viewer.