Changeset b5b0907 for src/SynTree


Ignore:
Timestamp:
Jun 15, 2015, 12:45:26 PM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
94b4364
Parents:
ea9b9d3 (diff), a1d5d2a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into resolver

Conflicts:

src/CodeGen/CodeGenerator.cc

Location:
src/SynTree
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/AggregateDecl.cc

    rea9b9d3 rb5b0907  
    1010// Created On       : Sun May 17 23:56:39 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May 19 16:52:08 2015
    13 // Update Count     : 5
     12// Last Modified On : Sat Jun 13 08:12:49 2015
     13// Update Count     : 6
    1414//
    1515
     
    1919
    2020
    21 AggregateDecl::AggregateDecl( const std::string &name ) : Parent( name, Declaration::NoStorageClass, LinkageSpec::Cforall ) {
     21AggregateDecl::AggregateDecl( const std::string &name ) : Parent( name, DeclarationNode::NoStorageClass, LinkageSpec::Cforall ) {
    2222}
    2323
  • src/SynTree/Declaration.cc

    rea9b9d3 rb5b0907  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 18 08:18:35 2015
    13 // Update Count     : 2
     12// Last Modified On : Sat Jun 13 08:07:20 2015
     13// Update Count     : 9
    1414//
    1515
     
    2222#include "utility.h"
    2323
    24 const char* Declaration::storageClassName[] = { "", "auto", "static", "extern", "register" }; 
    25 
    2624static UniqueId lastUniqueId = 0;
    2725typedef std::map< UniqueId, Declaration* > IdMapType;
    2826static IdMapType idMap;
    2927
    30 Declaration::Declaration( const std::string &name, StorageClass sc, LinkageSpec::Type linkage )
    31         : name( name ), storageClass( sc ), linkage( linkage ), uniqueId( 0 ) {
     28Declaration::Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage )
     29                : name( name ), storageClass( sc ), linkage( linkage ), uniqueId( 0 ) {
    3230}
    3331
    3432Declaration::Declaration( const Declaration &other )
    35         : name( other.name ), storageClass( other.storageClass ), linkage( other.linkage ), uniqueId( other.uniqueId ) {
     33                : name( other.name ), storageClass( other.storageClass ), linkage( other.linkage ), uniqueId( other.uniqueId ) {
    3634}
    3735
     
    4442}
    4543
    46 /* static class method */
    4744Declaration *Declaration::declFromId( UniqueId id ) {
    4845        IdMapType::const_iterator i = idMap.find( id );
    49         if ( i != idMap.end() ) {
    50                 return i->second;
    51         } else {
    52                 return 0;
    53         } // if
     46        return i != idMap.end() ? i->second : 0;
    5447}
    5548
    56 /* static class method */
    5749void Declaration::dumpIds( std::ostream &os ) {
    5850        for ( IdMapType::const_iterator i = idMap.begin(); i != idMap.end(); ++i ) {
  • src/SynTree/Declaration.h

    rea9b9d3 rb5b0907  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jun  7 22:03:43 2015
    13 // Update Count     : 7
     12// Last Modified On : Fri Jun 12 23:55:26 2015
     13// Update Count     : 24
    1414//
    1515
     
    2121#include "Mutator.h"
    2222#include "Parser/LinkageSpec.h"
     23#include "Parser/ParseNode.h"
    2324
    2425class Declaration {
    2526  public:
    26         enum StorageClass { 
    27                 NoStorageClass,
    28                 Extern,
    29                 Static,
    30                 Auto,
    31                 Register,
    32                 Inline,
    33                 Fortran,
    34         };     
    35 
    36         Declaration( const std::string &name, StorageClass sc, LinkageSpec::Type linkage );
     27        Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage );
    3728        Declaration( const Declaration &other );
    3829        virtual ~Declaration();
     
    4031        const std::string &get_name() const { return name; }
    4132        void set_name( std::string newValue ) { name = newValue; }
    42         StorageClass get_storageClass() const { return storageClass; }
    43         void set_storageClass( StorageClass newValue ) { storageClass = newValue; }
     33        DeclarationNode::StorageClass get_storageClass() const { return storageClass; }
     34        void set_storageClass( DeclarationNode::StorageClass newValue ) { storageClass = newValue; }
    4435        LinkageSpec::Type get_linkage() const { return linkage; }
    4536        void set_linkage( LinkageSpec::Type newValue ) { linkage = newValue; }
     
    5344        virtual void printShort( std::ostream &os, int indent = 0 ) const = 0;
    5445
    55         static const char* storageClassName[]; 
    56 
    5746        static void dumpIds( std::ostream &os );
    5847        static Declaration *declFromId( UniqueId id );
    5948  private:
    6049        std::string name;
    61         StorageClass storageClass;
     50        DeclarationNode::StorageClass storageClass;
    6251        LinkageSpec::Type linkage;
    6352        UniqueId uniqueId;
     
    6655class DeclarationWithType : public Declaration {
    6756  public:
    68         DeclarationWithType( const std::string &name, StorageClass sc, LinkageSpec::Type linkage );
     57        DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage );
    6958        DeclarationWithType( const DeclarationWithType &other );
    7059        virtual ~DeclarationWithType();
     
    8675        typedef DeclarationWithType Parent;
    8776  public:
    88         ObjectDecl( const std::string &name, StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init );
     77        ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init );
    8978        ObjectDecl( const ObjectDecl &other );
    9079        virtual ~ObjectDecl();
     
    112101        typedef DeclarationWithType Parent;
    113102  public:
    114         FunctionDecl( const std::string &name, StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline );
     103        FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline );
    115104        FunctionDecl( const FunctionDecl &other );
    116105        virtual ~FunctionDecl();
     
    144133        typedef Declaration Parent;
    145134  public:
    146         NamedTypeDecl( const std::string &name, StorageClass sc, Type *type );
     135        NamedTypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type );
    147136        NamedTypeDecl( const TypeDecl &other );
    148137        virtual ~NamedTypeDecl();
     
    169158        enum Kind { Any, Dtype, Ftype };
    170159
    171         TypeDecl( const std::string &name, StorageClass sc, Type *type, Kind kind );
     160        TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind );
    172161        TypeDecl( const TypeDecl &other );
    173162
     
    185174        typedef NamedTypeDecl Parent;
    186175  public:
    187         TypedefDecl( const std::string &name, StorageClass sc, Type *type ) : Parent( name, sc, type ) {}
     176        TypedefDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type ) : Parent( name, sc, type ) {}
    188177        TypedefDecl( const TypedefDecl &other ) : Parent( other ) {}
    189178
  • src/SynTree/DeclarationWithType.cc

    rea9b9d3 rb5b0907  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 18 08:20:23 2015
    13 // Update Count     : 2
     12// Last Modified On : Sat Jun 13 08:08:07 2015
     13// Update Count     : 3
    1414//
    1515
     
    1818#include "utility.h"
    1919
    20 DeclarationWithType::DeclarationWithType( const std::string &name, StorageClass sc, LinkageSpec::Type linkage )
     20DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage )
    2121                : Declaration( name, sc, linkage ) {
    2222}
  • src/SynTree/FunctionDecl.cc

    rea9b9d3 rb5b0907  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jun  7 08:36:44 2015
    13 // Update Count     : 12
     12// Last Modified On : Sat Jun 13 08:12:20 2015
     13// Update Count     : 14
    1414//
    1515
     
    2121#include "utility.h"
    2222
    23 FunctionDecl::FunctionDecl( const std::string &name, StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline )
     23FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline )
    2424                : Parent( name, sc, linkage ), type( type ), statements( statements ), isInline( isInline ) {
    2525        // this is a brazen hack to force the function "main" to have C linkage
     
    6060                os << "inline ";
    6161        } // if
    62         if ( get_storageClass() != NoStorageClass ) {
    63                 os << storageClassName[ get_storageClass() ] << ' ';
     62        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
     63                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
    6464        } // if
    6565        if ( get_type() ) {
     
    9696                os << "inline ";
    9797        } // if
    98         if ( get_storageClass() != NoStorageClass ) {
    99                 os << storageClassName[ get_storageClass() ] << ' ';
     98        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
     99                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
    100100        } // if
    101101        if ( get_type() ) {
  • src/SynTree/NamedTypeDecl.cc

    rea9b9d3 rb5b0907  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jun  7 08:36:09 2015
    13 // Update Count     : 2
     12// Last Modified On : Sat Jun 13 08:13:55 2015
     13// Update Count     : 3
    1414//
    1515
     
    1818#include "utility.h"
    1919
    20 NamedTypeDecl::NamedTypeDecl( const std::string &name, StorageClass sc, Type *base )
     20NamedTypeDecl::NamedTypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *base )
    2121        : Parent( name, sc, LinkageSpec::Cforall ), base( base ) {}
    2222
     
    3939                os << get_name() << ": ";
    4040        } // if
    41         if ( get_storageClass() != NoStorageClass ) {
    42                 os << storageClassName[ get_storageClass() ] << ' ';
     41        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
     42                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
    4343        } // if
    4444        os << typeString();
     
    6363                os << get_name() << ": ";
    6464        } // if
    65         if ( get_storageClass() != NoStorageClass ) {
    66                 os << storageClassName[ get_storageClass() ] << ' ';
     65        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
     66                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
    6767        } // if
    6868        os << typeString();
  • src/SynTree/ObjectDecl.cc

    rea9b9d3 rb5b0907  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jun  4 21:21:12 2015
    13 // Update Count     : 10
     12// Last Modified On : Sat Jun 13 08:10:16 2015
     13// Update Count     : 15
    1414//
    1515
     
    2020#include "utility.h"
    2121
    22 ObjectDecl::ObjectDecl( const std::string &name, StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init )
     22ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init )
    2323        : Parent( name, sc, linkage ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) {
    2424}
     
    4343        } // if
    4444
    45         if ( get_storageClass() != NoStorageClass ) {
    46                 os << storageClassName[ get_storageClass() ] << ' ';
     45        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
     46                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
    4747        } // if
    4848
     
    7474        } // if
    7575
    76         if ( get_storageClass() != NoStorageClass ) {
    77                 os << storageClassName[ get_storageClass() ] << ' ';
     76        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
     77                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
    7878        } // if
    7979
  • src/SynTree/TypeDecl.cc

    rea9b9d3 rb5b0907  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 18 11:02:11 2015
    13 // Update Count     : 1
     12// Last Modified On : Sat Jun 13 08:14:35 2015
     13// Update Count     : 2
    1414//
    1515
     
    1818#include "utility.h"
    1919
    20 TypeDecl::TypeDecl( const std::string &name, StorageClass sc, Type *type, Kind kind ) : Parent( name, sc, type ), kind( kind ) {
     20TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ) : Parent( name, sc, type ), kind( kind ) {
    2121}
    2222
Note: See TracChangeset for help on using the changeset viewer.