Ignore:
Timestamp:
Oct 30, 2020, 12:01:23 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
969e7ee7, f7e4f8e8
Parents:
6a77224 (diff), 3100754 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Pass.impl.hpp

    r6a77224 r4ae78c1  
    502502                                // foralls are still in function type
    503503                                maybe_accept( node, &FunctionDecl::type );
    504                                 // function body needs to have the same scope as parameters - CompoundStmt will not enter
    505                                 // a new scope if inFunction is true
     504                                // First remember that we are now within a function.
    506505                                ValueGuard< bool > oldInFunction( inFunction );
    507506                                inFunction = true;
     507                                // The function body needs to have the same scope as parameters.
     508                                // A CompoundStmt will not enter a new scope if atFunctionTop is true.
     509                                ValueGuard< bool > oldAtFunctionTop( atFunctionTop );
     510                                atFunctionTop = true;
    508511                                maybe_accept( node, &FunctionDecl::stmts );
    509512                                maybe_accept( node, &FunctionDecl::attributes );
     
    672675        VISIT_START( node );
    673676        VISIT({
    674                 // do not enter a new scope if inFunction is true - needs to check old state before the assignment
    675                 auto guard1 = makeFuncGuard( [this, inFunctionCpy = this->inFunction]() {
    676                         if ( ! inFunctionCpy ) __pass::symtab::enter(core, 0);
    677                 }, [this, inFunctionCpy = this->inFunction]() {
    678                         if ( ! inFunctionCpy ) __pass::symtab::leave(core, 0);
     677                // Do not enter (or leave) a new scope if atFunctionTop. Remember to save the result.
     678                auto guard1 = makeFuncGuard( [this, enterScope = !this->atFunctionTop]() {
     679                        if ( enterScope ) __pass::symtab::enter(core, 0);
     680                }, [this, leaveScope = !this->atFunctionTop]() {
     681                        if ( leaveScope ) __pass::symtab::leave(core, 0);
    679682                });
    680683                ValueGuard< bool > guard2( inFunction );
Note: See TracChangeset for help on using the changeset viewer.