Ignore:
Timestamp:
Sep 15, 2022, 11:28:46 AM (20 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master, pthread-emulation
Children:
747d0fa, a2fd937
Parents:
25793da
Message:

Changed ast::pass::make_location_guard so it should work with C++14.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Pass.proto.hpp

    r25793da r95e5018  
    295295        FIELD_PTR( at_cleanup, __pass::at_cleanup_t )
    296296        FIELD_PTR( visitor, ast::Pass<core_t> * const )
    297         FIELD_PTR( location, const CodeLocation * )
    298297
    299298        // Remove the macro to make sure we don't clash
     
    328327
    329328        template< typename core_t, typename node_t >
    330         static auto make_location_guard(core_t & core, node_t * node) -> ValueGuardPtr<const CodeLocation *> {
    331                 if constexpr (std::is_base_of<ParseNode, node_t>::value) {
    332                         const CodeLocation ** p = location(core, 0);
    333                         if(p) {
    334                                 ValueGuardPtr<const CodeLocation *> g = { p };
    335                                 *p = &node->location;
    336                                 return g;
    337                         }
    338                 }
    339                 (void)node;
    340                 return { nullptr };
     329        static auto make_location_guard( core_t & core, node_t * node, int )
     330                        -> decltype( node->location, ValueGuardPtr<const CodeLocation *>( &core.location ) ) {
     331                ValueGuardPtr<const CodeLocation *> guard( &core.location );
     332                core.location = &node->location;
     333                return guard;
     334        }
     335
     336        template< typename core_t, typename node_t >
     337        static auto make_location_guard( core_t &, node_t *, long ) -> int {
     338                return 0;
    341339        }
    342340
Note: See TracChangeset for help on using the changeset viewer.