Changeset 40e636a for src/InitTweak/GenInit.cc
- Timestamp:
- Jul 21, 2016, 11:19:24 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, 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:
- b81adcc4
- Parents:
- 5f98ce5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/GenInit.cc
r5f98ce5 r40e636a 90 90 91 91 private: 92 DeclarationWithType * mutate( ObjectDecl * objectDecl ); 92 virtual DeclarationWithType * mutate( ObjectDecl * objectDecl ); 93 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ); 93 94 // should not traverse into any of these declarations to find objects 94 95 // that need to be constructed or destructed … … 105 106 106 107 DeclarationNode::StorageClass storageclass = DeclarationNode::NoStorageClass; 108 bool inFunction = false; 107 109 }; 108 110 … … 157 159 void HoistArrayDimension::hoistArrayDimension( std::list< Declaration * > & translationUnit ) { 158 160 HoistArrayDimension hoister; 159 mutateAll( translationUnit, hoister);161 hoister.mutateDeclarationList( translationUnit ); 160 162 } 161 163 … … 169 171 170 172 void HoistArrayDimension::hoist( Type * type ) { 173 // if in function, generate const size_t var 171 174 static UniqueName dimensionName( "_array_dim" ); 172 175 if ( ArrayType * arrayType = dynamic_cast< ArrayType * >( type ) ) { 176 if ( ! inFunction ) return; 177 173 178 if ( ! arrayType->get_dimension() ) return; // xxx - recursive call to hoist? 174 179 … … 186 191 return; 187 192 } 193 } 194 195 DeclarationWithType * HoistArrayDimension::mutate( FunctionDecl *functionDecl ) { 196 bool oldInFunc = inFunction; 197 inFunction = true; 198 DeclarationWithType * decl = Parent::mutate( functionDecl ); 199 inFunction = oldInFunc; 200 return decl; 188 201 } 189 202
Note: See TracChangeset
for help on using the changeset viewer.