Ignore:
Timestamp:
Feb 5, 2016, 12:28:21 PM (10 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
408d460, bd85400
Parents:
b4cd03b7 (diff), 2a4b088 (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' into fix-argument-passing-type-warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AlternativeFinder.cc

    rb4cd03b7 r4789f44  
    811811        }
    812812
     813        template< typename StructOrUnionType >
     814        void AlternativeFinder::addOffsetof( StructOrUnionType *aggInst, const std::string &name ) {
     815                std::list< Declaration* > members;
     816                aggInst->lookup( name, members );
     817                for ( std::list< Declaration* >::const_iterator i = members.begin(); i != members.end(); ++i ) {
     818                        if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType* >( *i ) ) {
     819                                alternatives.push_back( Alternative( new OffsetofExpr( aggInst->clone(), dwt->clone() ), env, Cost::zero ) );
     820                                renameTypes( alternatives.back().expr );
     821                        } else {
     822                                assert( false );
     823                        }
     824                }
     825        }
     826       
     827        void AlternativeFinder::visit( UntypedOffsetofExpr *offsetofExpr ) {
     828                AlternativeFinder funcFinder( indexer, env );
     829                if ( StructInstType *structInst = dynamic_cast< StructInstType* >( offsetofExpr->get_type() ) ) {
     830                        addOffsetof( structInst, offsetofExpr->get_member() );
     831                } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( offsetofExpr->get_type() ) ) {
     832                        addOffsetof( unionInst, offsetofExpr->get_member() );
     833                }
     834        }
     835       
    813836        void AlternativeFinder::visit( OffsetofExpr *offsetofExpr ) {
    814837                alternatives.push_back( Alternative( offsetofExpr->clone(), env, Cost::zero ) );
Note: See TracChangeset for help on using the changeset viewer.