Changeset b66d14a
- Timestamp:
- Jan 11, 2021, 10:10:33 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 20207c0
- Parents:
- 2501ae5
- Location:
- src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/AST/Decl.cpp ¶
r2501ae5 rb66d14a 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 : Mon Jan 11 20:53:23 2021 13 // Update Count : 21 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[] = { "data type", "sized data type", "sized object type", "sized function type", "sized tuple type", "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 ]; -
TabularUnified src/AST/Decl.hpp ¶
r2501ae5 rb66d14a 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; -
TabularUnified src/Parser/DeclarationNode.cc ¶
r2501ae5 rb66d14a 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 ); -
TabularUnified src/Parser/parser.yy ¶
r2501ae5 rb66d14a 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jan 11 14:14:16202113 // Update Count : 463 012 // Last Modified On : Mon Jan 11 21:32:10 2021 13 // Update Count : 4633 14 14 // 15 15 … … 2449 2449 { $$ = DeclarationNode::newTypeParam( $2, $1 )->addTypeInitializer( $4 )->addAssertions( $5 ); } 2450 2450 | '[' identifier_or_type_name ']' 2451 { typedefTable.addToScope( *$2, TYPEDEFname, "9" ); } 2451 { 2452 typedefTable.addToScope( *$2, TYPEDEFname, "9" ); 2453 $$ = DeclarationNode::newTypeParam( TypeDecl::ALtype, $2 ); 2454 } 2452 2455 // | type_specifier identifier_parameter_declarator 2453 2456 | assertion_list … … 2461 2464 { $$ = TypeDecl::Dtype; } 2462 2465 | '*' 2463 { $$ = TypeDecl::D type; } // dtype + sized2466 { $$ = TypeDecl::DStype; } // dtype + sized 2464 2467 | ELLIPSIS 2465 2468 { $$ = TypeDecl::Ttype; } -
TabularUnified src/SymTab/Demangle.cc ¶
r2501ae5 rb66d14a 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, -
TabularUnified src/SymTab/Mangler.cc ¶
r2501ae5 rb66d14a 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 ); -
TabularUnified src/SymTab/ManglerCommon.cc ¶
r2501ae5 rb66d14a 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 ); -
TabularUnified src/SynTree/Declaration.h ¶
r2501ae5 rb66d14a 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; -
TabularUnified src/SynTree/TypeDecl.cc ¶
r2501ae5 rb66d14a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Oct 8 18:18:55 202013 // Update Count : 2 212 // Last Modified On : Mon Jan 11 21:26:50 2021 13 // Update Count : 23 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" };35 static const char * kindNames[] = { "data type", "sized data type", "sized object type", "sized function type", "sized tuple type", "array length type" }; 36 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." ); … … 40 40 41 41 const char * TypeDecl::genTypeString() const { 42 static const char * kindNames[] = { " dtype", "otype", "ftype", "ttype" };42 static const char * kindNames[] = { "T &", "T *", "T", "(*)", "T ...", "[T]" }; 43 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." );
Note: See TracChangeset
for help on using the changeset viewer.