Changeset 19a8c40 for src/Validate
- Timestamp:
- Nov 14, 2022, 11:47:23 AM (2 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 63be3387, c1fb3903
- Parents:
- 7491f97
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Validate/EnumAndPointerDecay.cpp
r7491f97 r19a8c40 41 41 auto mut = ast::mutate( decl ); 42 42 std::vector<ast::ptr<ast::Decl>> buffer; 43 for ( auto it = decl->members.begin(); it != decl->members.end(); ++it ) { 44 if ( ast::ObjectDecl const * object = (*it).as<ast::ObjectDecl>() ) { 45 buffer.push_back( ast::mutate_field( object, &ast::ObjectDecl::type, new ast::EnumInstType( decl, ast::CV::Const ) ) ); 46 } else if ( ast::InlineMemberDecl const * value = (*it).as<ast::InlineMemberDecl>() ) { 43 for ( auto member : decl->members ) { 44 if ( ast::ObjectDecl const * object = member.as<ast::ObjectDecl>() ) { 45 buffer.push_back( ast::mutate_field( object, 46 &ast::ObjectDecl::type, 47 new ast::EnumInstType( decl, ast::CV::Const ) ) ); 48 } else if ( auto value = member.as<ast::InlineMemberDecl>() ) { 47 49 if ( auto targetEnum = symtab.lookupEnum( value->name ) ) { 48 for ( auto singleMember : targetEnum->members ) {49 auto copyingMember = singleMember.as<ast::ObjectDecl>();50 for ( auto enumMember : targetEnum->members ) { 51 auto enumObject = enumMember.strict_as<ast::ObjectDecl>(); 50 52 buffer.push_back( new ast::ObjectDecl( 51 value->location, // use the "inline" location 52 copyingMember->name, 53 // Get the location from the "inline" declaration. 54 value->location, 55 enumObject->name, 56 // Construct a new EnumInstType as the type. 53 57 new ast::EnumInstType( decl, ast::CV::Const ), 54 // Construct a new EnumInstType as the type 55 copyingMember->init, 56 copyingMember->storage, 57 copyingMember->linkage, 58 copyingMember->bitfieldWidth, 58 enumObject->init, 59 enumObject->storage, 60 enumObject->linkage, 61 enumObject->bitfieldWidth, 59 62 {}, 60 copyingMember->funcSpec63 enumObject->funcSpec 61 64 ) ); 62 65 }
Note: See TracChangeset
for help on using the changeset viewer.