Changeset be8bd88 for src/SynTree


Ignore:
Timestamp:
Mar 8, 2017, 3:22:50 PM (9 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, stuck-waitfor-destruct, with_gc
Children:
031a2c95, 0e7ea335
Parents:
87c3bef (diff), 6363ad1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src/SynTree
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/AggregateDecl.cc

    r87c3bef rbe8bd88  
    1010// Created On       : Sun May 17 23:56:39 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Feb  6 15:31:23 2017
    13 // Update Count     : 17
     12// Last Modified On : Tue Mar  7 07:31:47 2017
     13// Update Count     : 19
    1414//
    1515
     
    2020
    2121
    22 AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, DeclarationNode::NoStorageClass, LinkageSpec::Cforall ), body( false ), attributes( attributes ) {
     22AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, DeclarationNode::StorageClasses(), LinkageSpec::Cforall ), body( false ), attributes( attributes ) {
    2323}
    2424
  • src/SynTree/Declaration.cc

    r87c3bef rbe8bd88  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  9 14:28:05 2017
    13 // Update Count     : 16
     12// Last Modified On : Tue Mar  7 07:31:11 2017
     13// Update Count     : 23
    1414//
    1515
     
    2727static IdMapType idMap;
    2828
    29 Declaration::Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage )
    30                 : name( name ), storageClass( sc ), linkage( linkage ), isInline( false ), isNoreturn( false ), uniqueId( 0 ) {
     29Declaration::Declaration( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage )
     30                : name( name ), storageClasses( scs ), linkage( linkage ), uniqueId( 0 ) {
    3131}
    3232
    3333Declaration::Declaration( const Declaration &other )
    34         : name( other.name ), storageClass( other.storageClass ), linkage( other.linkage ), isInline( other.isInline ), isNoreturn( other.isNoreturn ), uniqueId( other.uniqueId ) {
     34        : name( other.name ), storageClasses( other.storageClasses ), linkage( other.linkage ), uniqueId( other.uniqueId ) {
    3535}
    3636
     
    6666
    6767
    68 AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", DeclarationNode::NoStorageClass, LinkageSpec::C ), stmt( stmt ) {
     68AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", DeclarationNode::StorageClasses(), LinkageSpec::C ), stmt( stmt ) {
    6969}
    7070
  • src/SynTree/Declaration.h

    r87c3bef rbe8bd88  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 16 14:53:35 2017
    13 // Update Count     : 57
     12// Last Modified On : Tue Mar  7 07:40:42 2017
     13// Update Count     : 113
    1414//
    1515
     
    2828class Declaration : public BaseSyntaxNode {
    2929  public:
    30         Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage );
     30        Declaration( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage );
    3131        Declaration( const Declaration &other );
    3232        virtual ~Declaration();
     
    3434        const std::string &get_name() const { return name; }
    3535        void set_name( std::string newValue ) { name = newValue; }
    36         DeclarationNode::StorageClass get_storageClass() const { return storageClass; }
    37         void set_storageClass( DeclarationNode::StorageClass newValue ) { storageClass = newValue; }
     36
     37        DeclarationNode::StorageClasses get_storageClasses() const { return storageClasses; }
     38
    3839        LinkageSpec::Spec get_linkage() const { return linkage; }
    3940        void set_linkage( LinkageSpec::Spec newValue ) { linkage = newValue; }
    40         bool get_isInline() const { return isInline; }
    41         void set_isInline( bool newValue ) { isInline = newValue; }
    42         bool get_isNoreturn() const { return isNoreturn; }
    43         void set_isNoreturn( bool newValue ) { isNoreturn = newValue; }
     41
    4442        UniqueId get_uniqueId() const { return uniqueId; }
     43
    4544        bool get_extension() const { return extension; }
    4645        Declaration *set_extension( bool exten ) { extension = exten; return this; }
     
    5756  private:
    5857        std::string name;
    59         DeclarationNode::StorageClass storageClass;
     58        DeclarationNode::StorageClasses storageClasses;
    6059        LinkageSpec::Spec linkage;
    61         bool isInline, isNoreturn;
    6260        UniqueId uniqueId;
    6361        bool extension = false;
     
    6664class DeclarationWithType : public Declaration {
    6765  public:
    68         DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes );
     66        DeclarationWithType( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs );
    6967        DeclarationWithType( const DeclarationWithType &other );
    7068        virtual ~DeclarationWithType();
     
    8381        std::list< Attribute * >& get_attributes() { return attributes; }
    8482        const std::list< Attribute * >& get_attributes() const { return attributes; }
     83
     84        DeclarationNode::FuncSpecifiers get_funcSpec() const { return fs; }
     85        //void set_functionSpecifiers( DeclarationNode::FuncSpecifiers newValue ) { fs = newValue; }
    8586
    8687        virtual DeclarationWithType *clone() const = 0;
     
    9798        ConstantExpr *asmName;
    9899        std::list< Attribute * > attributes;
     100        DeclarationNode::FuncSpecifiers fs;
    99101};
    100102
     
    102104        typedef DeclarationWithType Parent;
    103105  public:
    104         ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes = std::list< Attribute * >(), bool isInline = false, bool isNoreturn = false );
     106        ObjectDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init,
     107                                const std::list< Attribute * > attributes = std::list< Attribute * >(), DeclarationNode::FuncSpecifiers fs = DeclarationNode::FuncSpecifiers() );
    105108        ObjectDecl( const ObjectDecl &other );
    106109        virtual ~ObjectDecl();
     
    129132        typedef DeclarationWithType Parent;
    130133  public:
    131         FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, const std::list< Attribute * > attributes = std::list< Attribute * >() );
     134        FunctionDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements,
     135                                  const std::list< Attribute * > attributes = std::list< Attribute * >(), DeclarationNode::FuncSpecifiers fs = DeclarationNode::FuncSpecifiers() );
    132136        FunctionDecl( const FunctionDecl &other );
    133137        virtual ~FunctionDecl();
     
    154158        typedef Declaration Parent;
    155159  public:
    156         NamedTypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type );
     160        NamedTypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type );
    157161        NamedTypeDecl( const NamedTypeDecl &other );
    158162        virtual ~NamedTypeDecl();
     
    189193        };
    190194
    191         TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind );
     195        TypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type, Kind kind );
    192196        TypeDecl( const TypeDecl &other );
    193197
     
    210214        typedef NamedTypeDecl Parent;
    211215  public:
    212         TypedefDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type ) : Parent( name, sc, type ) {}
     216        TypedefDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type ) : Parent( name, scs, type ) {}
    213217        TypedefDecl( const TypedefDecl &other ) : Parent( other ) {}
    214218
  • src/SynTree/DeclarationWithType.cc

    r87c3bef rbe8bd88  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 13 14:49:43 2016
    13 // Update Count     : 7
     12// Last Modified On : Tue Mar  7 07:32:14 2017
     13// Update Count     : 23
    1414//
    1515
     
    1919#include "Common/utility.h"
    2020
    21 DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes )
    22         : Declaration( name, sc, linkage ), asmName( nullptr ), attributes( attributes ) {
     21DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs )
     22        : Declaration( name, scs, linkage ), asmName( nullptr ), attributes( attributes ), fs( fs ) {
    2323}
    2424
    2525DeclarationWithType::DeclarationWithType( const DeclarationWithType &other )
    26                 : Declaration( other ), mangleName( other.mangleName ), scopeLevel( other.scopeLevel ) {
     26                : Declaration( other ), mangleName( other.mangleName ), scopeLevel( other.scopeLevel ), fs( other.fs ) {
    2727        cloneAll( other.attributes, attributes );
    2828        asmName = maybeClone( other.asmName );
  • src/SynTree/FunctionDecl.cc

    r87c3bef rbe8bd88  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 16 15:01:52 2017
    13 // Update Count     : 23
     12// Last Modified On : Tue Mar  7 07:54:58 2017
     13// Update Count     : 68
    1414//
    1515
     
    2626extern bool translation_unit_nomain;
    2727
    28 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, std::list< Attribute * > attributes )
    29                 : Parent( name, sc, linkage, attributes ), type( type ), statements( statements ) {
    30         set_isInline( isInline );
    31         set_isNoreturn( isNoreturn );
    32         // this is a brazen hack to force the function "main" to have Cforall linkage
    33         // because we want to replace the main even if it is inside an extern
     28FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, std::list< Attribute * > attributes, DeclarationNode::FuncSpecifiers fs )
     29        : Parent( name, scs, linkage, attributes, fs ), type( type ), statements( statements ) {
     30        // hack forcing the function "main" to have Cforall linkage to replace main even if it is inside an extern
    3431        if ( name == "main" ) {
    3532                set_linkage( CodeGen::FixMain::mainLinkage() );
     
    3835
    3936FunctionDecl::FunctionDecl( const FunctionDecl &other )
    40         : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {
     37                : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {
    4138}
    4239
     
    6562                os << LinkageSpec::linkageName( get_linkage() ) << " ";
    6663        } // if
    67         if ( get_isInline() ) {
    68                 os << "inline ";
    69         } // if
    70         if ( get_isNoreturn() ) {
    71                 os << "_Noreturn ";
    72         } // if
    7364
    7465        printAll( get_attributes(), os, indent );
    7566
    76         if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    77                 os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
    78         } // if
     67        DeclarationNode::print_StorageClass( os, get_storageClasses() );
     68        DeclarationNode::print_FuncSpec( os, get_funcSpec() );
     69
    7970        if ( get_type() ) {
    8071                get_type()->print( os, indent );
     
    9788                os << get_name() << ": ";
    9889        } // if
    99         if ( get_isInline() ) {
    100                 os << "inline ";
    101         } // if
    102         if ( get_isNoreturn() ) {
    103                 os << "_Noreturn ";
    104         } // if
    10590
    10691        // xxx - should printShort print attributes?
    10792
    108         if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    109                 os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
    110         } // if
     93        DeclarationNode::print_StorageClass( os, get_storageClasses() );
     94        DeclarationNode::print_FuncSpec( os, get_funcSpec() );
     95
    11196        if ( get_type() ) {
    11297                get_type()->print( os, indent );
  • src/SynTree/NamedTypeDecl.cc

    r87c3bef rbe8bd88  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jun 13 08:13:55 2015
    13 // Update Count     : 3
     12// Last Modified On : Tue Mar  7 07:39:41 2017
     13// Update Count     : 10
    1414//
    1515
     
    1818#include "Common/utility.h"
    1919
    20 NamedTypeDecl::NamedTypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *base )
    21         : Parent( name, sc, LinkageSpec::Cforall ), base( base ) {}
     20NamedTypeDecl::NamedTypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *base )
     21        : Parent( name, scs, LinkageSpec::Cforall ), base( base ) {}
    2222
    2323NamedTypeDecl::NamedTypeDecl( const NamedTypeDecl &other )
     
    3939                os << get_name() << ": ";
    4040        } // if
    41         if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    42                 os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
    43         } // if
     41        DeclarationNode::print_StorageClass( os, get_storageClasses() );
    4442        os << typeString();
    4543        if ( base ) {
     
    6361                os << get_name() << ": ";
    6462        } // if
    65         if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    66                 os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
    67         } // if
     63        DeclarationNode::print_StorageClass( os, get_storageClasses() );
    6864        os << typeString();
    6965        if ( base ) {
  • src/SynTree/ObjectDecl.cc

    r87c3bef rbe8bd88  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Oct  1 23:05:56 2016
    13 // Update Count     : 32
     12// Last Modified On : Tue Mar  7 07:55:24 2017
     13// Update Count     : 54
    1414//
    1515
     
    2222#include "Statement.h"
    2323
    24 ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, bool isInline, bool isNoreturn )
    25         : Parent( name, sc, linkage, attributes ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) {
    26         set_isInline( isInline );
    27         set_isNoreturn( isNoreturn );
     24ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, DeclarationNode::FuncSpecifiers fs )
     25        : Parent( name, scs, linkage, attributes, fs ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) {
    2826}
    2927
     
    4947        printAll( get_attributes(), os, indent );
    5048
    51         if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    52                 os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
    53         } // if
     49        DeclarationNode::print_StorageClass( os, get_storageClasses() );
    5450
    5551        if ( get_type() ) {
     
    8581        // xxx - should printShort print attributes?
    8682
    87         if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    88                 os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
    89         } // if
     83        DeclarationNode::print_StorageClass( os, get_storageClasses() );
    9084
    9185        if ( get_type() ) {
  • src/SynTree/Type.h

    r87c3bef rbe8bd88  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 23 16:38:53 2017
    13 // Update Count     : 34
     12// Last Modified On : Wed Mar  1 09:11:45 2017
     13// Update Count     : 41
    1414//
    1515
     
    2121#include "SynTree.h"
    2222#include "Visitor.h"
    23 #include "Common/utility.h"
    2423
    2524class Type : public BaseSyntaxNode {
     
    213212        bool get_isVarArgs() const { return isVarArgs; }
    214213        void set_isVarArgs( bool newValue ) { isVarArgs = newValue; }
    215 
    216214        bool isTtype() const;
    217215
  • src/SynTree/TypeDecl.cc

    r87c3bef rbe8bd88  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jun 13 08:14:35 2015
    13 // Update Count     : 2
     12// Last Modified On : Tue Mar  7 07:39:09 2017
     13// Update Count     : 4
    1414//
    1515
     
    1818#include "Common/utility.h"
    1919
    20 TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ) : Parent( name, sc, type ), kind( kind ), sized( kind == Any || kind == Ttype ) {
     20TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type, Kind kind ) : Parent( name, scs, type ), kind( kind ), sized( kind == Any || kind == Ttype ) {
    2121}
    2222
Note: See TracChangeset for help on using the changeset viewer.