Ignore:
Timestamp:
Aug 27, 2018, 4:40:34 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
b7c89aa
Parents:
f9feab8 (diff), 305581d (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' into cleanup-dtors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Mutator.h

    rf9feab8 r90152a4  
    2222class Mutator {
    2323  protected:
    24         Mutator();
    25         virtual ~Mutator();
     24        Mutator() = default;
     25        virtual ~Mutator() = default;
    2626  public:
    27         virtual DeclarationWithType * mutate( ObjectDecl * objectDecl );
    28         virtual DeclarationWithType * mutate( FunctionDecl * functionDecl );
    29         virtual Declaration * mutate( StructDecl * aggregateDecl );
    30         virtual Declaration * mutate( UnionDecl * aggregateDecl );
    31         virtual Declaration * mutate( EnumDecl * aggregateDecl );
    32         virtual Declaration * mutate( TraitDecl * aggregateDecl );
    33         virtual Declaration * mutate( TypeDecl * typeDecl );
    34         virtual Declaration * mutate( TypedefDecl * typeDecl );
    35         virtual AsmDecl * mutate( AsmDecl * asmDecl );
     27        virtual DeclarationWithType * mutate( ObjectDecl * objectDecl ) = 0;
     28        virtual DeclarationWithType * mutate( FunctionDecl * functionDecl ) = 0;
     29        virtual Declaration * mutate( StructDecl * aggregateDecl ) = 0;
     30        virtual Declaration * mutate( UnionDecl * aggregateDecl ) = 0;
     31        virtual Declaration * mutate( EnumDecl * aggregateDecl ) = 0;
     32        virtual Declaration * mutate( TraitDecl * aggregateDecl ) = 0;
     33        virtual Declaration * mutate( TypeDecl * typeDecl ) = 0;
     34        virtual Declaration * mutate( TypedefDecl * typeDecl ) = 0;
     35        virtual AsmDecl * mutate( AsmDecl * asmDecl ) = 0;
     36        virtual StaticAssertDecl * mutate( StaticAssertDecl * assertDecl ) = 0;
    3637
    37         virtual CompoundStmt * mutate( CompoundStmt * compoundStmt );
    38         virtual Statement * mutate( ExprStmt * exprStmt );
    39         virtual Statement * mutate( AsmStmt * asmStmt );
    40         virtual Statement * mutate( IfStmt * ifStmt );
    41         virtual Statement * mutate( WhileStmt * whileStmt );
    42         virtual Statement * mutate( ForStmt * forStmt );
    43         virtual Statement * mutate( SwitchStmt * switchStmt );
    44         virtual Statement * mutate( CaseStmt * caseStmt );
    45         virtual Statement * mutate( BranchStmt * branchStmt );
    46         virtual Statement * mutate( ReturnStmt * returnStmt );
    47         virtual Statement * mutate( ThrowStmt * throwStmt );
    48         virtual Statement * mutate( TryStmt * tryStmt );
    49         virtual Statement * mutate( CatchStmt * catchStmt );
    50         virtual Statement * mutate( FinallyStmt * catchStmt );
    51         virtual Statement * mutate( WaitForStmt * waitforStmt );
    52         virtual Statement * mutate( WithStmt * withStmt );
    53         virtual NullStmt * mutate( NullStmt * nullStmt );
    54         virtual Statement * mutate( DeclStmt * declStmt );
    55         virtual Statement * mutate( ImplicitCtorDtorStmt * impCtorDtorStmt );
     38        virtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) = 0;
     39        virtual Statement * mutate( ExprStmt * exprStmt ) = 0;
     40        virtual Statement * mutate( AsmStmt * asmStmt ) = 0;
     41        virtual Statement * mutate( DirectiveStmt * dirStmt ) = 0;
     42        virtual Statement * mutate( IfStmt * ifStmt ) = 0;
     43        virtual Statement * mutate( WhileStmt * whileStmt ) = 0;
     44        virtual Statement * mutate( ForStmt * forStmt ) = 0;
     45        virtual Statement * mutate( SwitchStmt * switchStmt ) = 0;
     46        virtual Statement * mutate( CaseStmt * caseStmt ) = 0;
     47        virtual Statement * mutate( BranchStmt * branchStmt ) = 0;
     48        virtual Statement * mutate( ReturnStmt * returnStmt ) = 0;
     49        virtual Statement * mutate( ThrowStmt * throwStmt ) = 0;
     50        virtual Statement * mutate( TryStmt * tryStmt ) = 0;
     51        virtual Statement * mutate( CatchStmt * catchStmt ) = 0;
     52        virtual Statement * mutate( FinallyStmt * catchStmt ) = 0;
     53        virtual Statement * mutate( WaitForStmt * waitforStmt ) = 0;
     54        virtual Statement * mutate( WithStmt * withStmt ) = 0;
     55        virtual NullStmt * mutate( NullStmt * nullStmt ) = 0;
     56        virtual Statement * mutate( DeclStmt * declStmt ) = 0;
     57        virtual Statement * mutate( ImplicitCtorDtorStmt * impCtorDtorStmt ) = 0;
    5658
    57         virtual Expression* mutate( ApplicationExpr * applicationExpr );
    58         virtual Expression* mutate( UntypedExpr * untypedExpr );
    59         virtual Expression* mutate( NameExpr * nameExpr );
    60         virtual Expression* mutate( AddressExpr * castExpr );
    61         virtual Expression* mutate( LabelAddressExpr * labAddressExpr );
    62         virtual Expression* mutate( CastExpr * castExpr );
    63         virtual Expression* mutate( VirtualCastExpr * castExpr );
    64         virtual Expression* mutate( UntypedMemberExpr * memberExpr );
    65         virtual Expression* mutate( MemberExpr * memberExpr );
    66         virtual Expression* mutate( VariableExpr * variableExpr );
    67         virtual Expression* mutate( ConstantExpr * constantExpr );
    68         virtual Expression* mutate( SizeofExpr * sizeofExpr );
    69         virtual Expression* mutate( AlignofExpr * alignofExpr );
    70         virtual Expression* mutate( UntypedOffsetofExpr * offsetofExpr );
    71         virtual Expression* mutate( OffsetofExpr * offsetofExpr );
    72         virtual Expression* mutate( OffsetPackExpr * offsetPackExpr );
    73         virtual Expression* mutate( AttrExpr * attrExpr );
    74         virtual Expression* mutate( LogicalExpr * logicalExpr );
    75         virtual Expression* mutate( ConditionalExpr * conditionalExpr );
    76         virtual Expression* mutate( CommaExpr * commaExpr );
    77         virtual Expression* mutate( TypeExpr * typeExpr );
    78         virtual Expression* mutate( AsmExpr * asmExpr );
    79         virtual Expression* mutate( ImplicitCopyCtorExpr * impCpCtorExpr );
    80         virtual Expression* mutate( ConstructorExpr * ctorExpr );
    81         virtual Expression* mutate( CompoundLiteralExpr * compLitExpr );
    82         virtual Expression* mutate( RangeExpr * rangeExpr );
    83         virtual Expression* mutate( UntypedTupleExpr * tupleExpr );
    84         virtual Expression* mutate( TupleExpr * tupleExpr );
    85         virtual Expression* mutate( TupleIndexExpr * tupleExpr );
    86         virtual Expression* mutate( TupleAssignExpr * assignExpr );
    87         virtual Expression* mutate( StmtExpr  * stmtExpr );
    88         virtual Expression* mutate( UniqueExpr  * uniqueExpr );
    89         virtual Expression* mutate( UntypedInitExpr  * initExpr );
    90         virtual Expression* mutate( InitExpr  * initExpr );
     59        virtual Expression * mutate( ApplicationExpr * applicationExpr ) = 0;
     60        virtual Expression * mutate( UntypedExpr * untypedExpr ) = 0;
     61        virtual Expression * mutate( NameExpr * nameExpr ) = 0;
     62        virtual Expression * mutate( AddressExpr * addrExpr ) = 0;
     63        virtual Expression * mutate( LabelAddressExpr * labAddressExpr ) = 0;
     64        virtual Expression * mutate( CastExpr * castExpr ) = 0;
     65        virtual Expression * mutate( KeywordCastExpr * castExpr ) = 0;
     66        virtual Expression * mutate( VirtualCastExpr * castExpr ) = 0;
     67        virtual Expression * mutate( UntypedMemberExpr * memberExpr ) = 0;
     68        virtual Expression * mutate( MemberExpr * memberExpr ) = 0;
     69        virtual Expression * mutate( VariableExpr * variableExpr ) = 0;
     70        virtual Expression * mutate( ConstantExpr * constantExpr ) = 0;
     71        virtual Expression * mutate( SizeofExpr * sizeofExpr ) = 0;
     72        virtual Expression * mutate( AlignofExpr * alignofExpr ) = 0;
     73        virtual Expression * mutate( UntypedOffsetofExpr * offsetofExpr ) = 0;
     74        virtual Expression * mutate( OffsetofExpr * offsetofExpr ) = 0;
     75        virtual Expression * mutate( OffsetPackExpr * offsetPackExpr ) = 0;
     76        virtual Expression * mutate( AttrExpr * attrExpr ) = 0;
     77        virtual Expression * mutate( LogicalExpr * logicalExpr ) = 0;
     78        virtual Expression * mutate( ConditionalExpr * conditionalExpr ) = 0;
     79        virtual Expression * mutate( CommaExpr * commaExpr ) = 0;
     80        virtual Expression * mutate( TypeExpr * typeExpr ) = 0;
     81        virtual Expression * mutate( AsmExpr * asmExpr ) = 0;
     82        virtual Expression * mutate( ImplicitCopyCtorExpr * impCpCtorExpr ) = 0;
     83        virtual Expression * mutate( ConstructorExpr * ctorExpr ) = 0;
     84        virtual Expression * mutate( CompoundLiteralExpr * compLitExpr ) = 0;
     85        virtual Expression * mutate( RangeExpr * rangeExpr ) = 0;
     86        virtual Expression * mutate( UntypedTupleExpr * tupleExpr ) = 0;
     87        virtual Expression * mutate( TupleExpr * tupleExpr ) = 0;
     88        virtual Expression * mutate( TupleIndexExpr * tupleExpr ) = 0;
     89        virtual Expression * mutate( TupleAssignExpr * assignExpr ) = 0;
     90        virtual Expression * mutate( StmtExpr  * stmtExpr ) = 0;
     91        virtual Expression * mutate( UniqueExpr  * uniqueExpr ) = 0;
     92        virtual Expression * mutate( UntypedInitExpr  * initExpr ) = 0;
     93        virtual Expression * mutate( InitExpr  * initExpr ) = 0;
     94        virtual Expression * mutate( DeletedExpr * delExpr ) = 0;
     95        virtual Expression * mutate( DefaultArgExpr * argExpr ) = 0;
     96        virtual Expression * mutate( GenericExpr * genExpr ) = 0;
    9197
    92         virtual Type * mutate( VoidType * basicType );
    93         virtual Type * mutate( BasicType * basicType );
    94         virtual Type * mutate( PointerType * pointerType );
    95         virtual Type * mutate( ArrayType * arrayType );
    96         virtual Type * mutate( ReferenceType * refType );
    97         virtual Type * mutate( FunctionType * functionType );
    98         virtual Type * mutate( StructInstType * aggregateUseType );
    99         virtual Type * mutate( UnionInstType * aggregateUseType );
    100         virtual Type * mutate( EnumInstType * aggregateUseType );
    101         virtual Type * mutate( TraitInstType * aggregateUseType );
    102         virtual Type * mutate( TypeInstType * aggregateUseType );
    103         virtual Type * mutate( TupleType * tupleType );
    104         virtual Type * mutate( TypeofType * typeofType );
    105         virtual Type * mutate( AttrType * attrType );
    106         virtual Type * mutate( VarArgsType * varArgsType );
    107         virtual Type * mutate( ZeroType * zeroType );
    108         virtual Type * mutate( OneType * oneType );
     98        virtual Type * mutate( VoidType * basicType ) = 0;
     99        virtual Type * mutate( BasicType * basicType ) = 0;
     100        virtual Type * mutate( PointerType * pointerType ) = 0;
     101        virtual Type * mutate( ArrayType * arrayType ) = 0;
     102        virtual Type * mutate( ReferenceType * refType ) = 0;
     103        virtual Type * mutate( QualifiedType * qualType ) = 0;
     104        virtual Type * mutate( FunctionType * functionType ) = 0;
     105        virtual Type * mutate( StructInstType * aggregateUseType ) = 0;
     106        virtual Type * mutate( UnionInstType * aggregateUseType ) = 0;
     107        virtual Type * mutate( EnumInstType * aggregateUseType ) = 0;
     108        virtual Type * mutate( TraitInstType * aggregateUseType ) = 0;
     109        virtual Type * mutate( TypeInstType * aggregateUseType ) = 0;
     110        virtual Type * mutate( TupleType * tupleType ) = 0;
     111        virtual Type * mutate( TypeofType * typeofType ) = 0;
     112        virtual Type * mutate( AttrType * attrType ) = 0;
     113        virtual Type * mutate( VarArgsType * varArgsType ) = 0;
     114        virtual Type * mutate( ZeroType * zeroType ) = 0;
     115        virtual Type * mutate( OneType * oneType ) = 0;
     116        virtual Type * mutate( GlobalScopeType * globalType ) = 0;
    109117
    110         virtual Designation * mutate( Designation * designation );
    111         virtual Initializer * mutate( SingleInit * singleInit );
    112         virtual Initializer * mutate( ListInit * listInit );
    113         virtual Initializer * mutate( ConstructorInit * ctorInit );
     118        virtual Designation * mutate( Designation * designation ) = 0 ;
     119        virtual Initializer * mutate( SingleInit * singleInit ) = 0 ;
     120        virtual Initializer * mutate( ListInit * listInit ) = 0 ;
     121        virtual Initializer * mutate( ConstructorInit * ctorInit ) = 0 ;
    114122
    115         virtual Subrange * mutate( Subrange * subrange );
     123        virtual Subrange * mutate( Subrange * subrange ) = 0;
    116124
    117         virtual Constant * mutate( Constant * constant );
     125        virtual Constant * mutate( Constant * constant ) = 0;
    118126
    119         virtual Attribute * mutate( Attribute * attribute );
     127        virtual Attribute * mutate( Attribute * attribute ) = 0;
    120128
    121         virtual TypeSubstitution * mutate( TypeSubstitution * sub );
    122 
    123   private:
    124         virtual Declaration * handleAggregateDecl(AggregateDecl * aggregateDecl );
    125         virtual Declaration * handleNamedTypeDecl(NamedTypeDecl * typeDecl );
    126         virtual Type * handleReferenceToType(ReferenceToType * aggregateUseType );
     129        virtual TypeSubstitution * mutate( TypeSubstitution * sub ) = 0;
    127130};
    128131
     
    140143template< typename Container, typename MutatorType >
    141144inline void mutateAll( Container &container, MutatorType &mutator ) {
    142         SemanticError errors;
     145        SemanticErrorException errors;
    143146        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    144147                try {
     
    148151                                assert( *i );
    149152                        } // if
    150                 } catch( SemanticError &e ) {
    151                         e.set_location( (*i)->location );
     153                } catch( SemanticErrorException &e ) {
    152154                        errors.append( e );
    153155                } // try
Note: See TracChangeset for help on using the changeset viewer.