Ignore:
Timestamp:
Mar 8, 2017, 3:22:50 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r87c3bef rbe8bd88  
    1010// Created On       : Sun May 17 21:50:04 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 23 21:33:55 2017
    13 // Update Count     : 318
     12// Last Modified On : Tue Mar  7 07:51:36 2017
     13// Update Count     : 349
    1414//
    1515
     
    9797        class ReturnTypeFixer final : public Visitor {
    9898          public:
    99 
    10099                typedef Visitor Parent;
    101100                using Parent::visit;
     
    104103
    105104                virtual void visit( FunctionDecl * functionDecl );
    106 
    107105                virtual void visit( FunctionType * ftype );
    108106        };
     
    161159          private:
    162160                virtual void visit( FunctionDecl * functionDecl );
    163 
    164161                virtual void visit( ReturnStmt * returnStmt );
    165162
     
    211208
    212209        class CompoundLiteral final : public GenPoly::DeclMutator {
    213                 DeclarationNode::StorageClass storageclass = DeclarationNode::NoStorageClass;
     210                DeclarationNode::StorageClasses storageClasses;
    214211
    215212                using GenPoly::DeclMutator::mutate;
     
    660657                // Note, qualifiers on the typedef are superfluous for the forward declaration.
    661658                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() );
    663660                } 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() );
    665662                } else if ( EnumInstType *enumDecl = dynamic_cast< EnumInstType * >( tyDecl->get_base() ) ) {
    666663                        return new EnumDecl( enumDecl->get_name() );
     
    691688                DeclarationWithType *ret = Mutator::mutate( objDecl );
    692689                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?
    695692                        // 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() );
    697694                        objDecl->get_attributes().clear();
    698695                        objDecl->set_type( nullptr );
    699696                        delete objDecl;
    700697                        return newDecl;
    701                 } else if ( objDecl->get_isInline() || objDecl->get_isNoreturn() ) {
    702                         throw SemanticError( "invalid inline or _Noreturn specification in declaration of ", objDecl );
    703698                } // if
    704699                return ret;
     
    759754                                type = new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() );
    760755                        } // if
    761                         TypedefDeclPtr tyDecl( new TypedefDecl( aggDecl->get_name(), DeclarationNode::NoStorageClass, type ) );
     756                        TypedefDeclPtr tyDecl( new TypedefDecl( aggDecl->get_name(), DeclarationNode::StorageClasses(), type ) );
    762757                        typedefNames[ aggDecl->get_name() ] = std::make_pair( std::move( tyDecl ), scopeLevel );
    763758                } // if
     
    813808
    814809        DeclarationWithType * CompoundLiteral::mutate( ObjectDecl *objectDecl ) {
    815                 storageclass = objectDecl->get_storageClass();
     810                storageClasses = objectDecl->get_storageClasses();
    816811                DeclarationWithType * temp = Mutator::mutate( objectDecl );
    817                 storageclass = DeclarationNode::NoStorageClass;
    818812                return temp;
    819813        }
     
    824818                static UniqueName indexName( "_compLit" );
    825819
    826                 ObjectDecl *tempvar = new ObjectDecl( indexName.newName(), storageclass, 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() );
    827821                compLitExpr->set_type( 0 );
    828822                compLitExpr->set_initializer( 0 );
     
    863857                        TupleType * tupleType = safe_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) );
    864858                        // 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 ) );
    866860                        deleteAll( retVals );
    867861                        retVals.clear();
Note: See TracChangeset for help on using the changeset viewer.