Ignore:
Timestamp:
Jul 19, 2016, 7:09:30 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
40e636a
Parents:
2be1023
Message:

hoist non-constexpr array dimension into const variable in case of side effects

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r2be1023 r5f98ce5  
    174174
    175175                virtual void visit( FunctionDecl *funcDecl );
    176 };
     176        };
    177177
    178178        class CompoundLiteral : public GenPoly::DeclMutator {
     
    490490                EliminateTypedef eliminator;
    491491                mutateAll( translationUnit, eliminator );
     492                if ( eliminator.typedefNames.count( "size_t" ) ) {
     493                        // grab and remember declaration of size_t
     494                        SizeType = eliminator.typedefNames["size_t"].first->get_base()->clone();
     495                } else {
     496                        assert( false && "missing global typedef for size_t" );
     497                }
    492498                filter( translationUnit, isTypedef, true );
     499
    493500        }
    494501
     
    518525        Declaration *EliminateTypedef::mutate( TypedefDecl * tyDecl ) {
    519526                Declaration *ret = Mutator::mutate( tyDecl );
     527
    520528                if ( typedefNames.count( tyDecl->get_name() ) == 1 && typedefNames[ tyDecl->get_name() ].second == scopeLevel ) {
    521529                        // typedef to the same name from the same scope
Note: See TracChangeset for help on using the changeset viewer.