Changeset e048ece


Ignore:
Timestamp:
Mar 11, 2024, 1:00:41 PM (2 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
6c8b76b
Parents:
9398177
Message:

Moved the DeclarationNode? enums over to TypeData? where they are actually used.

Location:
src/Parser
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r9398177 re048ece  
    4545
    4646using namespace std;
    47 
    48 // These must harmonize with the corresponding DeclarationNode enumerations.
    49 const char * DeclarationNode::basicTypeNames[] = {
    50         "void", "_Bool", "char", "int", "int128",
    51         "float", "double", "long double", "float80", "float128",
    52         "_float16", "_float32", "_float32x", "_float64", "_float64x", "_float128", "_float128x", "NoBasicTypeNames"
    53 };
    54 const char * DeclarationNode::complexTypeNames[] = {
    55         "_Complex", "NoComplexTypeNames", "_Imaginary"
    56 }; // Imaginary unsupported => parse, but make invisible and print error message
    57 const char * DeclarationNode::signednessNames[] = {
    58         "signed", "unsigned", "NoSignednessNames"
    59 };
    60 const char * DeclarationNode::lengthNames[] = {
    61         "short", "long", "long long", "NoLengthNames"
    62 };
    63 const char * DeclarationNode::builtinTypeNames[] = {
    64         "__builtin_va_list", "__auto_type", "zero_t", "one_t", "NoBuiltinTypeNames"
    65 };
    6647
    6748UniqueName DeclarationNode::anonymous( "__anonymous" );
     
    484465
    485466        checkQualifiers( type, q->type );
    486         BuiltinType const builtin = type->builtintype;
    487         if ( (builtin == Zero || builtin == One) && q->type->qualifiers.any() && error.length() == 0 ) {
    488                 SemanticWarning( yylloc, Warning::BadQualifiersZeroOne, builtinTypeNames[builtin] );
     467        TypeData::BuiltinType const builtin = type->builtintype;
     468        if ( (builtin == TypeData::Zero || builtin == TypeData::One) && q->type->qualifiers.any() && error.length() == 0 ) {
     469                SemanticWarning( yylloc, Warning::BadQualifiersZeroOne, TypeData::builtinTypeNames[builtin] );
    489470        } // if
    490471        type = ::addQualifiers( q->type, type );
  • src/Parser/DeclarationNode.h

    r9398177 re048ece  
    2222
    2323struct DeclarationNode final : public ParseList<DeclarationNode> {
    24         // These enumerations must harmonize with their names in DeclarationNode.cc.
    25         enum BasicType {
    26                 Void, Bool, Char, Int, Int128,
    27                 Float, Double, LongDouble, uuFloat80, uuFloat128,
    28                 uFloat16, uFloat32, uFloat32x, uFloat64, uFloat64x, uFloat128, uFloat128x,
    29                 NoBasicType
    30         };
    31         static const char * basicTypeNames[];
    32         enum ComplexType { Complex, NoComplexType, Imaginary };
    33         // Imaginary unsupported => parse, but make invisible and print error message
    34         static const char * complexTypeNames[];
    35         enum Signedness { Signed, Unsigned, NoSignedness };
    36         static const char * signednessNames[];
    37         enum Length { Short, Long, LongLong, NoLength };
    38         static const char * lengthNames[];
    39         enum BuiltinType { Valist, AutoType, Zero, One, NoBuiltinType };
    40         static const char * builtinTypeNames[];
    41 
    4224        static DeclarationNode * newFromTypeData( TypeData * );
    4325        static DeclarationNode * newStorageClass( ast::Storage::Classes );
  • src/Parser/ExpressionNode.cc

    r9398177 re048ece  
    319319                                DeclarationNode::newFromTypeData(
    320320                                        addType(
    321                                                 build_basic_type( DeclarationNode::Int128 ),
    322                                                 build_signedness( DeclarationNode::Unsigned ) ) ),
     321                                                build_basic_type( TypeData::Int128 ),
     322                                                build_signedness( TypeData::Unsigned ) ) ),
    323323                                new InitializerNode(
    324324                                        (new InitializerNode( new ExpressionNode( v2 == 0 ? ret2 : ret ) ))->set_last( new InitializerNode( new ExpressionNode( v2 == 0 ? ret : ret2 ) ) ), true )
  • src/Parser/TypeData.cc

    r9398177 re048ece  
    3333using namespace std;
    3434
     35// These must harmonize with the corresponding enumerations in the header.
     36const char * TypeData::basicTypeNames[] = {
     37        "void", "_Bool", "char", "int", "int128",
     38        "float", "double", "long double", "float80", "float128",
     39        "_float16", "_float32", "_float32x", "_float64", "_float64x", "_float128", "_float128x",
     40        "NoBasicTypeNames"
     41};
     42const char * TypeData::complexTypeNames[] = {
     43        "_Complex", "NoComplexTypeNames", "_Imaginary"
     44}; // Imaginary unsupported => parse, but make invisible and print error message
     45const char * TypeData::signednessNames[] = {
     46        "signed", "unsigned", "NoSignednessNames"
     47};
     48const char * TypeData::lengthNames[] = {
     49        "short", "long", "long long", "NoLengthNames"
     50};
     51const char * TypeData::builtinTypeNames[] = {
     52        "__builtin_va_list", "__auto_type", "zero_t", "one_t", "NoBuiltinTypeNames"
     53};
     54
    3555TypeData::TypeData( Kind k ) : location( yylloc ), kind( k ), base( nullptr ), forall( nullptr ) /*, PTR1( (void*)(0xdeadbeefdeadbeef)), PTR2( (void*)(0xdeadbeefdeadbeef) ) */ {
    3656        switch ( kind ) {
     
    239259                break;
    240260        case Builtin:
    241                 assert( builtintype == DeclarationNode::Zero || builtintype == DeclarationNode::One );
     261                assert( builtintype == Zero || builtintype == One );
    242262                newtype->builtintype = builtintype;
    243263                break;
     
    261281        switch ( kind ) {
    262282        case Basic:
    263                 if ( signedness != DeclarationNode::NoSignedness ) os << DeclarationNode::signednessNames[ signedness ] << " ";
    264                 if ( length != DeclarationNode::NoLength ) os << DeclarationNode::lengthNames[ length ] << " ";
    265                 if ( complextype != DeclarationNode::NoComplexType ) os << DeclarationNode::complexTypeNames[ complextype ] << " ";
    266                 if ( basictype != DeclarationNode::NoBasicType ) os << DeclarationNode::basicTypeNames[ basictype ] << " ";
     283                if ( signedness != NoSignedness ) os << signednessNames[ signedness ] << " ";
     284                if ( length != NoLength ) os << lengthNames[ length ] << " ";
     285                if ( complextype != NoComplexType ) os << complexTypeNames[ complextype ] << " ";
     286                if ( basictype != NoBasicType ) os << basicTypeNames[ basictype ] << " ";
    267287                break;
    268288        case Pointer:
     
    429449                break;
    430450        case Builtin:
    431                 os << DeclarationNode::builtinTypeNames[builtintype];
     451                os << builtinTypeNames[builtintype];
    432452                break;
    433453        case GlobalScope:
     
    495515}
    496516
    497 TypeData * build_basic_type( DeclarationNode::BasicType basic ) {
     517TypeData * build_basic_type( TypeData::BasicType basic ) {
    498518        TypeData * type = new TypeData( TypeData::Basic );
    499519        type->basictype = basic;
     
    501521}
    502522
    503 TypeData * build_complex_type( DeclarationNode::ComplexType complex ) {
     523TypeData * build_complex_type( TypeData::ComplexType complex ) {
    504524        TypeData * type = new TypeData( TypeData::Basic );
    505525        type->complextype = complex;
     
    507527}
    508528
    509 TypeData * build_signedness( DeclarationNode::Signedness signedness ) {
     529TypeData * build_signedness( TypeData::Signedness signedness ) {
    510530        TypeData * type = new TypeData( TypeData::Basic );
    511531        type->signedness = signedness;
     
    513533}
    514534
    515 TypeData * build_builtin_type( DeclarationNode::BuiltinType bit ) {
     535TypeData * build_builtin_type( TypeData::BuiltinType bit ) {
    516536        TypeData * type = new TypeData( TypeData::Builtin );
    517537        type->builtintype = bit;
     
    519539}
    520540
    521 TypeData * build_length( DeclarationNode::Length length ) {
     541TypeData * build_length( TypeData::Length length ) {
    522542        TypeData * type = new TypeData( TypeData::Basic );
    523543        type->length = length;
     
    622642                        assert( src->kind == TypeData::Basic );
    623643
    624                         if ( dst->basictype == DeclarationNode::NoBasicType ) {
     644                        if ( dst->basictype == TypeData::NoBasicType ) {
    625645                                dst->basictype = src->basictype;
    626                         } else if ( src->basictype != DeclarationNode::NoBasicType ) {
     646                        } else if ( src->basictype != TypeData::NoBasicType ) {
    627647                                SemanticError( yylloc, "multiple declaration types \"%s\" and \"%s\".",
    628                                         DeclarationNode::basicTypeNames[ dst->basictype ],
    629                                         DeclarationNode::basicTypeNames[ src->basictype ] );
     648                                        TypeData::basicTypeNames[ dst->basictype ],
     649                                        TypeData::basicTypeNames[ src->basictype ] );
    630650                        }
    631                         if ( dst->complextype == DeclarationNode::NoComplexType ) {
     651                        if ( dst->complextype == TypeData::NoComplexType ) {
    632652                                dst->complextype = src->complextype;
    633                         } else if ( src->complextype != DeclarationNode::NoComplexType ) {
     653                        } else if ( src->complextype != TypeData::NoComplexType ) {
    634654                                SemanticError( yylloc, "multiple declaration types \"%s\" and \"%s\".",
    635                                         DeclarationNode::complexTypeNames[ src->complextype ],
    636                                         DeclarationNode::complexTypeNames[ src->complextype ] );
     655                                        TypeData::complexTypeNames[ src->complextype ],
     656                                        TypeData::complexTypeNames[ src->complextype ] );
    637657                        }
    638                         if ( dst->signedness == DeclarationNode::NoSignedness ) {
     658                        if ( dst->signedness == TypeData::NoSignedness ) {
    639659                                dst->signedness = src->signedness;
    640                         } else if ( src->signedness != DeclarationNode::NoSignedness ) {
     660                        } else if ( src->signedness != TypeData::NoSignedness ) {
    641661                                SemanticError( yylloc, "conflicting type specifier \"%s\" and \"%s\".",
    642                                         DeclarationNode::signednessNames[ dst->signedness ],
    643                                         DeclarationNode::signednessNames[ src->signedness ] );
     662                                        TypeData::signednessNames[ dst->signedness ],
     663                                        TypeData::signednessNames[ src->signedness ] );
    644664                        }
    645                         if ( dst->length == DeclarationNode::NoLength ) {
     665                        if ( dst->length == TypeData::NoLength ) {
    646666                                dst->length = src->length;
    647                         } else if ( dst->length == DeclarationNode::Long && src->length == DeclarationNode::Long ) {
    648                                 dst->length = DeclarationNode::LongLong;
    649                         } else if ( src->length != DeclarationNode::NoLength ) {
     667                        } else if ( dst->length == TypeData::Long && src->length == TypeData::Long ) {
     668                                dst->length = TypeData::LongLong;
     669                        } else if ( src->length != TypeData::NoLength ) {
    650670                                SemanticError( yylloc, "conflicting type specifier \"%s\" and \"%s\".",
    651                                         DeclarationNode::lengthNames[ dst->length ],
    652                                         DeclarationNode::lengthNames[ src->length ] );
     671                                        TypeData::lengthNames[ dst->length ],
     672                                        TypeData::lengthNames[ src->length ] );
    653673                        }
    654674                } // if
     
    10911111        case TypeData::Builtin:
    10921112                switch ( td->builtintype ) {
    1093                 case DeclarationNode::Zero:
     1113                case TypeData::Zero:
    10941114                        return new ast::ZeroType();
    1095                 case DeclarationNode::One:
     1115                case TypeData::One:
    10961116                        return new ast::OneType();
    10971117                default:
     
    11491169
    11501170
    1151 static string genTSError( string msg, DeclarationNode::BasicType basictype ) {
    1152         SemanticError( yylloc, "invalid type specifier \"%s\" for type \"%s\".", msg.c_str(), DeclarationNode::basicTypeNames[basictype] );
     1171static string genTSError( string msg, TypeData::BasicType basictype ) {
     1172        SemanticError( yylloc, "invalid type specifier \"%s\" for type \"%s\".", msg.c_str(), TypeData::basicTypeNames[basictype] );
    11531173} // genTSError
    11541174
     
    11571177
    11581178        switch ( td->basictype ) {
    1159         case DeclarationNode::Void:
    1160                 if ( td->signedness != DeclarationNode::NoSignedness ) {
    1161                         genTSError( DeclarationNode::signednessNames[ td->signedness ], td->basictype );
    1162                 } // if
    1163                 if ( td->length != DeclarationNode::NoLength ) {
    1164                         genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
     1179        case TypeData::Void:
     1180                if ( td->signedness != TypeData::NoSignedness ) {
     1181                        genTSError( TypeData::signednessNames[ td->signedness ], td->basictype );
     1182                } // if
     1183                if ( td->length != TypeData::NoLength ) {
     1184                        genTSError( TypeData::lengthNames[ td->length ], td->basictype );
    11651185                } // if
    11661186                return new ast::VoidType( buildQualifiers( td ) );
    11671187                break;
    11681188
    1169         case DeclarationNode::Bool:
    1170                 if ( td->signedness != DeclarationNode::NoSignedness ) {
    1171                         genTSError( DeclarationNode::signednessNames[ td->signedness ], td->basictype );
    1172                 } // if
    1173                 if ( td->length != DeclarationNode::NoLength ) {
    1174                         genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
     1189        case TypeData::Bool:
     1190                if ( td->signedness != TypeData::NoSignedness ) {
     1191                        genTSError( TypeData::signednessNames[ td->signedness ], td->basictype );
     1192                } // if
     1193                if ( td->length != TypeData::NoLength ) {
     1194                        genTSError( TypeData::lengthNames[ td->length ], td->basictype );
    11751195                } // if
    11761196
     
    11781198                break;
    11791199
    1180         case DeclarationNode::Char:
     1200        case TypeData::Char:
    11811201                // C11 Standard 6.2.5.15: The three types char, signed char, and unsigned char are collectively called the
    11821202                // character types. The implementation shall define char to have the same range, representation, and behavior as
     
    11841204                static ast::BasicType::Kind chartype[] = { ast::BasicType::SignedChar, ast::BasicType::UnsignedChar, ast::BasicType::Char };
    11851205
    1186                 if ( td->length != DeclarationNode::NoLength ) {
    1187                         genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
     1206                if ( td->length != TypeData::NoLength ) {
     1207                        genTSError( TypeData::lengthNames[ td->length ], td->basictype );
    11881208                } // if
    11891209
     
    11911211                break;
    11921212
    1193         case DeclarationNode::Int:
     1213        case TypeData::Int:
    11941214                static ast::BasicType::Kind inttype[2][4] = {
    11951215                        { ast::BasicType::ShortSignedInt, ast::BasicType::LongSignedInt, ast::BasicType::LongLongSignedInt, ast::BasicType::SignedInt },
     
    11981218
    11991219        Integral: ;
    1200                 if ( td->signedness == DeclarationNode::NoSignedness ) {
    1201                         const_cast<TypeData *>(td)->signedness = DeclarationNode::Signed;
     1220                if ( td->signedness == TypeData::NoSignedness ) {
     1221                        const_cast<TypeData *>(td)->signedness = TypeData::Signed;
    12021222                } // if
    12031223                ret = inttype[ td->signedness ][ td->length ];
    12041224                break;
    12051225
    1206         case DeclarationNode::Int128:
    1207                 ret = td->signedness == DeclarationNode::Unsigned ? ast::BasicType::UnsignedInt128 : ast::BasicType::SignedInt128;
    1208                 if ( td->length != DeclarationNode::NoLength ) {
    1209                         genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
    1210                 } // if
    1211                 break;
    1212 
    1213         case DeclarationNode::Float:
    1214         case DeclarationNode::Double:
    1215         case DeclarationNode::LongDouble:                                       // not set until below
    1216         case DeclarationNode::uuFloat80:
    1217         case DeclarationNode::uuFloat128:
    1218         case DeclarationNode::uFloat16:
    1219         case DeclarationNode::uFloat32:
    1220         case DeclarationNode::uFloat32x:
    1221         case DeclarationNode::uFloat64:
    1222         case DeclarationNode::uFloat64x:
    1223         case DeclarationNode::uFloat128:
    1224         case DeclarationNode::uFloat128x:
     1226        case TypeData::Int128:
     1227                ret = td->signedness == TypeData::Unsigned ? ast::BasicType::UnsignedInt128 : ast::BasicType::SignedInt128;
     1228                if ( td->length != TypeData::NoLength ) {
     1229                        genTSError( TypeData::lengthNames[ td->length ], td->basictype );
     1230                } // if
     1231                break;
     1232
     1233        case TypeData::Float:
     1234        case TypeData::Double:
     1235        case TypeData::LongDouble:                                      // not set until below
     1236        case TypeData::uuFloat80:
     1237        case TypeData::uuFloat128:
     1238        case TypeData::uFloat16:
     1239        case TypeData::uFloat32:
     1240        case TypeData::uFloat32x:
     1241        case TypeData::uFloat64:
     1242        case TypeData::uFloat64x:
     1243        case TypeData::uFloat128:
     1244        case TypeData::uFloat128x:
    12251245                static ast::BasicType::Kind floattype[2][12] = {
    12261246                        { ast::BasicType::FloatComplex, ast::BasicType::DoubleComplex, ast::BasicType::LongDoubleComplex, (ast::BasicType::Kind)-1, (ast::BasicType::Kind)-1, ast::BasicType::uFloat16Complex, ast::BasicType::uFloat32Complex, ast::BasicType::uFloat32xComplex, ast::BasicType::uFloat64Complex, ast::BasicType::uFloat64xComplex, ast::BasicType::uFloat128Complex, ast::BasicType::uFloat128xComplex, },
     
    12291249
    12301250        FloatingPoint: ;
    1231                 if ( td->signedness != DeclarationNode::NoSignedness ) {
    1232                         genTSError( DeclarationNode::signednessNames[ td->signedness ], td->basictype );
    1233                 } // if
    1234                 if ( td->length == DeclarationNode::Short || td->length == DeclarationNode::LongLong ) {
    1235                         genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
    1236                 } // if
    1237                 if ( td->basictype != DeclarationNode::Double && td->length == DeclarationNode::Long ) {
    1238                         genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
    1239                 } // if
    1240                 if ( td->complextype == DeclarationNode::Imaginary ) {
    1241                         genTSError( DeclarationNode::complexTypeNames[ td->complextype ], td->basictype );
    1242                 } // if
    1243                 if ( (td->basictype == DeclarationNode::uuFloat80 || td->basictype == DeclarationNode::uuFloat128) && td->complextype == DeclarationNode::Complex ) { // gcc unsupported
    1244                         genTSError( DeclarationNode::complexTypeNames[ td->complextype ], td->basictype );
    1245                 } // if
    1246                 if ( td->length == DeclarationNode::Long ) {
    1247                         const_cast<TypeData *>(td)->basictype = DeclarationNode::LongDouble;
    1248                 } // if
    1249 
    1250                 ret = floattype[ td->complextype ][ td->basictype - DeclarationNode::Float ];
    1251                 //printf( "XXXX %d %d %d %d\n", td->complextype, td->basictype, DeclarationNode::Float, ret );
    1252                 break;
    1253 
    1254         case DeclarationNode::NoBasicType:
     1251                if ( td->signedness != TypeData::NoSignedness ) {
     1252                        genTSError( TypeData::signednessNames[ td->signedness ], td->basictype );
     1253                } // if
     1254                if ( td->length == TypeData::Short || td->length == TypeData::LongLong ) {
     1255                        genTSError( TypeData::lengthNames[ td->length ], td->basictype );
     1256                } // if
     1257                if ( td->basictype != TypeData::Double && td->length == TypeData::Long ) {
     1258                        genTSError( TypeData::lengthNames[ td->length ], td->basictype );
     1259                } // if
     1260                if ( td->complextype == TypeData::Imaginary ) {
     1261                        genTSError( TypeData::complexTypeNames[ td->complextype ], td->basictype );
     1262                } // if
     1263                if ( (td->basictype == TypeData::uuFloat80 || td->basictype == TypeData::uuFloat128) && td->complextype == TypeData::Complex ) { // gcc unsupported
     1264                        genTSError( TypeData::complexTypeNames[ td->complextype ], td->basictype );
     1265                } // if
     1266                if ( td->length == TypeData::Long ) {
     1267                        const_cast<TypeData *>(td)->basictype = TypeData::LongDouble;
     1268                } // if
     1269
     1270                ret = floattype[ td->complextype ][ td->basictype - TypeData::Float ];
     1271                //printf( "XXXX %d %d %d %d\n", td->complextype, td->basictype, TypeData::Float, ret );
     1272                break;
     1273
     1274        case TypeData::NoBasicType:
    12551275                // No basic type in declaration => default double for Complex/Imaginary and int type for integral types
    1256                 if ( td->complextype == DeclarationNode::Complex || td->complextype == DeclarationNode::Imaginary ) {
    1257                         const_cast<TypeData *>(td)->basictype = DeclarationNode::Double;
     1276                if ( td->complextype == TypeData::Complex || td->complextype == TypeData::Imaginary ) {
     1277                        const_cast<TypeData *>(td)->basictype = TypeData::Double;
    12581278                        goto FloatingPoint;
    12591279                } // if
    12601280
    1261                 const_cast<TypeData *>(td)->basictype = DeclarationNode::Int;
     1281                const_cast<TypeData *>(td)->basictype = TypeData::Int;
    12621282                goto Integral;
    12631283        default:
     
    18031823                if ( ! param->type ) {                                                  // generate type int for empty parameter type
    18041824                        param->type = new TypeData( TypeData::Basic );
    1805                         param->type->basictype = DeclarationNode::Int;
     1825                        param->type->basictype = TypeData::Int;
    18061826                } // if
    18071827        } // for
  • src/Parser/TypeData.h

    r9398177 re048ece  
    2424
    2525struct TypeData {
     26        // Type flags used in this type, and there names (harmonize with implementation).
     27        enum BasicType {
     28                Void, Bool, Char, Int, Int128,
     29                Float, Double, LongDouble, uuFloat80, uuFloat128,
     30                uFloat16, uFloat32, uFloat32x, uFloat64, uFloat64x, uFloat128, uFloat128x,
     31                NoBasicType
     32        };
     33        static const char * basicTypeNames[];
     34        enum ComplexType { Complex, NoComplexType, Imaginary };
     35        // Imaginary unsupported => parse, but make invisible and print error message
     36        static const char * complexTypeNames[];
     37        enum Signedness { Signed, Unsigned, NoSignedness };
     38        static const char * signednessNames[];
     39        enum Length { Short, Long, LongLong, NoLength };
     40        static const char * lengthNames[];
     41        enum BuiltinType { Valist, AutoType, Zero, One, NoBuiltinType };
     42        static const char * builtinTypeNames[];
     43
    2644        enum Kind { Basic, Pointer, Reference, Array, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic,
    2745                                SymbolicInst, Tuple, Basetypeof, Typeof, Vtable, Builtin, GlobalScope, Qualified, Unknown };
     
    86104        Kind kind;
    87105        TypeData * base;
    88         DeclarationNode::BasicType basictype = DeclarationNode::NoBasicType;
    89         DeclarationNode::ComplexType complextype = DeclarationNode::NoComplexType;
    90         DeclarationNode::Signedness signedness = DeclarationNode::NoSignedness;
    91         DeclarationNode::Length length = DeclarationNode::NoLength;
    92         DeclarationNode::BuiltinType builtintype = DeclarationNode::NoBuiltinType;
     106        BasicType basictype = NoBasicType;
     107        ComplexType complextype = NoComplexType;
     108        Signedness signedness = NoSignedness;
     109        Length length = NoLength;
     110        BuiltinType builtintype = NoBuiltinType;
    93111
    94112        ast::CV::Qualifiers qualifiers;
     
    118136
    119137TypeData * build_type_qualifier( ast::CV::Qualifiers );
    120 TypeData * build_basic_type( DeclarationNode::BasicType );
    121 TypeData * build_complex_type( DeclarationNode::ComplexType );
    122 TypeData * build_signedness( DeclarationNode::Signedness );
    123 TypeData * build_builtin_type( DeclarationNode::BuiltinType );
    124 TypeData * build_length( DeclarationNode::Length );
     138TypeData * build_basic_type( TypeData::BasicType );
     139TypeData * build_complex_type( TypeData::ComplexType );
     140TypeData * build_signedness( TypeData::Signedness );
     141TypeData * build_builtin_type( TypeData::BuiltinType );
     142TypeData * build_length( TypeData::Length );
    125143TypeData * build_forall( DeclarationNode * );
    126144TypeData * build_global_scope();
  • src/Parser/parser.yy

    r9398177 re048ece  
    23022302basic_type_name_type:
    23032303        VOID
    2304                 { $$ = build_basic_type( DeclarationNode::Void ); }
     2304                { $$ = build_basic_type( TypeData::Void ); }
    23052305        | BOOL                                                                                          // C99
    2306                 { $$ = build_basic_type( DeclarationNode::Bool ); }
     2306                { $$ = build_basic_type( TypeData::Bool ); }
    23072307        | CHAR
    2308                 { $$ = build_basic_type( DeclarationNode::Char ); }
     2308                { $$ = build_basic_type( TypeData::Char ); }
    23092309        | INT
    2310                 { $$ = build_basic_type( DeclarationNode::Int ); }
     2310                { $$ = build_basic_type( TypeData::Int ); }
    23112311        | INT128
    2312                 { $$ = build_basic_type( DeclarationNode::Int128 ); }
     2312                { $$ = build_basic_type( TypeData::Int128 ); }
    23132313        | UINT128
    2314                 { $$ = addType( build_basic_type( DeclarationNode::Int128 ), build_signedness( DeclarationNode::Unsigned ) ); }
     2314                { $$ = addType( build_basic_type( TypeData::Int128 ), build_signedness( TypeData::Unsigned ) ); }
    23152315        | FLOAT
    2316                 { $$ = build_basic_type( DeclarationNode::Float ); }
     2316                { $$ = build_basic_type( TypeData::Float ); }
    23172317        | DOUBLE
    2318                 { $$ = build_basic_type( DeclarationNode::Double ); }
     2318                { $$ = build_basic_type( TypeData::Double ); }
    23192319        | uuFLOAT80
    2320                 { $$ = build_basic_type( DeclarationNode::uuFloat80 ); }
     2320                { $$ = build_basic_type( TypeData::uuFloat80 ); }
    23212321        | uuFLOAT128
    2322                 { $$ = build_basic_type( DeclarationNode::uuFloat128 ); }
     2322                { $$ = build_basic_type( TypeData::uuFloat128 ); }
    23232323        | uFLOAT16
    2324                 { $$ = build_basic_type( DeclarationNode::uFloat16 ); }
     2324                { $$ = build_basic_type( TypeData::uFloat16 ); }
    23252325        | uFLOAT32
    2326                 { $$ = build_basic_type( DeclarationNode::uFloat32 ); }
     2326                { $$ = build_basic_type( TypeData::uFloat32 ); }
    23272327        | uFLOAT32X
    2328                 { $$ = build_basic_type( DeclarationNode::uFloat32x ); }
     2328                { $$ = build_basic_type( TypeData::uFloat32x ); }
    23292329        | uFLOAT64
    2330                 { $$ = build_basic_type( DeclarationNode::uFloat64 ); }
     2330                { $$ = build_basic_type( TypeData::uFloat64 ); }
    23312331        | uFLOAT64X
    2332                 { $$ = build_basic_type( DeclarationNode::uFloat64x ); }
     2332                { $$ = build_basic_type( TypeData::uFloat64x ); }
    23332333        | uFLOAT128
    2334                 { $$ = build_basic_type( DeclarationNode::uFloat128 ); }
     2334                { $$ = build_basic_type( TypeData::uFloat128 ); }
    23352335        | DECIMAL32
    23362336                { SemanticError( yylloc, "_Decimal32 is currently unimplemented." ); $$ = nullptr; }
     
    23402340                { SemanticError( yylloc, "_Decimal128 is currently unimplemented." ); $$ = nullptr; }
    23412341        | COMPLEX                                                                                       // C99
    2342                 { $$ = build_complex_type( DeclarationNode::Complex ); }
     2342                { $$ = build_complex_type( TypeData::Complex ); }
    23432343        | IMAGINARY                                                                                     // C99
    2344                 { $$ = build_complex_type( DeclarationNode::Imaginary ); }
     2344                { $$ = build_complex_type( TypeData::Imaginary ); }
    23452345        | SIGNED
    2346                 { $$ = build_signedness( DeclarationNode::Signed ); }
     2346                { $$ = build_signedness( TypeData::Signed ); }
    23472347        | UNSIGNED
    2348                 { $$ = build_signedness( DeclarationNode::Unsigned ); }
     2348                { $$ = build_signedness( TypeData::Unsigned ); }
    23492349        | SHORT
    2350                 { $$ = build_length( DeclarationNode::Short ); }
     2350                { $$ = build_length( TypeData::Short ); }
    23512351        | LONG
    2352                 { $$ = build_length( DeclarationNode::Long ); }
     2352                { $$ = build_length( TypeData::Long ); }
    23532353        | VA_LIST                                                                                       // GCC, __builtin_va_list
    2354                 { $$ = build_builtin_type( DeclarationNode::Valist ); }
     2354                { $$ = build_builtin_type( TypeData::Valist ); }
    23552355        | AUTO_TYPE
    2356                 { $$ = build_builtin_type( DeclarationNode::AutoType ); }
     2356                { $$ = build_builtin_type( TypeData::AutoType ); }
    23572357        | vtable
    23582358        ;
     
    24162416                { $$ = DeclarationNode::newTypeof( $3, true ); }
    24172417        | ZERO_T                                                                                        // CFA
    2418                 { $$ = DeclarationNode::newFromTypeData( build_builtin_type( DeclarationNode::Zero ) ); }
     2418                { $$ = DeclarationNode::newFromTypeData( build_builtin_type( TypeData::Zero ) ); }
    24192419        | ONE_T                                                                                         // CFA
    2420                 { $$ = DeclarationNode::newFromTypeData( build_builtin_type( DeclarationNode::One ) ); }
     2420                { $$ = DeclarationNode::newFromTypeData( build_builtin_type( TypeData::One ) ); }
    24212421        ;
    24222422
     
    28562856cfa_parameter_list_ellipsis_opt:                                                // CFA, abstract + real
    28572857        // empty
    2858                 { $$ = DeclarationNode::newFromTypeData( build_basic_type( DeclarationNode::Void ) ); }
     2858                { $$ = DeclarationNode::newFromTypeData( build_basic_type( TypeData::Void ) ); }
    28592859        | ELLIPSIS
    28602860                { $$ = nullptr; }
Note: See TracChangeset for help on using the changeset viewer.