Changeset 342af53 for src


Ignore:
Timestamp:
Jan 14, 2021, 12:23:14 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
8e4aa05
Parents:
4468a70 (diff), ec19b21 (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
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Decl.cpp

    r4468a70 r342af53  
    1010// Created On       : Thu May 9 10:00:00 2019
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Dec 13 16:23:15 2019
    13 // Update Count     : 20
     12// Last Modified On : Tue Jan 12 16:54:55 2021
     13// Update Count     : 23
    1414//
    1515
     
    7878
    7979const char * TypeDecl::typeString() const {
    80         static const char * kindNames[] = { "sized data type", "sized object type", "sized function type", "sized tuple type" };
    81         static_assert( sizeof(kindNames)/sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "typeString: kindNames is out of sync." );
     80        static const char * kindNames[] = { "sized data type", "sized data type", "sized object type", "sized function type", "sized tuple type", "sized array length type" };
     81        static_assert( sizeof(kindNames) / sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "typeString: kindNames is out of sync." );
    8282        assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDecl kind is out of bounds." );
    8383        return sized ? kindNames[ kind ] : &kindNames[ kind ][ sizeof("sized") ]; // sizeof includes '\0'
     
    8585
    8686const char * TypeDecl::genTypeString() const {
    87         static const char * kindNames[] = { "dtype", "otype", "ftype", "ttype" };
    88         static_assert( sizeof(kindNames)/sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "genTypeString: kindNames is out of sync." );
     87        static const char * kindNames[] = { "T &", "T *", "T", "(*)", "T ...", "[T]" };
     88        static_assert( sizeof(kindNames) / sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "genTypeString: kindNames is out of sync." );
    8989        assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDecl kind is out of bounds." );
    9090        return kindNames[ kind ];
  • src/AST/Decl.hpp

    r4468a70 r342af53  
    1010// Created On       : Thu May 9 10:00:00 2019
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Dec 13 17:38:33 2019
    13 // Update Count     : 29
     12// Last Modified On : Mon Jan 11 20:48:38 2021
     13// Update Count     : 30
    1414//
    1515
     
    175175class TypeDecl final : public NamedTypeDecl {
    176176  public:
    177         enum Kind { Dtype, Otype, Ftype, Ttype, NUMBER_OF_KINDS };
     177        enum Kind { Dtype, DStype, Otype, Ftype, Ttype, ALtype, NUMBER_OF_KINDS };
    178178
    179179        Kind kind;
  • src/Parser/DeclarationNode.cc

    r4468a70 r342af53  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Oct  8 08:03:38 2020
    13 // Update Count     : 1135
     12// Last Modified On : Mon Jan 11 20:58:07 2021
     13// Update Count     : 1137
    1414//
    1515
     
    10751075        if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) {
    10761076                // otype is internally converted to dtype + otype parameters
    1077                 static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype };
    1078                 static_assert( sizeof(kindMap)/sizeof(kindMap[0]) == TypeDecl::NUMBER_OF_KINDS, "DeclarationNode::build: kindMap is out of sync." );
     1077                static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::DStype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype, TypeDecl::ALtype };
     1078                static_assert( sizeof(kindMap) / sizeof(kindMap[0]) == TypeDecl::NUMBER_OF_KINDS, "DeclarationNode::build: kindMap is out of sync." );
    10791079                assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." );
    10801080                TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == TypeDecl::Otype, variable.initializer ? variable.initializer->buildType() : nullptr );
  • src/Parser/ParseNode.h

    r4468a70 r342af53  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Oct 24 03:53:54 2020
    13 // Update Count     : 895
     12// Last Modified On : Sun Jan  3 18:23:01 2021
     13// Update Count     : 896
    1414//
    1515
     
    3939struct DeclarationNode;
    4040class DeclarationWithType;
     41class Initializer;
    4142class ExpressionNode;
    42 class Initializer;
    4343struct StatementNode;
    4444
  • src/Parser/parser.yy

    r4468a70 r342af53  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Oct 24 08:21:14 2020
    13 // Update Count     : 4624
     12// Last Modified On : Mon Jan 11 21:32:10 2021
     13// Update Count     : 4633
    1414//
    1515
     
    329329%type<en> conditional_expression                constant_expression                     assignment_expression           assignment_expression_opt
    330330%type<en> comma_expression                              comma_expression_opt
    331 %type<en> argument_expression_list_opt  argument_expression                     default_initialize_opt
     331%type<en> argument_expression_list_opt  argument_expression                     default_initializer_opt
    332332%type<ifctl> if_control_expression
    333333%type<fctl> for_control_expression              for_control_expression_list
     
    424424%type<decl> sue_declaration_specifier sue_declaration_specifier_nobody sue_type_specifier sue_type_specifier_nobody
    425425
    426 %type<tclass> type_class
     426%type<tclass> type_class new_type_class
    427427%type<decl> type_declarator type_declarator_name type_declaring_list
    428428
     
    15451545        | cfa_function_declaration
    15461546        | type_declaring_list
     1547                { SemanticError( yylloc, "otype declaration is currently unimplemented." ); $$ = nullptr; }
    15471548        | trait_specifier
    15481549        ;
     
    22232224        ;
    22242225
    2225 cfa_parameter_ellipsis_list_opt:                                                        // CFA, abstract + real
     2226cfa_parameter_ellipsis_list_opt:                                                // CFA, abstract + real
    22262227        // empty
    22272228                { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
     
    22802281cfa_parameter_declaration:                                                              // CFA, new & old style parameter declaration
    22812282        parameter_declaration
    2282         | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initialize_opt
     2283        | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initializer_opt
    22832284                { $$ = $1->addName( $2 ); }
    2284         | cfa_abstract_tuple identifier_or_type_name default_initialize_opt
     2285        | cfa_abstract_tuple identifier_or_type_name default_initializer_opt
    22852286                // To obtain LR(1), these rules must be duplicated here (see cfa_abstract_declarator).
    22862287                { $$ = $1->addName( $2 ); }
    2287         | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initialize_opt
     2288        | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initializer_opt
    22882289                { $$ = $2->addName( $3 )->addQualifiers( $1 ); }
    22892290        | cfa_function_specifier
     
    23022303parameter_declaration:
    23032304                // No SUE declaration in parameter list.
    2304         declaration_specifier_nobody identifier_parameter_declarator default_initialize_opt
     2305        declaration_specifier_nobody identifier_parameter_declarator default_initializer_opt
    23052306                { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
    2306         | declaration_specifier_nobody type_parameter_redeclarator default_initialize_opt
     2307        | declaration_specifier_nobody type_parameter_redeclarator default_initializer_opt
    23072308                { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
    23082309        ;
    23092310
    23102311abstract_parameter_declaration:
    2311         declaration_specifier_nobody default_initialize_opt
     2312        declaration_specifier_nobody default_initializer_opt
    23122313                { $$ = $1->addInitializer( $2 ? new InitializerNode( $2 ) : nullptr ); }
    2313         | declaration_specifier_nobody abstract_parameter_declarator default_initialize_opt
     2314        | declaration_specifier_nobody abstract_parameter_declarator default_initializer_opt
    23142315                { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
    23152316        ;
     
    24412442        type_class identifier_or_type_name
    24422443                { typedefTable.addToScope( *$2, TYPEDEFname, "9" ); }
    2443         type_initializer_opt assertion_list_opt
     2444          type_initializer_opt assertion_list_opt
    24442445                { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); }
    2445         | type_specifier identifier_parameter_declarator
     2446        | identifier_or_type_name new_type_class
     2447                { typedefTable.addToScope( *$1, TYPEDEFname, "9" ); }
     2448          type_initializer_opt assertion_list_opt
     2449                { $$ = DeclarationNode::newTypeParam( $2, $1 )->addTypeInitializer( $4 )->addAssertions( $5 ); }
     2450        | '[' identifier_or_type_name ']'
     2451                {
     2452                        typedefTable.addToScope( *$2, TYPEDEFname, "9" );
     2453                        $$ = DeclarationNode::newTypeParam( TypeDecl::ALtype, $2 );
     2454                }
     2455        // | type_specifier identifier_parameter_declarator
    24462456        | assertion_list
    24472457                { $$ = DeclarationNode::newTypeParam( TypeDecl::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); }
     2458        ;
     2459
     2460new_type_class:                                                                                 // CFA
     2461        // empty
     2462                { $$ = TypeDecl::Otype; }
     2463        | '&'
     2464                { $$ = TypeDecl::Dtype; }
     2465        | '*'
     2466                { $$ = TypeDecl::DStype; }                                              // dtype + sized
     2467        | ELLIPSIS
     2468                { $$ = TypeDecl::Ttype; }
    24482469        ;
    24492470
     
    34763497        ;
    34773498
    3478 default_initialize_opt:
     3499default_initializer_opt:
    34793500        // empty
    34803501                { $$ = nullptr; }
  • src/ResolvExpr/ResolveAssertions.cc

    r4468a70 r342af53  
    397397
    398398        /// Limit to depth of recursion of assertion satisfaction
    399         static const int recursionLimit = 4;
     399        static const int recursionLimit = 7;
    400400        /// Maximum number of simultaneously-deferred assertions to attempt concurrent satisfaction of
    401401        static const int deferLimit = 10;
  • src/ResolvExpr/SatisfyAssertions.cpp

    r4468a70 r342af53  
    5757                ast::UniqueId resnSlot;          ///< Slot for any recursive assertion IDs
    5858
    59                 AssnCandidate( 
    60                         const ast::SymbolTable::IdData c, const ast::Type * at, ast::TypeEnvironment && e, 
     59                AssnCandidate(
     60                        const ast::SymbolTable::IdData c, const ast::Type * at, ast::TypeEnvironment && e,
    6161                        ast::AssertionSet && h, ast::AssertionSet && n, ast::OpenVarSet && o, ast::UniqueId rs )
    62                 : cdata( c ), adjType( at ), env( std::move( e ) ), have( std::move( h ) ), 
     62                : cdata( c ), adjType( at ), env( std::move( e ) ), have( std::move( h ) ),
    6363                  need( std::move( n ) ), open( std::move( o ) ), resnSlot( rs ) {}
    6464        };
     
    7373                const AssnCandidate & match;
    7474        };
    75        
    76         /// Wrapper for the deferred items from a single assertion satisfaction. 
     75
     76        /// Wrapper for the deferred items from a single assertion satisfaction.
    7777        /// Acts like an indexed list of DeferRef
    7878        struct DeferItem {
     
    8181                AssnCandidateList matches;
    8282
    83                 DeferItem( 
     83                DeferItem(
    8484                        const ast::VariableExpr * d, const ast::AssertionSetValue & i, AssnCandidateList && ms )
    8585                : expr( d ), info( i ), matches( std::move( ms ) ) {}
     
    117117                /// Initial satisfaction state for a candidate
    118118                SatState( CandidateRef & c, const ast::SymbolTable & syms )
    119                 : cand( c ), need(), newNeed(), deferred(), inferred(), costs{ Cost::zero }, 
     119                : cand( c ), need(), newNeed(), deferred(), inferred(), costs{ Cost::zero },
    120120                  symtab( syms ) { need.swap( c->need ); }
    121                
     121
    122122                /// Update satisfaction state for next step after previous state
    123123                SatState( SatState && o, IterateFlag )
    124                 : cand( std::move( o.cand ) ), need( o.newNeed.begin(), o.newNeed.end() ), newNeed(), 
    125                   deferred(), inferred( std::move( o.inferred ) ), costs( std::move( o.costs ) ), 
     124                : cand( std::move( o.cand ) ), need( o.newNeed.begin(), o.newNeed.end() ), newNeed(),
     125                  deferred(), inferred( std::move( o.inferred ) ), costs( std::move( o.costs ) ),
    126126                  symtab( o.symtab ) { costs.emplace_back( Cost::zero ); }
    127                
     127
    128128                /// Field-wise next step constructor
    129129                SatState(
    130                         CandidateRef && c, ast::AssertionSet && nn, InferCache && i, CostVec && cs, 
     130                        CandidateRef && c, ast::AssertionSet && nn, InferCache && i, CostVec && cs,
    131131                        ast::SymbolTable && syms )
    132                 : cand( std::move( c ) ), need( nn.begin(), nn.end() ), newNeed(), deferred(), 
     132                : cand( std::move( c ) ), need( nn.begin(), nn.end() ), newNeed(), deferred(),
    133133                  inferred( std::move( i ) ), costs( std::move( cs ) ), symtab( std::move( syms ) )
    134134                  { costs.emplace_back( Cost::zero ); }
     
    143143
    144144        /// Binds a single assertion, updating satisfaction state
    145         void bindAssertion( 
    146                 const ast::VariableExpr * expr, const ast::AssertionSetValue & info, CandidateRef & cand, 
     145        void bindAssertion(
     146                const ast::VariableExpr * expr, const ast::AssertionSetValue & info, CandidateRef & cand,
    147147                AssnCandidate & match, InferCache & inferred
    148148        ) {
    149149                const ast::DeclWithType * candidate = match.cdata.id;
    150                 assertf( candidate->uniqueId, 
     150                assertf( candidate->uniqueId,
    151151                        "Assertion candidate does not have a unique ID: %s", toString( candidate ).c_str() );
    152                
     152
    153153                ast::Expr * varExpr = match.cdata.combine( cand->expr->location, cand->cvtCost );
    154154                varExpr->result = match.adjType;
     
    201201                        ast::OpenVarSet newOpen{ sat.cand->open };
    202202                        ast::ptr< ast::Type > toType = assn.first->result;
    203                         ast::ptr< ast::Type > adjType = 
     203                        ast::ptr< ast::Type > adjType =
    204204                                renameTyVars( adjustExprType( candidate->get_type(), newEnv, sat.symtab ), GEN_USAGE, false );
    205205
     
    213213                                }
    214214
    215                                 matches.emplace_back( 
     215                                matches.emplace_back(
    216216                                        cdata, adjType, std::move( newEnv ), std::move( have ), std::move( newNeed ),
    217217                                        std::move( newOpen ), crntResnSlot );
     
    287287        };
    288288
    289         /// Replace ResnSlots with InferParams and add alternative to output list, if it meets pruning 
     289        /// Replace ResnSlots with InferParams and add alternative to output list, if it meets pruning
    290290        /// threshold.
    291         void finalizeAssertions( 
    292                 CandidateRef & cand, InferCache & inferred, PruneMap & thresholds, CostVec && costs, 
    293                 CandidateList & out 
     291        void finalizeAssertions(
     292                CandidateRef & cand, InferCache & inferred, PruneMap & thresholds, CostVec && costs,
     293                CandidateList & out
    294294        ) {
    295295                // prune if cheaper alternative for same key has already been generated
     
    308308        }
    309309
    310         /// Combo iterator that combines candidates into an output list, merging their environments. 
    311         /// Rejects an appended candidate if environments cannot be merged. See `Common/FilterCombos.h` 
     310        /// Combo iterator that combines candidates into an output list, merging their environments.
     311        /// Rejects an appended candidate if environments cannot be merged. See `Common/FilterCombos.h`
    312312        /// for description of "combo iterator".
    313313        class CandidateEnvMerger {
     
    390390} // anonymous namespace
    391391
    392 void satisfyAssertions( 
    393         CandidateRef & cand, const ast::SymbolTable & symtab, CandidateList & out, 
     392void satisfyAssertions(
     393        CandidateRef & cand, const ast::SymbolTable & symtab, CandidateList & out,
    394394        std::vector<std::string> & errors
    395395) {
     
    418418
    419419                        // should a limit be imposed? worst case here is O(n^2) but very unlikely to happen.
    420                         for (unsigned resetCount = 0; ; ++resetCount) { 
     420                        for (unsigned resetCount = 0; ; ++resetCount) {
    421421                                ast::AssertionList next;
    422422                                resetTyVarRenaming();
     
    449449                                // either add successful match or push back next state
    450450                                if ( sat.newNeed.empty() ) {
    451                                         finalizeAssertions( 
     451                                        finalizeAssertions(
    452452                                                sat.cand, sat.inferred, thresholds, std::move( sat.costs ), out );
    453453                                } else {
     
    471471                                std::vector< CandidateEnvMerger::OutType > compatible = filterCombos(
    472472                                        sat.deferred, CandidateEnvMerger{ sat.cand->env, sat.cand->open, sat.symtab } );
    473                                
     473
    474474                                // fail early if no mutually-compatible assertion satisfaction
    475475                                if ( compatible.empty() ) {
     
    494494                                        // set up next satisfaction state
    495495                                        CandidateRef nextCand = std::make_shared<Candidate>(
    496                                                 sat.cand->expr, std::move( compat.env ), std::move( compat.open ), 
     496                                                sat.cand->expr, std::move( compat.env ), std::move( compat.open ),
    497497                                                ast::AssertionSet{} /* need moved into satisfaction state */,
    498498                                                sat.cand->cost, sat.cand->cvtCost );
     
    500500                                        ast::AssertionSet nextNewNeed{ sat.newNeed };
    501501                                        InferCache nextInferred{ sat.inferred };
    502                                        
     502
    503503                                        CostVec nextCosts{ sat.costs };
    504504                                        nextCosts.back() += compat.cost;
    505                                                                
     505
    506506                                        ast::SymbolTable nextSymtab{ sat.symtab };
    507507
     
    517517                                        // either add successful match or push back next state
    518518                                        if ( nextNewNeed.empty() ) {
    519                                                 finalizeAssertions( 
     519                                                finalizeAssertions(
    520520                                                        nextCand, nextInferred, thresholds, std::move( nextCosts ), out );
    521521                                        } else {
    522                                                 nextSats.emplace_back( 
    523                                                         std::move( nextCand ), std::move( nextNewNeed ), 
    524                                                         std::move( nextInferred ), std::move( nextCosts ), 
     522                                                nextSats.emplace_back(
     523                                                        std::move( nextCand ), std::move( nextNewNeed ),
     524                                                        std::move( nextInferred ), std::move( nextCosts ),
    525525                                                        std::move( nextSymtab ) );
    526526                                        }
     
    534534                nextSats.clear();
    535535        }
    536        
     536
    537537        // exceeded recursion limit if reaches here
    538538        if ( out.empty() ) {
  • src/SymTab/Demangle.cc

    r4468a70 r342af53  
    1010// Created On       : Thu Jul 19 12:52:41 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb 11 15:09:18 2020
    13 // Update Count     : 10
     12// Last Modified On : Mon Jan 11 21:28:27 2021
     13// Update Count     : 11
    1414//
    1515
     
    367367                                // type variable types
    368368                                for (size_t k = 0; k < TypeDecl::NUMBER_OF_KINDS; ++k) {
    369                                         static const std::string typeVariableNames[] = { "DT", "OT", "FT", "TT", };
     369                                        static const std::string typeVariableNames[] = { "DT", "DST", "OT", "FT", "TT", "ALT", };
    370370                                        static_assert(
    371371                                                sizeof(typeVariableNames)/sizeof(typeVariableNames[0]) == TypeDecl::NUMBER_OF_KINDS,
  • src/SymTab/Mangler.cc

    r4468a70 r342af53  
    1010// Created On       : Sun May 17 21:40:29 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Nov 18 12:01:38 2020
    13 // Update Count     : 64
     12// Last Modified On : Mon Jan 11 21:56:06 2021
     13// Update Count     : 74
    1414//
    1515#include "Mangler.h"
     
    313313                                // and the case has not yet come up in practice. Alternatively, if not then this code can be removed
    314314                                // aside from the assert false.
    315                                 assertf(false, "Mangler_old should not visit typedecl: %s", toCString(decl));
     315                                assertf( false, "Mangler_old should not visit typedecl: %s", toCString(decl));
    316316                                assertf( decl->kind < TypeDecl::NUMBER_OF_KINDS, "Unhandled type variable kind: %d", decl->kind );
    317317                                mangleName += Encoding::typeVariables[ decl->kind ] + std::to_string( decl->name.length() ) + decl->name;
     
    343343                                                        break;
    344344                                                  default:
    345                                                         assert( false );
     345                                                        assertf( false, "unimplemented kind for type variable %s", SymTab::Mangler::Encoding::typeVariables[i->kind].c_str() );
    346346                                                } // switch
    347347                                                varNums[ i->name ] = std::make_pair( nextVarNum, (int)i->kind );
     
    673673                                        for ( auto & decl : ptype->forall ) {
    674674                                                switch ( decl->kind ) {
    675                                                 case ast::TypeDecl::Kind::Dtype:
     675                                                  case ast::TypeDecl::Kind::Dtype:
    676676                                                        dcount++;
    677677                                                        break;
    678                                                 case ast::TypeDecl::Kind::Ftype:
     678                                                  case ast::TypeDecl::Kind::Ftype:
    679679                                                        fcount++;
    680680                                                        break;
    681                                                 case ast::TypeDecl::Kind::Ttype:
     681                                                  case ast::TypeDecl::Kind::Ttype:
    682682                                                        vcount++;
    683683                                                        break;
    684                                                 default:
    685                                                         assert( false );
     684                                                  default:
     685                                                        assertf( false, "unimplemented kind for type variable %s", SymTab::Mangler::Encoding::typeVariables[decl->kind].c_str() );
    686686                                                } // switch
    687687                                                varNums[ decl->name ] = std::make_pair( nextVarNum, (int)decl->kind );
  • src/SymTab/ManglerCommon.cc

    r4468a70 r342af53  
    1010// Created On       : Sun May 17 21:44:03 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Dec 13 14:54:38 2019
    13 // Update Count     : 28
     12// Last Modified On : Mon Jan 11 21:23:10 2021
     13// Update Count     : 29
    1414//
    1515
     
    104104                        const std::string typeVariables[] = {
    105105                                "BD", // dtype
     106                                "BDS", // dtype + sized
    106107                                "BO", // otype
    107108                                "BF", // ftype
    108109                                "BT", // ttype
     110                                "BAL", // array length type
    109111                        };
    110112                        static_assert(
    111                                 sizeof(typeVariables)/sizeof(typeVariables[0]) == TypeDecl::NUMBER_OF_KINDS,
     113                                sizeof(typeVariables) / sizeof(typeVariables[0]) == TypeDecl::NUMBER_OF_KINDS,
    112114                                "Each type variable kind should have a corresponding mangler prefix"
    113115                        );
  • src/SynTree/Declaration.h

    r4468a70 r342af53  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Dec 13 23:11:22 2019
    13 // Update Count     : 157
     12// Last Modified On : Mon Jan 11 20:48:39 2021
     13// Update Count     : 158
    1414//
    1515
     
    201201        typedef NamedTypeDecl Parent;
    202202  public:
    203         enum Kind { Dtype, Otype, Ftype, Ttype, NUMBER_OF_KINDS };
     203        enum Kind { Dtype, DStype, Otype, Ftype, Ttype, ALtype, NUMBER_OF_KINDS };
    204204
    205205        Kind kind;
  • src/SynTree/TypeDecl.cc

    r4468a70 r342af53  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Oct  8 18:18:55 2020
    13 // Update Count     : 22
     12// Last Modified On : Tue Jan 12 16:07:33 2021
     13// Update Count     : 26
    1414//
    1515
     
    3333
    3434const char * TypeDecl::typeString() const {
    35         static const char * kindNames[] = { "sized data type", "sized object type", "sized function type", "sized tuple type" };
    36         static_assert( sizeof(kindNames)/sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "typeString: kindNames is out of sync." );
     35        static const char * kindNames[] = { "sized data type", "sized data type", "sized object type", "sized function type", "sized tuple type", "sized array length type" };
     36        static_assert( sizeof(kindNames) / sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "typeString: kindNames is out of sync." );
    3737        assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDecl kind is out of bounds." );
    3838        return isComplete() ? kindNames[ kind ] : &kindNames[ kind ][ sizeof("sized") ]; // sizeof includes '\0'
     
    4040
    4141const char * TypeDecl::genTypeString() const {
    42         static const char * kindNames[] = { "dtype", "otype", "ftype", "ttype" };
    43         static_assert( sizeof(kindNames)/sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "genTypeString: kindNames is out of sync." );
     42        static const char * kindNames[] = { "T &", "T *", "T", "(*)", "T ...", "[T]" };
     43        static_assert( sizeof(kindNames) / sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "genTypeString: kindNames is out of sync." );
    4444        assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDecl kind is out of bounds." );
    4545        return kindNames[ kind ];
Note: See TracChangeset for help on using the changeset viewer.