Ignore:
Timestamp:
Feb 20, 2020, 4:15:51 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
6a490b2
Parents:
dca5802 (diff), 2cbfe92 (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' into relaxed_ready

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rdca5802 rb7d6a36  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 11 07:40:14 2019
    13 // Update Count     : 1123
     12// Last Modified On : Mon Dec 16 15:32:22 2019
     13// Update Count     : 1133
    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
    2726#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" };
    49 const char * DeclarationNode::typeClassNames[] = { "otype", "dtype", "ftype", "NoTypeClassNames" };
    5049const char * DeclarationNode::builtinTypeNames[] = { "__builtin_va_list", "__auto_type", "zero_t", "one_t", "NoBuiltinTypeNames" };
    5150
     
    5857
    5958//      variable.name = nullptr;
    60         variable.tyClass = NoTypeClass;
     59        variable.tyClass = TypeDecl::NUMBER_OF_KINDS;
    6160        variable.assertions = nullptr;
    6261        variable.initializer = nullptr;
     
    134133
    135134        if ( linkage != LinkageSpec::Cforall ) {
    136                 os << LinkageSpec::linkageName( linkage ) << " ";
     135                os << LinkageSpec::name( linkage ) << " ";
    137136        } // if
    138137
     
    312311} // DeclarationNode::newFromTypeGen
    313312
    314 DeclarationNode * DeclarationNode::newTypeParam( TypeClass tc, const string * name ) {
     313DeclarationNode * DeclarationNode::newTypeParam( TypeDecl::Kind tc, const string * name ) {
    315314        DeclarationNode * newnode = new DeclarationNode;
    316315        newnode->type = nullptr;
     
    670669
    671670DeclarationNode * DeclarationNode::addAssertions( DeclarationNode * assertions ) {
    672         if ( variable.tyClass != NoTypeClass ) {
     671        if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) {
    673672                if ( variable.assertions ) {
    674673                        variable.assertions->appendList( assertions );
     
    875874
    876875DeclarationNode * DeclarationNode::addTypeInitializer( DeclarationNode * init ) {
    877         assertf( variable.tyClass != NoTypeClass, "Called addTypeInitializer on something that isn't a type variable." );
     876        assertf( variable.tyClass != TypeDecl::NUMBER_OF_KINDS, "Called addTypeInitializer on something that isn't a type variable." );
    878877        variable.initializer = init;
    879878        return this;
     
    10741073        } // if
    10751074
    1076         if ( variable.tyClass != NoTypeClass ) {
     1075        if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) {
    10771076                // otype is internally converted to dtype + otype parameters
    10781077                static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype };
    1079                 assertf( sizeof(kindMap)/sizeof(kindMap[0]) == NoTypeClass, "DeclarationNode::build: kindMap is out of sync." );
     1078                static_assert( sizeof(kindMap)/sizeof(kindMap[0]) == TypeDecl::NUMBER_OF_KINDS, "DeclarationNode::build: kindMap is out of sync." );
    10801079                assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." );
    1081                 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == Otype, variable.initializer ? variable.initializer->buildType() : nullptr );
     1080                TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == TypeDecl::Otype, variable.initializer ? variable.initializer->buildType() : nullptr );
    10821081                buildList( variable.assertions, ret->get_assertions() );
    10831082                return ret;
Note: See TracChangeset for help on using the changeset viewer.