Changeset 3100754 for src


Ignore:
Timestamp:
Oct 29, 2020, 5:21:03 PM (4 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
45444c3, 4ae78c1
Parents:
c6c682cf
Message:

Used the new isInFunction in GenPoly/Specialize? instead of a second pass. Might be faster and it is all in one place.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Specialize.cc

    rc6c682cf r3100754  
    218218                thunkFunc->get_attributes().push_back( new Attribute( "unused" ) );
    219219
     220                // Thunks at the global level must be static to avoid collisions between files.
     221                // (Conversly thunks inside a function must be unique and not static.)
     222                thunkFunc->storageClasses.is_static = !isInFunction();
     223
    220224                // thread thunk parameters into call to actual function, naming thunk parameters as we go
    221225                UniqueName paramNamer( paramPrefix );
     
    321325        }
    322326
    323         // Fold it into Specialize if we find a good way.
    324         struct StaticThunks final : public WithShortCircuiting {
    325                 void previsit( Declaration * ) {
    326                         visit_children = false;
    327                 }
    328                 void postvisit( FunctionDecl * decl ) {
    329                         if ( isPrefix( decl->name, "_thunk" ) ) {
    330                                 decl->storageClasses.is_static = true;
    331                         }
    332                 }
    333         };
    334 
    335327        void convertSpecializations( std::list< Declaration* >& translationUnit ) {
    336328                PassVisitor<Specialize> spec;
    337329                mutateAll( translationUnit, spec );
    338                 PassVisitor<StaticThunks> staticThunks;
    339                 acceptAll( translationUnit, staticThunks );
    340330        }
    341331} // namespace GenPoly
Note: See TracChangeset for help on using the changeset viewer.