Changeset 64b6913 for src/InitTweak
- Timestamp:
- Mar 16, 2017, 8:19:39 AM (8 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:
- 26ba208
- Parents:
- 6e8bd43
- Location:
- src/InitTweak
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixGlobalInit.cc
r6e8bd43 r64b6913 10 10 // Created On : Mon May 04 15:14:56 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Mar 13 23:58:27201713 // Update Count : 1 612 // Last Modified On : Thu Mar 16 07:53:11 2017 13 // Update Count : 18 14 14 // 15 15 … … 87 87 dtorParameters.push_back( new ConstantExpr( Constant::from_int( 102 ) ) ); 88 88 } 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 ) ); 90 90 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 ) ); 92 92 destroyFunction->get_attributes().push_back( new Attribute( "destructor", dtorParameters ) ); 93 93 } -
src/InitTweak/FixInit.cc
r6e8bd43 r64b6913 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Mar 14 08:05:28201713 // Update Count : 6 312 // Last Modified On : Thu Mar 16 08:08:04 2017 13 // Update Count : 67 14 14 // 15 15 … … 437 437 result = result->clone(); 438 438 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 ); 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::StorageClasses(), LinkageSpec::C, 0, result, 0 );485 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), Type::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::StorageClasses(), LinkageSpec::C, 0, result, 0 );508 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), Type::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::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 ) ); 541 541 unqExpr->set_var( new VariableExpr( unqExpr->get_object() ) ); 542 542 } … … 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::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 ); 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::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 ) ); 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::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") } ); 767 767 return dummy; 768 768 } … … 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::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 ); 1121 1121 addDeclaration( tmp ); 1122 1122 -
src/InitTweak/GenInit.cc
r6e8bd43 r64b6913 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Mar 13 23:59:09201713 // Update Count : 18 012 // Last Modified On : Thu Mar 16 08:01:25 2017 13 // Update Count : 181 14 14 // 15 15 … … 120 120 void hoist( Type * type ); 121 121 122 DeclarationNode::StorageClasses storageClasses;122 Type::StorageClasses storageClasses; 123 123 bool inFunction = false; 124 124 };
Note: See TracChangeset
for help on using the changeset viewer.