Changes in / [3f3bfe5a:cf32116]


Ignore:
Location:
src
Files:
2 added
21 edited

Legend:

Unmodified
Added
Removed
  • src/AST/CVQualifiers.hpp

    r3f3bfe5a rcf32116  
    2727                Restrict = 1 << 1,
    2828                Volatile = 1 << 2,
    29                 Mutex    = 1 << 3,
    30                 Atomic   = 1 << 4,
    31                 NumQualifiers = 5
     29                Lvalue   = 1 << 3,
     30                Mutex    = 1 << 4,
     31                Atomic   = 1 << 5,
     32                NumQualifiers = 6
    3233        };
    3334
    3435        /// Mask for equivalence-preserving qualfiers
    35         enum { EquivQualifiers = ~Restrict };
     36        enum { EquivQualifiers = ~(Restrict | Lvalue) };
    3637
    3738        /// Underlying data for qualifiers
     
    4344                                bool is_restrict : 1;
    4445                                bool is_volatile : 1;
     46                                bool is_lvalue   : 1;
    4547                                bool is_mutex    : 1;
    4648                                bool is_atomic   : 1;
  • src/AST/Expr.cpp

    r3f3bfe5a rcf32116  
    1010// Created On       : Wed May 15 17:00:00 2019
    1111// Last Modified By : Andrew Beach
    12 // Created On       : Fri Oct  4 15:34:00 2019
    13 // Update Count     : 4
     12// Created On       : Thr Jun 26 12:12:00 2019
     13// Update Count     : 3
    1414//
    1515
     
    8282                        // base type
    8383                        ret->result = base;
     84                        add_qualifiers( ret->result, CV::Lvalue );
    8485                }
    8586        }
     
    130131                        // lvalue, retains all levels of reference, and gains a pointer inside the references
    131132                        Type * res = addrType( arg->result );
     133                        res->set_lvalue( false ); // result of & is never an lvalue
    132134                        result = res;
    133135                } else {
     
    136138                                        dynamic_cast< const ReferenceType * >( arg->result.get() ) ) {
    137139                                Type * res = addrType( refType->base );
     140                                res->set_lvalue( false ); // result of & is never an lvalue
    138141                                result = res;
    139142                        } else {
     
    227230        // substitute aggregate generic parameters into member type
    228231        genericSubstitution( aggregate->result ).apply( result );
    229         // ensure appropriate restrictions from aggregate type
    230         add_qualifiers( result, aggregate->result->qualifiers );
     232        // ensure lvalue and appropriate restrictions from aggregate type
     233        add_qualifiers( result, aggregate->result->qualifiers | CV::Lvalue );
    231234}
    232235
     
    254257        assert( var );
    255258        assert( var->get_type() );
    256         result = shallowCopy( var->get_type() );
     259        auto r = shallowCopy( var->get_type() );
     260        r->qualifiers |= CV::Lvalue;
     261        result = r;
    257262}
    258263
     
    371376        assert( t && i );
    372377        result = t;
     378        add_qualifiers( result, CV::Lvalue );
    373379}
    374380
     
    391397        // like MemberExpr, TupleIndexExpr is always an lvalue
    392398        result = type->types[ index ];
     399        add_qualifiers( result, CV::Lvalue );
    393400}
    394401
  • src/AST/Type.hpp

    r3f3bfe5a rcf32116  
    5151        bool is_volatile() const { return qualifiers.is_volatile; }
    5252        bool is_restrict() const { return qualifiers.is_restrict; }
     53        bool is_lvalue() const { return qualifiers.is_lvalue; }
    5354        bool is_mutex() const { return qualifiers.is_mutex; }
    5455        bool is_atomic() const { return qualifiers.is_atomic; }
     
    5758        Type * set_volatile( bool v ) { qualifiers.is_volatile = v; return this; }
    5859        Type * set_restrict( bool v ) { qualifiers.is_restrict = v; return this; }
     60        Type * set_lvalue( bool v ) { qualifiers.is_lvalue = v; return this; }
    5961        Type * set_mutex( bool v ) { qualifiers.is_mutex = v; return this; }
    6062        Type * set_atomic( bool v ) { qualifiers.is_atomic = v; return this; }
  • src/CodeGen/GenType.cc

    r3f3bfe5a rcf32116  
    335335                        typeString = "_Atomic " + typeString;
    336336                } // if
     337                if ( type->get_lvalue() && ! options.genC ) {
     338                        // when not generating C code, print lvalue for debugging.
     339                        typeString = "lvalue " + typeString;
     340                }
    337341        }
    338342} // namespace CodeGen
  • src/GenPoly/Box.cc

    r3f3bfe5a rcf32116  
    837837                                        deref->args.push_back( new CastExpr( new VariableExpr( param ), new PointerType( Type::Qualifiers(), arg->get_type()->clone() ) ) );
    838838                                        deref->result = arg->get_type()->clone();
     839                                        deref->result->set_lvalue( true );
    839840                                        return deref;
    840841                                } // if
  • src/GenPoly/Lvalue.cc

    r3f3bfe5a rcf32116  
    5454                                delete ret->result;
    5555                                ret->result = base->clone();
     56                                ret->result->set_lvalue( true );
    5657                                return ret;
    5758                        } else {
     
    166167                                ReferenceType * result = strict_dynamic_cast< ReferenceType * >( appExpr->result );
    167168                                appExpr->result = result->base->clone();
     169                                appExpr->result->set_lvalue( true );
    168170                                if ( ! inIntrinsic ) {
    169171                                        // when not in an intrinsic function, add a cast to
     
    434436                                delete ret->result;
    435437                                ret->result = castExpr->result;
    436                                 assert( ret->get_lvalue() ); // ensure result is lvalue
     438                                ret->result->set_lvalue( true ); // ensure result is lvalue
    437439                                castExpr->env = nullptr;
    438440                                castExpr->arg = nullptr;
  • src/Makefile.in

    r3f3bfe5a rcf32116  
    232232        SynTree/Initializer.$(OBJEXT) \
    233233        SynTree/TypeSubstitution.$(OBJEXT) SynTree/Attribute.$(OBJEXT) \
    234         SynTree/DeclReplacer.$(OBJEXT)
     234        SynTree/DeclReplacer.$(OBJEXT) SynTree/TopLvalue.$(OBJEXT)
    235235am__objects_8 = CompilationState.$(OBJEXT) $(am__objects_1) \
    236236        $(am__objects_2) Concurrency/Keywords.$(OBJEXT) \
     
    698698      SynTree/TypeSubstitution.cc \
    699699      SynTree/Attribute.cc \
    700       SynTree/DeclReplacer.cc
     700      SynTree/DeclReplacer.cc \
     701      SynTree/TopLvalue.cc
    701702
    702703
     
    10291030SynTree/DeclReplacer.$(OBJEXT): SynTree/$(am__dirstamp) \
    10301031        SynTree/$(DEPDIR)/$(am__dirstamp)
     1032SynTree/TopLvalue.$(OBJEXT): SynTree/$(am__dirstamp) \
     1033        SynTree/$(DEPDIR)/$(am__dirstamp)
    10311034Tuples/$(am__dirstamp):
    10321035        @$(MKDIR_P) Tuples
     
    13401343@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/ReferenceType.Po@am__quote@
    13411344@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/Statement.Po@am__quote@
     1345@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TopLvalue.Po@am__quote@
    13421346@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TupleExpr.Po@am__quote@
    13431347@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TupleType.Po@am__quote@
  • src/ResolvExpr/ResolveAssertions.cc

    r3f3bfe5a rcf32116  
    156156                        for ( const auto& assn : x.assns ) {
    157157                                // compute conversion cost from satisfying decl to assertion
     158                                assert( !assn.match.adjType->get_lvalue() );
    158159                                k += computeConversionCost(
    159160                                        assn.match.adjType, assn.decl->get_type(), false, indexer, x.env );
  • src/SymTab/Autogen.h

    r3f3bfe5a rcf32116  
    9898                        //   type->get_qualifiers() = Type::Qualifiers();
    9999                        Type * castType = addCast->clone();
    100                         castType->get_qualifiers() -= Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic );
     100                        castType->get_qualifiers() -= Type::Qualifiers( Type::Lvalue | Type::Const | Type::Volatile | Type::Restrict | Type::Atomic );
    101101                        // castType->set_lvalue( true ); // xxx - might not need this
    102102                        dstParam = new CastExpr( dstParam, new ReferenceType( Type::Qualifiers(), castType ) );
  • src/SymTab/ManglerCommon.cc

    r3f3bfe5a rcf32116  
    8888                                { Type::Atomic, "DA" }, // A is array, so need something unique for atmoic. For now, go with multiletter DA
    8989                                { Type::Mutex, "X" },
     90                                { Type::Lvalue, "L" },
    9091                        };
    9192
  • src/SymTab/Validate.cc

    r3f3bfe5a rcf32116  
    8181#include "SynTree/Label.h"             // for operator==, Label
    8282#include "SynTree/Mutator.h"           // for Mutator
     83#include "SynTree/TopLvalue.h"         // for assertTopLvalue, clearInnerLvalue
    8384#include "SynTree/Type.h"              // for Type, TypeInstType, EnumInstType
    8485#include "SynTree/TypeSubstitution.h"  // for TypeSubstitution
     
    308309                PassVisitor<FixQualifiedTypes> fixQual;
    309310
     311                assertTopLvalue( translationUnit );
    310312                {
    311313                        Stats::Heap::newPass("validate-A");
     
    316318                        acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes_old because it is an indexer and needs correct types for mangling
    317319                }
     320                assertTopLvalue( translationUnit );
    318321                {
    319322                        Stats::Heap::newPass("validate-B");
    320323                        Stats::Time::BlockGuard guard("validate-B");
     324                        assertTopLvalue( translationUnit );
    321325                        Stats::Time::TimeBlock("Link Reference To Types", [&]() {
    322326                                acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
    323327                        });
     328                        clearInnerLvalue( translationUnit );
     329                        assertTopLvalue( translationUnit );
    324330                        Stats::Time::TimeBlock("Fix Qualified Types", [&]() {
    325331                                mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes_old, because aggregate members are accessed
    326332                        });
     333                        assertTopLvalue( translationUnit );
    327334                        Stats::Time::TimeBlock("Hoist Structs", [&]() {
    328335                                HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
    329336                        });
     337                        assertTopLvalue( translationUnit );
    330338                        Stats::Time::TimeBlock("Eliminate Typedefs", [&]() {
    331339                                EliminateTypedef::eliminateTypedef( translationUnit ); //
    332340                        });
    333341                }
     342                assertTopLvalue( translationUnit );
    334343                {
    335344                        Stats::Heap::newPass("validate-C");
     
    340349                        InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen
    341350                }
     351                assertTopLvalue( translationUnit );
    342352                {
    343353                        Stats::Heap::newPass("validate-D");
    344354                        Stats::Time::BlockGuard guard("validate-D");
     355                        assertTopLvalue( translationUnit );
    345356                        Stats::Time::TimeBlock("Apply Concurrent Keywords", [&]() {
    346357                                Concurrency::applyKeywords( translationUnit );
    347358                        });
     359                        clearInnerLvalue( translationUnit );
     360                        assertTopLvalue( translationUnit );
    348361                        Stats::Time::TimeBlock("Forall Pointer Decay", [&]() {
    349362                                acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution
    350363                        });
     364                        assertTopLvalue( translationUnit );
    351365                        Stats::Time::TimeBlock("Hoist Control Declarations", [&]() {
    352366                                ControlStruct::hoistControlDecls( translationUnit );  // hoist initialization out of for statements; must happen before autogenerateRoutines
    353367                        });
     368                        assertTopLvalue( translationUnit );
    354369                        Stats::Time::TimeBlock("Generate Autogen routines", [&]() {
    355370                                autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay_old
    356371                        });
    357                 }
     372                        clearInnerLvalue( translationUnit );
     373                }
     374                assertTopLvalue( translationUnit );
    358375                {
    359376                        Stats::Heap::newPass("validate-E");
    360377                        Stats::Time::BlockGuard guard("validate-E");
     378                        assertTopLvalue( translationUnit );
    361379                        Stats::Time::TimeBlock("Implement Mutex Func", [&]() {
    362380                                Concurrency::implementMutexFuncs( translationUnit );
    363381                        });
     382                        clearInnerLvalue( translationUnit );
     383                        assertTopLvalue( translationUnit );
    364384                        Stats::Time::TimeBlock("Implement Thread Start", [&]() {
    365385                                Concurrency::implementThreadStarter( translationUnit );
    366386                        });
     387                        assertTopLvalue( translationUnit );
    367388                        Stats::Time::TimeBlock("Compound Literal", [&]() {
    368389                                mutateAll( translationUnit, compoundliteral );
    369390                        });
     391                        assertTopLvalue( translationUnit );
    370392                        Stats::Time::TimeBlock("Resolve With Expressions", [&]() {
    371393                                ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables
    372394                        });
    373                 }
     395                        clearInnerLvalue( translationUnit );
     396                }
     397                assertTopLvalue( translationUnit );
    374398                {
    375399                        Stats::Heap::newPass("validate-F");
    376400                        Stats::Time::BlockGuard guard("validate-F");
     401                        assertTopLvalue( translationUnit );
    377402                        Stats::Time::TimeBlock("Fix Object Type", [&]() {
    378403                                FixObjectType::fix( translationUnit );
    379404                        });
     405                        assertTopLvalue( translationUnit );
    380406                        Stats::Time::TimeBlock("Array Length", [&]() {
    381407                                ArrayLength::computeLength( translationUnit );
    382408                        });
     409                        clearInnerLvalue( translationUnit );
     410                        assertTopLvalue( translationUnit );
    383411                        Stats::Time::TimeBlock("Find Special Declarations", [&]() {
    384412                                Validate::findSpecialDecls( translationUnit );
    385413                        });
     414                        assertTopLvalue( translationUnit );
    386415                        Stats::Time::TimeBlock("Fix Label Address", [&]() {
    387416                                mutateAll( translationUnit, labelAddrFixer );
    388417                        });
     418                        assertTopLvalue( translationUnit );
    389419                        Stats::Time::TimeBlock("Handle Attributes", [&]() {
    390420                                Validate::handleAttributes( translationUnit );
    391421                        });
    392422                }
     423                assertTopLvalue( translationUnit );
    393424        }
    394425
     
    13031334        void FixObjectType::previsit( ObjectDecl * objDecl ) {
    13041335                Type * new_type = ResolvExpr::resolveTypeof( objDecl->get_type(), indexer );
     1336                new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type
    13051337                objDecl->set_type( new_type );
    13061338        }
     
    13081340        void FixObjectType::previsit( FunctionDecl * funcDecl ) {
    13091341                Type * new_type = ResolvExpr::resolveTypeof( funcDecl->type, indexer );
     1342                new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type
    13101343                funcDecl->set_type( new_type );
    13111344        }
     
    13141347                if ( typeDecl->get_base() ) {
    13151348                        Type * new_type = ResolvExpr::resolveTypeof( typeDecl->get_base(), indexer );
     1349                        new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type
    13161350                        typeDecl->set_base( new_type );
    13171351                } // if
  • src/SynTree/AddressExpr.cc

    r3f3bfe5a rcf32116  
    5353                        } // if
    5454                }
     55                // result of & is never an lvalue
     56                get_result()->set_lvalue( false );
    5557        }
    5658}
  • src/SynTree/ArrayType.cc

    r3f3bfe5a rcf32116  
    2626ArrayType::ArrayType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes )
    2727        : Type( tq, attributes ), base( base ), dimension( dimension ), isVarLen( isVarLen ), isStatic( isStatic ) {
     28        base->set_lvalue( false );
    2829}
    2930
  • src/SynTree/CommaExpr.cc

    r3f3bfe5a rcf32116  
    2323CommaExpr::CommaExpr( Expression *arg1, Expression *arg2 )
    2424                : Expression(), arg1( arg1 ), arg2( arg2 ) {
     25        // xxx - result of a comma expression is never an lvalue, so should set lvalue
     26        // to false on all result types. Actually doing this causes some strange things
     27        // to happen in later passes (particularly, Specialize, Lvalue, and Box). This needs to be looked into.
    2528        set_result( maybeClone( arg2->get_result() ) );
     29        // get_type->set_isLvalue( false );
    2630}
    2731
     
    3741bool CommaExpr::get_lvalue() const {
    3842        // This is wrong by C, but the current implementation uses it.
    39         // (ex: Specialize, Lvalue and Box)
    4043        return arg2->get_lvalue();
    4144}
  • src/SynTree/Expression.cc

    r3f3bfe5a rcf32116  
    115115        assert( var->get_type() );
    116116        Type * type = var->get_type()->clone();
     117        type->set_lvalue( true );
    117118
    118119        // xxx - doesn't quite work yet - get different alternatives with the same cost
     
    124125        //      long long int value;
    125126        //      if ( decl->valueOf( var, value ) ) {
    126         //              type->set_lvalue( false ); // Would have to move to get_lvalue.
     127        //              type->set_lvalue( false );
    127128        //      }
    128129        // }
     
    383384        sub.apply( res );
    384385        result = res;
     386        result->set_lvalue( true );
    385387        result->get_qualifiers() |= aggregate->result->get_qualifiers();
    386388}
     
    431433                        // if references are still allowed in the AST, dereference returns a reference
    432434                        ret->set_result( new ReferenceType( Type::Qualifiers(), ret->get_result() ) );
     435                } else {
     436                        // references have been removed, in which case dereference returns an lvalue of the base type.
     437                        ret->result->set_lvalue( true );
    433438                }
    434439        }
     
    586591CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : initializer( initializer ) {
    587592        assert( type && initializer );
     593        type->set_lvalue( true );
    588594        set_result( type );
    589595}
  • src/SynTree/TupleExpr.cc

    r3f3bfe5a rcf32116  
    7171        assertf( type->size() > index, "TupleIndexExpr index out of bounds: tuple size %d, requested index %d in expr %s", type->size(), index, toString( tuple ).c_str() );
    7272        set_result( (*std::next( type->get_types().begin(), index ))->clone() );
     73        // like MemberExpr, TupleIndexExpr is always an lvalue
     74        get_result()->set_lvalue( true );
    7375}
    7476
  • src/SynTree/Type.cc

    r3f3bfe5a rcf32116  
    8585const char * Type::FuncSpecifiersNames[] = { "inline", "_Noreturn", "fortran" };
    8686const char * Type::StorageClassesNames[] = { "extern", "static", "auto", "register", "_Thread_local" };
    87 const char * Type::QualifiersNames[] = { "const", "restrict", "volatile", "mutex", "_Atomic" };
     87const char * Type::QualifiersNames[] = { "const", "restrict", "volatile", "lvalue", "mutex", "_Atomic" };
    8888
    8989Type * Type::stripDeclarator() {
  • src/SynTree/Type.h

    r3f3bfe5a rcf32116  
    102102        }; // StorageClasses
    103103
    104         enum { Const = 1 << 0, Restrict = 1 << 1, Volatile = 1 << 2, Mutex = 1 << 3, Atomic = 1 << 4, NumTypeQualifier = 5 };
     104        enum { Const = 1 << 0, Restrict = 1 << 1, Volatile = 1 << 2, Lvalue = 1 << 3, Mutex = 1 << 4, Atomic = 1 << 5, NumTypeQualifier = 6 };
    105105        static const char * QualifiersNames[];
    106106        union Qualifiers {
    107                 enum { Mask = ~Restrict };
     107                enum { Mask = ~(Restrict | Lvalue) };
    108108                unsigned int val;
    109109                struct {
     
    111111                        bool is_restrict : 1;
    112112                        bool is_volatile : 1;
     113                        bool is_lvalue : 1;
    113114                        bool is_mutex : 1;
    114115                        bool is_atomic : 1;
     
    152153        bool get_volatile() const { return tq.is_volatile; }
    153154        bool get_restrict() const { return tq.is_restrict; }
     155        bool get_lvalue() const { return tq.is_lvalue; }
    154156        bool get_mutex() const { return tq.is_mutex; }
    155157        bool get_atomic() const { return tq.is_atomic; }
     
    157159        void set_volatile( bool newValue ) { tq.is_volatile = newValue; }
    158160        void set_restrict( bool newValue ) { tq.is_restrict = newValue; }
     161        void set_lvalue( bool newValue ) { tq.is_lvalue = newValue; }
    159162        void set_mutex( bool newValue ) { tq.is_mutex = newValue; }
    160163        void set_atomic( bool newValue ) { tq.is_atomic = newValue; }
  • src/SynTree/module.mk

    r3f3bfe5a rcf32116  
    4949      SynTree/TypeSubstitution.cc \
    5050      SynTree/Attribute.cc \
    51       SynTree/DeclReplacer.cc
     51      SynTree/DeclReplacer.cc \
     52      SynTree/TopLvalue.cc
    5253
    5354SRC += $(SRC_SYNTREE)
  • src/Tuples/TupleExpansion.cc

    r3f3bfe5a rcf32116  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Oct  4 15:38:00 2019
    13 // Update Count     : 23
     12// Last Modified On : Fri Jul 19 14:39:00 2019
     13// Update Count     : 22
    1414//
    1515
     
    304304                // produce the TupleType which aggregates the types of the exprs
    305305                std::list< Type * > types;
    306                 Type::Qualifiers qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic | Type::Mutex );
     306                Type::Qualifiers qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Lvalue | Type::Atomic | Type::Mutex );
    307307                for ( Expression * expr : exprs ) {
    308308                        assert( expr->get_result() );
     
    323323                std::vector<ast::ptr<ast::Type>> types;
    324324                ast::CV::Qualifiers quals{
    325                         ast::CV::Const | ast::CV::Volatile | ast::CV::Restrict |
     325                        ast::CV::Const | ast::CV::Volatile | ast::CV::Restrict | ast::CV::Lvalue |
    326326                        ast::CV::Atomic | ast::CV::Mutex };
    327327
  • src/main.cc

    r3f3bfe5a rcf32116  
    6060#include "ResolvExpr/Resolver.h"            // for resolve
    6161#include "SymTab/Validate.h"                // for validate
     62#include "SynTree/TopLvalue.h"              // for assertTopLvalue, clearInn...
    6263#include "SynTree/Declaration.h"            // for Declaration
    6364#include "SynTree/Visitor.h"                // for acceptAll
     
    259260                Stats::Time::StopBlock();
    260261
     262                //std::cerr << "Post-Parse Check" << std::endl;
     263                clearInnerLvalue( translationUnit );
     264                assertTopLvalue( translationUnit );
     265
    261266                // add the assignment statement after the initialization of a type parameter
    262267                PASS( "Validate", SymTab::validate( translationUnit, symtabp ) );
     
    277282                } // if
    278283
     284                assertTopLvalue( translationUnit );
    279285                PASS( "Fix Labels", ControlStruct::fixLabels( translationUnit ) );
     286                assertTopLvalue( translationUnit );
    280287                PASS( "Fix Names", CodeGen::fixNames( translationUnit ) );
     288                assertTopLvalue( translationUnit );
    281289                PASS( "Gen Init", InitTweak::genInit( translationUnit ) );
     290                assertTopLvalue( translationUnit );
    282291                PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) );
     292                assertTopLvalue( translationUnit );
    283293                if ( libcfap ) {
    284294                        // generate the bodies of cfa library functions
     
    316326                } // if
    317327
     328                clearInnerLvalue( translationUnit );
     329                assertTopLvalue( translationUnit );
     330
    318331                // fix ObjectDecl - replaces ConstructorInit nodes
    319332                PASS( "Fix Init", InitTweak::fix( translationUnit, buildingLibrary() ) );
     333                clearInnerLvalue( translationUnit );
     334                assertTopLvalue( translationUnit );
    320335                if ( ctorinitp ) {
    321336                        dump ( translationUnit );
     
    324339
    325340                PASS( "Expand Unique Expr", Tuples::expandUniqueExpr( translationUnit ) ); // xxx - is this the right place for this? want to expand ASAP so tha, sequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
     341                assertTopLvalue( translationUnit );
    326342
    327343                PASS( "Translate EHM" , ControlStruct::translateEHM( translationUnit ) );
     344                assertTopLvalue( translationUnit );
    328345
    329346                PASS( "Gen Waitfor" , Concurrency::generateWaitFor( translationUnit ) );
     347                clearInnerLvalue( translationUnit );
     348                assertTopLvalue( translationUnit );
    330349
    331350                PASS( "Convert Specializations",  GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded
     351                clearInnerLvalue( translationUnit );
     352                assertTopLvalue( translationUnit );
    332353
    333354                PASS( "Expand Tuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this?
     355                assertTopLvalue( translationUnit );
    334356
    335357                if ( tuplep ) {
     
    339361
    340362                PASS( "Virtual Expand Casts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM
     363                assertTopLvalue( translationUnit );
    341364
    342365                PASS( "Instantiate Generics", GenPoly::instantiateGeneric( translationUnit ) );
     
    345368                        return EXIT_SUCCESS;
    346369                } // if
    347 
     370                clearInnerLvalue( translationUnit );
     371                assertTopLvalue( translationUnit );
    348372                PASS( "Convert L-Value", GenPoly::convertLvalue( translationUnit ) );
     373                clearInnerLvalue( translationUnit );
     374                assertTopLvalue( translationUnit );
    349375
    350376                if ( bboxp ) {
     
    353379                } // if
    354380                PASS( "Box", GenPoly::box( translationUnit ) );
     381                clearInnerLvalue( translationUnit );
     382                assertTopLvalue( translationUnit );
    355383
    356384                if ( bcodegenp ) {
     
    364392
    365393                CodeTools::fillLocations( translationUnit );
     394                assertTopLvalue( translationUnit );
    366395                PASS( "Code Gen", CodeGen::generate( translationUnit, *output, ! genproto, prettycodegenp, true, linemarks ) );
    367396
Note: See TracChangeset for help on using the changeset viewer.