Changeset 64b6913 for src


Ignore:
Timestamp:
Mar 16, 2017, 8:19:39 AM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
26ba208
Parents:
6e8bd43
Message:

move type StorageClasses? from DeclarationNode? to Type

Location:
src
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/FixNames.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  6 23:32:08 2017
    13 // Update Count     : 15
     12// Last Modified On : Thu Mar 16 07:50:30 2017
     13// Update Count     : 16
    1414//
    1515
     
    3939        std::string mangle_main() {
    4040                FunctionType* main_type;
    41                 std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", DeclarationNode::StorageClasses(), LinkageSpec::Cforall,
     41                std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", Type::StorageClasses(), LinkageSpec::Cforall,
    4242                                                                                                                                   main_type = new FunctionType( Type::Qualifiers(), true ), nullptr )
    4343                                };
    4444                main_type->get_returnVals().push_back(
    45                         new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
     45                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    4646                );
    4747
     
    5252        std::string mangle_main_args() {
    5353                FunctionType* main_type;
    54                 std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", DeclarationNode::StorageClasses(), LinkageSpec::Cforall,
     54                std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", Type::StorageClasses(), LinkageSpec::Cforall,
    5555                                                                                                                                   main_type = new FunctionType( Type::Qualifiers(), false ), nullptr )
    5656                                };
    5757                main_type->get_returnVals().push_back(
    58                         new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
     58                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    5959                );
    6060
    6161                mainDecl->get_functionType()->get_parameters().push_back(
    62                         new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
     62                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    6363                );
    6464
    6565                mainDecl->get_functionType()->get_parameters().push_back(
    66                         new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0,
     66                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0,
    6767                        new PointerType( Type::Qualifiers(), new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Char ) ) ),
    6868                        nullptr )
  • src/Concurrency/Keywords.cc

    r6e8bd43 r64b6913  
    1212// Last Modified By :
    1313// Last Modified On :
    14 // Update Count     : 0
     14// Update Count     : 1
    1515//
    1616
     
    2929        namespace {
    3030                const std::list<Label> noLabels;
    31                 DeclarationNode::StorageClasses noStorage;
     31                Type::StorageClasses noStorage;
    3232                Type::Qualifiers noQualifiers;
    3333        }
  • src/GenPoly/Box.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 14 07:45:29 2017
    13 // Update Count     : 334
     12// Last Modified On : Thu Mar 16 08:06:05 2017
     13// Update Count     : 337
    1414//
    1515
     
    289289                        TypeInstType paramType( Type::Qualifiers(), (*param)->get_name(), *param );
    290290                        std::string paramName = mangleType( &paramType );
    291                         layoutFnType->get_parameters().push_back( new ObjectDecl( sizeofName( paramName ), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignType.clone(), 0 ) );
    292                         layoutFnType->get_parameters().push_back( new ObjectDecl( alignofName( paramName ), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignType.clone(), 0 ) );
     291                        layoutFnType->get_parameters().push_back( new ObjectDecl( sizeofName( paramName ), Type::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignType.clone(), 0 ) );
     292                        layoutFnType->get_parameters().push_back( new ObjectDecl( alignofName( paramName ), Type::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignType.clone(), 0 ) );
    293293                }
    294294        }
     
    299299                // because each unit generates copies of the default routines for each aggregate.
    300300                FunctionDecl *layoutDecl = new FunctionDecl( layoutofName( typeDecl ),
    301                                                                                                          functionNesting > 0 ? DeclarationNode::StorageClasses() : DeclarationNode::StorageClasses( DeclarationNode::Static ),
     301                                                                                                         functionNesting > 0 ? Type::StorageClasses() : Type::StorageClasses( Type::Static ),
    302302                                                                                                         LinkageSpec::AutoGen, layoutFnType, new CompoundStmt( noLabels ),
    303303                                                                                                         std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::Inline ) );
     
    368368                PointerType *sizeAlignOutType = new PointerType( Type::Qualifiers(), sizeAlignType );
    369369
    370                 ObjectDecl *sizeParam = new ObjectDecl( sizeofName( structDecl->get_name() ), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType, 0 );
     370                ObjectDecl *sizeParam = new ObjectDecl( sizeofName( structDecl->get_name() ), Type::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType, 0 );
    371371                layoutFnType->get_parameters().push_back( sizeParam );
    372                 ObjectDecl *alignParam = new ObjectDecl( alignofName( structDecl->get_name() ), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
     372                ObjectDecl *alignParam = new ObjectDecl( alignofName( structDecl->get_name() ), Type::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
    373373                layoutFnType->get_parameters().push_back( alignParam );
    374                 ObjectDecl *offsetParam = new ObjectDecl( offsetofName( structDecl->get_name() ), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
     374                ObjectDecl *offsetParam = new ObjectDecl( offsetofName( structDecl->get_name() ), Type::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
    375375                layoutFnType->get_parameters().push_back( offsetParam );
    376376                addOtypeParams( layoutFnType, otypeParams );
     
    429429                PointerType *sizeAlignOutType = new PointerType( Type::Qualifiers(), sizeAlignType );
    430430
    431                 ObjectDecl *sizeParam = new ObjectDecl( sizeofName( unionDecl->get_name() ), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType, 0 );
     431                ObjectDecl *sizeParam = new ObjectDecl( sizeofName( unionDecl->get_name() ), Type::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType, 0 );
    432432                layoutFnType->get_parameters().push_back( sizeParam );
    433                 ObjectDecl *alignParam = new ObjectDecl( alignofName( unionDecl->get_name() ), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
     433                ObjectDecl *alignParam = new ObjectDecl( alignofName( unionDecl->get_name() ), Type::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
    434434                layoutFnType->get_parameters().push_back( alignParam );
    435435                addOtypeParams( layoutFnType, otypeParams );
     
    537537                                        if ( adapters.find( mangleName ) == adapters.end() ) {
    538538                                                std::string adapterName = makeAdapterName( mangleName );
    539                                                 adapters.insert( std::pair< std::string, DeclarationWithType *>( mangleName, new ObjectDecl( adapterName, DeclarationNode::StorageClasses(), LinkageSpec::C, nullptr, new PointerType( Type::Qualifiers(), makeAdapterType( *funType, scopeTyVars ) ), nullptr ) ) );
     539                                                adapters.insert( std::pair< std::string, DeclarationWithType *>( mangleName, new ObjectDecl( adapterName, Type::StorageClasses(), LinkageSpec::C, nullptr, new PointerType( Type::Qualifiers(), makeAdapterType( *funType, scopeTyVars ) ), nullptr ) ) );
    540540                                        } // if
    541541                                } // for
     
    656656
    657657                ObjectDecl *Pass1::makeTemporary( Type *type ) {
    658                         ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, 0, type, 0 );
     658                        ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, type, 0 );
    659659                        stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) );
    660660                        return newObj;
     
    765765                                        Type * newType = param->clone();
    766766                                        if ( env ) env->apply( newType );
    767                                         ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, 0, newType, 0 );
     767                                        ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, newType, 0 );
    768768                                        newObj->get_type()->get_qualifiers() = Type::Qualifiers(); // TODO: is this right???
    769769                                        stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) );
     
    831831                                makeRetParm( adapter );
    832832                        } // if
    833                         adapter->get_parameters().push_front( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ), 0 ) );
     833                        adapter->get_parameters().push_front( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ), 0 ) );
    834834                        return adapter;
    835835                }
     
    912912                        adapterBody->get_kids().push_back( bodyStmt );
    913913                        std::string adapterName = makeAdapterName( mangleName );
    914                         return new FunctionDecl( adapterName, DeclarationNode::StorageClasses(), LinkageSpec::C, adapterType, adapterBody );
     914                        return new FunctionDecl( adapterName, Type::StorageClasses(), LinkageSpec::C, adapterType, adapterBody );
    915915                }
    916916
     
    12731273                                if ( adaptersDone.find( mangleName ) == adaptersDone.end() ) {
    12741274                                        std::string adapterName = makeAdapterName( mangleName );
    1275                                         paramList.push_front( new ObjectDecl( adapterName, DeclarationNode::StorageClasses(), LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), makeAdapterType( *funType, scopeTyVars ) ), 0 ) );
     1275                                        paramList.push_front( new ObjectDecl( adapterName, Type::StorageClasses(), LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), makeAdapterType( *funType, scopeTyVars ) ), 0 ) );
    12761276                                        adaptersDone.insert( adaptersDone.begin(), mangleName );
    12771277                                }
     
    13791379                        std::list< DeclarationWithType *>::iterator last = funcType->get_parameters().begin();
    13801380                        std::list< DeclarationWithType *> inferredParams;
    1381                         ObjectDecl newObj( "", DeclarationNode::StorageClasses(), LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0 );
    1382                         ObjectDecl newPtr( "", DeclarationNode::StorageClasses(), LinkageSpec::C, 0,
     1381                        ObjectDecl newObj( "", Type::StorageClasses(), LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0 );
     1382                        ObjectDecl newPtr( "", Type::StorageClasses(), LinkageSpec::C, 0,
    13831383                                           new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ), 0 );
    13841384                        for ( Type::ForallList::const_iterator tyParm = funcType->get_forall().begin(); tyParm != funcType->get_forall().end(); ++tyParm ) {
     
    16341634
    16351635                ObjectDecl *PolyGenericCalculator::makeVar( const std::string &name, Type *type, Initializer *init ) {
    1636                         ObjectDecl *newObj = new ObjectDecl( name, DeclarationNode::StorageClasses(), LinkageSpec::C, 0, type, init );
     1636                        ObjectDecl *newObj = new ObjectDecl( name, Type::StorageClasses(), LinkageSpec::C, 0, type, init );
    16371637                        stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) );
    16381638                        return newObj;
     
    18181818                                                        memberDecl = origMember->clone();
    18191819                                                } else {
    1820                                                         memberDecl = new ObjectDecl( (*member)->get_name(), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, offsetType->clone(), 0 );
     1820                                                        memberDecl = new ObjectDecl( (*member)->get_name(), Type::StorageClasses(), LinkageSpec::Cforall, 0, offsetType->clone(), 0 );
    18211821                                                }
    18221822                                                inits.push_back( new SingleInit( new OffsetofExpr( ty->clone(), memberDecl ) ) );
  • src/GenPoly/Specialize.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  6 23:13:00 2017
    13 // Update Count     : 30
     12// Last Modified On : Thu Mar 16 07:53:59 2017
     13// Update Count     : 31
    1414//
    1515
     
    155155                } // if
    156156                // create new thunk with same signature as formal type (C linkage, empty body)
    157                 FunctionDecl *thunkFunc = new FunctionDecl( thunkNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, newType, new CompoundStmt( noLabels ) );
     157                FunctionDecl *thunkFunc = new FunctionDecl( thunkNamer.newName(), Type::StorageClasses(), LinkageSpec::C, newType, new CompoundStmt( noLabels ) );
    158158                thunkFunc->fixUniqueId();
    159159
  • src/InitTweak/FixGlobalInit.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Mon May 04 15:14:56 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar 13 23:58:27 2017
    13 // Update Count     : 16
     12// Last Modified On : Thu Mar 16 07:53:11 2017
     13// Update Count     : 18
    1414//
    1515
     
    8787                        dtorParameters.push_back( new ConstantExpr( Constant::from_int( 102 ) ) );
    8888                }
    89                 initFunction = new FunctionDecl( "_init_" + fixedName, DeclarationNode::StorageClasses( DeclarationNode::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );
     89                initFunction = new FunctionDecl( "_init_" + fixedName, Type::StorageClasses( Type::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );
    9090                initFunction->get_attributes().push_back( new Attribute( "constructor", ctorParameters ) );
    91                 destroyFunction = new FunctionDecl( "_destroy_" + fixedName, DeclarationNode::StorageClasses( DeclarationNode::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );
     91                destroyFunction = new FunctionDecl( "_destroy_" + fixedName, Type::StorageClasses( Type::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );
    9292                destroyFunction->get_attributes().push_back( new Attribute( "destructor", dtorParameters ) );
    9393        }
  • src/InitTweak/FixInit.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Wed Jan 13 16:29:30 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 14 08:05:28 2017
    13 // Update Count     : 63
     12// Last Modified On : Thu Mar 16 08:08:04 2017
     13// Update Count     : 67
    1414//
    1515
     
    437437                        result = result->clone();
    438438                        env->apply( result );
    439                         ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, 0, result, 0 );
     439                        ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, result, 0 );
    440440                        tmp->get_type()->set_isConst( false );
    441441
     
    483483                                result = result->clone();
    484484                                env->apply( result );
    485                                 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, 0, result, 0 );
     485                                ObjectDecl * ret = new ObjectDecl( retNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, result, 0 );
    486486                                ret->get_type()->set_isConst( false );
    487487                                impCpCtorExpr->get_returnDecls().push_back( ret );
     
    506506                                result = result->clone();
    507507                                env->apply( result );
    508                                 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, 0, result, 0 );
     508                                ObjectDecl * ret = new ObjectDecl( retNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, result, 0 );
    509509                                ret->get_type()->set_isConst( false );
    510510                                stmtExpr->get_returnDecls().push_front( ret );
     
    538538                        } else {
    539539                                // expr isn't a call expr, so create a new temporary variable to use to hold the value of the unique expression
    540                                 unqExpr->set_object( new ObjectDecl( toString("_unq_expr_", unqExpr->get_id()), DeclarationNode::StorageClasses(), LinkageSpec::C, nullptr, unqExpr->get_result()->clone(), nullptr ) );
     540                                unqExpr->set_object( new ObjectDecl( toString("_unq_expr_", unqExpr->get_id()), Type::StorageClasses(), LinkageSpec::C, nullptr, unqExpr->get_result()->clone(), nullptr ) );
    541541                                unqExpr->set_var( new VariableExpr( unqExpr->get_object() ) );
    542542                        }
     
    704704                                                BasicType * boolType = new BasicType( Type::Qualifiers(), BasicType::Bool );
    705705                                                SingleInit * boolInitExpr = new SingleInit( new ConstantExpr( Constant( boolType->clone(), "1" ) ), noDesignators );
    706                                                 ObjectDecl * isUninitializedVar = new ObjectDecl( objDecl->get_mangleName() + "_uninitialized", DeclarationNode::StorageClasses( DeclarationNode::Static ), LinkageSpec::Cforall, 0, boolType, boolInitExpr );
     706                                                ObjectDecl * isUninitializedVar = new ObjectDecl( objDecl->get_mangleName() + "_uninitialized", Type::StorageClasses( Type::Static ), LinkageSpec::Cforall, 0, boolType, boolInitExpr );
    707707                                                isUninitializedVar->fixUniqueId();
    708708
     
    731731
    732732                                                        // void __objName_dtor_atexitN(...) {...}
    733                                                         FunctionDecl * dtorCaller = new FunctionDecl( objDecl->get_mangleName() + dtorCallerNamer.newName(), DeclarationNode::StorageClasses( DeclarationNode::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );
     733                                                        FunctionDecl * dtorCaller = new FunctionDecl( objDecl->get_mangleName() + dtorCallerNamer.newName(), Type::StorageClasses( Type::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );
    734734                                                        dtorCaller->fixUniqueId();
    735735                                                        dtorCaller->get_statements()->push_back( dtorStmt );
     
    764764                                                        // create a new object which is never used
    765765                                                        static UniqueName dummyNamer( "_dummy" );
    766                                                         ObjectDecl * dummy = new ObjectDecl( dummyNamer.newName(), DeclarationNode::StorageClasses( DeclarationNode::Static ), LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new VoidType( Type::Qualifiers() ) ), 0, std::list< Attribute * >{ new Attribute("unused") } );
     766                                                        ObjectDecl * dummy = new ObjectDecl( dummyNamer.newName(), Type::StorageClasses( Type::Static ), LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new VoidType( Type::Qualifiers() ) ), 0, std::list< Attribute * >{ new Attribute("unused") } );
    767767                                                        return dummy;
    768768                                                }
     
    11181118
    11191119                        // xxx - ideally we would reuse the temporary generated from the copy constructor passes from within firstArg if it exists and not generate a temporary if it's unnecessary.
    1120                         ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, nullptr, ctorExpr->get_result()->clone(), nullptr );
     1120                        ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), Type::StorageClasses(), LinkageSpec::C, nullptr, ctorExpr->get_result()->clone(), nullptr );
    11211121                        addDeclaration( tmp );
    11221122
  • src/InitTweak/GenInit.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar 13 23:59:09 2017
    13 // Update Count     : 180
     12// Last Modified On : Thu Mar 16 08:01:25 2017
     13// Update Count     : 181
    1414//
    1515
     
    120120                void hoist( Type * type );
    121121
    122                 DeclarationNode::StorageClasses storageClasses;
     122                Type::StorageClasses storageClasses;
    123123                bool inFunction = false;
    124124        };
  • src/Parser/DeclarationNode.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 15 23:36:49 2017
    13 // Update Count     : 997
     12// Last Modified On : Thu Mar 16 07:59:40 2017
     13// Update Count     : 1003
    1414//
    1515
     
    3333
    3434// These must remain in the same order as the corresponding DeclarationNode enumerations.
    35 const char * DeclarationNode::StorageClasses::Names[] = { "extern", "static", "auto", "register", "_Thread_local", "NoStorageClassNames" };
    3635const char * DeclarationNode::FuncSpecifiers::Names[] = { "inline", "fortran", "_Noreturn", "NoFunctionSpecifierNames" };
    3736const char * DeclarationNode::basicTypeNames[] = { "void", "_Bool", "char", "int", "float", "double", "long double", "NoBasicTypeNames" };
     
    181180
    182181
    183 DeclarationNode * DeclarationNode::newStorageClass( StorageClasses sc ) {
     182DeclarationNode * DeclarationNode::newStorageClass( Type::StorageClasses sc ) {
    184183        DeclarationNode * newnode = new DeclarationNode;
    185184        newnode->storageClasses = sc;
     
    458457        if ( storageClasses.any() && src->storageClasses.any() ) { // any reason to check ?
    459458                if ( (storageClasses.val & src->storageClasses.val ) != 0 ) { // duplicates ?
    460                         for ( unsigned int i = 0; i < NumStorageClass; i += 1 ) { // find duplicates
     459                        for ( unsigned int i = 0; i < Type::NumStorageClass; i += 1 ) { // find duplicates
    461460                                if ( storageClasses[i] && src->storageClasses[i] ) {
    462                                         appendError( error, string( "duplicate " ) + StorageClasses::Names[i] );
     461                                        appendError( error, string( "duplicate " ) + Type::StorageClasses::Names[i] );
    463462                                } // if
    464463                        } // for
    465464                        // src is the new item being added and has a single bit
    466465                } else if ( ! src->storageClasses.is_threadlocal ) { // conflict ?
    467                         appendError( error, string( "conflicting " ) + StorageClasses::Names[ffs( storageClasses.val ) - 1] +
    468                                                  " & " + StorageClasses::Names[ffs( src->storageClasses.val ) - 1] );
     466                        appendError( error, string( "conflicting " ) + Type::StorageClasses::Names[ffs( storageClasses.val ) - 1] +
     467                                                 " & " + Type::StorageClasses::Names[ffs( src->storageClasses.val ) - 1] );
    469468                        src->storageClasses.val = 0;                            // FIX to preserve invariant of one basic storage specifier
    470469                } // if
     
    970969                                } else if ( StructDecl * agg = dynamic_cast< StructDecl * >( decl ) ) {
    971970                                        StructInstType * inst = new StructInstType( Type::Qualifiers(), agg->get_name() );
    972                                         auto obj = new ObjectDecl( "", DeclarationNode::StorageClasses(), linkage, nullptr, inst, nullptr );
     971                                        auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr );
    973972                                        obj->location = cur->location;
    974973                                        * out++ = obj;
     
    976975                                } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) {
    977976                                        UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->get_name() );
    978                                         auto obj = new ObjectDecl( "", DeclarationNode::StorageClasses(), linkage, nullptr, inst, nullptr );
     977                                        auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr );
    979978                                        obj->location = cur->location;
    980979                                        * out++ = obj;
     
    10231022                assertf( sizeof(kindMap)/sizeof(kindMap[0] == NoTypeClass-1), "DeclarationNode::build: kindMap is out of sync." );
    10241023                assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." );
    1025                 TypeDecl * ret = new TypeDecl( *name, DeclarationNode::StorageClasses(), nullptr, kindMap[ variable.tyClass ] );
     1024                TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ] );
    10261025                buildList( variable.assertions, ret->get_assertions() );
    10271026                return ret;
  • src/Parser/ParseNode.h

    r6e8bd43 r64b6913  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 15 23:31:02 2017
    13 // Update Count     : 770
     12// Last Modified On : Thu Mar 16 07:46:33 2017
     13// Update Count     : 772
    1414//
    1515
     
    201201class DeclarationNode : public ParseNode {
    202202  public:
    203         // These must remain in the same order as the corresponding DeclarationNode names.
    204 
    205         enum { Extern = 1 << 0, Static = 1 << 1, Auto = 1 << 2, Register = 1 << 3, Threadlocal = 1 << 4, NumStorageClass = 5 };
    206         union StorageClasses {
    207                 static const char * Names[];
    208                 unsigned int val;
    209                 struct {
    210                         bool is_extern : 1;
    211                         bool is_static : 1;
    212                         bool is_auto : 1;
    213                         bool is_register : 1;
    214                         bool is_threadlocal : 1;
    215                 };
    216 
    217                 StorageClasses() : val( 0 ) {}
    218                 StorageClasses( unsigned int val ) : val( val ) {}
    219                 bool operator[]( unsigned int i ) const { return val & (1 << i); }
    220                 bool any() const { return val != 0; }
    221                 void print( std::ostream & os ) const {
    222                         if ( (*this).any() ) {                                          // any storage classes ?
    223                                 for ( unsigned int i = 0; i < NumStorageClass; i += 1 ) {
    224                                         if ( (*this)[i] ) {
    225                                                 os << StorageClasses::Names[i] << ' ';
    226                                         } // if
    227                                 } // for
    228                         } // if
    229                 }
    230         }; // StorageClasses
    231 
    232203        enum { Inline = 1 << 0, Noreturn = 1 << 1, Fortran = 1 << 2, NumFuncSpecifier = 3 };
    233204        union FuncSpecifiers {
     
    270241        static const char * builtinTypeNames[];
    271242
    272         static DeclarationNode * newStorageClass( StorageClasses );
     243        static DeclarationNode * newStorageClass( Type::StorageClasses );
    273244        static DeclarationNode * newFuncSpecifier( FuncSpecifiers );
    274245        static DeclarationNode * newTypeQualifier( Type::Qualifiers );
     
    368339        TypeData * type;
    369340
    370         StorageClasses storageClasses;
     341        Type::StorageClasses storageClasses;
    371342        FuncSpecifiers funcSpecs;
    372343
  • src/Parser/TypeData.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 15 22:53:04 2017
    13 // Update Count     : 557
     12// Last Modified On : Thu Mar 16 07:54:50 2017
     13// Update Count     : 558
    1414//
    1515
     
    398398                        // add dtor:  void ^?{}(T *)
    399399                        FunctionType * dtorType = new FunctionType( Type::Qualifiers(), false );
    400                         dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    401                         td->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, dtorType, nullptr ) );
     400                        dtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     401                        td->get_assertions().push_front( new FunctionDecl( "^?{}", Type::StorageClasses(), LinkageSpec::Cforall, dtorType, nullptr ) );
    402402
    403403                        // add copy ctor:  void ?{}(T *, T)
    404404                        FunctionType * copyCtorType = new FunctionType( Type::Qualifiers(), false );
    405                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    406                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    407                         td->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, copyCtorType, nullptr ) );
     405                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     406                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
     407                        td->get_assertions().push_front( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, copyCtorType, nullptr ) );
    408408
    409409                        // add default ctor:  void ?{}(T *)
    410410                        FunctionType * ctorType = new FunctionType( Type::Qualifiers(), false );
    411                         ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    412                         td->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, ctorType, nullptr ) );
     411                        ctorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     412                        td->get_assertions().push_front( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, ctorType, nullptr ) );
    413413
    414414                        // add assignment operator:  T * ?=?(T *, T)
    415415                        FunctionType * assignType = new FunctionType( Type::Qualifiers(), false );
    416                         assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    417                         assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    418                         assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    419                         td->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, assignType, nullptr ) );
     416                        assignType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     417                        assignType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
     418                        assignType->get_returnVals().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
     419                        td->get_assertions().push_front( new FunctionDecl( "?=?", Type::StorageClasses(), LinkageSpec::Cforall, assignType, nullptr ) );
    420420                } // if
    421421        } // for
     
    726726} // buildAggInst
    727727
    728 NamedTypeDecl * buildSymbolic( const TypeData * td, const string & name, DeclarationNode::StorageClasses scs ) {
     728NamedTypeDecl * buildSymbolic( const TypeData * td, const string & name, Type::StorageClasses scs ) {
    729729        assert( td->kind == TypeData::Symbolic );
    730730        NamedTypeDecl * ret;
     
    778778} // buildTypeof
    779779
    780 Declaration * buildDecl( const TypeData * td, const string &name, DeclarationNode::StorageClasses scs, Expression * bitfieldWidth, DeclarationNode::FuncSpecifiers funcSpec, LinkageSpec::Spec linkage, ConstantExpr *asmName, Initializer * init, std::list< Attribute * > attributes ) {
     780Declaration * buildDecl( const TypeData * td, const string &name, Type::StorageClasses scs, Expression * bitfieldWidth, DeclarationNode::FuncSpecifiers funcSpec, LinkageSpec::Spec linkage, ConstantExpr *asmName, Initializer * init, std::list< Attribute * > attributes ) {
    781781        if ( td->kind == TypeData::Function ) {
    782782                if ( td->function.idList ) {                                    // KR function ?
     
    814814                        break;
    815815                  default:
    816                         ft->get_returnVals().push_back( dynamic_cast< DeclarationWithType * >( buildDecl( td->base, "", DeclarationNode::StorageClasses(), nullptr, DeclarationNode::FuncSpecifiers(), LinkageSpec::Cforall, nullptr ) ) );
     816                        ft->get_returnVals().push_back( dynamic_cast< DeclarationWithType * >( buildDecl( td->base, "", Type::StorageClasses(), nullptr, DeclarationNode::FuncSpecifiers(), LinkageSpec::Cforall, nullptr ) ) );
    817817                } // switch
    818818        } else {
    819                 ft->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) );
     819                ft->get_returnVals().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) );
    820820        } // if
    821821        return ft;
  • src/Parser/TypeData.h

    r6e8bd43 r64b6913  
    1010// Created On       : Sat May 16 15:18:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 15 22:10:23 2017
    13 // Update Count     : 183
     12// Last Modified On : Thu Mar 16 07:53:41 2017
     13// Update Count     : 184
    1414//
    1515
     
    109109TupleType * buildTuple( const TypeData * );
    110110TypeofType * buildTypeof( const TypeData * );
    111 Declaration * buildDecl( const TypeData *, const std::string &, DeclarationNode::StorageClasses, Expression *, DeclarationNode::FuncSpecifiers funcSpec, LinkageSpec::Spec, ConstantExpr *asmName, Initializer * init = nullptr, std::list< class Attribute * > attributes = std::list< class Attribute * >() );
     111Declaration * buildDecl( const TypeData *, const std::string &, Type::StorageClasses, Expression *, DeclarationNode::FuncSpecifiers funcSpec, LinkageSpec::Spec, ConstantExpr *asmName, Initializer * init = nullptr, std::list< class Attribute * > attributes = std::list< class Attribute * >() );
    112112FunctionType * buildFunction( const TypeData * );
    113113void buildKRFunction( const TypeData::Function_t & function );
  • src/Parser/parser.yy

    r6e8bd43 r64b6913  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 15 22:06:22 2017
    13 // Update Count     : 2308
     12// Last Modified On : Thu Mar 16 08:00:59 2017
     13// Update Count     : 2309
    1414//
    1515
     
    14491449storage_class:
    14501450        EXTERN
    1451                 { $$ = DeclarationNode::newStorageClass( DeclarationNode::Extern ); }
     1451                { $$ = DeclarationNode::newStorageClass( Type::Extern ); }
    14521452        | STATIC
    1453                 { $$ = DeclarationNode::newStorageClass( DeclarationNode::Static ); }
     1453                { $$ = DeclarationNode::newStorageClass( Type::Static ); }
    14541454        | AUTO
    1455                 { $$ = DeclarationNode::newStorageClass( DeclarationNode::Auto ); }
     1455                { $$ = DeclarationNode::newStorageClass( Type::Auto ); }
    14561456        | REGISTER
    1457                 { $$ = DeclarationNode::newStorageClass( DeclarationNode::Register ); }
     1457                { $$ = DeclarationNode::newStorageClass( Type::Register ); }
    14581458        | THREADLOCAL                                                                           // C11
    1459                 { $$ = DeclarationNode::newStorageClass( DeclarationNode::Threadlocal ); }
     1459                { $$ = DeclarationNode::newStorageClass( Type::Threadlocal ); }
    14601460                // Put function specifiers here to simplify parsing rules, but separate them semantically.
    14611461        | INLINE                                                                                        // C99
  • src/ResolvExpr/Unify.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Sun May 17 12:27:10 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  6 23:37:38 2017
    13 // Update Count     : 39
     12// Last Modified On : Thu Mar 16 07:59:59 2017
     13// Update Count     : 40
    1414//
    1515
     
    541541                        flatten( dcl->get_type(), back_inserter( types ) );
    542542                        for ( Type * t : types ) {
    543                                 dst.push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::C, nullptr, t, nullptr ) );
     543                                dst.push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::C, nullptr, t, nullptr ) );
    544544                        }
    545545                        delete dcl;
  • src/SymTab/Autogen.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Thu Mar 03 15:45:56 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 14 07:45:00 2017
    13 // Update Count     : 54
     12// Last Modified On : Thu Mar 16 08:03:35 2017
     13// Update Count     : 56
    1414//
    1515
     
    125125        FunctionType * genDefaultType( Type * paramType ) {
    126126                FunctionType *ftype = new FunctionType( Type::Qualifiers(), false );
    127                 ObjectDecl *dstParam = new ObjectDecl( "_dst", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), paramType->clone() ), nullptr );
     127                ObjectDecl *dstParam = new ObjectDecl( "_dst", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), paramType->clone() ), nullptr );
    128128                ftype->get_parameters().push_back( dstParam );
    129129
     
    134134        FunctionType * genCopyType( Type * paramType ) {
    135135                FunctionType *ftype = genDefaultType( paramType );
    136                 ObjectDecl *srcParam = new ObjectDecl( "_src", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr );
     136                ObjectDecl *srcParam = new ObjectDecl( "_src", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr );
    137137                ftype->get_parameters().push_back( srcParam );
    138138                return ftype;
     
    142142        FunctionType * genAssignType( Type * paramType ) {
    143143                FunctionType *ftype = genCopyType( paramType );
    144                 ObjectDecl *returnVal = new ObjectDecl( "_ret", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr );
     144                ObjectDecl *returnVal = new ObjectDecl( "_ret", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr );
    145145                ftype->get_returnVals().push_back( returnVal );
    146146                return ftype;
     
    162162                // because each unit generates copies of the default routines for each aggregate.
    163163//              DeclarationNode::StorageClass sc = functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static;
    164                 DeclarationNode::StorageClasses scs = functionNesting > 0 ? DeclarationNode::StorageClasses() : DeclarationNode::StorageClasses( DeclarationNode::Static );
     164                Type::StorageClasses scs = functionNesting > 0 ? Type::StorageClasses() : Type::StorageClasses( Type::Static );
    165165                LinkageSpec::Spec spec = isIntrinsic ? LinkageSpec::Intrinsic : LinkageSpec::AutoGen;
    166166                FunctionDecl * decl = new FunctionDecl( fname, scs, spec, ftype, new CompoundStmt( noLabels ),
     
    460460                                        continue;
    461461                                }
    462                                 memCtorType->get_parameters().push_back( new ObjectDecl( member->get_name(), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, member->get_type()->clone(), 0 ) );
     462                                memCtorType->get_parameters().push_back( new ObjectDecl( member->get_name(), Type::StorageClasses(), LinkageSpec::Cforall, 0, member->get_type()->clone(), 0 ) );
    463463                                FunctionDecl * ctor = genFunc( "?{}", memCtorType->clone(), functionNesting );
    464464                                makeStructFieldCtorBody( aggregateDecl->get_members().begin(), aggregateDecl->get_members().end(), ctor, isDynamicLayout );
     
    540540                for ( Declaration * member : aggregateDecl->get_members() ) {
    541541                        if ( DeclarationWithType * field = dynamic_cast< DeclarationWithType * >( member ) ) {
    542                                 ObjectDecl * srcParam = new ObjectDecl( "src", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, field->get_type()->clone(), 0 );
     542                                ObjectDecl * srcParam = new ObjectDecl( "src", Type::StorageClasses(), LinkageSpec::Cforall, 0, field->get_type()->clone(), 0 );
    543543
    544544                                FunctionType * memCtorType = ctorType->clone();
     
    605605                TypeInstType *typeInst = new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), false );
    606606                typeInst->set_baseType( typeDecl );
    607                 ObjectDecl *src = new ObjectDecl( "_src", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, typeInst->clone(), nullptr );
    608                 ObjectDecl *dst = new ObjectDecl( "_dst", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), typeInst->clone() ), nullptr );
     607                ObjectDecl *src = new ObjectDecl( "_src", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, typeInst->clone(), nullptr );
     608                ObjectDecl *dst = new ObjectDecl( "_dst", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), typeInst->clone() ), nullptr );
    609609
    610610                std::list< Statement * > stmts;
     
    618618                } // if
    619619                FunctionType *type = new FunctionType( Type::Qualifiers(), false );
    620                 type->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, typeInst, 0 ) );
     620                type->get_returnVals().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, typeInst, 0 ) );
    621621                type->get_parameters().push_back( dst );
    622622                type->get_parameters().push_back( src );
     
    717717                        if ( TypeInstType * ty = dynamic_cast< TypeInstType * >( t ) ) {
    718718                                if ( ! done.count( ty->get_baseType() ) ) {
    719                                         TypeDecl * newDecl = new TypeDecl( ty->get_baseType()->get_name(), DeclarationNode::StorageClasses(), nullptr, TypeDecl::Any );
     719                                        TypeDecl * newDecl = new TypeDecl( ty->get_baseType()->get_name(), Type::StorageClasses(), nullptr, TypeDecl::Any );
    720720                                        TypeInstType * inst = new TypeInstType( Type::Qualifiers(), newDecl->get_name(), newDecl );
    721                                         newDecl->get_assertions().push_back( new FunctionDecl( "?=?", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, genAssignType( inst ), nullptr,
     721                                        newDecl->get_assertions().push_back( new FunctionDecl( "?=?", Type::StorageClasses(), LinkageSpec::Cforall, genAssignType( inst ), nullptr,
    722722                                                                                                                                                   std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::Inline ) ) );
    723                                         newDecl->get_assertions().push_back( new FunctionDecl( "?{}", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, genDefaultType( inst ), nullptr,
     723                                        newDecl->get_assertions().push_back( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, genDefaultType( inst ), nullptr,
    724724                                                                                                                                                   std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::Inline ) ) );
    725                                         newDecl->get_assertions().push_back( new FunctionDecl( "?{}", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, genCopyType( inst ), nullptr,
     725                                        newDecl->get_assertions().push_back( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, genCopyType( inst ), nullptr,
    726726                                                                                                                                                   std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::Inline ) ) );
    727                                         newDecl->get_assertions().push_back( new FunctionDecl( "^?{}", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, genDefaultType( inst ), nullptr,
     727                                        newDecl->get_assertions().push_back( new FunctionDecl( "^?{}", Type::StorageClasses(), LinkageSpec::Cforall, genDefaultType( inst ), nullptr,
    728728                                                                                                                                                   std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::Inline ) ) );
    729729                                        typeParams.push_back( newDecl );
  • src/SymTab/Autogen.h

    r6e8bd43 r64b6913  
    1010// Created On       : Sun May 17 21:53:34 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 14 23:13:28 2017
    13 // Update Count     : 7
     12// Last Modified On : Thu Mar 16 07:51:39 2017
     13// Update Count     : 8
    1414//
    1515
     
    103103                }
    104104
    105                 ObjectDecl *index = new ObjectDecl( indexName.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), new SingleInit( begin, std::list<Expression*>() ) );
     105                ObjectDecl *index = new ObjectDecl( indexName.newName(), Type::StorageClasses(), LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), new SingleInit( begin, std::list<Expression*>() ) );
    106106
    107107                UntypedExpr *cond = new UntypedExpr( cmp );
  • src/SymTab/Validate.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Sun May 17 21:50:04 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 14 23:30:27 2017
    13 // Update Count     : 350
     12// Last Modified On : Thu Mar 16 08:02:54 2017
     13// Update Count     : 351
    1414//
    1515
     
    208208
    209209        class CompoundLiteral final : public GenPoly::DeclMutator {
    210                 DeclarationNode::StorageClasses storageClasses;
     210                Type::StorageClasses storageClasses;
    211211
    212212                using GenPoly::DeclMutator::mutate;
     
    754754                                type = new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() );
    755755                        } // if
    756                         TypedefDeclPtr tyDecl( new TypedefDecl( aggDecl->get_name(), DeclarationNode::StorageClasses(), type ) );
     756                        TypedefDeclPtr tyDecl( new TypedefDecl( aggDecl->get_name(), Type::StorageClasses(), type ) );
    757757                        typedefNames[ aggDecl->get_name() ] = std::make_pair( std::move( tyDecl ), scopeLevel );
    758758                } // if
     
    857857                        TupleType * tupleType = safe_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) );
    858858                        // ensure return value is not destructed by explicitly creating an empty ListInit node wherein maybeConstruct is false.
    859                         ObjectDecl * newRet = new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, tupleType, new ListInit( std::list<Initializer*>(), noDesignators, false ) );
     859                        ObjectDecl * newRet = new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, tupleType, new ListInit( std::list<Initializer*>(), noDesignators, false ) );
    860860                        deleteAll( retVals );
    861861                        retVals.clear();
  • src/SynTree/AggregateDecl.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Sun May 17 23:56:39 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:31:47 2017
    13 // Update Count     : 19
     12// Last Modified On : Thu Mar 16 07:49:07 2017
     13// Update Count     : 20
    1414//
    1515
     
    2020
    2121
    22 AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, DeclarationNode::StorageClasses(), LinkageSpec::Cforall ), body( false ), attributes( attributes ) {
     22AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, Type::StorageClasses(), LinkageSpec::Cforall ), body( false ), attributes( attributes ) {
    2323}
    2424
  • src/SynTree/Declaration.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:31:11 2017
    13 // Update Count     : 23
     12// Last Modified On : Thu Mar 16 07:49:18 2017
     13// Update Count     : 24
    1414//
    1515
     
    2727static IdMapType idMap;
    2828
    29 Declaration::Declaration( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage )
     29Declaration::Declaration( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage )
    3030                : name( name ), storageClasses( scs ), linkage( linkage ), uniqueId( 0 ) {
    3131}
     
    6666
    6767
    68 AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", DeclarationNode::StorageClasses(), LinkageSpec::C ), stmt( stmt ) {
     68AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", Type::StorageClasses(), LinkageSpec::C ), stmt( stmt ) {
    6969}
    7070
  • src/SynTree/Declaration.h

    r6e8bd43 r64b6913  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:40:42 2017
    13 // Update Count     : 113
     12// Last Modified On : Thu Mar 16 07:48:23 2017
     13// Update Count     : 117
    1414//
    1515
     
    2828class Declaration : public BaseSyntaxNode {
    2929  public:
    30         Declaration( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage );
     30        Declaration( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage );
    3131        Declaration( const Declaration &other );
    3232        virtual ~Declaration();
     
    3535        void set_name( std::string newValue ) { name = newValue; }
    3636
    37         DeclarationNode::StorageClasses get_storageClasses() const { return storageClasses; }
     37        Type::StorageClasses get_storageClasses() const { return storageClasses; }
    3838
    3939        LinkageSpec::Spec get_linkage() const { return linkage; }
     
    5656  private:
    5757        std::string name;
    58         DeclarationNode::StorageClasses storageClasses;
     58        Type::StorageClasses storageClasses;
    5959        LinkageSpec::Spec linkage;
    6060        UniqueId uniqueId;
     
    6464class DeclarationWithType : public Declaration {
    6565  public:
    66         DeclarationWithType( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs );
     66        DeclarationWithType( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs );
    6767        DeclarationWithType( const DeclarationWithType &other );
    6868        virtual ~DeclarationWithType();
     
    104104        typedef DeclarationWithType Parent;
    105105  public:
    106         ObjectDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init,
     106        ObjectDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init,
    107107                                const std::list< Attribute * > attributes = std::list< Attribute * >(), DeclarationNode::FuncSpecifiers fs = DeclarationNode::FuncSpecifiers() );
    108108        ObjectDecl( const ObjectDecl &other );
     
    132132        typedef DeclarationWithType Parent;
    133133  public:
    134         FunctionDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements,
     134        FunctionDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements,
    135135                                  const std::list< Attribute * > attributes = std::list< Attribute * >(), DeclarationNode::FuncSpecifiers fs = DeclarationNode::FuncSpecifiers() );
    136136        FunctionDecl( const FunctionDecl &other );
     
    158158        typedef Declaration Parent;
    159159  public:
    160         NamedTypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type );
     160        NamedTypeDecl( const std::string &name, Type::StorageClasses scs, Type *type );
    161161        NamedTypeDecl( const NamedTypeDecl &other );
    162162        virtual ~NamedTypeDecl();
     
    193193        };
    194194
    195         TypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type, Kind kind );
     195        TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind );
    196196        TypeDecl( const TypeDecl &other );
    197197
     
    214214        typedef NamedTypeDecl Parent;
    215215  public:
    216         TypedefDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type ) : Parent( name, scs, type ) {}
     216        TypedefDecl( const std::string &name, Type::StorageClasses scs, Type *type ) : Parent( name, scs, type ) {}
    217217        TypedefDecl( const TypedefDecl &other ) : Parent( other ) {}
    218218
  • src/SynTree/DeclarationWithType.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:32:14 2017
    13 // Update Count     : 23
     12// Last Modified On : Thu Mar 16 07:49:27 2017
     13// Update Count     : 24
    1414//
    1515
     
    1919#include "Common/utility.h"
    2020
    21 DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs )
     21DeclarationWithType::DeclarationWithType( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs )
    2222        : Declaration( name, scs, linkage ), asmName( nullptr ), attributes( attributes ), fs( fs ) {
    2323}
  • src/SynTree/FunctionDecl.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 15 23:33:43 2017
    13 // Update Count     : 72
     12// Last Modified On : Thu Mar 16 07:49:35 2017
     13// Update Count     : 73
    1414//
    1515
     
    2626extern bool translation_unit_nomain;
    2727
    28 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, std::list< Attribute * > attributes, DeclarationNode::FuncSpecifiers fs )
     28FunctionDecl::FunctionDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, std::list< Attribute * > attributes, DeclarationNode::FuncSpecifiers fs )
    2929        : Parent( name, scs, linkage, attributes, fs ), type( type ), statements( statements ) {
    3030        // hack forcing the function "main" to have Cforall linkage to replace main even if it is inside an extern
  • src/SynTree/NamedTypeDecl.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 15 23:25:41 2017
    13 // Update Count     : 12
     12// Last Modified On : Thu Mar 16 07:49:44 2017
     13// Update Count     : 13
    1414//
    1515
     
    1818#include "Common/utility.h"
    1919
    20 NamedTypeDecl::NamedTypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *base )
     20NamedTypeDecl::NamedTypeDecl( const std::string &name, Type::StorageClasses scs, Type *base )
    2121        : Parent( name, scs, LinkageSpec::Cforall ), base( base ) {}
    2222
  • src/SynTree/ObjectDecl.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 15 23:26:22 2017
    13 // Update Count     : 57
     12// Last Modified On : Thu Mar 16 07:49:51 2017
     13// Update Count     : 58
    1414//
    1515
     
    2222#include "Statement.h"
    2323
    24 ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, DeclarationNode::FuncSpecifiers fs )
     24ObjectDecl::ObjectDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, DeclarationNode::FuncSpecifiers fs )
    2525        : Parent( name, scs, linkage, attributes, fs ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) {
    2626}
  • src/SynTree/Type.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 15 23:14:35 2017
    13 // Update Count     : 19
     12// Last Modified On : Thu Mar 16 07:57:45 2017
     13// Update Count     : 20
    1414//
    1515
     
    5959}
    6060
     61// These must remain in the same order as the corresponding bit fields.
     62const char * Type::StorageClasses::Names[] = { "extern", "static", "auto", "register", "_Thread_local" };
    6163const char * Type::Qualifiers::Names[] = { "const", "restrict", "volatile", "lvalue", "mutex", "_Atomic" };
    6264
  • src/SynTree/Type.h

    r6e8bd43 r64b6913  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 15 23:28:33 2017
    13 // Update Count     : 89
     12// Last Modified On : Thu Mar 16 07:45:29 2017
     13// Update Count     : 90
    1414//
    1515
     
    2424class Type : public BaseSyntaxNode {
    2525  public:
     26        // enum must remain in the same order as the corresponding bit fields.
     27
     28        enum { Extern = 1 << 0, Static = 1 << 1, Auto = 1 << 2, Register = 1 << 3, Threadlocal = 1 << 4, NumStorageClass = 5 };
     29        union StorageClasses {
     30                static const char * Names[];
     31                unsigned int val;
     32                struct {
     33                        bool is_extern : 1;
     34                        bool is_static : 1;
     35                        bool is_auto : 1;
     36                        bool is_register : 1;
     37                        bool is_threadlocal : 1;
     38                };
     39
     40                StorageClasses() : val( 0 ) {}
     41                StorageClasses( unsigned int val ) : val( val ) {}
     42                bool operator[]( unsigned int i ) const { return val & (1 << i); }
     43                bool any() const { return val != 0; }
     44                void print( std::ostream & os ) const {
     45                        if ( (*this).any() ) {                                          // any storage classes ?
     46                                for ( unsigned int i = 0; i < NumStorageClass; i += 1 ) {
     47                                        if ( (*this)[i] ) {
     48                                                os << StorageClasses::Names[i] << ' ';
     49                                        } // if
     50                                } // for
     51                        } // if
     52                }
     53        }; // StorageClasses
     54
    2655        enum { Const = 1 << 0, Restrict = 1 << 1, Volatile = 1 << 2, Lvalue = 1 << 3, Mutex = 1 << 4, Atomic = 1 << 5, NumTypeQualifier = 6 };
    2756        union Qualifiers {
  • src/SynTree/TypeDecl.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:39:09 2017
    13 // Update Count     : 4
     12// Last Modified On : Thu Mar 16 07:49:58 2017
     13// Update Count     : 5
    1414//
    1515
     
    1818#include "Common/utility.h"
    1919
    20 TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type, Kind kind ) : Parent( name, scs, type ), kind( kind ), sized( kind == Any || kind == Ttype ) {
     20TypeDecl::TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind ) : Parent( name, scs, type ), kind( kind ), sized( kind == Any || kind == Ttype ) {
    2121}
    2222
  • src/Tuples/TupleAssignment.cc

    r6e8bd43 r64b6913  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 15 08:00:44 2017
    13 // Update Count     : 6
     12// Last Modified On : Thu Mar 16 08:04:51 2017
     13// Update Count     : 7
    1414//
    1515
     
    240240        ObjectDecl * TupleAssignSpotter::Matcher::newObject( UniqueName & namer, Expression * expr ) {
    241241                assert( expr->has_result() && ! expr->get_result()->isVoid() );
    242                 ObjectDecl * ret = new ObjectDecl( namer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, expr->get_result()->clone(), new SingleInit( expr->clone() ) );
     242                ObjectDecl * ret = new ObjectDecl( namer.newName(), Type::StorageClasses(), LinkageSpec::Cforall, nullptr, expr->get_result()->clone(), new SingleInit( expr->clone() ) );
    243243                ConstructorInit * ctorInit = InitTweak::genCtorInit( ret );
    244244                ret->set_init( ctorInit );
Note: See TracChangeset for help on using the changeset viewer.