Changeset 1ead581
- Timestamp:
- Nov 17, 2014, 4:11:29 PM (10 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- d0e8cfe4
- Parents:
- c8ffe20b
- Files:
-
- 7 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/SymTab/Validate.cc
rc8ffe20b r1ead581 1 1 /* 2 The "validate" phase of translation is used to take a syntax tree and convert it into a 3 standard form that aims to be as regular in structure as possible. Some assumptions can be4 made regarding the state of the tree after this pass iscomplete, including:5 6 - No nested structure or union definitions; any in the input are "hoisted" to the level of 7 the containing struct orunion.2 The "validate" phase of translation is used to take a syntax tree and convert it into a standard form that aims to be 3 as regular in structure as possible. Some assumptions can be made regarding the state of the tree after this pass is 4 complete, including: 5 6 - No nested structure or union definitions; any in the input are "hoisted" to the level of the containing struct or 7 union. 8 8 9 9 - All enumeration constants have type EnumInstType. 10 10 11 - The type "void" never occurs in lists of function parameter or return types; neither do 12 tuple types. A functiontaking no arguments has no argument types, and tuples are flattened.13 14 - No context instances exist; they are all replaced by the set of declarations signified by 15 the context, instantiatedby the particular set of type arguments.11 - The type "void" never occurs in lists of function parameter or return types; neither do tuple types. A function 12 taking no arguments has no argument types, and tuples are flattened. 13 14 - No context instances exist; they are all replaced by the set of declarations signified by the context, instantiated 15 by the particular set of type arguments. 16 16 17 17 - Every declaration is assigned a unique id. … … 21 21 - Each type, struct, and union definition is followed by an appropriate assignment operator. 22 22 23 - Each use of a struct or union is connected to a complete definition of that struct or union, 24 even if that definitionoccurs later in the input.23 - Each use of a struct or union is connected to a complete definition of that struct or union, even if that definition 24 occurs later in the input. 25 25 */ 26 26 … … 176 176 std::list< Declaration * >::iterator i = translationUnit.begin(); 177 177 while ( i != translationUnit.end() ) { 178 (*i 178 (*i)->accept( visitor ); 179 179 std::list< Declaration * >::iterator next = i; 180 180 next++; … … 191 191 } 192 192 193 HoistStruct::HoistStruct() 194 : inStruct( false ) { 193 HoistStruct::HoistStruct() : inStruct( false ) { 195 194 } 196 195 … … 317 316 } 318 317 319 Pass2::Pass2( bool doDebug, const Indexer *other_indexer ) 320 : Indexer( doDebug ) { 318 Pass2::Pass2( bool doDebug, const Indexer *other_indexer ) : Indexer( doDebug ) { 321 319 if ( other_indexer ) { 322 320 indexer = other_indexer; … … 405 403 } 406 404 407 Pass3::Pass3( const Indexer *other_indexer ) 408 : Indexer( false ) { 405 Pass3::Pass3( const Indexer *other_indexer ) : Indexer( false ) { 409 406 if ( other_indexer ) { 410 407 indexer = other_indexer;
Note: See TracChangeset
for help on using the changeset viewer.