Changeset 0720e049 for src/SynTree


Ignore:
Timestamp:
Aug 11, 2017, 10:33:37 AM (9 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, stuck-waitfor-destruct, with_gc
Children:
54cd58b0
Parents:
3d4b23fa (diff), 59a75cb (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:/u/cforall/software/cfa/cfa-cc

Location:
src/SynTree
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/AddStmtVisitor.h

    r3d4b23fa r0720e049  
    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

    r3d4b23fa r0720e049  
    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/ApplicationExpr.cc

    r3d4b23fa r0720e049  
    4444}
    4545
    46 ApplicationExpr::ApplicationExpr( Expression *funcExpr ) : function( funcExpr ) {
     46ApplicationExpr::ApplicationExpr( Expression *funcExpr, const std::list< Expression * > & argList ) : function( funcExpr ), args( argList ) {
    4747        PointerType *pointer = safe_dynamic_cast< PointerType* >( funcExpr->get_result() );
    4848        FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
  • src/SynTree/Attribute.h

    r3d4b23fa r0720e049  
    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

    r3d4b23fa r0720e049  
    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

    r3d4b23fa r0720e049  
    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

    r3d4b23fa r0720e049  
    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

    r3d4b23fa r0720e049  
    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

    r3d4b23fa r0720e049  
    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

    r3d4b23fa r0720e049  
    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
     
    298298        if ( result->isVoid() ) {
    299299                os << "nothing";
     300        } else {
     301                result->print( os, indent+2 );
     302        } // if
     303        os << std::endl;
     304        Expression::print( os, indent );
     305}
     306
     307VirtualCastExpr::VirtualCastExpr( Expression *arg_, Type *toType ) : Expression(), arg(arg_) {
     308        set_result(toType);
     309}
     310
     311VirtualCastExpr::VirtualCastExpr( const VirtualCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ) {
     312}
     313
     314VirtualCastExpr::~VirtualCastExpr() {
     315        delete arg;
     316}
     317
     318void VirtualCastExpr::print( std::ostream &os, int indent ) const {
     319        os << "Virtual Cast of:" << std::endl << std::string( indent+2, ' ' );
     320        arg->print(os, indent+2);
     321        os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl;
     322        os << std::string( indent+2, ' ' );
     323        if ( ! result ) {
     324                os << "unknown";
    300325        } else {
    301326                result->print( os, indent+2 );
     
    503528}
    504529
    505 AsmExpr::AsmExpr( const AsmExpr & other ) : inout( maybeClone( other.inout ) ), constraint( maybeClone( other.constraint ) ), operand( maybeClone( other.operand ) ) {}
     530AsmExpr::AsmExpr( const AsmExpr & other ) : Expression( other ), inout( maybeClone( other.inout ) ), constraint( maybeClone( other.constraint ) ), operand( maybeClone( other.operand ) ) {}
    506531
    507532
  • src/SynTree/Expression.h

    r3d4b23fa r0720e049  
    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 );
     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 );
     
    263284        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    264285        virtual void print( std::ostream & os, int indent = 0 ) const;
    265   private:
    266         DeclarationWithType * var;
    267286};
    268287
     
    270289class ConstantExpr : public Expression {
    271290  public:
     291        Constant constant;
     292
    272293        ConstantExpr( Constant constant, Expression *_aname = nullptr );
    273294        ConstantExpr( const ConstantExpr & other );
     
    281302        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    282303        virtual void print( std::ostream & os, int indent = 0 ) const;
    283   private:
    284         Constant constant;
    285304};
    286305
     
    288307class SizeofExpr : public Expression {
    289308  public:
     309        Expression * expr;
     310        Type * type;
     311        bool isType;
     312
    290313        SizeofExpr( Expression * expr, Expression *_aname = nullptr );
    291314        SizeofExpr( const SizeofExpr & other );
     
    304327        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    305328        virtual void print( std::ostream & os, int indent = 0 ) const;
    306   private:
     329};
     330
     331/// AlignofExpr represents an alignof expression
     332class AlignofExpr : public Expression {
     333  public:
    307334        Expression * expr;
    308335        Type * type;
    309336        bool isType;
    310 };
    311 
    312 /// AlignofExpr represents an alignof expression
    313 class AlignofExpr : public Expression {
    314   public:
     337
    315338        AlignofExpr( Expression * expr, Expression *_aname = nullptr );
    316339        AlignofExpr( const AlignofExpr & other );
     
    329352        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    330353        virtual void print( std::ostream & os, int indent = 0 ) const;
    331   private:
    332         Expression * expr;
    333         Type * type;
    334         bool isType;
    335354};
    336355
     
    338357class UntypedOffsetofExpr : public Expression {
    339358  public:
     359        Type * type;
     360        std::string member;
     361
    340362        UntypedOffsetofExpr( Type * type, const std::string & member, Expression *_aname = nullptr );
    341363        UntypedOffsetofExpr( const UntypedOffsetofExpr & other );
     
    351373        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    352374        virtual void print( std::ostream & os, int indent = 0 ) const;
    353   private:
    354         Type * type;
    355         std::string member;
    356375};
    357376
     
    359378class OffsetofExpr : public Expression {
    360379  public:
     380        Type * type;
     381        DeclarationWithType * member;
     382
    361383        OffsetofExpr( Type * type, DeclarationWithType * member, Expression *_aname = nullptr );
    362384        OffsetofExpr( const OffsetofExpr & other );
     
    372394        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    373395        virtual void print( std::ostream & os, int indent = 0 ) const;
    374   private:
    375         Type * type;
    376         DeclarationWithType * member;
    377396};
    378397
     
    380399class OffsetPackExpr : public Expression {
    381400public:
     401        StructInstType * type;
     402
    382403        OffsetPackExpr( StructInstType * type_, Expression * aname_ = 0 );
    383404        OffsetPackExpr( const OffsetPackExpr & other );
     
    390411        virtual void accept( Visitor & v ) { v.visit( this ); }
    391412        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    392 
    393         virtual void print( std::ostream & os, int indent = 0 ) const;
    394 
    395 private:
    396         StructInstType * type;
     413        virtual void print( std::ostream & os, int indent = 0 ) const;
    397414};
    398415
     
    400417class AttrExpr : public Expression {
    401418  public:
     419        Expression * attr;
     420        Expression * expr;
     421        Type * type;
     422        bool isType;
     423
    402424        AttrExpr(Expression * attr, Expression * expr, Expression *_aname = nullptr );
    403425        AttrExpr( const AttrExpr & other );
     
    418440        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    419441        virtual void print( std::ostream & os, int indent = 0 ) const;
    420   private:
    421         Expression * attr;
    422         Expression * expr;
    423         Type * type;
    424         bool isType;
    425442};
    426443
     
    428445class LogicalExpr : public Expression {
    429446  public:
     447        Expression * arg1;
     448        Expression * arg2;
     449
    430450        LogicalExpr( Expression * arg1, Expression * arg2, bool andp = true, Expression *_aname = nullptr );
    431451        LogicalExpr( const LogicalExpr & other );
     
    442462        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    443463        virtual void print( std::ostream & os, int indent = 0 ) const;
     464
    444465  private:
     466        bool isAnd;
     467};
     468
     469/// ConditionalExpr represents the three-argument conditional ( p ? a : b )
     470class ConditionalExpr : public Expression {
     471  public:
    445472        Expression * arg1;
    446473        Expression * arg2;
    447         bool isAnd;
    448 };
    449 
    450 /// ConditionalExpr represents the three-argument conditional ( p ? a : b )
    451 class ConditionalExpr : public Expression {
    452   public:
     474        Expression * arg3;
     475
    453476        ConditionalExpr( Expression * arg1, Expression * arg2, Expression * arg3, Expression *_aname = nullptr );
    454477        ConditionalExpr( const ConditionalExpr & other );
     
    466489        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    467490        virtual void print( std::ostream & os, int indent = 0 ) const;
    468   private:
     491};
     492
     493/// CommaExpr represents the sequence operator ( a, b )
     494class CommaExpr : public Expression {
     495  public:
    469496        Expression * arg1;
    470497        Expression * arg2;
    471         Expression * arg3;
    472 };
    473 
    474 /// CommaExpr represents the sequence operator ( a, b )
    475 class CommaExpr : public Expression {
    476   public:
     498
    477499        CommaExpr( Expression * arg1, Expression * arg2, Expression *_aname = nullptr );
    478500        CommaExpr( const CommaExpr & other );
     
    488510        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    489511        virtual void print( std::ostream & os, int indent = 0 ) const;
    490   private:
    491         Expression * arg1;
    492         Expression * arg2;
    493512};
    494513
     
    496515class TypeExpr : public Expression {
    497516  public:
     517        Type * type;
     518
    498519        TypeExpr( Type * type );
    499520        TypeExpr( const TypeExpr & other );
     
    507528        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    508529        virtual void print( std::ostream & os, int indent = 0 ) const;
    509   private:
    510         Type * type;
    511530};
    512531
     
    514533class AsmExpr : public Expression {
    515534  public:
     535        Expression * inout;
     536        ConstantExpr * constraint;
     537        Expression * operand;
     538
    516539        AsmExpr( Expression * inout, ConstantExpr * constraint, Expression * operand ) : inout( inout ), constraint( constraint ), operand( operand ) {}
    517540        AsmExpr( const AsmExpr & other );
     
    531554        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    532555        virtual void print( std::ostream & os, int indent = 0 ) const;
    533   private:
     556
    534557        // https://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Machine-Constraints.html#Machine-Constraints
    535         Expression * inout;
    536         ConstantExpr * constraint;
    537         Expression * operand;
    538558};
    539559
     
    542562class ImplicitCopyCtorExpr : public Expression {
    543563public:
    544         ImplicitCopyCtorExpr( ApplicationExpr * callExpr );
    545         ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other );
    546         virtual ~ImplicitCopyCtorExpr();
    547 
    548         ApplicationExpr * get_callExpr() const { return callExpr; }
    549         void set_callExpr( ApplicationExpr * newValue ) { callExpr = newValue; }
    550 
    551         std::list< ObjectDecl * > & get_tempDecls() { return tempDecls; }
    552         std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; }
    553         std::list< Expression * > & get_dtors() { return dtors; }
    554 
    555         virtual ImplicitCopyCtorExpr * clone() const { return new ImplicitCopyCtorExpr( * this ); }
    556         virtual void accept( Visitor & v ) { v.visit( this ); }
    557         virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    558         virtual void print( std::ostream & os, int indent = 0 ) const;
    559   private:
    560564        ApplicationExpr * callExpr;
    561565        std::list< ObjectDecl * > tempDecls;
    562566        std::list< ObjectDecl * > returnDecls;
    563567        std::list< Expression * > dtors;
     568
     569        ImplicitCopyCtorExpr( ApplicationExpr * callExpr );
     570        ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other );
     571        virtual ~ImplicitCopyCtorExpr();
     572
     573        ApplicationExpr * get_callExpr() const { return callExpr; }
     574        void set_callExpr( ApplicationExpr * newValue ) { callExpr = newValue; }
     575
     576        std::list< ObjectDecl * > & get_tempDecls() { return tempDecls; }
     577        std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; }
     578        std::list< Expression * > & get_dtors() { return dtors; }
     579
     580        virtual ImplicitCopyCtorExpr * clone() const { return new ImplicitCopyCtorExpr( * this ); }
     581        virtual void accept( Visitor & v ) { v.visit( this ); }
     582        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     583        virtual void print( std::ostream & os, int indent = 0 ) const;
    564584};
    565585
     
    567587class ConstructorExpr : public Expression {
    568588public:
     589        Expression * callExpr;
     590
    569591        ConstructorExpr( Expression * callExpr );
    570592        ConstructorExpr( const ConstructorExpr & other );
     
    578600        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    579601        virtual void print( std::ostream & os, int indent = 0 ) const;
    580 private:
    581         Expression * callExpr;
    582602};
    583603
     
    585605class CompoundLiteralExpr : public Expression {
    586606  public:
     607        Initializer * initializer;
     608
    587609        CompoundLiteralExpr( Type * type, Initializer * initializer );
    588610        CompoundLiteralExpr( const CompoundLiteralExpr & other );
     
    596618        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    597619        virtual void print( std::ostream & os, int indent = 0 ) const;
    598   private:
    599         Initializer * initializer;
    600620};
    601621
     
    603623class RangeExpr : public Expression {
    604624  public:
     625        Expression * low, * high;
     626
    605627        RangeExpr( Expression * low, Expression * high );
    606628        RangeExpr( const RangeExpr & other );
     
    615637        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    616638        virtual void print( std::ostream & os, int indent = 0 ) const;
    617   private:
    618         Expression * low, * high;
    619639};
    620640
     
    622642class UntypedTupleExpr : public Expression {
    623643  public:
     644        std::list<Expression*> exprs;
     645
    624646        UntypedTupleExpr( const std::list< Expression * > & exprs, Expression *_aname = nullptr );
    625647        UntypedTupleExpr( const UntypedTupleExpr & other );
     
    632654        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    633655        virtual void print( std::ostream & os, int indent = 0 ) const;
    634   private:
    635         std::list<Expression*> exprs;
    636656};
    637657
     
    639659class TupleExpr : public Expression {
    640660  public:
     661        std::list<Expression*> exprs;
     662
    641663        TupleExpr( const std::list< Expression * > & exprs, Expression *_aname = nullptr );
    642664        TupleExpr( const TupleExpr & other );
     
    649671        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    650672        virtual void print( std::ostream & os, int indent = 0 ) const;
    651   private:
    652         std::list<Expression*> exprs;
    653673};
    654674
     
    656676class TupleIndexExpr : public Expression {
    657677  public:
     678        Expression * tuple;
     679        unsigned int index;
     680
    658681        TupleIndexExpr( Expression * tuple, unsigned int index );
    659682        TupleIndexExpr( const TupleIndexExpr & other );
     
    669692        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    670693        virtual void print( std::ostream & os, int indent = 0 ) const;
    671   private:
    672         Expression * tuple;
    673         unsigned int index;
    674694};
    675695
     
    677697class TupleAssignExpr : public Expression {
    678698  public:
     699        StmtExpr * stmtExpr = nullptr;
     700
    679701        TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname = nullptr );
    680702        TupleAssignExpr( const TupleAssignExpr & other );
     
    688710        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    689711        virtual void print( std::ostream & os, int indent = 0 ) const;
    690   private:
    691         StmtExpr * stmtExpr = nullptr;
    692712};
    693713
     
    695715class StmtExpr : public Expression {
    696716public:
     717        CompoundStmt * statements;
     718        std::list< ObjectDecl * > returnDecls; // return variable(s) for stmt expression
     719        std::list< Expression * > dtors; // destructor(s) for return variable(s)
     720
    697721        StmtExpr( CompoundStmt * statements );
    698722        StmtExpr( const StmtExpr & other );
     
    709733        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    710734        virtual void print( std::ostream & os, int indent = 0 ) const;
    711 private:
    712         CompoundStmt * statements;
    713         std::list< ObjectDecl * > returnDecls; // return variable(s) for stmt expression
    714         std::list< Expression * > dtors; // destructor(s) for return variable(s)
    715735};
    716736
    717737class UniqueExpr : public Expression {
    718738public:
     739        Expression * expr;
     740        ObjectDecl * object;
     741        VariableExpr * var;
     742
    719743        UniqueExpr( Expression * expr, long long idVal = -1 );
    720744        UniqueExpr( const UniqueExpr & other );
     
    736760        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    737761        virtual void print( std::ostream & os, int indent = 0 ) const;
     762
    738763private:
    739         Expression * expr;
    740         ObjectDecl * object;
    741         VariableExpr * var;
    742764        int id;
    743765        static long long count;
     
    756778class UntypedInitExpr : public Expression {
    757779public:
     780        Expression * expr;
     781        std::list<InitAlternative> initAlts;
     782
    758783        UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts );
    759784        UntypedInitExpr( const UntypedInitExpr & other );
     
    769794        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    770795        virtual void print( std::ostream & os, int indent = 0 ) const;
    771 private:
    772         Expression * expr;
    773         std::list<InitAlternative> initAlts;
    774796};
    775797
    776798class InitExpr : public Expression {
    777799public:
     800        Expression * expr;
     801        Designation * designation;
     802
    778803        InitExpr( Expression * expr, Designation * designation );
    779804        InitExpr( const InitExpr & other );
     
    790815        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    791816        virtual void print( std::ostream & os, int indent = 0 ) const;
    792 private:
    793         Expression * expr;
    794         Designation * designation;
    795817};
    796818
    797819
    798820std::ostream & operator<<( std::ostream & out, const Expression * expr );
    799 
    800 #endif // EXPRESSION_H
    801821
    802822// Local Variables: //
  • src/SynTree/Initializer.cc

    r3d4b23fa r0720e049  
    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

    r3d4b23fa r0720e049  
    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

    r3d4b23fa r0720e049  
    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

    r3d4b23fa r0720e049  
    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

    r3d4b23fa r0720e049  
    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 );
     
    150150}
    151151
    152 #endif // MUTATOR_H
    153 
    154152// Local Variables: //
    155153// tab-width: 4 //
  • src/SynTree/NamedTypeDecl.cc

    r3d4b23fa r0720e049  
    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

    r3d4b23fa r0720e049  
    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

    r3d4b23fa r0720e049  
    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;
     
    135135class Attribute;
    136136
    137 #endif // SYNTREE_H
    138 
    139137// Local Variables: //
    140138// tab-width: 4 //
  • src/SynTree/Type.cc

    r3d4b23fa r0720e049  
    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
     
    8888}
    8989
     90// Empty Variable declarations:
     91const Type::FuncSpecifiers noFuncSpecifiers;
     92const Type::StorageClasses noStorageClasses;
     93const Type::Qualifiers noQualifiers;
     94
    9095std::ostream & operator<<( std::ostream & out, const Type * type ) {
    9196        if ( type ) {
  • src/SynTree/Type.h

    r3d4b23fa r0720e049  
    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
     
    166170        virtual Type *acceptMutator( Mutator & m ) = 0;
    167171        virtual void print( std::ostream & os, int indent = 0 ) const;
    168   private:
    169         Qualifiers tq;
    170         ForallList forall;
    171         std::list< Attribute * > attributes;
    172 };
    173 
    174 extern Type::Qualifiers emptyQualifiers;                                // no qualifiers on constants
     172};
     173
     174extern const Type::FuncSpecifiers noFuncSpecifiers;
     175extern const Type::StorageClasses noStorageClasses;
     176extern const Type::Qualifiers noQualifiers;                     // no qualifiers on constants
    175177
    176178class VoidType : public Type {
     
    212214                LongDoubleImaginary,
    213215                NUMBER_OF_BASIC_TYPES
    214         };
     216        } kind;
    215217
    216218        static const char *typeNames[];                                         // string names for basic types, MUST MATCH with Kind
     
    227229
    228230        bool isInteger() const;
    229   private:
    230         Kind kind;
    231231};
    232232
    233233class PointerType : public Type {
    234234  public:
     235        Type *base;
     236
     237        // In C99, pointer types can be qualified in many ways e.g., int f( int a[ static 3 ] )
     238        Expression *dimension;
     239        bool isVarLen;
     240        bool isStatic;
     241
    235242        PointerType( const Type::Qualifiers & tq, Type *base, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    236243        PointerType( const Type::Qualifiers & tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
     
    253260        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    254261        virtual void print( std::ostream & os, int indent = 0 ) const;
    255   private:
     262};
     263
     264class ArrayType : public Type {
     265  public:
    256266        Type *base;
    257 
    258         // In C99, pointer types can be qualified in many ways e.g., int f( int a[ static 3 ] )
    259267        Expression *dimension;
    260268        bool isVarLen;
    261269        bool isStatic;
    262 };
    263 
    264 class ArrayType : public Type {
    265   public:
     270
    266271        ArrayType( const Type::Qualifiers & tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    267272        ArrayType( const ArrayType& );
     
    283288        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    284289        virtual void print( std::ostream & os, int indent = 0 ) const;
    285   private:
    286         Type *base;
    287         Expression *dimension;
    288         bool isVarLen;
    289         bool isStatic;
    290290};
    291291
    292292class FunctionType : public Type {
    293293  public:
     294        std::list<DeclarationWithType*> returnVals;
     295        std::list<DeclarationWithType*> parameters;
     296
     297        // Does the function accept a variable number of arguments following the arguments specified in the parameters list.
     298        // This could be because of
     299        // - an ellipsis in a prototype declaration
     300        // - an unprototyped declaration
     301        bool isVarArgs;
     302
    294303        FunctionType( const Type::Qualifiers & tq, bool isVarArgs, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    295304        FunctionType( const FunctionType& );
     
    306315        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    307316        virtual void print( std::ostream & os, int indent = 0 ) const;
    308   private:
    309         std::list<DeclarationWithType*> returnVals;
    310         std::list<DeclarationWithType*> parameters;
    311 
    312         // Does the function accept a variable number of arguments following the arguments specified in the parameters list.
    313         // This could be because of
    314         // - an ellipsis in a prototype declaration
    315         // - an unprototyped declaration
    316         bool isVarArgs;
    317317};
    318318
    319319class ReferenceToType : public Type {
    320320  public:
     321        std::list< Expression* > parameters;
     322        std::string name;
     323        bool hoistType;
     324
    321325        ReferenceToType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes );
    322326        ReferenceToType( const ReferenceToType & other );
     
    337341  protected:
    338342        virtual std::string typeString() const = 0;
    339         std::list< Expression* > parameters;
    340         std::string name;
    341   private:
    342         bool hoistType;
    343343};
    344344
     
    346346        typedef ReferenceToType Parent;
    347347  public:
     348        // this decl is not "owned" by the struct inst; it is merely a pointer to elsewhere in the tree,
     349        // where the structure used in this type is actually defined
     350        StructDecl *baseStruct;
     351
    348352        StructInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ), baseStruct( 0 ) {}
    349353        StructInstType( const Type::Qualifiers & tq, StructDecl * baseStruct, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
     
    369373  private:
    370374        virtual std::string typeString() const;
    371 
    372         // this decl is not "owned" by the struct inst; it is merely a pointer to elsewhere in the tree,
    373         // where the structure used in this type is actually defined
    374         StructDecl *baseStruct;
    375375};
    376376
     
    378378        typedef ReferenceToType Parent;
    379379  public:
     380        // this decl is not "owned" by the union inst; it is merely a pointer to elsewhere in the tree,
     381        // where the union used in this type is actually defined
     382        UnionDecl *baseUnion;
     383
    380384        UnionInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ), baseUnion( 0 ) {}
    381385        UnionInstType( const Type::Qualifiers & tq, UnionDecl * baseUnion, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
     
    401405  private:
    402406        virtual std::string typeString() const;
    403 
     407};
     408
     409class EnumInstType : public ReferenceToType {
     410        typedef ReferenceToType Parent;
     411  public:
    404412        // this decl is not "owned" by the union inst; it is merely a pointer to elsewhere in the tree,
    405413        // where the union used in this type is actually defined
    406         UnionDecl *baseUnion;
    407 };
    408 
    409 class EnumInstType : public ReferenceToType {
    410         typedef ReferenceToType Parent;
    411   public:
     414        EnumDecl *baseEnum = nullptr;
     415
    412416        EnumInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ) {}
    413417        EnumInstType( const Type::Qualifiers & tq, EnumDecl * baseEnum, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
     
    424428  private:
    425429        virtual std::string typeString() const;
    426 
    427         // this decl is not "owned" by the union inst; it is merely a pointer to elsewhere in the tree,
    428         // where the union used in this type is actually defined
    429         EnumDecl *baseEnum = nullptr;
    430430};
    431431
     
    433433        typedef ReferenceToType Parent;
    434434  public:
     435        // this member is filled in by the validate pass, which instantiates the members of the correponding
     436        // aggregate with the actual type parameters specified for this use of the context
     437        std::list< Declaration* > members;
     438
    435439        TraitInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ) {}
    436440        TraitInstType( const TraitInstType & other );
     
    446450  private:
    447451        virtual std::string typeString() const;
    448 
    449         // this member is filled in by the validate pass, which instantiates the members of the correponding
    450         // aggregate with the actual type parameters specified for this use of the context
    451         std::list< Declaration* > members;
    452452};
    453453
     
    455455        typedef ReferenceToType Parent;
    456456  public:
     457        // this decl is not "owned" by the type inst; it is merely a pointer to elsewhere in the tree,
     458        // where the type used here is actually defined
     459        TypeDecl *baseType;
     460        bool isFtype;
     461
    457462        TypeInstType( const Type::Qualifiers & tq, const std::string & name, TypeDecl *baseType, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
    458463        TypeInstType( const Type::Qualifiers & tq, const std::string & name, bool isFtype, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
     
    473478  private:
    474479        virtual std::string typeString() const;
    475         // this decl is not "owned" by the type inst; it is merely a pointer to elsewhere in the tree,
    476         // where the type used here is actually defined
    477         TypeDecl *baseType;
    478         bool isFtype;
    479480};
    480481
    481482class TupleType : public Type {
    482483  public:
     484        std::list<Type *> types;
     485        std::list<Declaration *> members;
     486
    483487        TupleType( const Type::Qualifiers & tq, const std::list< Type * > & types, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
    484488        TupleType( const TupleType& );
     
    509513        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    510514        virtual void print( std::ostream & os, int indent = 0 ) const;
    511   private:
    512         std::list<Type *> types;
    513         std::list<Declaration *> members;
    514515};
    515516
    516517class TypeofType : public Type {
    517518  public:
     519        Expression *expr;
     520
    518521        TypeofType( const Type::Qualifiers & tq, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
    519522        TypeofType( const TypeofType& );
     
    529532        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    530533        virtual void print( std::ostream & os, int indent = 0 ) const;
    531   private:
     534};
     535
     536class AttrType : public Type {
     537  public:
     538        std::string name;
    532539        Expression *expr;
    533 };
    534 
    535 class AttrType : public Type {
    536   public:
     540        Type *type;
     541        bool isType;
     542
    537543        AttrType( const Type::Qualifiers & tq, const std::string & name, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    538544        AttrType( const Type::Qualifiers & tq, const std::string & name, Type *type, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
     
    555561        virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    556562        virtual void print( std::ostream & os, int indent = 0 ) const;
    557   private:
    558         std::string name;
    559         Expression *expr;
    560         Type *type;
    561         bool isType;
    562563};
    563564
     
    601602
    602603std::ostream & operator<<( std::ostream & out, const Type * type );
    603 
    604 #endif // TYPE_H
    605604
    606605// Local Variables: //
  • src/SynTree/TypeDecl.cc

    r3d4b23fa r0720e049  
    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/TypeExpr.cc

    r3d4b23fa r0720e049  
    2121}
    2222
    23 TypeExpr::TypeExpr( const TypeExpr &other ) : type( maybeClone( other.type ) ) {
     23TypeExpr::TypeExpr( const TypeExpr &other ) : Expression( other ), type( maybeClone( other.type ) ) {
    2424}
    2525
  • src/SynTree/TypeSubstitution.h

    r3d4b23fa r0720e049  
    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

    r3d4b23fa r0720e049  
    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

    r3d4b23fa r0720e049  
    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

    r3d4b23fa r0720e049  
    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 );
     
    174174}
    175175
    176 #endif // VISITOR_H
    177 
    178176// Local Variables: //
    179177// tab-width: 4 //
Note: See TracChangeset for help on using the changeset viewer.