Changeset 515a037 for src/Parser/TypeData.cc
- Timestamp:
- Dec 12, 2018, 3:52:19 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 1b8f13f0
- Parents:
- cdc02f2 (diff), 85acec94 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/TypeData.cc
rcdc02f2 r515a037 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 20 14:39:31201813 // Update Count : 62 212 // Last Modified On : Fri Nov 2 07:54:26 2018 13 // Update Count : 624 14 14 // 15 15 … … 96 96 break; 97 97 case Typeof: 98 case Basetypeof: 98 99 // typeexpr = new Typeof_t; 99 100 typeexpr = nullptr; … … 166 167 break; 167 168 case Typeof: 169 case Basetypeof: 168 170 // delete typeexpr->expr; 169 171 delete typeexpr; … … 245 247 break; 246 248 case Typeof: 249 case Basetypeof: 247 250 newtype->typeexpr = maybeClone( typeexpr ); 248 251 break; … … 419 422 } // if 420 423 break; 424 case Basetypeof: 425 os << "base-"; 426 #if defined(__GNUC__) && __GNUC__ >= 7 427 __attribute__((fallthrough)); 428 #endif 421 429 case Typeof: 422 430 os << "type-of expression "; … … 457 465 case Tuple: 458 466 case Typeof: 467 case Basetypeof: 459 468 case Builtin: 460 469 assertf(false, "Tried to get leaf name from kind without a name: %d", kind); … … 513 522 switch ( td->kind ) { 514 523 case TypeData::Unknown: 515 // fill in implicit int516 return new BasicType( buildQualifiers( td ), BasicType::SignedInt );524 // fill in implicit int 525 return new BasicType( buildQualifiers( td ), BasicType::SignedInt ); 517 526 case TypeData::Basic: 518 return buildBasicType( td );527 return buildBasicType( td ); 519 528 case TypeData::Pointer: 520 return buildPointer( td );529 return buildPointer( td ); 521 530 case TypeData::Array: 522 return buildArray( td );531 return buildArray( td ); 523 532 case TypeData::Reference: 524 return buildReference( td );533 return buildReference( td ); 525 534 case TypeData::Function: 526 return buildFunction( td );535 return buildFunction( td ); 527 536 case TypeData::AggregateInst: 528 return buildAggInst( td );537 return buildAggInst( td ); 529 538 case TypeData::EnumConstant: 530 // the name gets filled in later -- by SymTab::Validate531 return new EnumInstType( buildQualifiers( td ), "" );539 // the name gets filled in later -- by SymTab::Validate 540 return new EnumInstType( buildQualifiers( td ), "" ); 532 541 case TypeData::SymbolicInst: 533 return buildSymbolicInst( td );542 return buildSymbolicInst( td ); 534 543 case TypeData::Tuple: 535 return buildTuple( td );544 return buildTuple( td ); 536 545 case TypeData::Typeof: 537 return buildTypeof( td ); 546 case TypeData::Basetypeof: 547 return buildTypeof( td ); 538 548 case TypeData::Builtin: 539 if(td->builtintype == DeclarationNode::Zero) {540 return new ZeroType( noQualifiers );541 }542 else if(td->builtintype == DeclarationNode::One) {543 return new OneType( noQualifiers );544 }545 else {546 return new VarArgsType( buildQualifiers( td ) );547 }549 if (td->builtintype == DeclarationNode::Zero) { 550 return new ZeroType( noQualifiers ); 551 } 552 else if (td->builtintype == DeclarationNode::One) { 553 return new OneType( noQualifiers ); 554 } 555 else { 556 return new VarArgsType( buildQualifiers( td ) ); 557 } 548 558 case TypeData::GlobalScope: 549 return new GlobalScopeType();559 return new GlobalScopeType(); 550 560 case TypeData::Qualified: 551 return new QualifiedType( buildQualifiers( td ), typebuild( td->qualified.parent ), typebuild( td->qualified.child ) );561 return new QualifiedType( buildQualifiers( td ), typebuild( td->qualified.parent ), typebuild( td->qualified.child ) ); 552 562 case TypeData::Symbolic: 553 563 case TypeData::Enum: 554 564 case TypeData::Aggregate: 555 assert( false );565 assert( false ); 556 566 } // switch 557 567 … … 929 939 930 940 TypeofType * buildTypeof( const TypeData * td ) { 931 assert( td->kind == TypeData::Typeof );941 assert( td->kind == TypeData::Typeof || td->kind == TypeData::Basetypeof ); 932 942 assert( td->typeexpr ); 933 943 // assert( td->typeexpr->expr ); 934 return new TypeofType( buildQualifiers( td ), td->typeexpr->build() ); 944 return new TypeofType{ 945 buildQualifiers( td ), td->typeexpr->build(), td->kind == TypeData::Basetypeof }; 935 946 } // buildTypeof 936 947
Note: See TracChangeset
for help on using the changeset viewer.