Changeset be8bd88 for src/SymTab/Validate.cc
- Timestamp:
- Mar 8, 2017, 3:22:50 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 031a2c95, 0e7ea335
- Parents:
- 87c3bef (diff), 6363ad1 (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
r87c3bef rbe8bd88 10 10 // Created On : Sun May 17 21:50:04 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Feb 23 21:33:55201713 // Update Count : 3 1812 // Last Modified On : Tue Mar 7 07:51:36 2017 13 // Update Count : 349 14 14 // 15 15 … … 97 97 class ReturnTypeFixer final : public Visitor { 98 98 public: 99 100 99 typedef Visitor Parent; 101 100 using Parent::visit; … … 104 103 105 104 virtual void visit( FunctionDecl * functionDecl ); 106 107 105 virtual void visit( FunctionType * ftype ); 108 106 }; … … 161 159 private: 162 160 virtual void visit( FunctionDecl * functionDecl ); 163 164 161 virtual void visit( ReturnStmt * returnStmt ); 165 162 … … 211 208 212 209 class CompoundLiteral final : public GenPoly::DeclMutator { 213 DeclarationNode::StorageClass storageclass = DeclarationNode::NoStorageClass;210 DeclarationNode::StorageClasses storageClasses; 214 211 215 212 using GenPoly::DeclMutator::mutate; … … 660 657 // Note, qualifiers on the typedef are superfluous for the forward declaration. 661 658 if ( StructInstType *aggDecl = dynamic_cast< StructInstType * >( tyDecl->get_base() ) ) { 662 return aggDecl->get_baseStruct() ? Mutator::mutate( aggDecl->get_baseStruct() ) :new StructDecl( aggDecl->get_name() );659 return new StructDecl( aggDecl->get_name() ); 663 660 } else if ( UnionInstType *aggDecl = dynamic_cast< UnionInstType * >( tyDecl->get_base() ) ) { 664 return aggDecl->get_baseUnion() ? Mutator::mutate( aggDecl->get_baseUnion() ) :new UnionDecl( aggDecl->get_name() );661 return new UnionDecl( aggDecl->get_name() ); 665 662 } else if ( EnumInstType *enumDecl = dynamic_cast< EnumInstType * >( tyDecl->get_base() ) ) { 666 663 return new EnumDecl( enumDecl->get_name() ); … … 691 688 DeclarationWithType *ret = Mutator::mutate( objDecl ); 692 689 typedefNames.endScope(); 693 // is the type a function? 694 if ( FunctionType *funtype = dynamic_cast<FunctionType *>( ret->get_type() ) ) { 690 691 if ( FunctionType *funtype = dynamic_cast<FunctionType *>( ret->get_type() ) ) { // function type? 695 692 // replace the current object declaration with a function declaration 696 FunctionDecl * newDecl = new FunctionDecl( ret->get_name(), ret->get_storageClass (), ret->get_linkage(), funtype, 0, ret->get_isInline(), ret->get_isNoreturn(), objDecl->get_attributes() );693 FunctionDecl * newDecl = new FunctionDecl( ret->get_name(), ret->get_storageClasses(), ret->get_linkage(), funtype, 0, objDecl->get_attributes(), ret->get_funcSpec() ); 697 694 objDecl->get_attributes().clear(); 698 695 objDecl->set_type( nullptr ); 699 696 delete objDecl; 700 697 return newDecl; 701 } else if ( objDecl->get_isInline() || objDecl->get_isNoreturn() ) {702 throw SemanticError( "invalid inline or _Noreturn specification in declaration of ", objDecl );703 698 } // if 704 699 return ret; … … 759 754 type = new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() ); 760 755 } // if 761 TypedefDeclPtr tyDecl( new TypedefDecl( aggDecl->get_name(), DeclarationNode:: NoStorageClass, type ) );756 TypedefDeclPtr tyDecl( new TypedefDecl( aggDecl->get_name(), DeclarationNode::StorageClasses(), type ) ); 762 757 typedefNames[ aggDecl->get_name() ] = std::make_pair( std::move( tyDecl ), scopeLevel ); 763 758 } // if … … 813 808 814 809 DeclarationWithType * CompoundLiteral::mutate( ObjectDecl *objectDecl ) { 815 storage class = objectDecl->get_storageClass();810 storageClasses = objectDecl->get_storageClasses(); 816 811 DeclarationWithType * temp = Mutator::mutate( objectDecl ); 817 storageclass = DeclarationNode::NoStorageClass;818 812 return temp; 819 813 } … … 824 818 static UniqueName indexName( "_compLit" ); 825 819 826 ObjectDecl *tempvar = new ObjectDecl( indexName.newName(), storage class, LinkageSpec::C, 0, compLitExpr->get_type(), compLitExpr->get_initializer() );820 ObjectDecl *tempvar = new ObjectDecl( indexName.newName(), storageClasses, LinkageSpec::C, 0, compLitExpr->get_type(), compLitExpr->get_initializer() ); 827 821 compLitExpr->set_type( 0 ); 828 822 compLitExpr->set_initializer( 0 ); … … 863 857 TupleType * tupleType = safe_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) ); 864 858 // ensure return value is not destructed by explicitly creating an empty ListInit node wherein maybeConstruct is false. 865 ObjectDecl * newRet = new ObjectDecl( "", DeclarationNode:: NoStorageClass, LinkageSpec::Cforall, 0, tupleType, new ListInit( std::list<Initializer*>(), noDesignators, false ) );859 ObjectDecl * newRet = new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, tupleType, new ListInit( std::list<Initializer*>(), noDesignators, false ) ); 866 860 deleteAll( retVals ); 867 861 retVals.clear();
Note: See TracChangeset
for help on using the changeset viewer.