Changeset 03e5d14 for src/InitTweak
- Timestamp:
- May 6, 2016, 3:45:23 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 9e2c1f0, af18713, fac84be
- Parents:
- 37024fd
- Location:
- src/InitTweak
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixGlobalInit.cc
r37024fd r03e5d14 10 10 // Created On : Mon May 04 15:14:56 2016 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 06 1 4:59:26201612 // Last Modified On : Fri May 06 15:40:48 2016 13 13 // Update Count : 2 14 14 // … … 30 30 class GlobalFixer : public Visitor { 31 31 public: 32 GlobalFixer( const std::string & name );32 GlobalFixer( const std::string & name, bool inLibrary ); 33 33 34 34 virtual void visit( ObjectDecl *objDecl ); … … 87 87 } 88 88 89 void fixGlobalInit( std::list< Declaration * > & translationUnit, const std::string & name ) {90 GlobalFixer fixer( name );89 void fixGlobalInit( std::list< Declaration * > & translationUnit, const std::string & name, bool inLibrary ) { 90 GlobalFixer fixer( name, inLibrary ); 91 91 acceptAll( translationUnit, fixer ); 92 92 translationUnit.push_back( fixer.initFunction ); … … 102 102 } 103 103 104 GlobalFixer::GlobalFixer( const std::string & name ) : tempNamer( "_global_init" ) {105 initFunction = new FunctionDecl( initName( name ), DeclarationNode::Static, LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ), false, false, FunctionDecl:: Constructor);104 GlobalFixer::GlobalFixer( const std::string & name, bool inLibrary ) : tempNamer( "_global_init" ) { 105 initFunction = new FunctionDecl( initName( name ), DeclarationNode::Static, LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ), false, false, FunctionDecl::Attribute( FunctionDecl::Attribute::Constructor, inLibrary ? FunctionDecl::Attribute::High : FunctionDecl::Attribute::Default ) ); 106 106 } 107 107 -
src/InitTweak/FixGlobalInit.h
r37024fd r03e5d14 10 10 // Created On : Mon May 04 15:14:56 2016 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed May 04 16:35:37201612 // Last Modified On : Fri May 06 15:29:13 2016 13 13 // Update Count : 2 14 14 // … … 24 24 25 25 namespace InitTweak { 26 /// Moves global initialization into an _init function that is unique to the translation unit 27 void fixGlobalInit( std::list< Declaration * > & translationUnit, const std::string & name ); 26 /// Moves global initialization into an _init function that is unique to the translation unit. 27 /// Sets the priority of the initialization function depending on whether the initialization 28 /// function is for library code. 29 void fixGlobalInit( std::list< Declaration * > & translationUnit, const std::string & name, bool inLibrary ); 28 30 29 31 /// Apply transformations to a file name to get a valid C identifier which will be used as
Note: See TracChangeset
for help on using the changeset viewer.