Changeset 413f7f8 for src/SymTab
- Timestamp:
- Jul 7, 2015, 1:49:58 PM (10 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 82dd287
- Parents:
- e0ff3e6 (diff), 8686f31 (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/SymTab/Validate.cc
re0ff3e6 r413f7f8 10 10 // Created On : Sun May 17 21:50:04 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jun 24 16:20:50201513 // Update Count : 3012 // Last Modified On : Tue Jul 07 10:41:23 2015 13 // Update Count : 136 14 14 // 15 15 … … 52 52 #include "UniqueName.h" 53 53 #include "AddVisit.h" 54 #include "MakeLibCfa.h" 54 55 55 56 … … 126 127 std::list< Declaration * > &get_declsToAdd() { return declsToAdd; } 127 128 129 virtual void visit( EnumDecl *enumDecl ); 128 130 virtual void visit( StructDecl *structDecl ); 129 131 virtual void visit( UnionDecl *structDecl ); … … 291 293 292 294 for ( std::list< Declaration * >::iterator i = enumDecl->get_members().begin(); i != enumDecl->get_members().end(); ++i ) { 293 ObjectDecl * obj = dynamic_cast< ObjectDecl * >( *i );295 ObjectDecl * obj = dynamic_cast< ObjectDecl * >( *i ); 294 296 assert( obj ); 295 obj->set_type( new EnumInstType( Type::Qualifiers( true, false, false, false, false, false ), enumDecl->get_name() ) ); 297 // obj->set_type( new EnumInstType( Type::Qualifiers( true, false, false, false, false, false ), enumDecl->get_name() ) ); 298 BasicType * enumType = new BasicType( Type::Qualifiers(), BasicType::SignedInt ); 299 obj->set_type( enumType ) ; 296 300 } // for 297 301 Parent::visit( enumDecl ); … … 543 547 } 544 548 549 //E ?=?(E volatile*, int), 550 // ?=?(E _Atomic volatile*, int); 551 void makeEnumAssignment( EnumDecl *enumDecl, EnumInstType *refType, unsigned int functionNesting, std::list< Declaration * > &declsToAdd ) { 552 FunctionType *assignType = new FunctionType( Type::Qualifiers(), false ); 553 554 ObjectDecl *returnVal = new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, refType->clone(), 0 ); 555 assignType->get_returnVals().push_back( returnVal ); 556 557 // need two assignment operators with different types 558 FunctionType * assignType2 = assignType->clone(); 559 560 // E ?=?(E volatile *, E) 561 Type *etype = refType->clone(); 562 // etype->get_qualifiers() += Type::Qualifiers(false, true, false, false, false, false); 563 564 ObjectDecl *dstParam = new ObjectDecl( "_dst", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), etype ), 0 ); 565 assignType->get_parameters().push_back( dstParam ); 566 567 ObjectDecl *srcParam = new ObjectDecl( "_src", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, etype->clone(), 0 ); 568 assignType->get_parameters().push_back( srcParam ); 569 570 // E ?=?(E volatile *, int) 571 assignType2->get_parameters().push_back( dstParam->clone() ); 572 BasicType * paramType = new BasicType(Type::Qualifiers(), BasicType::SignedInt); 573 ObjectDecl *srcParam2 = new ObjectDecl( "_src", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, paramType, 0 ); 574 assignType2->get_parameters().push_back( srcParam2 ); 575 576 // Routines at global scope marked "static" to prevent multiple definitions is separate translation units 577 // because each unit generates copies of the default routines for each aggregate. 578 579 // since there is no definition, these should not be inline 580 // make these intrinsic so that the code generator does not make use of them 581 FunctionDecl *assignDecl = new FunctionDecl( "?=?", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::Intrinsic, assignType, 0, false, false ); 582 assignDecl->fixUniqueId(); 583 FunctionDecl *assignDecl2 = new FunctionDecl( "?=?", functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::Intrinsic, assignType2, 0, false, false ); 584 assignDecl2->fixUniqueId(); 585 586 std::list< Declaration * > assigns; 587 assigns.push_back( assignDecl ); 588 assigns.push_back( assignDecl2 ); 589 590 LibCfa::makeLibCfa( assigns ); 591 592 // need to remove the prototypes, since these can appear nested in a routine 593 for (int start = 0, end = assigns.size()/2; start < end; start++) { 594 delete assigns.front(); 595 assigns.pop_front(); 596 } 597 598 declsToAdd.insert( declsToAdd.begin(), assigns.begin(), assigns.end() ); 599 600 // return assignDecl; 601 } 602 603 545 604 Declaration *makeStructAssignment( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting ) { 546 605 FunctionType *assignType = new FunctionType( Type::Qualifiers(), false ); … … 612 671 613 672 return assignDecl; 673 } 674 675 void AddStructAssignment::visit( EnumDecl *enumDecl ) { 676 if ( ! enumDecl->get_members().empty() ) { 677 EnumInstType *enumInst = new EnumInstType( Type::Qualifiers(), enumDecl->get_name() ); 678 // enumInst->set_baseEnum( enumDecl ); 679 // declsToAdd.push_back( 680 makeEnumAssignment( enumDecl, enumInst, functionNesting, declsToAdd ); 681 } 614 682 } 615 683
Note:
See TracChangeset
for help on using the changeset viewer.