Changeset 84e8423


Ignore:
Timestamp:
Jan 23, 2018, 1:12:26 PM (4 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
15d248e
Parents:
e23d20b
Message:

Fix initialization issue with nested unions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CurrentObject.cc

    re23d20b r84e8423  
    6262                virtual ~MemberIterator() {}
    6363
     64                /// walks the current object using the given designators as a guide
    6465                virtual void setPosition( std::list< Expression * > & designators ) = 0;
     66
     67                /// retrieve the list of possible Type/Designaton pairs for the current position in the currect object
    6568                virtual std::list<InitAlternative> operator*() const = 0;
     69
     70                /// true if the iterator is not currently at the end
    6671                virtual operator bool() const = 0;
     72
     73                /// moves the iterator by one member in the current object
    6774                virtual MemberIterator & bigStep() = 0;
     75
     76                /// moves the iterator by one member in the current subobject
    6877                virtual MemberIterator & smallStep() = 0;
     78
     79                /// the type of the current object
    6980                virtual Type * getType() = 0;
     81
     82                /// the type of the current subobject
    7083                virtual Type * getNext() = 0;
    7184
     85                /// printing for debug
    7286                virtual void print( std::ostream & out, Indenter indent ) const = 0;
    7387
     88                /// helper for operator*; aggregates must add designator to each init alternative, but
     89                /// adding designators in operator* creates duplicates.
    7490                virtual std::list<InitAlternative> first() const = 0; // should be protected
    7591        };
     
    354370                                }
    355371                        }
    356                         // if ( curMember == std::next( decl->get_members().begin(), 1 ) ) { // xxx - this never triggers because curMember is incremented immediately on construction
    357                         if ( atbegin ) { // xxx - this never triggers because curMember is incremented immediately on construction
     372                        if ( atbegin ) {
    358373                                // xxx - what about case of empty struct??
    359374                                // only add self if at the very beginning of the structure
     
    389404                        return *this;
    390405                }
    391                 virtual std::list<InitAlternative> first() const { return std::list<InitAlternative>{}; }
    392406        };
    393407
Note: See TracChangeset for help on using the changeset viewer.