Changeset de8a0a4 for src/InitTweak/GenInit.cpp
- Timestamp:
- Jan 26, 2025, 6:37:05 PM (3 months ago)
- Branches:
- master
- Children:
- a950021
- Parents:
- 0f070a4 (diff), 11f92fac (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/InitTweak/GenInit.cpp ¶
r0f070a4 rde8a0a4 162 162 // FROM USER: float a[ rand() ]; 163 163 // TO GCC: const size_t __len_of_a = rand(); float a[ __len_of_a ]; 164 165 ast::ObjectDecl * arrayDimension = new ast::ObjectDecl( 166 arrayType->dimension->location, 167 dimensionName.newName(), 168 dimType, 169 new ast::SingleInit( 164 ast::ObjectDecl * arrayDimension = nullptr; 165 166 const ast::TypeExpr * ty = dynamic_cast< const ast::TypeExpr * >( arrayType->dimension.get() ); 167 if ( ty ) { 168 auto inst = ty->type.as<ast::EnumInstType>(); 169 if ( inst ) { 170 if ( inst->base->isCfa ) { 171 arrayDimension = new ast::ObjectDecl( 172 arrayType->dimension->location, 173 dimensionName.newName(), 174 new ast::BasicType( ast::BasicKind::UnsignedChar ), 175 new ast::SingleInit( 176 arrayType->dimension->location, 177 ast::ConstantExpr::from_int( arrayType->dimension->location, inst->base->members.size() ) 178 ) 179 ); 180 // return arrayType; 181 } 182 } 183 } 184 if ( arrayDimension == nullptr ) { 185 arrayDimension = new ast::ObjectDecl( 170 186 arrayType->dimension->location, 171 arrayType->dimension 172 ) 173 ); 187 dimensionName.newName(), 188 dimType, 189 new ast::SingleInit( 190 arrayType->dimension->location, 191 arrayType->dimension 192 ) 193 ); 194 } 174 195 175 196 ast::ArrayType * mutType = ast::mutate( arrayType );
Note: See TracChangeset
for help on using the changeset viewer.