Changeset 9151fcb for src/AST


Ignore:
Timestamp:
Jun 7, 2019, 12:00:17 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
e16e27e1, ef75948
Parents:
0b73f0c (diff), 5684736 (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/AST
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Node.hpp

    r0b73f0c r9151fcb  
    1818#include <cassert>
    1919#include <iosfwd>
     20#include <type_traits> // for remove_reference
    2021
    2122#include "Common/ErrorObjects.h"  // for SemanticErrorException
     
    8283};
    8384
    84 // Mutate a node, non-member function to avoid static type
    85 // problems and be able to use auto return
     85/// Mutate a node, non-member function to avoid static type
     86/// problems and be able to use auto return
    8687template<typename node_t>
    8788node_t * mutate( const node_t * node ) {
     
    9596        );
    9697        return node->clone();
     98}
     99
     100/// Mutate a node field (only clones if not equal to existing value)
     101template<typename node_t, typename field_t>
     102const node_t * mutate_field(
     103        const node_t * node,
     104        typename std::remove_const<typename std::remove_reference<field_t>::type>::type node_t::* field,
     105        field_t&& val
     106) {
     107        if ( node->*field == val ) return node;
     108       
     109        node_t * ret = mutate( node );
     110        ret->*field = std::forward< field_t >( val );
     111        return ret;
    97112}
    98113
  • src/AST/Pass.hpp

    r0b73f0c r9151fcb  
    201201        container_t< ptr<node_t> > call_accept( const container_t< ptr<node_t> > & container );
    202202
     203public:
    203204        /// Logic to call the accept and mutate the parent if needed, delegates call to accept
    204205        template<typename node_t, typename parent_t, typename child_t>
  • src/AST/module.mk

    r0b73f0c r9151fcb  
    1616
    1717SRC_AST = \
     18        AST/AssertAcyclic.cpp \
    1819        AST/Attribute.cpp \
    1920        AST/Convert.cpp \
Note: See TracChangeset for help on using the changeset viewer.