- Timestamp:
- Jan 14, 2021, 12:23:14 PM (5 years ago)
- 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. - Location:
- src
- Files:
-
- 12 edited
-
AST/Decl.cpp (modified) (3 diffs)
-
AST/Decl.hpp (modified) (2 diffs)
-
Parser/DeclarationNode.cc (modified) (2 diffs)
-
Parser/ParseNode.h (modified) (2 diffs)
-
Parser/parser.yy (modified) (9 diffs)
-
ResolvExpr/ResolveAssertions.cc (modified) (1 diff)
-
ResolvExpr/SatisfyAssertions.cpp (modified) (17 diffs)
-
SymTab/Demangle.cc (modified) (2 diffs)
-
SymTab/Mangler.cc (modified) (4 diffs)
-
SymTab/ManglerCommon.cc (modified) (2 diffs)
-
SynTree/Declaration.h (modified) (2 diffs)
-
SynTree/TypeDecl.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.cpp
r4468a70 r342af53 10 10 // Created On : Thu May 9 10:00:00 2019 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Dec 13 16:23:15 201913 // Update Count : 2 012 // Last Modified On : Tue Jan 12 16:54:55 2021 13 // Update Count : 23 14 14 // 15 15 … … 78 78 79 79 const char * TypeDecl::typeString() const { 80 static const char * kindNames[] = { "sized data type", "sized object type", "sized function type", "sized tupletype" };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." ); 82 82 assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDecl kind is out of bounds." ); 83 83 return sized ? kindNames[ kind ] : &kindNames[ kind ][ sizeof("sized") ]; // sizeof includes '\0' … … 85 85 86 86 const 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." ); 89 89 assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDecl kind is out of bounds." ); 90 90 return kindNames[ kind ]; -
src/AST/Decl.hpp
r4468a70 r342af53 10 10 // Created On : Thu May 9 10:00:00 2019 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Dec 13 17:38:33 201913 // Update Count : 2912 // Last Modified On : Mon Jan 11 20:48:38 2021 13 // Update Count : 30 14 14 // 15 15 … … 175 175 class TypeDecl final : public NamedTypeDecl { 176 176 public: 177 enum Kind { Dtype, Otype, Ftype, Ttype, NUMBER_OF_KINDS };177 enum Kind { Dtype, DStype, Otype, Ftype, Ttype, ALtype, NUMBER_OF_KINDS }; 178 178 179 179 Kind kind; -
src/Parser/DeclarationNode.cc
r4468a70 r342af53 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Oct 8 08:03:38 202013 // Update Count : 113 512 // Last Modified On : Mon Jan 11 20:58:07 2021 13 // Update Count : 1137 14 14 // 15 15 … … 1075 1075 if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) { 1076 1076 // otype is internally converted to dtype + otype parameters 1077 static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::D type, 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." ); 1079 1079 assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." ); 1080 1080 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 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at Oct 24 03:53:54 202013 // Update Count : 89 512 // Last Modified On : Sun Jan 3 18:23:01 2021 13 // Update Count : 896 14 14 // 15 15 … … 39 39 struct DeclarationNode; 40 40 class DeclarationWithType; 41 class Initializer; 41 42 class ExpressionNode; 42 class Initializer;43 43 struct StatementNode; 44 44 -
src/Parser/parser.yy
r4468a70 r342af53 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Oct 24 08:21:14 202013 // Update Count : 46 2412 // Last Modified On : Mon Jan 11 21:32:10 2021 13 // Update Count : 4633 14 14 // 15 15 … … 329 329 %type<en> conditional_expression constant_expression assignment_expression assignment_expression_opt 330 330 %type<en> comma_expression comma_expression_opt 331 %type<en> argument_expression_list_opt argument_expression default_initialize _opt331 %type<en> argument_expression_list_opt argument_expression default_initializer_opt 332 332 %type<ifctl> if_control_expression 333 333 %type<fctl> for_control_expression for_control_expression_list … … 424 424 %type<decl> sue_declaration_specifier sue_declaration_specifier_nobody sue_type_specifier sue_type_specifier_nobody 425 425 426 %type<tclass> type_class 426 %type<tclass> type_class new_type_class 427 427 %type<decl> type_declarator type_declarator_name type_declaring_list 428 428 … … 1545 1545 | cfa_function_declaration 1546 1546 | type_declaring_list 1547 { SemanticError( yylloc, "otype declaration is currently unimplemented." ); $$ = nullptr; } 1547 1548 | trait_specifier 1548 1549 ; … … 2223 2224 ; 2224 2225 2225 cfa_parameter_ellipsis_list_opt: // CFA, abstract + real2226 cfa_parameter_ellipsis_list_opt: // CFA, abstract + real 2226 2227 // empty 2227 2228 { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); } … … 2280 2281 cfa_parameter_declaration: // CFA, new & old style parameter declaration 2281 2282 parameter_declaration 2282 | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initialize _opt2283 | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initializer_opt 2283 2284 { $$ = $1->addName( $2 ); } 2284 | cfa_abstract_tuple identifier_or_type_name default_initialize _opt2285 | cfa_abstract_tuple identifier_or_type_name default_initializer_opt 2285 2286 // To obtain LR(1), these rules must be duplicated here (see cfa_abstract_declarator). 2286 2287 { $$ = $1->addName( $2 ); } 2287 | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initialize _opt2288 | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initializer_opt 2288 2289 { $$ = $2->addName( $3 )->addQualifiers( $1 ); } 2289 2290 | cfa_function_specifier … … 2302 2303 parameter_declaration: 2303 2304 // No SUE declaration in parameter list. 2304 declaration_specifier_nobody identifier_parameter_declarator default_initialize _opt2305 declaration_specifier_nobody identifier_parameter_declarator default_initializer_opt 2305 2306 { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); } 2306 | declaration_specifier_nobody type_parameter_redeclarator default_initialize _opt2307 | declaration_specifier_nobody type_parameter_redeclarator default_initializer_opt 2307 2308 { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); } 2308 2309 ; 2309 2310 2310 2311 abstract_parameter_declaration: 2311 declaration_specifier_nobody default_initialize _opt2312 declaration_specifier_nobody default_initializer_opt 2312 2313 { $$ = $1->addInitializer( $2 ? new InitializerNode( $2 ) : nullptr ); } 2313 | declaration_specifier_nobody abstract_parameter_declarator default_initialize _opt2314 | declaration_specifier_nobody abstract_parameter_declarator default_initializer_opt 2314 2315 { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); } 2315 2316 ; … … 2441 2442 type_class identifier_or_type_name 2442 2443 { typedefTable.addToScope( *$2, TYPEDEFname, "9" ); } 2443 type_initializer_opt assertion_list_opt2444 type_initializer_opt assertion_list_opt 2444 2445 { $$ = 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 2446 2456 | assertion_list 2447 2457 { $$ = DeclarationNode::newTypeParam( TypeDecl::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); } 2458 ; 2459 2460 new_type_class: // CFA 2461 // empty 2462 { $$ = TypeDecl::Otype; } 2463 | '&' 2464 { $$ = TypeDecl::Dtype; } 2465 | '*' 2466 { $$ = TypeDecl::DStype; } // dtype + sized 2467 | ELLIPSIS 2468 { $$ = TypeDecl::Ttype; } 2448 2469 ; 2449 2470 … … 3476 3497 ; 3477 3498 3478 default_initialize _opt:3499 default_initializer_opt: 3479 3500 // empty 3480 3501 { $$ = nullptr; } -
src/ResolvExpr/ResolveAssertions.cc
r4468a70 r342af53 397 397 398 398 /// Limit to depth of recursion of assertion satisfaction 399 static const int recursionLimit = 4;399 static const int recursionLimit = 7; 400 400 /// Maximum number of simultaneously-deferred assertions to attempt concurrent satisfaction of 401 401 static const int deferLimit = 10; -
src/ResolvExpr/SatisfyAssertions.cpp
r4468a70 r342af53 57 57 ast::UniqueId resnSlot; ///< Slot for any recursive assertion IDs 58 58 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, 61 61 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 ) ), 63 63 need( std::move( n ) ), open( std::move( o ) ), resnSlot( rs ) {} 64 64 }; … … 73 73 const AssnCandidate & match; 74 74 }; 75 76 /// Wrapper for the deferred items from a single assertion satisfaction. 75 76 /// Wrapper for the deferred items from a single assertion satisfaction. 77 77 /// Acts like an indexed list of DeferRef 78 78 struct DeferItem { … … 81 81 AssnCandidateList matches; 82 82 83 DeferItem( 83 DeferItem( 84 84 const ast::VariableExpr * d, const ast::AssertionSetValue & i, AssnCandidateList && ms ) 85 85 : expr( d ), info( i ), matches( std::move( ms ) ) {} … … 117 117 /// Initial satisfaction state for a candidate 118 118 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 }, 120 120 symtab( syms ) { need.swap( c->need ); } 121 121 122 122 /// Update satisfaction state for next step after previous state 123 123 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 ) ), 126 126 symtab( o.symtab ) { costs.emplace_back( Cost::zero ); } 127 127 128 128 /// Field-wise next step constructor 129 129 SatState( 130 CandidateRef && c, ast::AssertionSet && nn, InferCache && i, CostVec && cs, 130 CandidateRef && c, ast::AssertionSet && nn, InferCache && i, CostVec && cs, 131 131 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(), 133 133 inferred( std::move( i ) ), costs( std::move( cs ) ), symtab( std::move( syms ) ) 134 134 { costs.emplace_back( Cost::zero ); } … … 143 143 144 144 /// 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, 147 147 AssnCandidate & match, InferCache & inferred 148 148 ) { 149 149 const ast::DeclWithType * candidate = match.cdata.id; 150 assertf( candidate->uniqueId, 150 assertf( candidate->uniqueId, 151 151 "Assertion candidate does not have a unique ID: %s", toString( candidate ).c_str() ); 152 152 153 153 ast::Expr * varExpr = match.cdata.combine( cand->expr->location, cand->cvtCost ); 154 154 varExpr->result = match.adjType; … … 201 201 ast::OpenVarSet newOpen{ sat.cand->open }; 202 202 ast::ptr< ast::Type > toType = assn.first->result; 203 ast::ptr< ast::Type > adjType = 203 ast::ptr< ast::Type > adjType = 204 204 renameTyVars( adjustExprType( candidate->get_type(), newEnv, sat.symtab ), GEN_USAGE, false ); 205 205 … … 213 213 } 214 214 215 matches.emplace_back( 215 matches.emplace_back( 216 216 cdata, adjType, std::move( newEnv ), std::move( have ), std::move( newNeed ), 217 217 std::move( newOpen ), crntResnSlot ); … … 287 287 }; 288 288 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 290 290 /// 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 294 294 ) { 295 295 // prune if cheaper alternative for same key has already been generated … … 308 308 } 309 309 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` 312 312 /// for description of "combo iterator". 313 313 class CandidateEnvMerger { … … 390 390 } // anonymous namespace 391 391 392 void satisfyAssertions( 393 CandidateRef & cand, const ast::SymbolTable & symtab, CandidateList & out, 392 void satisfyAssertions( 393 CandidateRef & cand, const ast::SymbolTable & symtab, CandidateList & out, 394 394 std::vector<std::string> & errors 395 395 ) { … … 418 418 419 419 // 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) { 421 421 ast::AssertionList next; 422 422 resetTyVarRenaming(); … … 449 449 // either add successful match or push back next state 450 450 if ( sat.newNeed.empty() ) { 451 finalizeAssertions( 451 finalizeAssertions( 452 452 sat.cand, sat.inferred, thresholds, std::move( sat.costs ), out ); 453 453 } else { … … 471 471 std::vector< CandidateEnvMerger::OutType > compatible = filterCombos( 472 472 sat.deferred, CandidateEnvMerger{ sat.cand->env, sat.cand->open, sat.symtab } ); 473 473 474 474 // fail early if no mutually-compatible assertion satisfaction 475 475 if ( compatible.empty() ) { … … 494 494 // set up next satisfaction state 495 495 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 ), 497 497 ast::AssertionSet{} /* need moved into satisfaction state */, 498 498 sat.cand->cost, sat.cand->cvtCost ); … … 500 500 ast::AssertionSet nextNewNeed{ sat.newNeed }; 501 501 InferCache nextInferred{ sat.inferred }; 502 502 503 503 CostVec nextCosts{ sat.costs }; 504 504 nextCosts.back() += compat.cost; 505 505 506 506 ast::SymbolTable nextSymtab{ sat.symtab }; 507 507 … … 517 517 // either add successful match or push back next state 518 518 if ( nextNewNeed.empty() ) { 519 finalizeAssertions( 519 finalizeAssertions( 520 520 nextCand, nextInferred, thresholds, std::move( nextCosts ), out ); 521 521 } 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 ), 525 525 std::move( nextSymtab ) ); 526 526 } … … 534 534 nextSats.clear(); 535 535 } 536 536 537 537 // exceeded recursion limit if reaches here 538 538 if ( out.empty() ) { -
src/SymTab/Demangle.cc
r4468a70 r342af53 10 10 // Created On : Thu Jul 19 12:52:41 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 11 15:09:18 202013 // Update Count : 1 012 // Last Modified On : Mon Jan 11 21:28:27 2021 13 // Update Count : 11 14 14 // 15 15 … … 367 367 // type variable types 368 368 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", }; 370 370 static_assert( 371 371 sizeof(typeVariableNames)/sizeof(typeVariableNames[0]) == TypeDecl::NUMBER_OF_KINDS, -
src/SymTab/Mangler.cc
r4468a70 r342af53 10 10 // Created On : Sun May 17 21:40:29 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Nov 18 12:01:38 202013 // Update Count : 6412 // Last Modified On : Mon Jan 11 21:56:06 2021 13 // Update Count : 74 14 14 // 15 15 #include "Mangler.h" … … 313 313 // and the case has not yet come up in practice. Alternatively, if not then this code can be removed 314 314 // 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)); 316 316 assertf( decl->kind < TypeDecl::NUMBER_OF_KINDS, "Unhandled type variable kind: %d", decl->kind ); 317 317 mangleName += Encoding::typeVariables[ decl->kind ] + std::to_string( decl->name.length() ) + decl->name; … … 343 343 break; 344 344 default: 345 assert ( false);345 assertf( false, "unimplemented kind for type variable %s", SymTab::Mangler::Encoding::typeVariables[i->kind].c_str() ); 346 346 } // switch 347 347 varNums[ i->name ] = std::make_pair( nextVarNum, (int)i->kind ); … … 673 673 for ( auto & decl : ptype->forall ) { 674 674 switch ( decl->kind ) { 675 case ast::TypeDecl::Kind::Dtype:675 case ast::TypeDecl::Kind::Dtype: 676 676 dcount++; 677 677 break; 678 case ast::TypeDecl::Kind::Ftype:678 case ast::TypeDecl::Kind::Ftype: 679 679 fcount++; 680 680 break; 681 case ast::TypeDecl::Kind::Ttype:681 case ast::TypeDecl::Kind::Ttype: 682 682 vcount++; 683 683 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() ); 686 686 } // switch 687 687 varNums[ decl->name ] = std::make_pair( nextVarNum, (int)decl->kind ); -
src/SymTab/ManglerCommon.cc
r4468a70 r342af53 10 10 // Created On : Sun May 17 21:44:03 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Dec 13 14:54:38 201913 // Update Count : 2 812 // Last Modified On : Mon Jan 11 21:23:10 2021 13 // Update Count : 29 14 14 // 15 15 … … 104 104 const std::string typeVariables[] = { 105 105 "BD", // dtype 106 "BDS", // dtype + sized 106 107 "BO", // otype 107 108 "BF", // ftype 108 109 "BT", // ttype 110 "BAL", // array length type 109 111 }; 110 112 static_assert( 111 sizeof(typeVariables) /sizeof(typeVariables[0]) == TypeDecl::NUMBER_OF_KINDS,113 sizeof(typeVariables) / sizeof(typeVariables[0]) == TypeDecl::NUMBER_OF_KINDS, 112 114 "Each type variable kind should have a corresponding mangler prefix" 113 115 ); -
src/SynTree/Declaration.h
r4468a70 r342af53 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Dec 13 23:11:22 201913 // Update Count : 15 712 // Last Modified On : Mon Jan 11 20:48:39 2021 13 // Update Count : 158 14 14 // 15 15 … … 201 201 typedef NamedTypeDecl Parent; 202 202 public: 203 enum Kind { Dtype, Otype, Ftype, Ttype, NUMBER_OF_KINDS };203 enum Kind { Dtype, DStype, Otype, Ftype, Ttype, ALtype, NUMBER_OF_KINDS }; 204 204 205 205 Kind kind; -
src/SynTree/TypeDecl.cc
r4468a70 r342af53 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Oct 8 18:18:55 202013 // Update Count : 2 212 // Last Modified On : Tue Jan 12 16:07:33 2021 13 // Update Count : 26 14 14 // 15 15 … … 33 33 34 34 const char * TypeDecl::typeString() const { 35 static const char * kindNames[] = { "sized data type", "sized object type", "sized function type", "sized tupletype" };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." ); 37 37 assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDecl kind is out of bounds." ); 38 38 return isComplete() ? kindNames[ kind ] : &kindNames[ kind ][ sizeof("sized") ]; // sizeof includes '\0' … … 40 40 41 41 const 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." ); 44 44 assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDecl kind is out of bounds." ); 45 45 return kindNames[ kind ];
Note:
See TracChangeset
for help on using the changeset viewer.