Changeset 47498bd
- Timestamp:
- Jun 19, 2018, 2:11:38 PM (6 years ago)
- 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:
- 9a7a3b6
- Parents:
- 704d11e
- Location:
- src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/PassVisitor.h
r704d11e r47498bd 146 146 virtual void visit( ZeroType * zeroType ) override final; 147 147 virtual void visit( OneType * oneType ) override final; 148 virtual void visit( GlobalScopeType * globalType ) override final; 148 149 149 150 virtual void visit( Designation * designation ) override final; … … 247 248 virtual Type * mutate( ZeroType * zeroType ) override final; 248 249 virtual Type * mutate( OneType * oneType ) override final; 250 virtual Type * mutate( GlobalScopeType * globalType ) override final; 249 251 250 252 virtual Designation * mutate( Designation * designation ) override final; -
src/Common/PassVisitor.impl.h
r704d11e r47498bd 2576 2576 2577 2577 //-------------------------------------------------------------------------- 2578 // GlobalScopeType 2579 template< typename pass_type > 2580 void PassVisitor< pass_type >::visit( GlobalScopeType * node ) { 2581 VISIT_START( node ); 2582 2583 maybeAccept_impl( node->forall, *this ); 2584 2585 VISIT_END( node ); 2586 } 2587 2588 template< typename pass_type > 2589 Type * PassVisitor< pass_type >::mutate( GlobalScopeType * node ) { 2590 MUTATE_START( node ); 2591 2592 maybeMutate_impl( node->forall, *this ); 2593 2594 MUTATE_END( Type, node ); 2595 } 2596 2597 //-------------------------------------------------------------------------- 2578 2598 // Designation 2579 2599 template< typename pass_type > -
src/Parser/DeclarationNode.cc
r704d11e r47498bd 253 253 return newnode; 254 254 } // DeclarationNode::newFromTypedef 255 256 DeclarationNode * DeclarationNode::newFromGlobalScope() { 257 DeclarationNode * newnode = new DeclarationNode; 258 newnode->type = new TypeData( TypeData::GlobalScope ); 259 return newnode; 260 } 255 261 256 262 DeclarationNode * DeclarationNode::newQualifiedType( DeclarationNode * parent, DeclarationNode * child) { … … 998 1004 try { 999 1005 Declaration * decl = cur->build(); 1000 if ( decl ) {1001 1002 1003 1004 1005 StructInstType * inst = new StructInstType( Type::Qualifiers(), agg->name );1006 auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr);1007 obj->location = cur->location;1008 * out++ = obj;1009 delete agg;1010 } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) {1011 UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->name );1012 auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr);1013 obj->location = cur->location;1014 * out++ = obj;1015 } // if1006 assert( decl ); 1007 if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) { 1008 dwt->location = cur->location; 1009 * out++ = dwt; 1010 } else if ( StructDecl * agg = dynamic_cast< StructDecl * >( decl ) ) { 1011 // xxx - this might be where anonymous struct members are added - should be conditional on struct name 1012 StructInstType * inst = new StructInstType( Type::Qualifiers(), agg->name ); 1013 auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr ); 1014 obj->location = cur->location; 1015 * out++ = obj; 1016 delete agg; 1017 } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) { 1018 UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->name ); 1019 auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr ); 1020 obj->location = cur->location; 1021 * out++ = obj; 1016 1022 } // if 1017 1023 } catch( SemanticErrorException &e ) { -
src/Parser/ParseNode.h
r704d11e r47498bd 231 231 static DeclarationNode * newForall( DeclarationNode * ); 232 232 static DeclarationNode * newFromTypedef( const std::string * ); 233 static DeclarationNode * newFromGlobalScope(); 233 234 static DeclarationNode * newQualifiedType( DeclarationNode *, DeclarationNode * ); 234 235 static DeclarationNode * newFunction( const std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body ); -
src/Parser/TypeData.cc
r704d11e r47498bd 37 37 case Reference: 38 38 case EnumConstant: 39 case GlobalScope: 39 40 // nothing else to initialize 40 41 break; … … 112 113 case Reference: 113 114 case EnumConstant: 115 case GlobalScope: 114 116 // nothing to destroy 115 117 break; … … 180 182 case Pointer: 181 183 case Reference: 184 case GlobalScope: 182 185 // nothing else to copy 183 186 break; -
src/Parser/TypeData.h
r704d11e r47498bd 27 27 struct TypeData { 28 28 enum Kind { Basic, Pointer, Array, Reference, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic, 29 SymbolicInst, Tuple, Typeof, Builtin, Unknown };29 SymbolicInst, Tuple, Typeof, Builtin, GlobalScope, Unknown }; 30 30 31 31 struct Aggregate_t { … … 88 88 DeclarationNode * forall; 89 89 90 // Basic_t basic;91 90 Aggregate_t aggregate; 92 91 AggInst_t aggInst; 93 92 Array_t array; 94 93 Enumeration_t enumeration; 95 // Variable_t variable;96 94 Function_t function; 97 95 Symbolic_t symbolic; -
src/Parser/parser.yy
r704d11e r47498bd 1792 1792 { $$ = DeclarationNode::newFromTypedef( $1 ); } 1793 1793 | '.' TYPEDEFname 1794 { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }1794 { $$ = DeclarationNode::newQualifiedType( DeclarationNode::newFromGlobalScope(), DeclarationNode::newFromTypedef( $2 ) ); } 1795 1795 | type_name '.' TYPEDEFname 1796 1796 { $$ = DeclarationNode::newQualifiedType( $1, DeclarationNode::newFromTypedef( $3 ) ); } 1797 1797 | typegen_name 1798 1798 | '.' typegen_name 1799 { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }1799 { $$ = DeclarationNode::newQualifiedType( DeclarationNode::newFromGlobalScope(), $2 ); } 1800 1800 | type_name '.' typegen_name 1801 1801 { $$ = DeclarationNode::newQualifiedType( $1, $3 ); } -
src/SynTree/Mutator.h
r704d11e r47498bd 114 114 virtual Type * mutate( ZeroType * zeroType ) = 0; 115 115 virtual Type * mutate( OneType * oneType ) = 0; 116 virtual Type * mutate( GlobalScopeType * globalType ) = 0; 116 117 117 118 virtual Designation * mutate( Designation * designation ) = 0 ; -
src/SynTree/SynTree.h
r704d11e r47498bd 124 124 class ZeroType; 125 125 class OneType; 126 class GlobalScopeType; 126 127 127 128 class Designation; -
src/SynTree/Type.cc
r704d11e r47498bd 118 118 119 119 void QualifiedType::print( std::ostream & os, Indenter indent ) const { 120 os << "Qualified Type: " ;120 os << "Qualified Type: " << endl; 121 121 printAll( types, os, indent+1 ); 122 122 Type::print( os, indent+1 ); 123 } 124 125 GlobalScopeType::GlobalScopeType() : Type( Type::Qualifiers(), {} ) {} 126 127 void GlobalScopeType::print( std::ostream & os, Indenter indent ) const { 128 os << "Global Scope Type" << endl; 123 129 } 124 130 -
src/SynTree/Type.h
r704d11e r47498bd 679 679 }; 680 680 681 class GlobalScopeType : public Type { 682 public: 683 GlobalScopeType(); 684 685 virtual GlobalScopeType *clone() const override { return new GlobalScopeType( *this ); } 686 virtual void accept( Visitor & v ) override { v.visit( this ); } 687 virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); } 688 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 689 }; 690 681 691 // Local Variables: // 682 692 // tab-width: 4 // -
src/SynTree/Visitor.h
r704d11e r47498bd 116 116 virtual void visit( ZeroType * zeroType ) = 0; 117 117 virtual void visit( OneType * oneType ) = 0; 118 virtual void visit( GlobalScopeType * globalType ) = 0; 118 119 119 120 virtual void visit( Designation * designation ) = 0;
Note: See TracChangeset
for help on using the changeset viewer.