Changeset 44b5ca0 for src/SymTab
- Timestamp:
- Jun 5, 2015, 8:12:32 AM (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:
- a65d92e
- Parents:
- cf0941d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/SymTab/Indexer.cc ¶
rcf0941d r44b5ca0 10 10 // Created On : Sun May 17 21:37:33 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 19 16:49:55201513 // Update Count : 312 // Last Modified On : Fri Jun 5 08:05:17 2015 13 // Update Count : 5 14 14 // 15 15 … … 51 51 } 52 52 53 /******** 54 * A NOTE ON THE ORDER OF TRAVERSAL 55 * 56 * Types and typedefs have their base types visited before they are added to the type table. 57 * This is ok, since there is no such thing as a recursive type or typedef. 58 * typedef struct { T *x; } T; // never allowed 59 * 60 * for structs/unions, it is possible to have recursion, so the decl should be added as if it's 61 * incomplete to begin, the members are traversed, and then the complete type should be added 62 * (assuming the type is completed by this particular declaration). 63 * struct T { struct T *x; }; // allowed 64 * 65 * It's important to add the complete type to the symbol table *after* the members/base has been 66 * traversed, since that traversal may modify the definition of the type and these modifications 67 * should be visible when the symbol table is queried later in this pass. 68 * 69 * TODO: figure out whether recursive contexts are sensible/possible/reasonable. 70 */ 53 54 // A NOTE ON THE ORDER OF TRAVERSAL 55 // 56 // Types and typedefs have their base types visited before they are added to the type table. This is ok, since there is 57 // no such thing as a recursive type or typedef. 58 // 59 // typedef struct { T *x; } T; // never allowed 60 // 61 // for structs/unions, it is possible to have recursion, so the decl should be added as if it's incomplete to begin, the 62 // members are traversed, and then the complete type should be added (assuming the type is completed by this particular 63 // declaration). 64 // 65 // struct T { struct T *x; }; // allowed 66 // 67 // It is important to add the complete type to the symbol table *after* the members/base has been traversed, since that 68 // traversal may modify the definition of the type and these modifications should be visible when the symbol table is 69 // queried later in this pass. 70 // 71 // TODO: figure out whether recursive contexts are sensible/possible/reasonable. 72 71 73 72 74 void Indexer::visit( TypeDecl *typeDecl ) { 73 75 // see A NOTE ON THE ORDER OF TRAVERSAL, above 74 // note that assertions come after the type is added to the symtab, since they are n't part75 // of the type properand may depend on the type itself76 // note that assertions come after the type is added to the symtab, since they are not part of the type proper 77 // and may depend on the type itself 76 78 enterScope(); 77 79 acceptAll( typeDecl->get_parameters(), *this );
Note: See TracChangeset
for help on using the changeset viewer.