Ignore:
Timestamp:
Nov 8, 2017, 5:43:33 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
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:
954908d
Parents:
78315272 (diff), e35f30a (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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Declaration.h

    r78315272 r3f7e12cb  
    6161
    6262        void fixUniqueId( void );
    63         virtual Declaration *clone() const = 0;
    64         virtual void accept( Visitor &v ) = 0;
    65         virtual Declaration *acceptMutator( Mutator &m ) = 0;
    66         virtual void print( std::ostream &os, int indent = 0 ) const = 0;
    67         virtual void printShort( std::ostream &os, int indent = 0 ) const = 0;
     63        virtual Declaration *clone() const override = 0;
     64        virtual void accept( Visitor &v ) override = 0;
     65        virtual Declaration *acceptMutator( Mutator &m ) override = 0;
     66        virtual void print( std::ostream &os, Indenter indent = {} ) const override = 0;
     67        virtual void printShort( std::ostream &os, Indenter indent = {} ) const = 0;
    6868
    6969        static void dumpIds( std::ostream &os );
     
    106106        //void set_functionSpecifiers( Type::FuncSpecifiers newValue ) { fs = newValue; }
    107107
    108         virtual DeclarationWithType *clone() const = 0;
    109         virtual DeclarationWithType *acceptMutator( Mutator &m ) = 0;
     108        virtual DeclarationWithType *clone() const override = 0;
     109        virtual DeclarationWithType *acceptMutator( Mutator &m )  override = 0;
    110110
    111111        virtual Type * get_type() const = 0;
     
    128128        virtual ~ObjectDecl();
    129129
    130         virtual Type * get_type() const { return type; }
    131         virtual void set_type(Type *newType) { type = newType; }
     130        virtual Type * get_type() const override { return type; }
     131        virtual void set_type(Type *newType) override { type = newType; }
    132132
    133133        Initializer *get_init() const { return init; }
     
    139139        static ObjectDecl * newObject( const std::string & name, Type * type, Initializer * init );
    140140
    141         virtual ObjectDecl *clone() const { return new ObjectDecl( *this ); }
    142         virtual void accept( Visitor &v ) { v.visit( this ); }
    143         virtual DeclarationWithType *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    144         virtual void print( std::ostream &os, int indent = 0 ) const;
    145         virtual void printShort( std::ostream &os, int indent = 0 ) const;
     141        virtual ObjectDecl *clone() const override { return new ObjectDecl( *this ); }
     142        virtual void accept( Visitor &v ) override { v.visit( this ); }
     143        virtual DeclarationWithType *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     144        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     145        virtual void printShort( std::ostream &os, Indenter indent = {} ) const override;
    146146};
    147147
     
    157157        virtual ~FunctionDecl();
    158158
    159         Type * get_type() const { return type; }
    160         virtual void set_type(Type * t) { type = strict_dynamic_cast< FunctionType* >( t ); }
     159        virtual Type * get_type() const override { return type; }
     160        virtual void set_type(Type * t) override { type = strict_dynamic_cast< FunctionType* >( t ); }
    161161
    162162        FunctionType * get_functionType() const { return type; }
     
    165165        void set_statements( CompoundStmt *newValue ) { statements = newValue; }
    166166
    167         virtual FunctionDecl *clone() const { return new FunctionDecl( *this ); }
    168         virtual void accept( Visitor &v ) { v.visit( this ); }
    169         virtual DeclarationWithType *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    170         virtual void print( std::ostream &os, int indent = 0 ) const;
    171         virtual void printShort( std::ostream &os, int indent = 0 ) const;
     167        static FunctionDecl * newFunction( const std::string & name, FunctionType * type, CompoundStmt * statements );
     168
     169        virtual FunctionDecl *clone() const override { return new FunctionDecl( *this ); }
     170        virtual void accept( Visitor &v ) override { v.visit( this ); }
     171        virtual DeclarationWithType *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     172        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     173        virtual void printShort( std::ostream &os, Indenter indent = {} ) const override;
    172174};
    173175
     
    190192        virtual std::string typeString() const = 0;
    191193
    192         virtual NamedTypeDecl *clone() const = 0;
    193         virtual void print( std::ostream &os, int indent = 0 ) const;
    194         virtual void printShort( std::ostream &os, int indent = 0 ) const;
     194        virtual NamedTypeDecl *clone() const override = 0;
     195        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     196        virtual void printShort( std::ostream &os, Indenter indent = {} ) const override;
    195197};
    196198
     
    198200        typedef NamedTypeDecl Parent;
    199201  public:
    200         enum Kind { Any, Dtype, Ftype, Ttype };
     202        enum Kind { Dtype, Ftype, Ttype };
    201203
    202204        Type * init;
     
    214216        };
    215217
    216         TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, Type * init = nullptr );
     218        TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, bool sized, Type * init = nullptr );
    217219        TypeDecl( const TypeDecl &other );
    218220        virtual ~TypeDecl();
     
    223225        TypeDecl * set_init( Type * newValue ) { init = newValue; return this; }
    224226
    225         bool isComplete() const { return kind == Any || sized; }
     227        bool isComplete() const { return sized; }
    226228        bool get_sized() const { return sized; }
    227229        TypeDecl * set_sized( bool newValue ) { sized = newValue; return this; }
    228230
    229         virtual std::string typeString() const;
     231        virtual std::string typeString() const override;
    230232        virtual std::string genTypeString() const;
    231233
    232         virtual TypeDecl *clone() const { return new TypeDecl( *this ); }
    233         virtual void accept( Visitor &v ) { v.visit( this ); }
    234         virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    235         virtual void print( std::ostream &os, int indent = 0 ) const;
     234        virtual TypeDecl *clone() const override { return new TypeDecl( *this ); }
     235        virtual void accept( Visitor &v ) override { v.visit( this ); }
     236        virtual Declaration *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     237        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    236238
    237239  private:
     
    245247        TypedefDecl( const TypedefDecl &other ) : Parent( other ) {}
    246248
    247         virtual std::string typeString() const;
    248 
    249         virtual TypedefDecl *clone() const { return new TypedefDecl( *this ); }
    250         virtual void accept( Visitor &v ) { v.visit( this ); }
    251         virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     249        virtual std::string typeString() const override;
     250
     251        virtual TypedefDecl *clone() const override { return new TypedefDecl( *this ); }
     252        virtual void accept( Visitor &v ) override { v.visit( this ); }
     253        virtual Declaration *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    252254  private:
    253255};
     
    274276        AggregateDecl * set_body( bool body ) { AggregateDecl::body = body; return this; }
    275277
    276         virtual void print( std::ostream &os, int indent = 0 ) const;
    277         virtual void printShort( std::ostream &os, int indent = 0 ) const;
     278        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     279        virtual void printShort( std::ostream &os, Indenter indent = {} ) const override;
    278280  protected:
    279281        virtual std::string typeString() const = 0;
     
    290292        bool is_thread() { return kind == DeclarationNode::Thread; }
    291293
    292         virtual StructDecl *clone() const { return new StructDecl( *this ); }
    293         virtual void accept( Visitor &v ) { v.visit( this ); }
    294         virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     294        virtual StructDecl *clone() const override { return new StructDecl( *this ); }
     295        virtual void accept( Visitor &v ) override { v.visit( this ); }
     296        virtual Declaration *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    295297  private:
    296298        DeclarationNode::Aggregate kind;
    297         virtual std::string typeString() const;
     299        virtual std::string typeString() const override;
    298300};
    299301
     
    304306        UnionDecl( const UnionDecl &other ) : Parent( other ) {}
    305307
    306         virtual UnionDecl *clone() const { return new UnionDecl( *this ); }
    307         virtual void accept( Visitor &v ) { v.visit( this ); }
    308         virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    309   private:
    310         virtual std::string typeString() const;
     308        virtual UnionDecl *clone() const override { return new UnionDecl( *this ); }
     309        virtual void accept( Visitor &v ) override { v.visit( this ); }
     310        virtual Declaration *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     311  private:
     312        virtual std::string typeString() const override;
    311313};
    312314
     
    317319        EnumDecl( const EnumDecl &other ) : Parent( other ) {}
    318320
    319         virtual EnumDecl *clone() const { return new EnumDecl( *this ); }
    320         virtual void accept( Visitor &v ) { v.visit( this ); }
    321         virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    322   private:
    323         virtual std::string typeString() const;
     321        virtual EnumDecl *clone() const override { return new EnumDecl( *this ); }
     322        virtual void accept( Visitor &v ) override { v.visit( this ); }
     323        virtual Declaration *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     324  private:
     325        virtual std::string typeString() const override;
    324326};
    325327
     
    332334        TraitDecl( const TraitDecl &other ) : Parent( other ) {}
    333335
    334         virtual TraitDecl *clone() const { return new TraitDecl( *this ); }
    335         virtual void accept( Visitor &v ) { v.visit( this ); }
    336         virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    337   private:
    338         virtual std::string typeString() const;
     336        virtual TraitDecl *clone() const override { return new TraitDecl( *this ); }
     337        virtual void accept( Visitor &v ) override { v.visit( this ); }
     338        virtual Declaration *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     339  private:
     340        virtual std::string typeString() const override;
    339341};
    340342
     
    350352        void set_stmt( AsmStmt *newValue ) { stmt = newValue; }
    351353
    352         virtual AsmDecl *clone() const { return new AsmDecl( *this ); }
    353         virtual void accept( Visitor &v ) { v.visit( this ); }
    354         virtual AsmDecl *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    355         virtual void print( std::ostream &os, int indent = 0 ) const;
    356         virtual void printShort( std::ostream &os, int indent = 0 ) const;
    357 };
    358 
    359 std::ostream & operator<<( std::ostream & out, const Declaration * decl );
     354        virtual AsmDecl *clone() const override { return new AsmDecl( *this ); }
     355        virtual void accept( Visitor &v ) override { v.visit( this ); }
     356        virtual AsmDecl *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     357        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     358        virtual void printShort( std::ostream &os, Indenter indent = {} ) const override;
     359};
     360
    360361std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data );
    361362
Note: See TracChangeset for help on using the changeset viewer.