Changeset 7de22b28 for src


Ignore:
Timestamp:
Jul 10, 2018, 3:53:38 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
777ed2b
Parents:
d804830
git-author:
Rob Schluntz <rschlunt@…> (07/10/18 15:11:53)
git-committer:
Rob Schluntz <rschlunt@…> (07/10/18 15:53:38)
Message:

Call TypedefTable::makeTypedef with leaf type for nested aggregate definitions

Location:
src/Parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TypeData.cc

    rd804830 r7de22b28  
    423423        } // switch
    424424} // TypeData::print
     425
     426const std::string * TypeData::leafName() const {
     427        switch ( kind ) {
     428          case Unknown:
     429          case Pointer:
     430          case Reference:
     431          case EnumConstant:
     432          case GlobalScope:
     433          case Array:
     434          case Basic:
     435          case Function:
     436          case AggregateInst:
     437          case Tuple:
     438          case Typeof:
     439          case Builtin:
     440                assertf(false, "Tried to get leaf name from kind without a name: %d", kind);
     441                break;
     442          case Aggregate:
     443                return aggregate.name;
     444          case Enum:
     445                return enumeration.name;
     446          case Symbolic:
     447          case SymbolicInst:
     448                return symbolic.name;
     449          case Qualified:
     450                return qualified.child->leafName();
     451        } // switch
     452        assert(false);
     453}
    425454
    426455
  • src/Parser/TypeData.h

    rd804830 r7de22b28  
    109109        void print( std::ostream &, int indent = 0 ) const;
    110110        TypeData * clone() const;
     111
     112        const std::string * leafName() const;
    111113};
    112114
  • src/Parser/parser.yy

    rd804830 r7de22b28  
    18671867        | aggregate_key attribute_list_opt type_name fred
    18681868                {
    1869                         typedefTable.makeTypedef( *$3->type->symbolic.name, forall ? TYPEGENname : TYPEDEFname ); // create typedef
     1869                        // for type_name can be a qualified type name S.T, in which case only the last name in the chain needs a typedef (other names in the chain should already have one)
     1870                        typedefTable.makeTypedef( *$3->type->leafName(), forall ? TYPEGENname : TYPEDEFname ); // create typedef
    18701871                        forall = false;                                                         // reset
    18711872                }
Note: See TracChangeset for help on using the changeset viewer.