Changeset 29702ad for src/Common
- Timestamp:
- Nov 22, 2022, 10:18:04 AM (3 years ago)
- Branches:
- ADT, ast-experimental, master, stuck-waitfor-destruct
- Children:
- 20cf96d
- Parents:
- 1553a55 (diff), d41735a (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. - Location:
- src/Common
- Files:
-
- 4 edited
-
CodeLocationTools.cpp (modified) (1 diff)
-
PassVisitor.h (modified) (2 diffs)
-
PassVisitor.impl.h (modified) (3 diffs)
-
utility.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/CodeLocationTools.cpp
r1553a55 r29702ad 111 111 macro(DirectiveDecl, DirectiveDecl) \ 112 112 macro(StaticAssertDecl, StaticAssertDecl) \ 113 macro(Inline ValueDecl, DeclWithType) \113 macro(InlineMemberDecl, DeclWithType) \ 114 114 macro(CompoundStmt, CompoundStmt) \ 115 115 macro(ExprStmt, Stmt) \ -
src/Common/PassVisitor.h
r1553a55 r29702ad 81 81 virtual void visit( StaticAssertDecl * assertDecl ) override final; 82 82 virtual void visit( const StaticAssertDecl * assertDecl ) override final; 83 virtual void visit( Inline ValueDecl * valueDecl ) override final;84 virtual void visit( const Inline ValueDecl * valueDecl ) override final;83 virtual void visit( InlineMemberDecl * valueDecl ) override final; 84 virtual void visit( const InlineMemberDecl * valueDecl ) override final; 85 85 86 86 virtual void visit( CompoundStmt * compoundStmt ) override final; … … 275 275 virtual DirectiveDecl * mutate( DirectiveDecl * directiveDecl ) override final; 276 276 virtual StaticAssertDecl * mutate( StaticAssertDecl * assertDecl ) override final; 277 virtual DeclarationWithType * mutate( Inline ValueDecl * valueDecl ) override final;277 virtual DeclarationWithType * mutate( InlineMemberDecl * valueDecl ) override final; 278 278 279 279 virtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) override final; -
src/Common/PassVisitor.impl.h
r1553a55 r29702ad 1047 1047 1048 1048 //-------------------------------------------------------------------------- 1049 // Inline ValueDecl1050 template< typename pass_type > 1051 void PassVisitor< pass_type >::visit( Inline ValueDecl * node ) {1049 // InlineMemberDecl 1050 template< typename pass_type > 1051 void PassVisitor< pass_type >::visit( InlineMemberDecl * node ) { 1052 1052 VISIT_START( node ); 1053 1053 … … 1058 1058 1059 1059 template< typename pass_type > 1060 void PassVisitor< pass_type >::visit( const Inline ValueDecl * node ) {1060 void PassVisitor< pass_type >::visit( const InlineMemberDecl * node ) { 1061 1061 VISIT_START( node ); 1062 1062 … … 1067 1067 1068 1068 template< typename pass_type > 1069 DeclarationWithType * PassVisitor< pass_type >::mutate( Inline ValueDecl * node ) {1069 DeclarationWithType * PassVisitor< pass_type >::mutate( InlineMemberDecl * node ) { 1070 1070 MUTATE_START( node ); 1071 1071 -
src/Common/utility.h
r1553a55 r29702ad 461 461 Iterables iterables; 462 462 463 // Getting the iterator and value types this way preserves const. 463 464 template<size_t I> using Iter = decltype(std::get<I>(iterables).begin()); 464 465 template<size_t I> using Data = decltype(*std::get<I>(iterables).begin()); 465 466 template<typename> struct base_iterator; 466 467 467 template<std::size_t... Is> 468 struct base_iterator<std::integer_sequence<std::size_t, Is...>> { 469 using value_type = std::tuple< Data<Is>... >; 470 std::tuple<Iter<Is>...> iterators; 471 472 base_iterator( Iter<Is>... is ) : iterators( is... ) {} 468 // This inner template puts the sequence of `0, 1, ... sizeof...(Args)-1` 469 // into a pack. These are the indexes into the tuples, so unpacking can 470 // go over each element of the tuple. 471 // The std::integer_sequence is just used to build that sequence. 472 // A library reference will probably explain it better than I can. 473 template<std::size_t... Indices> 474 struct base_iterator<std::integer_sequence<std::size_t, Indices...>> { 475 using value_type = std::tuple< Data<Indices>... >; 476 std::tuple<Iter<Indices>...> iterators; 477 478 base_iterator( Iter<Indices>... is ) : iterators( is... ) {} 473 479 base_iterator operator++() { 474 return base_iterator( ++std::get<I s>( iterators )... );480 return base_iterator( ++std::get<Indices>( iterators )... ); 475 481 } 476 482 bool operator!=( const base_iterator& other ) const { … … 478 484 } 479 485 value_type operator*() const { 480 return std::tie( *std::get<I s>( iterators )... );486 return std::tie( *std::get<Indices>( iterators )... ); 481 487 } 482 488 483 489 static base_iterator make_begin( Iterables & data ) { 484 return base_iterator( std::get<I s>( data ).begin()... );490 return base_iterator( std::get<Indices>( data ).begin()... ); 485 491 } 486 492 static base_iterator make_end( Iterables & data ) { 487 return base_iterator( std::get<I s>( data ).end()... );493 return base_iterator( std::get<Indices>( data ).end()... ); 488 494 } 489 495 };
Note:
See TracChangeset
for help on using the changeset viewer.