Ignore:
Timestamp:
Mar 8, 2017, 3:22:50 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.h

    r87c3bef rbe8bd88  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 23 15:22:10 2017
    13 // Update Count     : 662
     12// Last Modified On : Tue Mar  7 08:10:53 2017
     13// Update Count     : 726
    1414//
    1515
     
    1919#include <string>
    2020#include <list>
     21#include <bitset>
    2122#include <iterator>
    2223#include <memory>
     
    3940//##############################################################################
    4041
    41 extern char* yyfilename;
     42extern char * yyfilename;
    4243extern int yylineno;
    4344
     
    122123        }
    123124
    124         Expression * build() const { return const_cast<ExpressionNode*>(this)->expr.release(); }
     125        Expression * build() const { return const_cast<ExpressionNode *>(this)->expr.release(); }
    125126  private:
    126127        bool extension = false;
     
    203204        // These must remain in the same order as the corresponding DeclarationNode names.
    204205
    205         // enum StorageClass { Extern, Static, Auto, Register, NoStorageClass };
    206         // enum FunctionSpec { Inline, Fortran, Noreturn, NoFunctionSpec };
    207         // enum Qualifier { Const, Restrict, Volatile, Lvalue, Atomic, Threadlocal, Mutex, NoQualifier };
    208 
    209         enum StorageClass { Extern, Static, Auto, Register, Inline, Fortran, Noreturn, Threadlocal, NoStorageClass, };
    210         enum Qualifier { Const, Restrict, Volatile, Lvalue, Atomic, NoQualifier };
     206        enum StorageClass { Extern, Static, Auto, Register, Threadlocal, NoStorageClass,
     207                                                ExternClass = 1 << Extern, StaticClass = 1 << Static, AutoClass = 1 << Auto, RegisterClass = 1 << Register, ThreadlocalClass = 1 << Threadlocal };
     208        enum FuncSpecifier { Inline, Noreturn, Fortran, NoFuncSpecifier,
     209                                                 InlineSpec = 1 << Inline, NoreturnSpec = 1 << Noreturn, FortranSpec = 1 << Fortran };
     210        enum TypeQualifier { Const, Restrict, Volatile, Lvalue, Mutex, Atomic, NoTypeQualifier };
    211211        enum BasicType { Void, Bool, Char, Int, Float, Double, LongDouble, NoBasicType };
    212212        enum ComplexType { Complex, Imaginary, NoComplexType };
     
    217217        enum BuiltinType { Valist, Zero, One, NoBuiltinType };
    218218
    219         static const char * storageName[];
    220         static const char * qualifierName[];
    221         static const char * basicTypeName[];
    222         static const char * complexTypeName[];
    223         static const char * signednessName[];
    224         static const char * lengthName[];
    225         static const char * aggregateName[];
    226         static const char * typeClassName[];
    227         static const char * builtinTypeName[];
    228 
    229         static DeclarationNode * newFunction( std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body, bool newStyle = false );
    230         static DeclarationNode * newQualifier( Qualifier );
    231         static DeclarationNode * newForall( DeclarationNode * );
     219        static const char * storageClassNames[];
     220        static const char * funcSpecifierNames[];
     221        static const char * typeQualifierNames[];
     222        static const char * basicTypeNames[];
     223        static const char * complexTypeNames[];
     224        static const char * signednessNames[];
     225        static const char * lengthNames[];
     226        static const char * aggregateNames[];
     227        static const char * typeClassNames[];
     228        static const char * builtinTypeNames[];
     229
    232230        static DeclarationNode * newStorageClass( StorageClass );
     231        static DeclarationNode * newFuncSpecifier( FuncSpecifier );
     232        static DeclarationNode * newTypeQualifier( TypeQualifier );
    233233        static DeclarationNode * newBasicType( BasicType );
    234234        static DeclarationNode * newComplexType( ComplexType );
    235         static DeclarationNode * newSignedNess( Signedness sn );
    236         static DeclarationNode * newLength( Length lnth );
     235        static DeclarationNode * newSignedNess( Signedness );
     236        static DeclarationNode * newLength( Length );
    237237        static DeclarationNode * newBuiltinType( BuiltinType );
     238        static DeclarationNode * newForall( DeclarationNode * );
    238239        static DeclarationNode * newFromTypedef( std::string * );
     240        static DeclarationNode * newFunction( std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body, bool newStyle = false );
    239241        static DeclarationNode * newAggregate( Aggregate kind, const std::string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body );
    240242        static DeclarationNode * newEnum( std::string * name, DeclarationNode * constants, bool body );
     
    263265        DeclarationNode * addQualifiers( DeclarationNode * );
    264266        void checkQualifiers( const TypeData *, const TypeData * );
    265         void checkStorageClasses( DeclarationNode * );
    266         DeclarationNode * copyStorageClasses( DeclarationNode * );
     267        void checkSpecifiers( DeclarationNode * );
     268        DeclarationNode * copySpecifiers( DeclarationNode * );
    267269        DeclarationNode * addType( DeclarationNode * );
    268270        DeclarationNode * addTypedef();
     
    295297
    296298        Declaration * build() const;
    297         ::Type * buildType() const;
     299        Type * buildType() const;
    298300
    299301        bool get_hasEllipsis() const;
     
    301303        DeclarationNode * extractAggregate() const;
    302304        bool has_enumeratorValue() const { return (bool)enumeratorValue; }
    303         ExpressionNode * consume_enumeratorValue() const { return const_cast<DeclarationNode*>(this)->enumeratorValue.release(); }
     305        ExpressionNode * consume_enumeratorValue() const { return const_cast<DeclarationNode *>(this)->enumeratorValue.release(); }
    304306
    305307        bool get_extension() const { return extension; }
     
    323325
    324326        TypeData * type;
    325         StorageClass storageClass;
     327
     328        typedef std::bitset< DeclarationNode::NoStorageClass > StorageClasses;
     329        StorageClasses storageClasses;
     330        static void print_StorageClass( std::ostream & output, StorageClasses storageClasses );
     331
     332        typedef std::bitset< DeclarationNode::NoFuncSpecifier > FuncSpecifiers;
     333        FuncSpecifiers funcSpecs;
     334        static void print_FuncSpec( std::ostream & output, FuncSpecifiers funcSpecs );
     335
    326336        ExpressionNode * bitfieldWidth;
    327         bool isInline, isNoreturn;
    328337        std::unique_ptr<ExpressionNode> enumeratorValue;
    329338        bool hasEllipsis;
     
    342351
    343352static inline Type * maybeMoveBuildType( const DeclarationNode * orig ) {
    344         Type* ret = orig ? orig->buildType() : nullptr;
     353        Type * ret = orig ? orig->buildType() : nullptr;
    345354        delete orig;
    346355        return ret;
     
    357366
    358367        virtual StatementNode * clone() const final { assert( false ); return nullptr; }
    359         Statement * build() const { return const_cast<StatementNode*>(this)->stmt.release(); }
     368        Statement * build() const { return const_cast<StatementNode *>(this)->stmt.release(); }
    360369
    361370        virtual StatementNode * add_label( const std::string * name, DeclarationNode * attr = nullptr ) {
Note: See TracChangeset for help on using the changeset viewer.