Ignore:
Timestamp:
Jun 24, 2015, 4:04:19 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, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
94e0864d
Parents:
a1d5d2a
Message:

fix computed goto, fixed -std=, implicit typedefs for enum and aggregates, add _Noreturn _Thread_local

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    ra1d5d2a rde62360d  
    1010// Created On       : Sun May 17 12:17:01 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jun  7 21:50:37 2015
    13 // Update Count     : 23
     12// Last Modified On : Wed Jun 24 15:47:16 2015
     13// Update Count     : 50
    1414//
    1515
     
    4545                virtual void visit( ChooseStmt *switchStmt );
    4646                virtual void visit( CaseStmt *caseStmt );
     47                virtual void visit( BranchStmt *branchStmt );
    4748                virtual void visit( ReturnStmt *returnStmt );
    4849
     
    260261        void Resolver::visit( CaseStmt *caseStmt ) {
    261262                Visitor::visit( caseStmt );
     263        }
     264
     265        void Resolver::visit( BranchStmt *branchStmt ) {
     266                // must resolve the argument for a computed goto
     267                if ( branchStmt->get_type() == BranchStmt::Goto ) { // check for computed goto statement
     268                        if ( NameExpr * arg = dynamic_cast< NameExpr * >( branchStmt->get_computedTarget() ) ) {
     269                                VoidType v = Type::Qualifiers();                // cast to void * for the alternative finder
     270                                PointerType pt( Type::Qualifiers(), v.clone() );
     271                                CastExpr * castExpr = new CastExpr( arg, pt.clone() );
     272                                Expression * newExpr = findSingleExpression( castExpr, *this ); // find best expression
     273                                branchStmt->set_target( newExpr );
     274                        } // if
     275                } // if
    262276        }
    263277
Note: See TracChangeset for help on using the changeset viewer.