Changeset 276f105 for src


Ignore:
Timestamp:
Jun 26, 2020, 2:34:09 PM (4 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
c15085d
Parents:
81da70a5
Message:

Changed deep copy to highlight a questionable case. Even if it is correct it is clearer now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Copy.hpp

    r81da70a5 r276f105  
    1010// Created On       : Wed Jul 10 16:13:00 2019
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Jul 11 10:38:00 2019
    13 // Update Count     : 0
     12// Last Modified On : Fri Jun 19 16:43:00 2020
     13// Update Count     : 1
    1414//
    1515
     
    4545        std::unordered_set< readonly<Node> * > readonlyCache;
    4646
     47        template<typename node_t>
     48        void readonlyInsert( const readonly<node_t> * ptrptr ) {
     49                readonlyCache.insert( (readonly<Node> *) ptrptr );
     50        }
     51
    4752public:
    4853        template<typename node_t>
     
    5459
    5560        void postvisit( const AggregateDecl * node ) {
    56                 readonlyCache.insert( (readonly<Node> *) & node->parent );
     61                readonlyInsert( &node->parent );
    5762        }
    5863
    5964        void postvisit( const StructInstType * node ) {
    60                 readonlyCache.insert( (readonly<Node> *) & node->base );
     65                readonlyInsert( &node->base );
    6166        }
    6267
    6368        void postvisit( const UnionInstType * node ) {
    64                 readonlyCache.insert( (readonly<Node> *) & node->base );
     69                readonlyInsert( &node->base );
    6570        }
    6671
    6772        void postvisit( const EnumInstType * node ) {
    68                 readonlyCache.insert( (readonly<Node> *) & node->base );
     73                readonlyInsert( &node->base );
    6974        }
    7075
    7176        void postvisit( const TraitInstType * node ) {
    72                 readonlyCache.insert( (readonly<Node> *) & node->base );
     77                readonlyInsert( &node->base );
    7378        }
    7479
    7580        void postvisit( const TypeInstType * node ) {
    76                 readonlyCache.insert( (readonly<Node> *) & node->base );
     81                readonlyInsert( &node->base );
    7782        }
    7883
    7984        void postvisit( const ImplicitCtorDtorStmt * node ) {
    80                 readonlyCache.insert( (readonly<Node> *) & node->callStmt );
     85                readonlyInsert( (const readonly<Stmt> *) &node->callStmt );
    8186        }
    8287
    8388        void postvisit( const MemberExpr * node ) {
    84                 readonlyCache.insert( (readonly<Node> *) & node->member );
     89                readonlyInsert( &node->member );
    8590        }
    8691
    8792        void postvisit( const VariableExpr * node ) {
    88                 readonlyCache.insert( (readonly<Node> *) & node->var );
     93                readonlyInsert( &node->var );
    8994        }
    9095
    9196        void postvisit( const OffsetofExpr * node ) {
    92                 readonlyCache.insert( (readonly<Node> *) & node->member );
     97                readonlyInsert( &node->member );
    9398        }
    9499
    95100        void postvisit( const DeletedExpr * node ) {
    96                 readonlyCache.insert( (readonly<Node> *) & node->deleteStmt );
     101                readonlyInsert( &node->deleteStmt );
    97102        }
    98103
Note: See TracChangeset for help on using the changeset viewer.