Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rd912bed r312029a  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Dec 16 15:32:22 2019
    13 // Update Count     : 1133
     12// Last Modified On : Wed Dec 11 07:40:14 2019
     13// Update Count     : 1123
    1414//
    1515
     
    2424#include "Common/UniqueName.h"     // for UniqueName
    2525#include "Common/utility.h"        // for maybeClone, maybeBuild, CodeLocation
     26#include "Parser/LinkageSpec.h"    // for Spec, linkageName, Cforall
    2627#include "Parser/ParseNode.h"      // for DeclarationNode, ExpressionNode
    27 #include "SynTree/LinkageSpec.h"   // for Spec, linkageName, Cforall
    2828#include "SynTree/Attribute.h"     // for Attribute
    2929#include "SynTree/Declaration.h"   // for TypeDecl, ObjectDecl, Declaration
     
    4747const char * DeclarationNode::signednessNames[] = { "signed", "unsigned", "NoSignednessNames" };
    4848const char * DeclarationNode::lengthNames[] = { "short", "long", "long long", "NoLengthNames" };
     49const char * DeclarationNode::typeClassNames[] = { "otype", "dtype", "ftype", "NoTypeClassNames" };
    4950const char * DeclarationNode::builtinTypeNames[] = { "__builtin_va_list", "__auto_type", "zero_t", "one_t", "NoBuiltinTypeNames" };
    5051
     
    5758
    5859//      variable.name = nullptr;
    59         variable.tyClass = TypeDecl::NUMBER_OF_KINDS;
     60        variable.tyClass = NoTypeClass;
    6061        variable.assertions = nullptr;
    6162        variable.initializer = nullptr;
     
    133134
    134135        if ( linkage != LinkageSpec::Cforall ) {
    135                 os << LinkageSpec::name( linkage ) << " ";
     136                os << LinkageSpec::linkageName( linkage ) << " ";
    136137        } // if
    137138
     
    311312} // DeclarationNode::newFromTypeGen
    312313
    313 DeclarationNode * DeclarationNode::newTypeParam( TypeDecl::Kind tc, const string * name ) {
     314DeclarationNode * DeclarationNode::newTypeParam( TypeClass tc, const string * name ) {
    314315        DeclarationNode * newnode = new DeclarationNode;
    315316        newnode->type = nullptr;
     
    669670
    670671DeclarationNode * DeclarationNode::addAssertions( DeclarationNode * assertions ) {
    671         if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) {
     672        if ( variable.tyClass != NoTypeClass ) {
    672673                if ( variable.assertions ) {
    673674                        variable.assertions->appendList( assertions );
     
    874875
    875876DeclarationNode * DeclarationNode::addTypeInitializer( DeclarationNode * init ) {
    876         assertf( variable.tyClass != TypeDecl::NUMBER_OF_KINDS, "Called addTypeInitializer on something that isn't a type variable." );
     877        assertf( variable.tyClass != NoTypeClass, "Called addTypeInitializer on something that isn't a type variable." );
    877878        variable.initializer = init;
    878879        return this;
     
    10731074        } // if
    10741075
    1075         if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) {
     1076        if ( variable.tyClass != NoTypeClass ) {
    10761077                // otype is internally converted to dtype + otype parameters
    10771078                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." );
     1079                assertf( sizeof(kindMap)/sizeof(kindMap[0]) == NoTypeClass, "DeclarationNode::build: kindMap is out of sync." );
    10791080                assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." );
    1080                 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == TypeDecl::Otype, variable.initializer ? variable.initializer->buildType() : nullptr );
     1081                TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == Otype, variable.initializer ? variable.initializer->buildType() : nullptr );
    10811082                buildList( variable.assertions, ret->get_assertions() );
    10821083                return ret;
Note: See TracChangeset for help on using the changeset viewer.