Changeset 62e5546 for src/InitTweak


Ignore:
Timestamp:
Oct 27, 2016, 4:22:27 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
0ebac75
Parents:
d93d980
Message:

Removed warnings when compiling with clang

Location:
src/InitTweak
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/InitTweak/FixInit.cc

    rd93d980 r62e5546  
    5050                const std::list<Expression*> noDesignators;
    5151
    52                 class InsertImplicitCalls : public GenPoly::PolyMutator {
     52                class InsertImplicitCalls final : public GenPoly::PolyMutator {
    5353                public:
    5454                        /// wrap function application expressions as ImplicitCopyCtorExpr nodes so that it is easy to identify which
     
    5656                        static void insert( std::list< Declaration * > & translationUnit );
    5757
    58                         virtual Expression * mutate( ApplicationExpr * appExpr );
    59                 };
    60 
    61                 class ResolveCopyCtors : public SymTab::Indexer {
     58                        using GenPoly::PolyMutator::mutate;
     59                        virtual Expression * mutate( ApplicationExpr * appExpr ) override;
     60                };
     61
     62                class ResolveCopyCtors final : public SymTab::Indexer {
    6263                public:
    6364                        /// generate temporary ObjectDecls for each argument and return value of each ImplicitCopyCtorExpr,
     
    6667                        static void resolveImplicitCalls( std::list< Declaration * > & translationUnit );
    6768
    68                         virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr );
     69                        using SymTab::Indexer::visit;
     70                        virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr ) override;
    6971
    7072                        /// create and resolve ctor/dtor expression: fname(var, [cpArg])
     
    8284                        using Parent::visit;
    8385                        typedef std::set< ObjectDecl * > ObjectSet;
    84                         virtual void visit( CompoundStmt *compoundStmt );
    85                         virtual void visit( DeclStmt *stmt );
     86                        virtual void visit( CompoundStmt *compoundStmt ) override;
     87                        virtual void visit( DeclStmt *stmt ) override;
    8688                  protected:
    8789                        ObjectSet curVars;
     
    103105                }
    104106
    105                 class LabelFinder : public ObjDeclCollector {
     107                class LabelFinder final : public ObjDeclCollector {
    106108                  public:
    107109                        typedef ObjDeclCollector Parent;
     
    117119                        // subclasses are added, there is only one place that the code has to be updated, rather than ensure that
    118120                        // every specialized class knows about every new kind of statement that might be added.
    119                         virtual void visit( CompoundStmt *stmt ) { handleStmt( stmt ); return Parent::visit( stmt ); }
    120                         virtual void visit( ExprStmt *stmt ) { handleStmt( stmt ); return Parent::visit( stmt ); }
    121                         virtual void visit( AsmStmt *stmt ) { handleStmt( stmt ); return Parent::visit( stmt ); }
    122                         virtual void visit( IfStmt *stmt ) { handleStmt( stmt ); return Parent::visit( stmt ); }
    123                         virtual void visit( WhileStmt *stmt ) { handleStmt( stmt ); return Parent::visit( stmt ); }
    124                         virtual void visit( ForStmt *stmt ) { handleStmt( stmt ); return Parent::visit( stmt ); }
    125                         virtual void visit( SwitchStmt *stmt ) { handleStmt( stmt ); return Parent::visit( stmt ); }
    126                         virtual void visit( CaseStmt *stmt ) { handleStmt( stmt ); return Parent::visit( stmt ); }
    127                         virtual void visit( BranchStmt *stmt ) { handleStmt( stmt ); return Parent::visit( stmt ); }
    128                         virtual void visit( ReturnStmt *stmt ) { handleStmt( stmt ); return Parent::visit( stmt ); }
    129                         virtual void visit( TryStmt *stmt ) { handleStmt( stmt ); return Parent::visit( stmt ); }
    130                         virtual void visit( CatchStmt *stmt ) { handleStmt( stmt ); return Parent::visit( stmt ); }
    131                         virtual void visit( FinallyStmt *stmt ) { handleStmt( stmt ); return Parent::visit( stmt ); }
    132                         virtual void visit( NullStmt *stmt ) { handleStmt( stmt ); return Parent::visit( stmt ); }
    133                         virtual void visit( DeclStmt *stmt ) { handleStmt( stmt ); return Parent::visit( stmt ); }
    134                         virtual void visit( ImplicitCtorDtorStmt *stmt ) { handleStmt( stmt ); return Parent::visit( stmt ); }
    135                 };
    136 
    137                 class InsertDtors : public ObjDeclCollector {
     121                        using Parent::visit;
     122                        virtual void visit( CompoundStmt *stmt ) override { handleStmt( stmt ); return Parent::visit( stmt ); }
     123                        virtual void visit( ExprStmt *stmt ) override { handleStmt( stmt ); return Parent::visit( stmt ); }
     124                        virtual void visit( AsmStmt *stmt ) override { handleStmt( stmt ); return Parent::visit( stmt ); }
     125                        virtual void visit( IfStmt *stmt ) override { handleStmt( stmt ); return Parent::visit( stmt ); }
     126                        virtual void visit( WhileStmt *stmt ) override { handleStmt( stmt ); return Parent::visit( stmt ); }
     127                        virtual void visit( ForStmt *stmt ) override { handleStmt( stmt ); return Parent::visit( stmt ); }
     128                        virtual void visit( SwitchStmt *stmt ) override { handleStmt( stmt ); return Parent::visit( stmt ); }
     129                        virtual void visit( CaseStmt *stmt ) override { handleStmt( stmt ); return Parent::visit( stmt ); }
     130                        virtual void visit( BranchStmt *stmt ) override { handleStmt( stmt ); return Parent::visit( stmt ); }
     131                        virtual void visit( ReturnStmt *stmt ) override { handleStmt( stmt ); return Parent::visit( stmt ); }
     132                        virtual void visit( TryStmt *stmt ) override { handleStmt( stmt ); return Parent::visit( stmt ); }
     133                        virtual void visit( CatchStmt *stmt ) override { handleStmt( stmt ); return Parent::visit( stmt ); }
     134                        virtual void visit( FinallyStmt *stmt ) override { handleStmt( stmt ); return Parent::visit( stmt ); }
     135                        virtual void visit( NullStmt *stmt ) override { handleStmt( stmt ); return Parent::visit( stmt ); }
     136                        virtual void visit( DeclStmt *stmt ) override { handleStmt( stmt ); return Parent::visit( stmt ); }
     137                        virtual void visit( ImplicitCtorDtorStmt *stmt ) override { handleStmt( stmt ); return Parent::visit( stmt ); }
     138                };
     139
     140                class InsertDtors final : public ObjDeclCollector {
    138141                public:
    139142                        /// insert destructor calls at the appropriate places.  must happen before CtorInit nodes are removed
     
    147150                        InsertDtors( LabelFinder & finder ) : labelVars( finder.vars ) {}
    148151
    149                         virtual void visit( ObjectDecl * objDecl );
    150 
    151                         virtual void visit( CompoundStmt * compoundStmt );
    152                         virtual void visit( ReturnStmt * returnStmt );
    153                         virtual void visit( BranchStmt * stmt );
     152                        using Parent::visit;
     153
     154                        virtual void visit( ObjectDecl * objDecl ) override;
     155
     156                        virtual void visit( CompoundStmt * compoundStmt ) override;
     157                        virtual void visit( ReturnStmt * returnStmt ) override;
     158                        virtual void visit( BranchStmt * stmt ) override;
    154159                private:
    155160                        void handleGoto( BranchStmt * stmt );
     
    159164                };
    160165
    161                 class FixInit : public GenPoly::PolyMutator {
     166                class FixInit final : public GenPoly::PolyMutator {
    162167                  public:
    163168                        /// expand each object declaration to use its constructor after it is declared.
    164169                        static void fixInitializers( std::list< Declaration * > &translationUnit );
    165170
    166                         virtual DeclarationWithType * mutate( ObjectDecl *objDecl );
     171                        using GenPoly::PolyMutator::mutate;
     172                        virtual DeclarationWithType * mutate( ObjectDecl *objDecl ) override;
    167173
    168174                        std::list< Declaration * > staticDtorDecls;
    169175                };
    170176
    171                 class FixCopyCtors : public GenPoly::PolyMutator {
     177                class FixCopyCtors final : public GenPoly::PolyMutator {
    172178                  public:
    173179                        /// expand ImplicitCopyCtorExpr nodes into the temporary declarations, copy constructors, call expression,
     
    175181                        static void fixCopyCtors( std::list< Declaration * > &translationUnit );
    176182
    177                         virtual Expression * mutate( ImplicitCopyCtorExpr * impCpCtorExpr );
    178                 };
    179 
    180                 class GenStructMemberCalls : public SymTab::Indexer {
     183                        using GenPoly::PolyMutator::mutate;
     184                        virtual Expression * mutate( ImplicitCopyCtorExpr * impCpCtorExpr ) override;
     185                };
     186
     187                class GenStructMemberCalls final : public SymTab::Indexer {
    181188                  public:
    182189                        typedef Indexer Parent;
     
    186193                        static void generate( std::list< Declaration * > & translationUnit );
    187194
    188                         virtual void visit( FunctionDecl * funcDecl );
    189 
    190                         virtual void visit( MemberExpr * memberExpr );
    191                         virtual void visit( ApplicationExpr * appExpr );
     195                        using Parent::visit;
     196
     197                        virtual void visit( FunctionDecl * funcDecl ) override;
     198
     199                        virtual void visit( MemberExpr * memberExpr ) override;
     200                        virtual void visit( ApplicationExpr * appExpr ) override;
    192201
    193202                        SemanticError errors;
     
    207216                // resolve UntypedExprs that are found within newly
    208217                // generated constructor/destructor calls
    209                 class MutatingResolver : public Mutator {
     218                class MutatingResolver final : public Mutator {
    210219                  public:
    211220                        MutatingResolver( SymTab::Indexer & indexer ) : indexer( indexer ) {}
    212221
    213                         virtual DeclarationWithType* mutate( ObjectDecl *objectDecl );
    214 
    215                         virtual Expression* mutate( UntypedExpr *untypedExpr );
    216                         private:
     222                        using Mutator::mutate;
     223                        virtual DeclarationWithType* mutate( ObjectDecl *objectDecl ) override;
     224                        virtual Expression* mutate( UntypedExpr *untypedExpr ) override;
     225
     226                  private:
    217227                        SymTab::Indexer & indexer;
    218228                };
    219229
    220                 class FixCtorExprs : public GenPoly::DeclMutator {
     230                class FixCtorExprs final : public GenPoly::DeclMutator {
    221231                  public:
    222232                        /// expands ConstructorExpr nodes into comma expressions, using a temporary for the first argument
    223233                        static void fix( std::list< Declaration * > & translationUnit );
    224234
    225                         virtual Expression * mutate( ConstructorExpr * ctorExpr );
     235                        using GenPoly::DeclMutator::mutate;
     236                        virtual Expression * mutate( ConstructorExpr * ctorExpr ) override;
    226237                };
    227238        } // namespace
  • TabularUnified src/InitTweak/GenInit.cc

    rd93d980 r62e5546  
    3636        }
    3737
    38         class ReturnFixer : public GenPoly::PolyMutator {
     38        class ReturnFixer final : public GenPoly::PolyMutator {
    3939          public:
    4040                /// consistently allocates a temporary variable for the return value
     
    4545                ReturnFixer();
    4646
    47                 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl );
    48 
    49                 virtual Statement * mutate( ReturnStmt * returnStmt );
     47                using GenPoly::PolyMutator::mutate;
     48                virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ) override;
     49                virtual Statement * mutate( ReturnStmt * returnStmt ) override;
    5050
    5151          protected:
     
    5555        };
    5656
    57         class CtorDtor : public GenPoly::PolyMutator {
     57        class CtorDtor final : public GenPoly::PolyMutator {
    5858          public:
    5959                typedef GenPoly::PolyMutator Parent;
     
    6565                static void generateCtorDtor( std::list< Declaration * > &translationUnit );
    6666
    67                 virtual DeclarationWithType * mutate( ObjectDecl * );
    68                 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl );
     67                virtual DeclarationWithType * mutate( ObjectDecl * ) override;
     68                virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ) override;
    6969                // should not traverse into any of these declarations to find objects
    7070                // that need to be constructed or destructed
    71                 virtual Declaration* mutate( StructDecl *aggregateDecl );
    72                 virtual Declaration* mutate( UnionDecl *aggregateDecl ) { return aggregateDecl; }
    73                 virtual Declaration* mutate( EnumDecl *aggregateDecl ) { return aggregateDecl; }
    74                 virtual Declaration* mutate( TraitDecl *aggregateDecl ) { return aggregateDecl; }
    75                 virtual TypeDecl* mutate( TypeDecl *typeDecl ) { return typeDecl; }
    76                 virtual Declaration* mutate( TypedefDecl *typeDecl ) { return typeDecl; }
    77 
    78                 virtual Type * mutate( FunctionType *funcType ) { return funcType; }
    79 
    80                 virtual CompoundStmt * mutate( CompoundStmt * compoundStmt );
     71                virtual Declaration* mutate( StructDecl *aggregateDecl ) override;
     72                virtual Declaration* mutate( UnionDecl *aggregateDecl ) override { return aggregateDecl; }
     73                virtual Declaration* mutate( EnumDecl *aggregateDecl ) override { return aggregateDecl; }
     74                virtual Declaration* mutate( TraitDecl *aggregateDecl ) override { return aggregateDecl; }
     75                virtual TypeDecl* mutate( TypeDecl *typeDecl ) override { return typeDecl; }
     76                virtual Declaration* mutate( TypedefDecl *typeDecl ) override { return typeDecl; }
     77
     78                virtual Type * mutate( FunctionType *funcType ) override { return funcType; }
     79
     80                virtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) override;
    8181
    8282          private:
     
    9191        };
    9292
    93         class HoistArrayDimension : public GenPoly::DeclMutator {
     93        class HoistArrayDimension final : public GenPoly::DeclMutator {
    9494          public:
    9595                typedef GenPoly::DeclMutator Parent;
     
    101101
    102102          private:
    103                 virtual DeclarationWithType * mutate( ObjectDecl * objectDecl );
    104                 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl );
     103                using Parent::mutate;
     104
     105                virtual DeclarationWithType * mutate( ObjectDecl * objectDecl ) override;
     106                virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ) override;
    105107                // should not traverse into any of these declarations to find objects
    106108                // that need to be constructed or destructed
    107                 virtual Declaration* mutate( StructDecl *aggregateDecl ) { return aggregateDecl; }
    108                 virtual Declaration* mutate( UnionDecl *aggregateDecl ) { return aggregateDecl; }
    109                 virtual Declaration* mutate( EnumDecl *aggregateDecl ) { return aggregateDecl; }
    110                 virtual Declaration* mutate( TraitDecl *aggregateDecl ) { return aggregateDecl; }
    111                 virtual TypeDecl* mutate( TypeDecl *typeDecl ) { return typeDecl; }
    112                 virtual Declaration* mutate( TypedefDecl *typeDecl ) { return typeDecl; }
    113 
    114                 virtual Type* mutate( FunctionType *funcType ) { return funcType; }
     109                virtual Declaration* mutate( StructDecl *aggregateDecl ) override { return aggregateDecl; }
     110                virtual Declaration* mutate( UnionDecl *aggregateDecl ) override { return aggregateDecl; }
     111                virtual Declaration* mutate( EnumDecl *aggregateDecl ) override { return aggregateDecl; }
     112                virtual Declaration* mutate( TraitDecl *aggregateDecl ) override { return aggregateDecl; }
     113                virtual TypeDecl* mutate( TypeDecl *typeDecl ) override { return typeDecl; }
     114                virtual Declaration* mutate( TypedefDecl *typeDecl ) override { return typeDecl; }
     115
     116                virtual Type* mutate( FunctionType *funcType ) override { return funcType; }
    115117
    116118                void hoist( Type * type );
  • TabularUnified src/InitTweak/InitTweak.h

    rd93d980 r62e5546  
    100100
    101101                class ExpanderImpl;
     102                typedef std::list< Expression * > IndexList;
    102103        private:
    103104                std::shared_ptr< ExpanderImpl > expander;
     
    105106
    106107                // invariant: list of size 2N (elements come in pairs [index, dimension])
    107                 typedef std::list< Expression * > IndexList;
    108108                IndexList indices;
    109109        };
Note: See TracChangeset for help on using the changeset viewer.