Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Indexer.cc

    r44b5ca0 r843054c2  
    1010// Created On       : Sun May 17 21:37:33 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun  5 08:05:17 2015
    13 // Update Count     : 5
     12// Last Modified On : Tue May 19 16:49:55 2015
     13// Update Count     : 3
    1414//
    1515
     
    5151        }
    5252
    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 */
    7371
    7472        void Indexer::visit( TypeDecl *typeDecl ) {
    7573                // 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 proper
    77                 // and may depend on the type itself
     74                // 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
    7876                enterScope();
    7977                acceptAll( typeDecl->get_parameters(), *this );
Note: See TracChangeset for help on using the changeset viewer.