Changeset a7c90d4 for src/InitTweak/FixInit.cc
- Timestamp:
- Mar 7, 2017, 8:33:43 AM (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:
- 64cb860, c3396e0
- Parents:
- 7fe2498
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
r7fe2498 ra7c90d4 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 3 21:56:11201713 // Update Count : 3912 // Last Modified On : Tue Mar 7 07:51:40 2017 13 // Update Count : 59 14 14 // 15 15 … … 437 437 result = result->clone(); 438 438 env->apply( result ); 439 ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode:: NoStorageClass, LinkageSpec::C, 0, result, 0 );439 ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, 0, result, 0 ); 440 440 tmp->get_type()->set_isConst( false ); 441 441 … … 483 483 result = result->clone(); 484 484 env->apply( result ); 485 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), DeclarationNode:: NoStorageClass, LinkageSpec::C, 0, result, 0 );485 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, 0, result, 0 ); 486 486 ret->get_type()->set_isConst( false ); 487 487 impCpCtorExpr->get_returnDecls().push_back( ret ); … … 506 506 result = result->clone(); 507 507 env->apply( result ); 508 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), DeclarationNode:: NoStorageClass, LinkageSpec::C, 0, result, 0 );508 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, 0, result, 0 ); 509 509 ret->get_type()->set_isConst( false ); 510 510 stmtExpr->get_returnDecls().push_front( ret ); … … 538 538 } else { 539 539 // 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:: NoStorageClass, LinkageSpec::C, nullptr, unqExpr->get_result()->clone(), nullptr ) );540 unqExpr->set_object( new ObjectDecl( toString("_unq_expr_", unqExpr->get_id()), DeclarationNode::StorageClasses(), LinkageSpec::C, nullptr, unqExpr->get_result()->clone(), nullptr ) ); 541 541 unqExpr->set_var( new VariableExpr( unqExpr->get_object() ) ); 542 542 } … … 678 678 assert( ! ctorInit->get_ctor() || ! ctorInit->get_init() ); 679 679 if ( Statement * ctor = ctorInit->get_ctor() ) { 680 if ( objDecl->get_storageClass () == DeclarationNode::Static) {680 if ( objDecl->get_storageClasses()[ DeclarationNode::Static ] ) { 681 681 // originally wanted to take advantage of gcc nested functions, but 682 682 // we get memory errors with this approach. To remedy this, the static … … 704 704 BasicType * boolType = new BasicType( Type::Qualifiers(), BasicType::Bool ); 705 705 SingleInit * boolInitExpr = new SingleInit( new ConstantExpr( Constant( boolType->clone(), "1" ) ), noDesignators ); 706 ObjectDecl * isUninitializedVar = new ObjectDecl( objDecl->get_mangleName() + "_uninitialized", DeclarationNode::St atic, LinkageSpec::Cforall, 0, boolType, boolInitExpr );706 ObjectDecl * isUninitializedVar = new ObjectDecl( objDecl->get_mangleName() + "_uninitialized", DeclarationNode::StorageClasses( DeclarationNode::StaticClass ), LinkageSpec::Cforall, 0, boolType, boolInitExpr ); 707 707 isUninitializedVar->fixUniqueId(); 708 708 … … 731 731 732 732 // void __objName_dtor_atexitN(...) {...} 733 FunctionDecl * dtorCaller = new FunctionDecl( objDecl->get_mangleName() + dtorCallerNamer.newName(), DeclarationNode::St atic, LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );733 FunctionDecl * dtorCaller = new FunctionDecl( objDecl->get_mangleName() + dtorCallerNamer.newName(), DeclarationNode::StorageClasses( DeclarationNode::StaticClass ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) ); 734 734 dtorCaller->fixUniqueId(); 735 735 dtorCaller->get_statements()->push_back( dtorStmt ); … … 764 764 // create a new object which is never used 765 765 static UniqueName dummyNamer( "_dummy" ); 766 ObjectDecl * dummy = new ObjectDecl( dummyNamer.newName(), DeclarationNode::St atic, 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(), DeclarationNode::StorageClasses( DeclarationNode::StaticClass ), LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new VoidType( Type::Qualifiers() ) ), 0, std::list< Attribute * >{ new Attribute("unused") } ); 767 767 return dummy; 768 768 } … … 821 821 void InsertDtors::visit( ObjectDecl * objDecl ) { 822 822 // remember non-static destructed objects so that their destructors can be inserted later 823 if ( objDecl->get_storageClass() != DeclarationNode::Static) {823 if ( ! objDecl->get_storageClasses()[ DeclarationNode::Static ] ) { 824 824 if ( ConstructorInit * ctorInit = dynamic_cast< ConstructorInit * >( objDecl->get_init() ) ) { 825 825 // a decision should have been made by the resolver, so ctor and init are not both non-NULL … … 1118 1118 1119 1119 // 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:: NoStorageClass, LinkageSpec::C, nullptr, ctorExpr->get_result()->clone(), nullptr );1120 ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, nullptr, ctorExpr->get_result()->clone(), nullptr ); 1121 1121 addDeclaration( tmp ); 1122 1122
Note: See TracChangeset
for help on using the changeset viewer.