Ignore:
Timestamp:
Sep 13, 2018, 11:09:15 AM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
4d59ff9, b499c18
Parents:
b181639
Message:

Fix gcc-5 support for ResolvProtoDump?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeTools/ResolvProtoDump.cc

    rb181639 r40cd873  
    2323#include <string>
    2424#include <unordered_set>
     25#include <utility>
    2526#include <vector>
    2627
     
    3637        /// Visitor for dumping resolver prototype output
    3738        class ProtoDump : public WithShortCircuiting, public WithVisitorRef<ProtoDump> {
    38                 std::set<std::string> decls;               ///< Declarations in this scope
    39                 std::vector<std::string> exprs;            ///< Expressions in this scope
    40                 std::vector<PassVisitor<ProtoDump>> subs;  ///< Sub-scopes
    41                 const ProtoDump* parent;                   ///< Outer lexical scope
     39                std::set<std::string> decls;     ///< Declarations in this scope
     40                std::vector<std::string> exprs;  ///< Expressions in this scope
     41                std::vector<ProtoDump> subs;     ///< Sub-scopes
     42                const ProtoDump* parent;         ///< Outer lexical scope
    4243
    4344        public:
     
    4647
    4748                /// Child constructor
    48                 ProtoDump(const ProtoDump& p) : decls(), exprs(), subs(), parent(&p) {}
     49                ProtoDump(const ProtoDump* p) : decls(), exprs(), subs(), parent(p) {}
    4950
    5051        private:
     
    6768
    6869                /// adds a new subscope to this scope, returning a reference
    69                 PassVisitor<ProtoDump>& addSub() {
    70                         subs.emplace_back( *this );
    71                         return subs.back();
     70                void addSub( PassVisitor<ProtoDump>&& sub ) {
     71                        subs.emplace_back( std::move(sub.pass) );
    7272                }
    7373       
     
    517517                        // add body if available
    518518                        if ( decl->statements ) {
    519                                 PassVisitor<ProtoDump>& body = addSub();
     519                                PassVisitor<ProtoDump> body{ this };
    520520                               
    521521                                // add named parameters and returns to local scope
     
    529529                                // add contents of function to new scope
    530530                                decl->statements->accept( body );
     531
     532                                // store sub-scope
     533                                addSub( std::move(body) );
    531534                        }
    532535
Note: See TracChangeset for help on using the changeset viewer.