Changeset 29702ad for src/Common


Ignore:
Timestamp:
Nov 22, 2022, 10:18:04 AM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src/Common
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Common/CodeLocationTools.cpp

    r1553a55 r29702ad  
    111111    macro(DirectiveDecl, DirectiveDecl) \
    112112    macro(StaticAssertDecl, StaticAssertDecl) \
    113     macro(InlineValueDecl, DeclWithType) \
     113    macro(InlineMemberDecl, DeclWithType) \
    114114    macro(CompoundStmt, CompoundStmt) \
    115115    macro(ExprStmt, Stmt) \
  • src/Common/PassVisitor.h

    r1553a55 r29702ad  
    8181        virtual void visit( StaticAssertDecl * assertDecl ) override final;
    8282        virtual void visit( const StaticAssertDecl * assertDecl ) override final;
    83         virtual void visit( InlineValueDecl * valueDecl ) override final;
    84         virtual void visit( const InlineValueDecl * valueDecl ) override final;
     83        virtual void visit( InlineMemberDecl * valueDecl ) override final;
     84        virtual void visit( const InlineMemberDecl * valueDecl ) override final;
    8585
    8686        virtual void visit( CompoundStmt * compoundStmt ) override final;
     
    275275        virtual DirectiveDecl * mutate( DirectiveDecl * directiveDecl ) override final;
    276276        virtual StaticAssertDecl * mutate( StaticAssertDecl * assertDecl ) override final;
    277         virtual DeclarationWithType * mutate( InlineValueDecl * valueDecl ) override final;
     277        virtual DeclarationWithType * mutate( InlineMemberDecl * valueDecl ) override final;
    278278
    279279        virtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) override final;
  • src/Common/PassVisitor.impl.h

    r1553a55 r29702ad  
    10471047
    10481048//--------------------------------------------------------------------------
    1049 // InlineValueDecl
    1050 template< typename pass_type >
    1051 void PassVisitor< pass_type >::visit( InlineValueDecl * node ) {
     1049// InlineMemberDecl
     1050template< typename pass_type >
     1051void PassVisitor< pass_type >::visit( InlineMemberDecl * node ) {
    10521052        VISIT_START( node );
    10531053
     
    10581058
    10591059template< typename pass_type >
    1060 void PassVisitor< pass_type >::visit( const InlineValueDecl * node ) {
     1060void PassVisitor< pass_type >::visit( const InlineMemberDecl * node ) {
    10611061        VISIT_START( node );
    10621062
     
    10671067
    10681068template< typename pass_type >
    1069 DeclarationWithType * PassVisitor< pass_type >::mutate( InlineValueDecl * node ) {
     1069DeclarationWithType * PassVisitor< pass_type >::mutate( InlineMemberDecl * node ) {
    10701070        MUTATE_START( node );
    10711071
  • src/Common/utility.h

    r1553a55 r29702ad  
    461461        Iterables iterables;
    462462
     463        // Getting the iterator and value types this way preserves const.
    463464        template<size_t I> using Iter = decltype(std::get<I>(iterables).begin());
    464465        template<size_t I> using Data = decltype(*std::get<I>(iterables).begin());
    465466        template<typename> struct base_iterator;
    466467
    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... ) {}
    473479                base_iterator operator++() {
    474                         return base_iterator( ++std::get<Is>( iterators )... );
     480                        return base_iterator( ++std::get<Indices>( iterators )... );
    475481                }
    476482                bool operator!=( const base_iterator& other ) const {
     
    478484                }
    479485                value_type operator*() const {
    480                         return std::tie( *std::get<Is>( iterators )... );
     486                        return std::tie( *std::get<Indices>( iterators )... );
    481487                }
    482488
    483489                static base_iterator make_begin( Iterables & data ) {
    484                         return base_iterator( std::get<Is>( data ).begin()... );
     490                        return base_iterator( std::get<Indices>( data ).begin()... );
    485491                }
    486492                static base_iterator make_end( Iterables & data ) {
    487                         return base_iterator( std::get<Is>( data ).end()... );
     493                        return base_iterator( std::get<Indices>( data ).end()... );
    488494                }
    489495        };
Note: See TracChangeset for help on using the changeset viewer.