Changes in src/SymTab/Indexer.cc [44b5ca0:843054c2]
- File:
-
- 1 edited
-
src/SymTab/Indexer.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Indexer.cc
r44b5ca0 r843054c2 10 10 // Created On : Sun May 17 21:37:33 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jun 5 08:05:17201513 // Update Count : 512 // Last Modified On : Tue May 19 16:49:55 2015 13 // Update Count : 3 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. 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 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 */ 73 71 74 72 void Indexer::visit( TypeDecl *typeDecl ) { 75 73 // see A NOTE ON THE ORDER OF TRAVERSAL, above 76 // note that assertions come after the type is added to the symtab, since they are not part of the type proper77 // and may depend on the type itself74 // note that assertions come after the type is added to the symtab, since they aren't part 75 // of the type proper and may depend on the type itself 78 76 enterScope(); 79 77 acceptAll( typeDecl->get_parameters(), *this );
Note:
See TracChangeset
for help on using the changeset viewer.