Changeset 19a8c40
- Timestamp:
- Nov 14, 2022, 11:47:23 AM (2 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 63be3387, c1fb3903
- Parents:
- 7491f97
- Location:
- src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r7491f97 r19a8c40 1875 1875 auto&& type = GET_ACCEPT_1(type, Type); 1876 1876 auto&& attr = GET_ACCEPT_V(attributes, Attribute); 1877 1877 1878 1878 auto decl = new ast::InlineMemberDecl( 1879 1879 old->location, -
src/AST/Decl.hpp
r7491f97 r19a8c40 397 397 }; 398 398 399 /// Static Assertion `_Static_assert( ... , ... );` 399 400 class StaticAssertDecl : public Decl { 400 401 public: … … 411 412 }; 412 413 414 /// Inline Member Declaration `inline TypeName;` 413 415 class InlineMemberDecl final : public DeclWithType { 414 416 public: … … 428 430 MUTATE_FRIEND 429 431 }; 432 430 433 } 431 434 -
src/AST/Pass.hpp
r7491f97 r19a8c40 141 141 const ast::DirectiveDecl * visit( const ast::DirectiveDecl * ) override final; 142 142 const ast::StaticAssertDecl * visit( const ast::StaticAssertDecl * ) override final; 143 const ast::DeclWithType * visit( const ast::InlineMemberDecl 143 const ast::DeclWithType * visit( const ast::InlineMemberDecl * ) override final; 144 144 const ast::CompoundStmt * visit( const ast::CompoundStmt * ) override final; 145 145 const ast::Stmt * visit( const ast::ExprStmt * ) override final; -
src/AST/Pass.impl.hpp
r7491f97 r19a8c40 803 803 804 804 //-------------------------------------------------------------------------- 805 // DeclWithType805 // InlineMemberDecl 806 806 template< typename core_t > 807 807 const ast::DeclWithType * ast::Pass< core_t >::visit( const ast::InlineMemberDecl * node ) { -
src/AST/Visitor.hpp
r7491f97 r19a8c40 33 33 virtual const ast::DirectiveDecl * visit( const ast::DirectiveDecl * ) = 0; 34 34 virtual const ast::StaticAssertDecl * visit( const ast::StaticAssertDecl * ) = 0; 35 virtual const ast::DeclWithType * visit( const ast::InlineMemberDecl 35 virtual const ast::DeclWithType * visit( const ast::InlineMemberDecl * ) = 0; 36 36 virtual const ast::CompoundStmt * visit( const ast::CompoundStmt * ) = 0; 37 37 virtual const ast::Stmt * visit( const ast::ExprStmt * ) = 0; -
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.