Changeset 3403534 for src/ResolvExpr


Ignore:
Timestamp:
Sep 4, 2016, 10:34:35 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
f04a8b81
Parents:
28307be (diff), b16898e (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 plg2:software/cfa/cfa-cc

Location:
src/ResolvExpr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AlternativeFinder.cc

    r28307be r3403534  
    3838#include "SynTree/TypeSubstitution.h"
    3939#include "SymTab/Validate.h"
    40 #include "Designators/Processor.h"
    4140#include "Tuples/TupleAssignment.h"
    4241#include "Tuples/NameMatcher.h"
    4342#include "Common/utility.h"
    4443#include "InitTweak/InitTweak.h"
     44#include "ResolveTypeof.h"
    4545
    4646extern bool resolvep;
     
    708708        void AlternativeFinder::visit( CastExpr *castExpr ) {
    709709                for ( std::list< Type* >::iterator i = castExpr->get_results().begin(); i != castExpr->get_results().end(); ++i ) {
     710                        *i = resolveTypeof( *i, indexer );
    710711                        SymTab::validateType( *i, &indexer );
    711712                        adjustExprType( *i, env, indexer );
     
    796797
    797798        void AlternativeFinder::visit( VariableExpr *variableExpr ) {
    798                 alternatives.push_back( Alternative( variableExpr->clone(), env, Cost::zero ) );
     799                // not sufficient to clone here, because variable's type may have changed
     800                // since the VariableExpr was originally created.
     801                alternatives.push_back( Alternative( new VariableExpr( variableExpr->get_var() ), env, Cost::zero ) );
    799802        }
    800803
     
    805808        void AlternativeFinder::visit( SizeofExpr *sizeofExpr ) {
    806809                if ( sizeofExpr->get_isType() ) {
     810                        // xxx - resolveTypeof?
    807811                        alternatives.push_back( Alternative( sizeofExpr->clone(), env, Cost::zero ) );
    808812                } else {
     
    824828        void AlternativeFinder::visit( AlignofExpr *alignofExpr ) {
    825829                if ( alignofExpr->get_isType() ) {
     830                        // xxx - resolveTypeof?
    826831                        alternatives.push_back( Alternative( alignofExpr->clone(), env, Cost::zero ) );
    827832                } else {
     
    857862        void AlternativeFinder::visit( UntypedOffsetofExpr *offsetofExpr ) {
    858863                AlternativeFinder funcFinder( indexer, env );
     864                // xxx - resolveTypeof?
    859865                if ( StructInstType *structInst = dynamic_cast< StructInstType* >( offsetofExpr->get_type() ) ) {
    860866                        addOffsetof( structInst, offsetofExpr->get_member() );
  • src/ResolvExpr/Resolver.cc

    r28307be r3403534  
    528528
    529529        void Resolver::visit( ConstructorInit *ctorInit ) {
    530                 try {
    531                         maybeAccept( ctorInit->get_ctor(), *this );
    532                         maybeAccept( ctorInit->get_dtor(), *this );
    533                 } catch ( SemanticError ) {
    534                         // no alternatives for the constructor initializer - fallback on C-style initializer
    535                         // xxx - not sure if this makes a ton of sense - should maybe never be able to have this situation?
    536                         fallbackInit( ctorInit );
    537                         return;
    538                 }
     530                // xxx - fallback init has been removed => remove fallbackInit function and remove complexity from FixInit and remove C-init from ConstructorInit
     531                maybeAccept( ctorInit->get_ctor(), *this );
     532                maybeAccept( ctorInit->get_dtor(), *this );
    539533
    540534                // found a constructor - can get rid of C-style initializer
Note: See TracChangeset for help on using the changeset viewer.