Changeset 9236060 for src/SynTree


Ignore:
Timestamp:
Aug 14, 2017, 2:03:39 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
74b007ba
Parents:
fd344aa (diff), 54cd58b0 (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 references

Location:
src/SynTree
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/AddStmtVisitor.h

    rfd344aa r9236060  
    1010// Created On       : Wed Jun 22 12:05:48 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:50:32 2016
    13 // Update Count     : 8
     12// Last Modified On : Sat Jul 22 09:51:08 2017
     13// Update Count     : 9
    1414//
    1515
    16 #ifndef ADD_STATEMENT_VISITOR_H
    17 #define ADD_STATEMENT_VISITOR_H
     16#pragma once
    1817
    1918#include <list>
     
    4241};
    4342
    44 #endif // ADD_STATEMENT_VISITOR_H
     43// Local Variables: //
     44// tab-width: 4 //
     45// mode: c++ //
     46// compile-command: "make install" //
     47// End: //
  • src/SynTree/AggregateDecl.cc

    rfd344aa r9236060  
    1010// Created On       : Sun May 17 23:56:39 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tus Jun 27 15:30:00 2017
    13 // Update Count     : 21
     12// Last Modified On : Fri Aug  4 14:22:00 2017
     13// Update Count     : 22
    1414//
    1515
     
    4040        using std::endl;
    4141
    42         os << typeString() << " " << get_name();
    43         os << string( indent+2, ' ' ) << "with body " << has_body() << endl;
     42        os << typeString() << " " << get_name() << ":";
     43        if ( get_linkage() != LinkageSpec::Cforall ) {
     44                os << " " << LinkageSpec::linkageName( get_linkage() );
     45        } // if
     46        os << " with body " << has_body() << endl;
    4447
    4548        if ( ! parameters.empty() ) {
  • src/SynTree/Attribute.h

    rfd344aa r9236060  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jan 18 16:27:11 2017
    13 // Update Count     : 38
     12// Last Modified On : Sat Jul 22 09:54:14 2017
     13// Update Count     : 39
    1414//
    1515
    16 #ifndef GCC_ATTRIBUTE_H
    17 #define GCC_ATTRIBUTE_H
     16#pragma once
    1817
    1918#include "SynTree.h"
     
    4241const std::list< Attribute * > noAttributes;
    4342
    44 #endif
    45 
    4643// Local Variables: //
    4744// tab-width: 4 //
  • src/SynTree/BaseSyntaxNode.h

    rfd344aa r9236060  
    1414//
    1515
    16 #ifndef BASE_SYNTAX_NODE_H
    17 #define BASE_SYNTAX_NODE_H
     16#pragma once
    1817
    1918#include "Common/utility.h"
     
    2928};
    3029
    31 #endif // BASE_SYNTAX_NODE_H
    32 
    3330// Local Variables: //
    3431// tab-width: 4 //
  • src/SynTree/Constant.cc

    rfd344aa r9236060  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Jun 22 10:11:00 2017
    13 // Update Count     : 28
     12// Last Modified On : Fri Jul 14 14:50:00 2017
     13// Update Count     : 29
    1414//
    1515
     
    4646}
    4747
     48Constant Constant::null( Type * ptrtype ) {
     49        if ( nullptr == ptrtype ) {
     50                ptrtype = new PointerType(
     51                        Type::Qualifiers(),
     52                        new VoidType( Type::Qualifiers() )
     53                        );
     54        }
     55
     56        return Constant( ptrtype, "0", (unsigned long long int)0 );
     57}
     58
    4859unsigned long long Constant::get_ival() const {
    4960        assertf( safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." );
  • src/SynTree/Constant.h

    rfd344aa r9236060  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Jun 22 10:13:00 2017
    13 // Update Count     : 15
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Jul 22 09:54:46 2017
     13// Update Count     : 17
    1414//
    1515
    16 #ifndef CONSTANT_H
    17 #define CONSTANT_H
     16#pragma once
    1817
    1918#include "SynTree.h"
     
    4443        static Constant from_double( double d );
    4544
     45        /// generates a null pointer value for the given type. void * if omitted.
     46        static Constant null( Type * ptrtype = nullptr );
     47
    4648        virtual void accept( Visitor & v ) { v.visit( this ); }
    4749        virtual Constant * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     
    5860};
    5961
    60 #endif // CONSTANT_H
    61 
    6262// Local Variables: //
    6363// tab-width: 4 //
  • src/SynTree/Declaration.cc

    rfd344aa r9236060  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 07:49:18 2017
    13 // Update Count     : 24
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Aug  9 14:38:00 2017
     13// Update Count     : 25
    1414//
    1515
     
    2828
    2929Declaration::Declaration( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage )
    30                 : name( name ), storageClasses( scs ), linkage( linkage ), uniqueId( 0 ) {
     30                : name( name ), linkage( linkage ), storageClasses( scs ), uniqueId( 0 ) {
    3131}
    3232
    3333Declaration::Declaration( const Declaration &other )
    34         : BaseSyntaxNode( other ), name( other.name ), storageClasses( other.storageClasses ), linkage( other.linkage ), uniqueId( other.uniqueId ) {
     34        : BaseSyntaxNode( other ), name( other.name ), linkage( other.linkage ), extension( other.extension ), storageClasses( other.storageClasses ), uniqueId( other.uniqueId ) {
    3535}
    3636
  • src/SynTree/Declaration.h

    rfd344aa r9236060  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tus Jun 27 15:31:00 2017
    13 // Update Count     : 122
    14 //
    15 
    16 #ifndef DECLARATION_H
    17 #define DECLARATION_H
     12// Last Modified On : Wed Aug  9 14:45:00 2017
     13// Update Count     : 126
     14//
     15
     16#pragma once
    1817
    1918#include <string>
     
    2827class Declaration : public BaseSyntaxNode {
    2928  public:
     29        std::string name;
     30        LinkageSpec::Spec linkage;
     31        bool extension = false;
     32
    3033        Declaration( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage );
    3134        Declaration( const Declaration &other );
     
    5457        static void dumpIds( std::ostream &os );
    5558        static Declaration *declFromId( UniqueId id );
    56   private:
    57         std::string name;
     59
     60  private:
    5861        Type::StorageClasses storageClasses;
    59         LinkageSpec::Spec linkage;
    6062        UniqueId uniqueId;
    61         bool extension = false;
    6263};
    6364
    6465class DeclarationWithType : public Declaration {
    6566  public:
    66         DeclarationWithType( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, Type::FuncSpecifiers fs );
    67         DeclarationWithType( const DeclarationWithType &other );
    68         virtual ~DeclarationWithType();
    69 
    70         std::string get_mangleName() const { return mangleName; }
    71         DeclarationWithType * set_mangleName( std::string newValue ) { mangleName = newValue; return this; }
    72 
    73         std::string get_scopedMangleName() const { return mangleName + "_" + std::to_string(scopeLevel); }
    74 
    75         int get_scopeLevel() const { return scopeLevel; }
    76         DeclarationWithType * set_scopeLevel( int newValue ) { scopeLevel = newValue; return this; }
    77 
    78         ConstantExpr *get_asmName() const { return asmName; }
    79         DeclarationWithType * set_asmName( ConstantExpr *newValue ) { asmName = newValue; return this; }
    80 
    81         std::list< Attribute * >& get_attributes() { return attributes; }
    82         const std::list< Attribute * >& get_attributes() const { return attributes; }
    83 
    84         Type::FuncSpecifiers get_funcSpec() const { return fs; }
    85         //void set_functionSpecifiers( Type::FuncSpecifiers newValue ) { fs = newValue; }
    86 
    87         virtual DeclarationWithType *clone() const = 0;
    88         virtual DeclarationWithType *acceptMutator( Mutator &m ) = 0;
    89 
    90         virtual Type *get_type() const = 0;
    91         virtual void set_type(Type *) = 0;
    92   private:
    9367        // this represents the type with all types and typedefs expanded it is generated by SymTab::Validate::Pass2
    9468        std::string mangleName;
     
    9872        ConstantExpr *asmName;
    9973        std::list< Attribute * > attributes;
     74
     75        DeclarationWithType( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, Type::FuncSpecifiers fs );
     76        DeclarationWithType( const DeclarationWithType &other );
     77        virtual ~DeclarationWithType();
     78
     79        std::string get_mangleName() const { return mangleName; }
     80        DeclarationWithType * set_mangleName( std::string newValue ) { mangleName = newValue; return this; }
     81
     82        std::string get_scopedMangleName() const { return mangleName + "_" + std::to_string(scopeLevel); }
     83
     84        int get_scopeLevel() const { return scopeLevel; }
     85        DeclarationWithType * set_scopeLevel( int newValue ) { scopeLevel = newValue; return this; }
     86
     87        ConstantExpr *get_asmName() const { return asmName; }
     88        DeclarationWithType * set_asmName( ConstantExpr *newValue ) { asmName = newValue; return this; }
     89
     90        std::list< Attribute * >& get_attributes() { return attributes; }
     91        const std::list< Attribute * >& get_attributes() const { return attributes; }
     92
     93        Type::FuncSpecifiers get_funcSpec() const { return fs; }
     94        //void set_functionSpecifiers( Type::FuncSpecifiers newValue ) { fs = newValue; }
     95
     96        virtual DeclarationWithType *clone() const = 0;
     97        virtual DeclarationWithType *acceptMutator( Mutator &m ) = 0;
     98
     99        virtual Type *get_type() const = 0;
     100        virtual void set_type(Type *) = 0;
     101
     102  private:
    100103        Type::FuncSpecifiers fs;
    101104};
     
    104107        typedef DeclarationWithType Parent;
    105108  public:
     109        Type *type;
     110        Initializer *init;
     111        Expression *bitfieldWidth;
     112
    106113        ObjectDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init,
    107114                                const std::list< Attribute * > attributes = std::list< Attribute * >(), Type::FuncSpecifiers fs = Type::FuncSpecifiers() );
     
    123130        virtual void print( std::ostream &os, int indent = 0 ) const;
    124131        virtual void printShort( std::ostream &os, int indent = 0 ) const;
    125   private:
    126         Type *type;
    127         Initializer *init;
    128         Expression *bitfieldWidth;
    129132};
    130133
     
    132135        typedef DeclarationWithType Parent;
    133136  public:
     137        FunctionType *type;
     138        CompoundStmt *statements;
     139
    134140        FunctionDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements,
    135141                                  const std::list< Attribute * > attributes = std::list< Attribute * >(), Type::FuncSpecifiers fs = Type::FuncSpecifiers() );
     
    150156        virtual void print( std::ostream &os, int indent = 0 ) const;
    151157        virtual void printShort( std::ostream &os, int indent = 0 ) const;
    152   private:
    153         FunctionType *type;
    154         CompoundStmt *statements;
    155158};
    156159
     
    158161        typedef Declaration Parent;
    159162  public:
     163        Type *base;
     164        std::list< TypeDecl* > parameters;
     165        std::list< DeclarationWithType* > assertions;
     166
    160167        NamedTypeDecl( const std::string &name, Type::StorageClasses scs, Type *type );
    161168        NamedTypeDecl( const NamedTypeDecl &other );
     
    172179        virtual void print( std::ostream &os, int indent = 0 ) const;
    173180        virtual void printShort( std::ostream &os, int indent = 0 ) const;
    174   protected:
    175   private:
    176         Type *base;
    177         std::list< TypeDecl* > parameters;
    178         std::list< DeclarationWithType* > assertions;
    179181};
    180182
     
    183185  public:
    184186        enum Kind { Any, Dtype, Ftype, Ttype };
     187
     188        Type * init;
     189        bool sized;
     190
    185191        /// Data extracted from a type decl
    186192        struct Data {
     
    217223  private:
    218224        Kind kind;
    219         Type * init;
    220         bool sized;
    221225};
    222226
     
    224228        typedef NamedTypeDecl Parent;
    225229  public:
    226         TypedefDecl( const std::string &name, Type::StorageClasses scs, Type *type ) : Parent( name, scs, type ) {}
     230        TypedefDecl( const std::string &name, Type::StorageClasses scs, Type *type, LinkageSpec::Spec spec = LinkageSpec::Cforall ) : Parent( name, scs, type ) { set_linkage( spec ); }
    227231        TypedefDecl( const TypedefDecl &other ) : Parent( other ) {}
    228232
     
    238242        typedef Declaration Parent;
    239243  public:
    240         AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall );
    241         AggregateDecl( const AggregateDecl &other );
    242         virtual ~AggregateDecl();
    243 
    244         std::list<Declaration*>& get_members() { return members; }
    245         std::list<TypeDecl*>& get_parameters() { return parameters; }
    246 
    247         std::list< Attribute * >& get_attributes() { return attributes; }
    248         const std::list< Attribute * >& get_attributes() const { return attributes; }
    249 
    250         bool has_body() const { return body; }
    251         AggregateDecl * set_body( bool body ) { AggregateDecl::body = body; return this; }
    252 
    253         virtual void print( std::ostream &os, int indent = 0 ) const;
    254         virtual void printShort( std::ostream &os, int indent = 0 ) const;
    255   protected:
    256         virtual std::string typeString() const = 0;
    257 
    258   private:
    259244        std::list<Declaration*> members;
    260245        std::list<TypeDecl*> parameters;
    261246        bool body;
    262247        std::list< Attribute * > attributes;
     248
     249        AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall );
     250        AggregateDecl( const AggregateDecl &other );
     251        virtual ~AggregateDecl();
     252
     253        std::list<Declaration*>& get_members() { return members; }
     254        std::list<TypeDecl*>& get_parameters() { return parameters; }
     255
     256        std::list< Attribute * >& get_attributes() { return attributes; }
     257        const std::list< Attribute * >& get_attributes() const { return attributes; }
     258
     259        bool has_body() const { return body; }
     260        AggregateDecl * set_body( bool body ) { AggregateDecl::body = body; return this; }
     261
     262        virtual void print( std::ostream &os, int indent = 0 ) const;
     263        virtual void printShort( std::ostream &os, int indent = 0 ) const;
     264  protected:
     265        virtual std::string typeString() const = 0;
    263266};
    264267
     
    266269        typedef AggregateDecl Parent;
    267270  public:
    268         StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ) {}
     271        StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ), tagged( false ), parent_name( "" ) {}
     272        StructDecl( const std::string &name, const std::string *parent, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( DeclarationNode::Struct ), tagged( true ), parent_name( parent ? *parent : "" ) {}
    269273        StructDecl( const StructDecl &other ) : Parent( other ) {}
    270274
     
    273277        bool is_thread() { return kind == DeclarationNode::Thread; }
    274278
     279        // Tagged/Tree Structure Excetion
     280        bool get_tagged() { return tagged; }
     281        void set_tagged( bool newValue ) { tagged = newValue; }
     282        bool has_parent() { return parent_name != ""; }
     283        std::string get_parentName() { return parent_name; }
     284
    275285        virtual StructDecl *clone() const { return new StructDecl( *this ); }
    276286        virtual void accept( Visitor &v ) { v.visit( this ); }
     
    279289        DeclarationNode::Aggregate kind;
    280290        virtual std::string typeString() const;
     291
     292        bool tagged;
     293        std::string parent_name;
    281294};
    282295
     
    324337class AsmDecl : public Declaration {
    325338  public:
     339        AsmStmt *stmt;
     340
    326341        AsmDecl( AsmStmt *stmt );
    327342        AsmDecl( const AsmDecl &other );
     
    336351        virtual void print( std::ostream &os, int indent = 0 ) const;
    337352        virtual void printShort( std::ostream &os, int indent = 0 ) const;
    338   private:
    339         AsmStmt *stmt;
    340353};
    341354
    342355std::ostream & operator<<( std::ostream & out, const Declaration * decl );
    343356std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data );
    344 
    345 #endif // DECLARATION_H
    346357
    347358// Local Variables: //
  • src/SynTree/Expression.cc

    rfd344aa r9236060  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 30 16:41:13 2017
    13 // Update Count     : 52
     12// Last Modified On : Tue Jul 25 14:15:47 2017
     13// Update Count     : 54
    1414//
    1515
     
    305305        if ( result->isVoid() ) {
    306306                os << "nothing";
     307        } else {
     308                result->print( os, indent+2 );
     309        } // if
     310        os << std::endl;
     311        Expression::print( os, indent );
     312}
     313
     314VirtualCastExpr::VirtualCastExpr( Expression *arg_, Type *toType ) : Expression(), arg(arg_) {
     315        set_result(toType);
     316}
     317
     318VirtualCastExpr::VirtualCastExpr( const VirtualCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ) {
     319}
     320
     321VirtualCastExpr::~VirtualCastExpr() {
     322        delete arg;
     323}
     324
     325void VirtualCastExpr::print( std::ostream &os, int indent ) const {
     326        os << "Virtual Cast of:" << std::endl << std::string( indent+2, ' ' );
     327        arg->print(os, indent+2);
     328        os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl;
     329        os << std::string( indent+2, ' ' );
     330        if ( ! result ) {
     331                os << "unknown";
    307332        } else {
    308333                result->print( os, indent+2 );
  • src/SynTree/Expression.h

    rfd344aa r9236060  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 30 16:44:00 2017
    13 // Update Count     : 41
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Fri Aug  8 11:54:00 2017
     13// Update Count     : 44
    1414//
    1515
    16 #ifndef EXPRESSION_H
    17 #define EXPRESSION_H
     16#pragma once
    1817
    1918#include <map>
     
    3029class Expression : public BaseSyntaxNode{
    3130  public:
     31        Type * result;
     32        TypeSubstitution * env;
     33        Expression * argName; // if expression is used as an argument, it can be "designated" by this name
     34        bool extension = false;
     35
    3236        Expression( Expression * _aname = nullptr );
    3337        Expression( const Expression & other );
     
    5054        virtual Expression * acceptMutator( Mutator & m ) = 0;
    5155        virtual void print( std::ostream & os, int indent = 0 ) const;
    52   protected:
    53         Type * result;
    54         TypeSubstitution * env;
    55         Expression * argName; // if expression is used as an argument, it can be "designated" by this name
    56         bool extension = false;
    5756};
    5857
     
    8079class ApplicationExpr : public Expression {
    8180  public:
    82         ApplicationExpr( Expression * function, const std::list<Expression *> & args = std::list<Expression *>() );
     81        Expression * function;
     82
     83        ApplicationExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() );
    8384        ApplicationExpr( const ApplicationExpr & other );
    8485        virtual ~ApplicationExpr();
     
    9394        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    9495        virtual void print( std::ostream & os, int indent = 0 ) const;
     96
    9597  private:
    96         Expression * function;
    9798        std::list<Expression *> args;
    9899        InferredParams inferParams;
     
    104105class UntypedExpr : public Expression {
    105106  public:
     107        Expression * function;
     108        std::list<Expression*> args;
     109
    106110        UntypedExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >(), Expression *_aname = nullptr );
    107111        UntypedExpr( const UntypedExpr & other );
     
    124128        virtual void print( std::ostream & os, int indent = 0 ) const;
    125129        virtual void printArgs(std::ostream & os, int indent = 0) const;
    126   private:
    127         Expression * function;
    128         std::list<Expression*> args;
    129130};
    130131
     
    132133class NameExpr : public Expression {
    133134  public:
     135        std::string name;
     136
    134137        NameExpr( std::string name, Expression *_aname = nullptr );
    135138        NameExpr( const NameExpr & other );
     
    143146        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    144147        virtual void print( std::ostream & os, int indent = 0 ) const;
    145   private:
    146         std::string name;
    147148};
    148149
     
    153154class AddressExpr : public Expression {
    154155  public:
     156        Expression * arg;
     157
    155158        AddressExpr( Expression * arg, Expression *_aname = nullptr );
    156159        AddressExpr( const AddressExpr & other );
     
    164167        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    165168        virtual void print( std::ostream & os, int indent = 0 ) const;
    166   private:
    167         Expression * arg;
    168169};
    169170
     
    171172class LabelAddressExpr : public Expression {
    172173  public:
     174        Expression * arg;
     175
    173176        LabelAddressExpr( Expression * arg );
    174177        LabelAddressExpr( const LabelAddressExpr & other );
     
    182185        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    183186        virtual void print( std::ostream & os, int indent = 0 ) const;
    184   private:
    185         Expression * arg;
    186187};
    187188
     
    189190class CastExpr : public Expression {
    190191  public:
     192        Expression * arg;
     193
    191194        CastExpr( Expression * arg, Expression *_aname = nullptr );
    192195        CastExpr( Expression * arg, Type * toType, Expression *_aname = nullptr );
     
    195198
    196199        Expression * get_arg() const { return arg; }
    197         void set_arg(Expression * newValue ) { arg = newValue; }
     200        void set_arg( Expression * newValue ) { arg = newValue; }
    198201
    199202        virtual CastExpr * clone() const { return new CastExpr( * this ); }
     
    201204        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    202205        virtual void print( std::ostream & os, int indent = 0 ) const;
    203   private:
     206};
     207
     208/// VirtualCastExpr repersents a virtual dynamic cast, e.g. (virtual exception)e
     209class VirtualCastExpr : public Expression {
     210  public:
    204211        Expression * arg;
     212
     213        VirtualCastExpr( Expression * arg, Type * toType );
     214        VirtualCastExpr( const VirtualCastExpr & other );
     215        virtual ~VirtualCastExpr();
     216
     217        Expression * get_arg() const { return arg; }
     218        void set_arg( Expression * newValue ) { arg = newValue; }
     219
     220        virtual VirtualCastExpr * clone() const { return new VirtualCastExpr( * this ); }
     221        virtual void accept( Visitor & v ) { v.visit( this ); }
     222        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     223        virtual void print( std::ostream & os, int indent = 0 ) const;
    205224};
    206225
     
    208227class UntypedMemberExpr : public Expression {
    209228  public:
     229        Expression * member;
     230        Expression * aggregate;
     231
    210232        UntypedMemberExpr( Expression * member, Expression * aggregate, Expression *_aname = nullptr );
    211233        UntypedMemberExpr( const UntypedMemberExpr & other );
     
    221243        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    222244        virtual void print( std::ostream & os, int indent = 0 ) const;
    223   private:
    224         Expression * member;
    225         Expression * aggregate;
    226245};
    227246
     
    230249class MemberExpr : public Expression {
    231250  public:
     251        DeclarationWithType * member;
     252        Expression * aggregate;
     253
    232254        MemberExpr( DeclarationWithType * member, Expression * aggregate, Expression *_aname = nullptr );
    233255        MemberExpr( const MemberExpr & other );
     
    243265        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    244266        virtual void print( std::ostream & os, int indent = 0 ) const;
    245   private:
    246         DeclarationWithType * member;
    247         Expression * aggregate;
    248267};
    249268
     
    252271class VariableExpr : public Expression {
    253272  public:
     273        DeclarationWithType * var;
     274
    254275        VariableExpr( DeclarationWithType * var, Expression *_aname = nullptr );
    255276        VariableExpr( const VariableExpr & other );
     
    265286        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    266287        virtual void print( std::ostream & os, int indent = 0 ) const;
    267   private:
    268         DeclarationWithType * var;
    269288};
    270289
     
    272291class ConstantExpr : public Expression {
    273292  public:
     293        Constant constant;
     294
    274295        ConstantExpr( Constant constant, Expression *_aname = nullptr );
    275296        ConstantExpr( const ConstantExpr & other );
     
    283304        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    284305        virtual void print( std::ostream & os, int indent = 0 ) const;
    285   private:
    286         Constant constant;
    287306};
    288307
     
    290309class SizeofExpr : public Expression {
    291310  public:
     311        Expression * expr;
     312        Type * type;
     313        bool isType;
     314
    292315        SizeofExpr( Expression * expr, Expression *_aname = nullptr );
    293316        SizeofExpr( const SizeofExpr & other );
     
    306329        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    307330        virtual void print( std::ostream & os, int indent = 0 ) const;
    308   private:
     331};
     332
     333/// AlignofExpr represents an alignof expression
     334class AlignofExpr : public Expression {
     335  public:
    309336        Expression * expr;
    310337        Type * type;
    311338        bool isType;
    312 };
    313 
    314 /// AlignofExpr represents an alignof expression
    315 class AlignofExpr : public Expression {
    316   public:
     339
    317340        AlignofExpr( Expression * expr, Expression *_aname = nullptr );
    318341        AlignofExpr( const AlignofExpr & other );
     
    331354        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    332355        virtual void print( std::ostream & os, int indent = 0 ) const;
    333   private:
    334         Expression * expr;
    335         Type * type;
    336         bool isType;
    337356};
    338357
     
    340359class UntypedOffsetofExpr : public Expression {
    341360  public:
     361        Type * type;
     362        std::string member;
     363
    342364        UntypedOffsetofExpr( Type * type, const std::string & member, Expression *_aname = nullptr );
    343365        UntypedOffsetofExpr( const UntypedOffsetofExpr & other );
     
    353375        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    354376        virtual void print( std::ostream & os, int indent = 0 ) const;
    355   private:
    356         Type * type;
    357         std::string member;
    358377};
    359378
     
    361380class OffsetofExpr : public Expression {
    362381  public:
     382        Type * type;
     383        DeclarationWithType * member;
     384
    363385        OffsetofExpr( Type * type, DeclarationWithType * member, Expression *_aname = nullptr );
    364386        OffsetofExpr( const OffsetofExpr & other );
     
    374396        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    375397        virtual void print( std::ostream & os, int indent = 0 ) const;
    376   private:
    377         Type * type;
    378         DeclarationWithType * member;
    379398};
    380399
     
    382401class OffsetPackExpr : public Expression {
    383402public:
     403        StructInstType * type;
     404
    384405        OffsetPackExpr( StructInstType * type_, Expression * aname_ = 0 );
    385406        OffsetPackExpr( const OffsetPackExpr & other );
     
    392413        virtual void accept( Visitor & v ) { v.visit( this ); }
    393414        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    394 
    395         virtual void print( std::ostream & os, int indent = 0 ) const;
    396 
    397 private:
    398         StructInstType * type;
     415        virtual void print( std::ostream & os, int indent = 0 ) const;
    399416};
    400417
     
    402419class AttrExpr : public Expression {
    403420  public:
     421        Expression * attr;
     422        Expression * expr;
     423        Type * type;
     424        bool isType;
     425
    404426        AttrExpr(Expression * attr, Expression * expr, Expression *_aname = nullptr );
    405427        AttrExpr( const AttrExpr & other );
     
    420442        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    421443        virtual void print( std::ostream & os, int indent = 0 ) const;
    422   private:
    423         Expression * attr;
    424         Expression * expr;
    425         Type * type;
    426         bool isType;
    427444};
    428445
     
    430447class LogicalExpr : public Expression {
    431448  public:
     449        Expression * arg1;
     450        Expression * arg2;
     451
    432452        LogicalExpr( Expression * arg1, Expression * arg2, bool andp = true, Expression *_aname = nullptr );
    433453        LogicalExpr( const LogicalExpr & other );
     
    444464        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    445465        virtual void print( std::ostream & os, int indent = 0 ) const;
     466
    446467  private:
     468        bool isAnd;
     469};
     470
     471/// ConditionalExpr represents the three-argument conditional ( p ? a : b )
     472class ConditionalExpr : public Expression {
     473  public:
    447474        Expression * arg1;
    448475        Expression * arg2;
    449         bool isAnd;
    450 };
    451 
    452 /// ConditionalExpr represents the three-argument conditional ( p ? a : b )
    453 class ConditionalExpr : public Expression {
    454   public:
     476        Expression * arg3;
     477
    455478        ConditionalExpr( Expression * arg1, Expression * arg2, Expression * arg3, Expression *_aname = nullptr );
    456479        ConditionalExpr( const ConditionalExpr & other );
     
    468491        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    469492        virtual void print( std::ostream & os, int indent = 0 ) const;
    470   private:
     493};
     494
     495/// CommaExpr represents the sequence operator ( a, b )
     496class CommaExpr : public Expression {
     497  public:
    471498        Expression * arg1;
    472499        Expression * arg2;
    473         Expression * arg3;
    474 };
    475 
    476 /// CommaExpr represents the sequence operator ( a, b )
    477 class CommaExpr : public Expression {
    478   public:
     500
    479501        CommaExpr( Expression * arg1, Expression * arg2, Expression *_aname = nullptr );
    480502        CommaExpr( const CommaExpr & other );
     
    490512        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    491513        virtual void print( std::ostream & os, int indent = 0 ) const;
    492   private:
    493         Expression * arg1;
    494         Expression * arg2;
    495514};
    496515
     
    498517class TypeExpr : public Expression {
    499518  public:
     519        Type * type;
     520
    500521        TypeExpr( Type * type );
    501522        TypeExpr( const TypeExpr & other );
     
    509530        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    510531        virtual void print( std::ostream & os, int indent = 0 ) const;
    511   private:
    512         Type * type;
    513532};
    514533
     
    516535class AsmExpr : public Expression {
    517536  public:
     537        Expression * inout;
     538        ConstantExpr * constraint;
     539        Expression * operand;
     540
    518541        AsmExpr( Expression * inout, ConstantExpr * constraint, Expression * operand ) : inout( inout ), constraint( constraint ), operand( operand ) {}
    519542        AsmExpr( const AsmExpr & other );
     
    533556        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    534557        virtual void print( std::ostream & os, int indent = 0 ) const;
    535   private:
     558
    536559        // https://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Machine-Constraints.html#Machine-Constraints
    537         Expression * inout;
    538         ConstantExpr * constraint;
    539         Expression * operand;
    540560};
    541561
     
    544564class ImplicitCopyCtorExpr : public Expression {
    545565public:
    546         ImplicitCopyCtorExpr( ApplicationExpr * callExpr );
    547         ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other );
    548         virtual ~ImplicitCopyCtorExpr();
    549 
    550         ApplicationExpr * get_callExpr() const { return callExpr; }
    551         void set_callExpr( ApplicationExpr * newValue ) { callExpr = newValue; }
    552 
    553         std::list< ObjectDecl * > & get_tempDecls() { return tempDecls; }
    554         std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; }
    555         std::list< Expression * > & get_dtors() { return dtors; }
    556 
    557         virtual ImplicitCopyCtorExpr * clone() const { return new ImplicitCopyCtorExpr( * this ); }
    558         virtual void accept( Visitor & v ) { v.visit( this ); }
    559         virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    560         virtual void print( std::ostream & os, int indent = 0 ) const;
    561   private:
    562566        ApplicationExpr * callExpr;
    563567        std::list< ObjectDecl * > tempDecls;
    564568        std::list< ObjectDecl * > returnDecls;
    565569        std::list< Expression * > dtors;
     570
     571        ImplicitCopyCtorExpr( ApplicationExpr * callExpr );
     572        ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other );
     573        virtual ~ImplicitCopyCtorExpr();
     574
     575        ApplicationExpr * get_callExpr() const { return callExpr; }
     576        void set_callExpr( ApplicationExpr * newValue ) { callExpr = newValue; }
     577
     578        std::list< ObjectDecl * > & get_tempDecls() { return tempDecls; }
     579        std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; }
     580        std::list< Expression * > & get_dtors() { return dtors; }
     581
     582        virtual ImplicitCopyCtorExpr * clone() const { return new ImplicitCopyCtorExpr( * this ); }
     583        virtual void accept( Visitor & v ) { v.visit( this ); }
     584        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     585        virtual void print( std::ostream & os, int indent = 0 ) const;
    566586};
    567587
     
    569589class ConstructorExpr : public Expression {
    570590public:
     591        Expression * callExpr;
     592
    571593        ConstructorExpr( Expression * callExpr );
    572594        ConstructorExpr( const ConstructorExpr & other );
     
    580602        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    581603        virtual void print( std::ostream & os, int indent = 0 ) const;
    582 private:
    583         Expression * callExpr;
    584604};
    585605
     
    587607class CompoundLiteralExpr : public Expression {
    588608  public:
     609        Initializer * initializer;
     610
    589611        CompoundLiteralExpr( Type * type, Initializer * initializer );
    590612        CompoundLiteralExpr( const CompoundLiteralExpr & other );
     
    598620        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    599621        virtual void print( std::ostream & os, int indent = 0 ) const;
    600   private:
    601         Initializer * initializer;
    602622};
    603623
     
    605625class RangeExpr : public Expression {
    606626  public:
     627        Expression * low, * high;
     628
    607629        RangeExpr( Expression * low, Expression * high );
    608630        RangeExpr( const RangeExpr & other );
     
    617639        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    618640        virtual void print( std::ostream & os, int indent = 0 ) const;
    619   private:
    620         Expression * low, * high;
    621641};
    622642
     
    624644class UntypedTupleExpr : public Expression {
    625645  public:
     646        std::list<Expression*> exprs;
     647
    626648        UntypedTupleExpr( const std::list< Expression * > & exprs, Expression *_aname = nullptr );
    627649        UntypedTupleExpr( const UntypedTupleExpr & other );
     
    634656        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    635657        virtual void print( std::ostream & os, int indent = 0 ) const;
    636   private:
    637         std::list<Expression*> exprs;
    638658};
    639659
     
    641661class TupleExpr : public Expression {
    642662  public:
     663        std::list<Expression*> exprs;
     664
    643665        TupleExpr( const std::list< Expression * > & exprs, Expression *_aname = nullptr );
    644666        TupleExpr( const TupleExpr & other );
     
    651673        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    652674        virtual void print( std::ostream & os, int indent = 0 ) const;
    653   private:
    654         std::list<Expression*> exprs;
    655675};
    656676
     
    658678class TupleIndexExpr : public Expression {
    659679  public:
     680        Expression * tuple;
     681        unsigned int index;
     682
    660683        TupleIndexExpr( Expression * tuple, unsigned int index );
    661684        TupleIndexExpr( const TupleIndexExpr & other );
     
    671694        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    672695        virtual void print( std::ostream & os, int indent = 0 ) const;
    673   private:
    674         Expression * tuple;
    675         unsigned int index;
    676696};
    677697
     
    679699class TupleAssignExpr : public Expression {
    680700  public:
     701        StmtExpr * stmtExpr = nullptr;
     702
    681703        TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname = nullptr );
    682704        TupleAssignExpr( const TupleAssignExpr & other );
     
    690712        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    691713        virtual void print( std::ostream & os, int indent = 0 ) const;
    692   private:
    693         StmtExpr * stmtExpr = nullptr;
    694714};
    695715
     
    697717class StmtExpr : public Expression {
    698718public:
     719        CompoundStmt * statements;
     720        std::list< ObjectDecl * > returnDecls; // return variable(s) for stmt expression
     721        std::list< Expression * > dtors; // destructor(s) for return variable(s)
     722
    699723        StmtExpr( CompoundStmt * statements );
    700724        StmtExpr( const StmtExpr & other );
     
    711735        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    712736        virtual void print( std::ostream & os, int indent = 0 ) const;
    713 private:
    714         CompoundStmt * statements;
    715         std::list< ObjectDecl * > returnDecls; // return variable(s) for stmt expression
    716         std::list< Expression * > dtors; // destructor(s) for return variable(s)
    717737};
    718738
    719739class UniqueExpr : public Expression {
    720740public:
     741        Expression * expr;
     742        ObjectDecl * object;
     743        VariableExpr * var;
     744
    721745        UniqueExpr( Expression * expr, long long idVal = -1 );
    722746        UniqueExpr( const UniqueExpr & other );
     
    738762        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    739763        virtual void print( std::ostream & os, int indent = 0 ) const;
     764
    740765private:
    741         Expression * expr;
    742         ObjectDecl * object;
    743         VariableExpr * var;
    744766        int id;
    745767        static long long count;
     
    758780class UntypedInitExpr : public Expression {
    759781public:
     782        Expression * expr;
     783        std::list<InitAlternative> initAlts;
     784
    760785        UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts );
    761786        UntypedInitExpr( const UntypedInitExpr & other );
     
    771796        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    772797        virtual void print( std::ostream & os, int indent = 0 ) const;
    773 private:
    774         Expression * expr;
    775         std::list<InitAlternative> initAlts;
    776798};
    777799
    778800class InitExpr : public Expression {
    779801public:
     802        Expression * expr;
     803        Designation * designation;
     804
    780805        InitExpr( Expression * expr, Designation * designation );
    781806        InitExpr( const InitExpr & other );
     
    792817        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    793818        virtual void print( std::ostream & os, int indent = 0 ) const;
    794 private:
    795         Expression * expr;
    796         Designation * designation;
    797819};
    798820
    799821
    800822std::ostream & operator<<( std::ostream & out, const Expression * expr );
    801 
    802 #endif // EXPRESSION_H
    803823
    804824// Local Variables: //
  • src/SynTree/Initializer.cc

    rfd344aa r9236060  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Fri May 13 13:23:03 2016
    13 // Update Count     : 28
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Aug  3 11:33:00 2016
     13// Update Count     : 29
    1414//
    1515
     
    7474                        }
    7575                }
    76                 assertf( initializers.size() == designations.size(), "Created ListInit with mismatching initializers (%d) and designations (%d)", initializers.size(), designations.size() );
     76                assertf( initializers.size() == designations.size(), "Created ListInit with mismatching initializers (%lu) and designations (%lu)", initializers.size(), designations.size() );
    7777}
    7878
  • src/SynTree/Initializer.h

    rfd344aa r9236060  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 23 16:12:42 2017
    13 // Update Count     : 20
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Aug  9 10:19:00 2017
     13// Update Count     : 22
    1414//
    1515
    16 #ifndef INITIALIZER_H
    17 #define INITIALIZER_H
     16#pragma once
    1817
    1918#include <cassert>
     
    2827class Designation : public BaseSyntaxNode {
    2928public:
     29        std::list< Expression * > designators;
     30
    3031        Designation( const std::list< Expression * > & designators );
    3132        Designation( const Designation & other );
     
    3839        virtual Designation * acceptMutator( Mutator &m ) { return m.mutate( this ); }
    3940        virtual void print( std::ostream &os, int indent = 0 ) const;
    40 private:
    41         std::list< Expression * > designators;
    4241};
    4342
     
    6463class SingleInit : public Initializer {
    6564  public:
     65        //Constant *value;
     66        Expression *value;      // has to be a compile-time constant
     67
    6668        SingleInit( Expression *value, bool maybeConstructed = false );
    6769        SingleInit( const SingleInit &other );
     
    7577        virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    7678        virtual void print( std::ostream &os, int indent = 0 ) const;
    77   private:
    78         //Constant *value;
    79         Expression *value;      // has to be a compile-time constant
    8079};
    8180
     
    8483class ListInit : public Initializer {
    8584  public:
     85        std::list<Initializer *> initializers;  // order *is* important
     86        std::list<Designation *> designations;  // order/length is consistent with initializers
     87
    8688        ListInit( const std::list<Initializer*> &initializers,
    8789                          const std::list<Designation *> &designators = {}, bool maybeConstructed = false );
     
    103105        virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    104106        virtual void print( std::ostream &os, int indent = 0 ) const;
    105   private:
    106         std::list<Initializer *> initializers;  // order *is* important
    107         std::list<Designation *> designations;  // order/length is consistent with initializers
    108107};
    109108
     
    114113class ConstructorInit : public Initializer {
    115114  public:
     115        Statement * ctor;
     116        Statement * dtor;
     117
    116118        ConstructorInit( Statement * ctor, Statement * dtor, Initializer * init );
    117119        ConstructorInit( const ConstructorInit &other );
     
    131133
    132134  private:
    133         Statement * ctor;
    134         Statement * dtor;
    135135        // C-style initializer made up of SingleInit and ListInit nodes to use as a fallback
    136136        // if an appropriate constructor definition is not found by the resolver
     
    141141std::ostream & operator<<( std::ostream & out, const Designation * des );
    142142
    143 #endif // INITIALIZER_H
    144 
    145143// Local Variables: //
    146144// tab-width: 4 //
  • src/SynTree/Label.h

    rfd344aa r9236060  
    1010// Created On       : Wed Jun 8 12:53:12 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Aug  7 14:44:29 2016
    13 // Update Count     : 2
     12// Last Modified On : Sat Jul 22 09:52:44 2017
     13// Update Count     : 3
    1414//
    1515
    16 #ifndef LABEL_H
    17 #define LABEL_H
     16#pragma once
    1817
    1918#include <string>
     
    5150static const std::list< Label > noLabels;
    5251
    53 #endif // LABEL_H
    54 
    5552// Local Variables: //
    5653// tab-width: 4 //
  • src/SynTree/Mutator.cc

    rfd344aa r9236060  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thu Jun 22 13:43:00 2017
    13 // Update Count     : 24
     12// Last Modified On : Mon Jul 24 16:32:00 2017
     13// Update Count     : 25
    1414//
    1515
     
    235235}
    236236
     237Expression *Mutator::mutate( VirtualCastExpr *castExpr ) {
     238        castExpr->set_env( maybeMutate( castExpr->get_env(), *this ) );
     239        castExpr->set_result( maybeMutate( castExpr->get_result(), *this ) );
     240        castExpr->set_arg( maybeMutate( castExpr->get_arg(), *this ) );
     241        return castExpr;
     242}
     243
    237244Expression *Mutator::mutate( UntypedMemberExpr *memberExpr ) {
    238245        memberExpr->set_env( maybeMutate( memberExpr->get_env(), *this ) );
  • src/SynTree/Mutator.h

    rfd344aa r9236060  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thu Jun  8 15:45:00 2017
    13 // Update Count     : 14
     12// Last Modified On : Mon Jul 24 16:31:00 2017
     13// Update Count     : 16
    1414//
    1515#include <cassert>
     
    1818#include "Common/SemanticError.h"
    1919
    20 #ifndef MUTATOR_H
    21 #define MUTATOR_H
     20#pragma once
    2221
    2322class Mutator {
     
    6059        virtual Expression* mutate( LabelAddressExpr *labAddressExpr );
    6160        virtual Expression* mutate( CastExpr *castExpr );
     61        virtual Expression* mutate( VirtualCastExpr *castExpr );
    6262        virtual Expression* mutate( UntypedMemberExpr *memberExpr );
    6363        virtual Expression* mutate( MemberExpr *memberExpr );
     
    151151}
    152152
    153 #endif // MUTATOR_H
    154 
    155153// Local Variables: //
    156154// tab-width: 4 //
  • src/SynTree/NamedTypeDecl.cc

    rfd344aa r9236060  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 07:49:44 2017
    13 // Update Count     : 13
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Aug  9 13:28:00 2017
     13// Update Count     : 14
    1414//
    1515
     
    3838        if ( get_name() != "" ) {
    3939                os << get_name() << ": ";
     40        } // if
     41        if ( get_linkage() != LinkageSpec::Cforall ) {
     42                os << LinkageSpec::linkageName( get_linkage() ) << " ";
    4043        } // if
    4144        get_storageClasses().print( os );
  • src/SynTree/Statement.h

    rfd344aa r9236060  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Jun 12 13:35:00 2017
    13 // Update Count     : 67
     12// Last Modified On : Thr Aug  3 14:08:00 2017
     13// Update Count     : 69
    1414//
    1515
    16 #ifndef STATEMENT_H
    17 #define STATEMENT_H
     16#pragma once
    1817
    1918#include "BaseSyntaxNode.h"
     
    2726class Statement : public BaseSyntaxNode {
    2827  public:
     28        std::list<Label> labels;
     29
    2930        Statement( std::list<Label> labels );
    3031        virtual ~Statement();
     
    3738        virtual Statement *acceptMutator( Mutator &m ) = 0;
    3839        virtual void print( std::ostream &os, int indent = 0 ) const;
    39   protected:
    40         std::list<Label> labels;
    4140};
    4241
    4342class CompoundStmt : public Statement {
    4443  public:
     44        std::list<Statement*> kids;
     45
    4546        CompoundStmt( std::list<Label> labels );
    4647        CompoundStmt( const CompoundStmt &other );
     
    5556        virtual CompoundStmt *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    5657        virtual void print( std::ostream &os, int indent = 0 ) const;
    57   private:
    58         std::list<Statement*> kids;
    5958};
    6059
     
    6867        virtual NullStmt *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    6968        virtual void print( std::ostream &os, int indent = 0 ) const;
    70 
    71   private:
    7269};
    7370
    7471class ExprStmt : public Statement {
    7572  public:
     73        Expression *expr;
     74
    7675        ExprStmt( std::list<Label> labels, Expression *expr );
    7776        ExprStmt( const ExprStmt &other );
     
    8584        virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    8685        virtual void print( std::ostream &os, int indent = 0 ) const;
    87   private:
    88         Expression *expr;
    8986};
    9087
    9188class AsmStmt : public Statement {
    9289  public:
     90        bool voltile;
     91        ConstantExpr *instruction;
     92        std::list<Expression *> output, input;
     93        std::list<ConstantExpr *> clobber;
     94        std::list<Label> gotolabels;
     95
    9396        AsmStmt( std::list<Label> labels, bool voltile, ConstantExpr *instruction, std::list<Expression *> input, std::list<Expression *> output, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels );
    9497        AsmStmt( const AsmStmt &other );
     
    112115        virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    113116        virtual void print( std::ostream &os, int indent = 0 ) const;
    114   private:
    115         bool voltile;
    116         ConstantExpr *instruction;
    117         std::list<Expression *> output, input;
    118         std::list<ConstantExpr *> clobber;
    119         std::list<Label> gotolabels;
    120117};
    121118
    122119class IfStmt : public Statement {
    123120  public:
     121        Expression *condition;
     122        Statement *thenPart;
     123        Statement *elsePart;
     124
    124125        IfStmt( std::list<Label> labels, Expression *condition, Statement *thenPart, Statement *elsePart );
    125126        IfStmt( const IfStmt &other );
     
    137138        virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    138139        virtual void print( std::ostream &os, int indent = 0 ) const;
    139   private:
    140         Expression *condition;
    141         Statement *thenPart;
    142         Statement *elsePart;
    143140};
    144141
    145142class SwitchStmt : public Statement {
    146143  public:
     144        Expression * condition;
     145
    147146        SwitchStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> &statements );
    148147        SwitchStmt( const SwitchStmt &other );
     
    160159        virtual void print( std::ostream &os, int indent = 0 ) const;
    161160  private:
     161        std::list<Statement *> statements;
     162};
     163
     164class CaseStmt : public Statement {
     165  public:
    162166        Expression * condition;
    163         std::list<Statement *> statements;
    164 };
    165 
    166 class CaseStmt : public Statement {
    167   public:
     167        std::list<Statement *> stmts;
     168
    168169        CaseStmt( std::list<Label> labels, Expression *conditions, std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError);
    169170        CaseStmt( const CaseStmt &other );
     
    187188        virtual void print( std::ostream &os, int indent = 0 ) const;
    188189  private:
    189         Expression * condition;
    190         std::list<Statement *> stmts;
    191190        bool _isDefault;
    192191};
     
    194193class WhileStmt : public Statement {
    195194  public:
     195        Expression *condition;
     196        Statement *body;
     197        bool isDoWhile;
     198
    196199        WhileStmt( std::list<Label> labels, Expression *condition,
    197200               Statement *body, bool isDoWhile = false );
     
    210213        virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    211214        virtual void print( std::ostream &os, int indent = 0 ) const;
    212   private:
     215};
     216
     217class ForStmt : public Statement {
     218  public:
     219        std::list<Statement *> initialization;
    213220        Expression *condition;
     221        Expression *increment;
    214222        Statement *body;
    215         bool isDoWhile;
    216 };
    217 
    218 class ForStmt : public Statement {
    219   public:
     223
    220224        ForStmt( std::list<Label> labels, std::list<Statement *> initialization,
    221225             Expression *condition = 0, Expression *increment = 0, Statement *body = 0 );
     
    236240        virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    237241        virtual void print( std::ostream &os, int indent = 0 ) const;
    238   private:
    239         std::list<Statement *> initialization;
    240         Expression *condition;
    241         Expression *increment;
    242         Statement *body;
    243242};
    244243
     
    246245  public:
    247246        enum Type { Goto = 0, Break, Continue };
     247
     248        // originalTarget kept for error messages.
     249        const Label originalTarget;
     250        Label target;
     251        Expression *computedTarget;
     252        Type type;
    248253
    249254        BranchStmt( std::list<Label> labels, Label target, Type ) throw (SemanticError);
     
    266271  private:
    267272        static const char *brType[];
    268         Label originalTarget;  // can give better error messages if we remember the label name that the user entered
    269         Label target;
    270         Expression *computedTarget;
    271         Type type;
    272273};
    273274
    274275class ReturnStmt : public Statement {
    275276  public:
     277        Expression *expr;
     278
    276279        ReturnStmt( std::list<Label> labels, Expression *expr );
    277280        ReturnStmt( const ReturnStmt &other );
     
    285288        virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    286289        virtual void print( std::ostream &os, int indent = 0 ) const;
    287   private:
    288         Expression *expr;
    289290};
    290291
     
    292293  public:
    293294        enum Kind { Terminate, Resume };
     295
     296        const Kind kind;
     297        Expression * expr;
     298        Expression * target;
    294299
    295300        ThrowStmt( std::list<Label> labels, Kind kind, Expression * expr, Expression * target = nullptr );
     
    307312        virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    308313        virtual void print( std::ostream &os, int indent = 0 ) const;
    309   private:
    310         Kind kind;
    311         Expression * expr;
    312         Expression * target;
    313314};
    314315
    315316class TryStmt : public Statement {
    316317  public:
     318        CompoundStmt *block;
     319        std::list<CatchStmt *> handlers;
     320        FinallyStmt *finallyBlock;
     321
    317322        TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 );
    318323        TryStmt( const TryStmt &other );
     
    330335        virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    331336        virtual void print( std::ostream &os, int indent = 0 ) const;
    332 
    333   private:
    334         CompoundStmt *block;
    335         std::list<CatchStmt *> handlers;
    336         FinallyStmt *finallyBlock;
    337337};
    338338
     
    340340  public:
    341341        enum Kind { Terminate, Resume };
     342
     343        const Kind kind;
     344        Declaration *decl;
     345        Expression *cond;
     346        Statement *body;
    342347
    343348        CatchStmt( std::list<Label> labels, Kind kind, Declaration *decl,
     
    358363        virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    359364        virtual void print( std::ostream &os, int indent = 0 ) const;
    360 
    361   private:
    362         Kind kind;
    363         Declaration *decl;
    364         Expression *cond;
    365         Statement *body;
    366365};
    367366
    368367class FinallyStmt : public Statement {
    369368  public:
     369        CompoundStmt *block;
     370
    370371        FinallyStmt( std::list<Label> labels, CompoundStmt *block );
    371372        FinallyStmt( const FinallyStmt &other );
     
    379380        virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    380381        virtual void print( std::ostream &os, int indent = 0 ) const;
    381   private:
    382         CompoundStmt *block;
    383382};
    384383
     
    387386class DeclStmt : public Statement {
    388387  public:
     388        Declaration *decl;
     389
    389390        DeclStmt( std::list<Label> labels, Declaration *decl );
    390391        DeclStmt( const DeclStmt &other );
     
    398399        virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    399400        virtual void print( std::ostream &os, int indent = 0 ) const;
    400   private:
    401         Declaration *decl;
    402401};
    403402
     
    408407class ImplicitCtorDtorStmt : public Statement {
    409408  public:
     409        // Non-owned pointer to the constructor/destructor statement
     410        Statement * callStmt;
     411
    410412        ImplicitCtorDtorStmt( Statement * callStmt );
    411413        ImplicitCtorDtorStmt( const ImplicitCtorDtorStmt & other );
     
    419421        virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    420422        virtual void print( std::ostream &os, int indent = 0 ) const;
    421 
    422   private:
    423         // Non-owned pointer to the constructor/destructor statement
    424         Statement * callStmt;
    425423};
    426424
    427425
    428426std::ostream & operator<<( std::ostream & out, const Statement * statement );
    429 
    430 #endif // STATEMENT_H
    431427
    432428// Local Variables: //
  • src/SynTree/SynTree.h

    rfd344aa r9236060  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thu Jun  8 17:00:00 2017
    13 // Update Count     : 9
     12// Last Modified On : Mon Jul 24 16:54:00 2017
     13// Update Count     : 11
    1414//
    1515
    16 #ifndef SYNTREE_H
    17 #define SYNTREE_H
     16#pragma once
    1817
    1918#include <string>
     
    6766class LabelAddressExpr;
    6867class CastExpr;
     68class VirtualCastExpr;
    6969class MemberExpr;
    7070class UntypedMemberExpr;
     
    136136class Attribute;
    137137
    138 #endif // SYNTREE_H
    139 
    140138// Local Variables: //
    141139// tab-width: 4 //
  • src/SynTree/Type.cc

    rfd344aa r9236060  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 17 08:42:47 2017
    13 // Update Count     : 28
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Aug  2 11:11:00 2017
     13// Update Count     : 29
    1414//
    1515
     
    9898}
    9999
     100// Empty Variable declarations:
     101const Type::FuncSpecifiers noFuncSpecifiers;
     102const Type::StorageClasses noStorageClasses;
     103const Type::Qualifiers noQualifiers;
     104
    100105std::ostream & operator<<( std::ostream & out, const Type * type ) {
    101106        if ( type ) {
  • src/SynTree/Type.h

    rfd344aa r9236060  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 23 16:16:36 2017
    13 // Update Count     : 149
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Aug  9 14:25:00 2017
     13// Update Count     : 152
    1414//
    1515
    16 #ifndef TYPE_H
    17 #define TYPE_H
     16#pragma once
    1817
    1918#include "BaseSyntaxNode.h"
     
    128127        }; // Qualifiers
    129128
     129        typedef std::list<TypeDecl *> ForallList;
     130
     131        Qualifiers tq;
     132        ForallList forall;
     133        std::list< Attribute * > attributes;
     134
    130135        Type( const Qualifiers & tq, const std::list< Attribute * > & attributes );
    131136        Type( const Type & other );
     
    146151        void set_atomic( bool newValue ) { tq.is_atomic = newValue; }
    147152
    148         typedef std::list<TypeDecl *> ForallList;
    149153        ForallList& get_forall() { return forall; }
    150154
     
    172176        virtual Type *acceptMutator( Mutator & m ) = 0;
    173177        virtual void print( std::ostream & os, int indent = 0 ) const;
    174   private:
    175         Qualifiers tq;
    176         ForallList forall;
    177         std::list< Attribute * > attributes;
    178 };
    179 
    180 extern Type::Qualifiers emptyQualifiers;                                // no qualifiers on constants
     178};
     179
     180extern const Type::FuncSpecifiers noFuncSpecifiers;
     181extern const Type::StorageClasses noStorageClasses;
     182extern const Type::Qualifiers noQualifiers;                     // no qualifiers on constants
    181183
    182184class VoidType : public Type {
     
    218220                LongDoubleImaginary,
    219221                NUMBER_OF_BASIC_TYPES
    220         };
     222        } kind;
    221223
    222224        static const char *typeNames[];                                         // string names for basic types, MUST MATCH with Kind
     
    233235
    234236        bool isInteger() const;
    235   private:
    236         Kind kind;
    237237};
    238238
    239239class PointerType : public Type {
    240240  public:
     241        Type *base;
     242
     243        // In C99, pointer types can be qualified in many ways e.g., int f( int a[ static 3 ] )
     244        Expression *dimension;
     245        bool isVarLen;
     246        bool isStatic;
     247
    241248        PointerType( const Type::Qualifiers & tq, Type *base, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    242249        PointerType( const Type::Qualifiers & tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
     
    261268        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    262269        virtual void print( std::ostream & os, int indent = 0 ) const;
    263   private:
     270};
     271
     272class ArrayType : public Type {
     273  public:
    264274        Type *base;
    265 
    266         // In C99, pointer types can be qualified in many ways e.g., int f( int a[ static 3 ] )
    267275        Expression *dimension;
    268276        bool isVarLen;
    269277        bool isStatic;
    270 };
    271 
    272 class ArrayType : public Type {
    273   public:
     278
    274279        ArrayType( const Type::Qualifiers & tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    275280        ArrayType( const ArrayType& );
     
    291296        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    292297        virtual void print( std::ostream & os, int indent = 0 ) const;
    293   private:
    294         Type *base;
    295         Expression *dimension;
    296         bool isVarLen;
    297         bool isStatic;
    298298};
    299299
    300300class ReferenceType : public Type {
    301301public:
     302        Type *base;
     303
    302304        ReferenceType( const Type::Qualifiers & tq, Type *base, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    303305        ReferenceType( const ReferenceType & );
     
    313315        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    314316        virtual void print( std::ostream & os, int indent = 0 ) const;
    315 private:
    316         Type *base;
    317317};
    318318
    319319class FunctionType : public Type {
    320320  public:
     321        std::list<DeclarationWithType*> returnVals;
     322        std::list<DeclarationWithType*> parameters;
     323
     324        // Does the function accept a variable number of arguments following the arguments specified in the parameters list.
     325        // This could be because of
     326        // - an ellipsis in a prototype declaration
     327        // - an unprototyped declaration
     328        bool isVarArgs;
     329
    321330        FunctionType( const Type::Qualifiers & tq, bool isVarArgs, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    322331        FunctionType( const FunctionType& );
     
    333342        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    334343        virtual void print( std::ostream & os, int indent = 0 ) const;
    335   private:
    336         std::list<DeclarationWithType*> returnVals;
    337         std::list<DeclarationWithType*> parameters;
    338 
    339         // Does the function accept a variable number of arguments following the arguments specified in the parameters list.
    340         // This could be because of
    341         // - an ellipsis in a prototype declaration
    342         // - an unprototyped declaration
    343         bool isVarArgs;
    344344};
    345345
    346346class ReferenceToType : public Type {
    347347  public:
     348        std::list< Expression* > parameters;
     349        std::string name;
     350        bool hoistType;
     351
    348352        ReferenceToType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes );
    349353        ReferenceToType( const ReferenceToType & other );
     
    364368  protected:
    365369        virtual std::string typeString() const = 0;
    366         std::list< Expression* > parameters;
    367         std::string name;
    368   private:
    369         bool hoistType;
    370370};
    371371
     
    373373        typedef ReferenceToType Parent;
    374374  public:
     375        // this decl is not "owned" by the struct inst; it is merely a pointer to elsewhere in the tree,
     376        // where the structure used in this type is actually defined
     377        StructDecl *baseStruct;
     378
    375379        StructInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ), baseStruct( 0 ) {}
    376380        StructInstType( const Type::Qualifiers & tq, StructDecl * baseStruct, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
     
    396400  private:
    397401        virtual std::string typeString() const;
    398 
    399         // this decl is not "owned" by the struct inst; it is merely a pointer to elsewhere in the tree,
    400         // where the structure used in this type is actually defined
    401         StructDecl *baseStruct;
    402402};
    403403
     
    405405        typedef ReferenceToType Parent;
    406406  public:
     407        // this decl is not "owned" by the union inst; it is merely a pointer to elsewhere in the tree,
     408        // where the union used in this type is actually defined
     409        UnionDecl *baseUnion;
     410
    407411        UnionInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ), baseUnion( 0 ) {}
    408412        UnionInstType( const Type::Qualifiers & tq, UnionDecl * baseUnion, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
     
    428432  private:
    429433        virtual std::string typeString() const;
    430 
     434};
     435
     436class EnumInstType : public ReferenceToType {
     437        typedef ReferenceToType Parent;
     438  public:
    431439        // this decl is not "owned" by the union inst; it is merely a pointer to elsewhere in the tree,
    432440        // where the union used in this type is actually defined
    433         UnionDecl *baseUnion;
    434 };
    435 
    436 class EnumInstType : public ReferenceToType {
    437         typedef ReferenceToType Parent;
    438   public:
     441        EnumDecl *baseEnum = nullptr;
     442
    439443        EnumInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ) {}
    440444        EnumInstType( const Type::Qualifiers & tq, EnumDecl * baseEnum, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
     
    451455  private:
    452456        virtual std::string typeString() const;
    453 
    454         // this decl is not "owned" by the union inst; it is merely a pointer to elsewhere in the tree,
    455         // where the union used in this type is actually defined
    456         EnumDecl *baseEnum = nullptr;
    457457};
    458458
     
    460460        typedef ReferenceToType Parent;
    461461  public:
     462        // this member is filled in by the validate pass, which instantiates the members of the correponding
     463        // aggregate with the actual type parameters specified for this use of the context
     464        std::list< Declaration* > members;
     465
    462466        TraitInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ) {}
    463467        TraitInstType( const TraitInstType & other );
     
    473477  private:
    474478        virtual std::string typeString() const;
    475 
    476         // this member is filled in by the validate pass, which instantiates the members of the correponding
    477         // aggregate with the actual type parameters specified for this use of the context
    478         std::list< Declaration* > members;
    479479};
    480480
     
    482482        typedef ReferenceToType Parent;
    483483  public:
     484        // this decl is not "owned" by the type inst; it is merely a pointer to elsewhere in the tree,
     485        // where the type used here is actually defined
     486        TypeDecl *baseType;
     487        bool isFtype;
     488
    484489        TypeInstType( const Type::Qualifiers & tq, const std::string & name, TypeDecl *baseType, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
    485490        TypeInstType( const Type::Qualifiers & tq, const std::string & name, bool isFtype, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
     
    500505  private:
    501506        virtual std::string typeString() const;
    502         // this decl is not "owned" by the type inst; it is merely a pointer to elsewhere in the tree,
    503         // where the type used here is actually defined
    504         TypeDecl *baseType;
    505         bool isFtype;
    506507};
    507508
    508509class TupleType : public Type {
    509510  public:
     511        std::list<Type *> types;
     512        std::list<Declaration *> members;
     513
    510514        TupleType( const Type::Qualifiers & tq, const std::list< Type * > & types, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
    511515        TupleType( const TupleType& );
     
    536540        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    537541        virtual void print( std::ostream & os, int indent = 0 ) const;
    538   private:
    539         std::list<Type *> types;
    540         std::list<Declaration *> members;
    541542};
    542543
    543544class TypeofType : public Type {
    544545  public:
     546        Expression *expr;
     547
    545548        TypeofType( const Type::Qualifiers & tq, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
    546549        TypeofType( const TypeofType& );
     
    556559        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    557560        virtual void print( std::ostream & os, int indent = 0 ) const;
    558   private:
     561};
     562
     563class AttrType : public Type {
     564  public:
     565        std::string name;
    559566        Expression *expr;
    560 };
    561 
    562 class AttrType : public Type {
    563   public:
     567        Type *type;
     568        bool isType;
     569
    564570        AttrType( const Type::Qualifiers & tq, const std::string & name, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    565571        AttrType( const Type::Qualifiers & tq, const std::string & name, Type *type, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
     
    582588        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    583589        virtual void print( std::ostream & os, int indent = 0 ) const;
    584   private:
    585         std::string name;
    586         Expression *expr;
    587         Type *type;
    588         bool isType;
    589590};
    590591
     
    628629
    629630std::ostream & operator<<( std::ostream & out, const Type * type );
    630 
    631 #endif // TYPE_H
    632631
    633632// Local Variables: //
  • src/SynTree/TypeDecl.cc

    rfd344aa r9236060  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 07:49:58 2017
    13 // Update Count     : 5
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Aug  9 14:35:00 2017
     13// Update Count     : 6
    1414//
    1515
     
    1818#include "Common/utility.h"
    1919
    20 TypeDecl::TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, Type * init ) : Parent( name, scs, type ), kind( kind ), init( init ), sized( kind == Any || kind == Ttype ) {
     20TypeDecl::TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, Type * init ) : Parent( name, scs, type ), init( init ), sized( kind == Any || kind == Ttype ), kind( kind ) {
    2121}
    2222
    23 TypeDecl::TypeDecl( const TypeDecl &other ) : Parent( other ), kind( other.kind ), init( maybeClone( other.init ) ), sized( other.sized ) {
     23TypeDecl::TypeDecl( const TypeDecl &other ) : Parent( other ), init( maybeClone( other.init ) ), sized( other.sized ), kind( other.kind ) {
    2424}
    2525
  • src/SynTree/TypeSubstitution.h

    rfd344aa r9236060  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Fri Apr 29 15:00:20 2016
    13 // Update Count     : 2
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Jul 22 09:52:24 2017
     13// Update Count     : 3
    1414//
    1515
    16 #ifndef TYPESUBSTITUTION_H
    17 #define TYPESUBSTITUTION_H
     16#pragma once
    1817
    1918#include <map>
     
    180179std::ostream & operator<<( std::ostream & out, const TypeSubstitution & sub );
    181180
    182 #endif // TYPESUBSTITUTION_H
    183 
    184181// Local Variables: //
    185182// tab-width: 4 //
  • src/SynTree/VarExprReplacer.h

    rfd344aa r9236060  
    99// Author           : Rob Schluntz
    1010// Created On       : Wed Jan 13 16:29:30 2016
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Fri May 13 11:27:52 2016
    13 // Update Count     : 5
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Jul 22 09:53:41 2017
     13// Update Count     : 6
    1414//
    1515
    16 #ifndef VAR_EXPR_REPLACER_H
    17 #define VAR_EXPR_REPLACER_H
     16#pragma once
    1817
    1918#include <map>
     
    3534};
    3635
    37 #endif // VAR_EXPR_REPLACER_H
    38 
    3936// Local Variables: //
    4037// tab-width: 4 //
  • src/SynTree/Visitor.cc

    rfd344aa r9236060  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thu Jun 22 13:41:00 2017
    13 // Update Count     : 26
     12// Last Modified On : Mon Jul 24 16:30:00 2017
     13// Update Count     : 27
    1414//
    1515
     
    192192}
    193193
     194void Visitor::visit( VirtualCastExpr *castExpr ) {
     195        maybeAccept( castExpr->get_result(), *this );
     196        maybeAccept( castExpr->get_arg(), *this );
     197}
     198
    194199void Visitor::visit( UntypedMemberExpr *memberExpr ) {
    195200        maybeAccept( memberExpr->get_result(), *this );
  • src/SynTree/Visitor.h

    rfd344aa r9236060  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Jun 08 15:45:00 2017
    13 // Update Count     : 11
     12// Last Modified On : Mon Jul 24 16:28:00 2017
     13// Update Count     : 13
    1414//
    1515
    16 #ifndef VISITOR_H
    17 #define VISITOR_H
     16#pragma once
    1817
    1918#include "SynTree.h"
     
    6160        virtual void visit( NameExpr *nameExpr );
    6261        virtual void visit( CastExpr *castExpr );
     62        virtual void visit( VirtualCastExpr *castExpr );
    6363        virtual void visit( AddressExpr *addressExpr );
    6464        virtual void visit( LabelAddressExpr *labAddressExpr );
     
    175175}
    176176
    177 #endif // VISITOR_H
    178 
    179177// Local Variables: //
    180178// tab-width: 4 //
Note: See TracChangeset for help on using the changeset viewer.