Changeset 8d7bef2


Ignore:
Timestamp:
Mar 20, 2018, 5:12:25 PM (5 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env, with_gc
Children:
7e4b44d
Parents:
68f9c43
Message:

First compiling build of CFA-CC with GC

Location:
src
Files:
1 deleted
23 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/FixMain.cc

    r68f9c43 r8d7bef2  
    2929namespace CodeGen {
    3030        bool FixMain::replace_main = false;
    31         std::unique_ptr<FunctionDecl> FixMain::main_signature = nullptr;
     31        FunctionDecl* FixMain::main_signature = nullptr;
    3232
    3333        template<typename container>
     
    4141                        SemanticError(functionDecl, "Multiple definition of main routine\n");
    4242                }
    43                 main_signature.reset( functionDecl->clone() );
     43                main_signature = functionDecl;
    4444        }
    4545
  • src/CodeGen/FixMain.h

    r68f9c43 r8d7bef2  
    4040          private:
    4141                static bool replace_main;
    42                 static std::unique_ptr<FunctionDecl> main_signature;
     42                static FunctionDecl* main_signature;
    4343        };
    4444};
  • src/CodeGen/FixNames.cc

    r68f9c43 r8d7bef2  
    1616#include "FixNames.h"
    1717
    18 #include <memory>                  // for unique_ptr
    1918#include <string>                  // for string, operator!=, operator==
    2019
     
    4746        std::string mangle_main() {
    4847                FunctionType* main_type;
    49                 std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", Type::StorageClasses(), LinkageSpec::Cforall,
    50                                                                                                                                    main_type = new FunctionType( Type::Qualifiers(), true ), nullptr )
    51                                 };
     48                FunctionDecl* mainDecl = new FunctionDecl{
     49                        "main", Type::StorageClasses(), LinkageSpec::Cforall,
     50                        main_type = new FunctionType{ Type::Qualifiers(), true }, nullptr };
    5251                main_type->get_returnVals().push_back(
    5352                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    5453                );
    5554
    56                 auto && name = SymTab::Mangler::mangle( mainDecl.get() );
     55                auto && name = SymTab::Mangler::mangle( mainDecl );
    5756                // std::cerr << name << std::endl;
    5857                return name;
     
    6059        std::string mangle_main_args() {
    6160                FunctionType* main_type;
    62                 std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", Type::StorageClasses(), LinkageSpec::Cforall,
    63                                                                                                                                    main_type = new FunctionType( Type::Qualifiers(), false ), nullptr )
    64                                 };
     61                FunctionDecl* mainDecl = new FunctionDecl{
     62                        "main", Type::StorageClasses(), LinkageSpec::Cforall,
     63                        main_type = new FunctionType{ Type::Qualifiers(), false }, nullptr };
    6564                main_type->get_returnVals().push_back(
    6665                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
     
    7776                );
    7877
    79                 auto&& name = SymTab::Mangler::mangle( mainDecl.get() );
     78                auto&& name = SymTab::Mangler::mangle( mainDecl );
    8079                // std::cerr << name << std::endl;
    8180                return name;
  • src/Common/GC.h

    r68f9c43 r8d7bef2  
    6666inline const GC& operator<< (const GC& gc, const T& x) { return gc; }
    6767
    68 inline void traceAll(const GC& gc) {}
     68inline void traceAll(const GC&) {}
    6969
    7070/// Marks all arguments as live in current generation
     
    9494class GC_Traceable {
    9595        friend class GC;
    96         friend class GcTracer;
     96protected:
     97        mutable bool mark;
    9798
    98         mutable bool mark;
    99 protected:
    10099        /// override to trace any child objects
    101         virtual void trace(const GC& gc) const {}
     100        virtual void trace(const GC&) const {}
    102101};
    103102
  • src/Concurrency/Keywords.cc

    r68f9c43 r8d7bef2  
    200200                StructDecl* dtor_guard_decl = nullptr;
    201201
    202                 static std::unique_ptr< Type > generic_func;
     202                static Type* generic_func;
    203203        };
    204204
    205         std::unique_ptr< Type > MutexKeyword::generic_func = std::unique_ptr< Type >(
    206                 new FunctionType(
    207                         noQualifiers,
    208                         true
    209                 )
    210         );
     205        Type* MutexKeyword::generic_func = new FunctionType{ noQualifiers, true };
    211206
    212207        //-----------------------------------------------------------------------------
  • src/Concurrency/Waitfor.cc

    r68f9c43 r8d7bef2  
    137137                StructDecl          * decl_acceptable = nullptr;
    138138                StructDecl          * decl_monitor    = nullptr;
    139 
    140                 static std::unique_ptr< Type > generic_func;
    141139
    142140                UniqueName namer_acc = "__acceptables_"s;
  • src/GenPoly/GenPoly.cc

    r68f9c43 r8d7bef2  
    437437                Type * newType = arg->clone();
    438438                if ( env ) env->apply( newType );
    439                 std::unique_ptr<Type> manager( newType );
    440439                // if the argument's type is polymorphic, we don't need to box again!
    441440                return ! isPolyType( newType );
  • src/GenPoly/Specialize.cc

    r68f9c43 r8d7bef2  
    1717#include <iterator>                      // for back_insert_iterator, back_i...
    1818#include <map>                           // for _Rb_tree_iterator, _Rb_tree_...
    19 #include <memory>                        // for unique_ptr
    2019#include <string>                        // for string
    2120#include <tuple>                         // for get
     
    225224                        env->apply( actualType );
    226225                }
    227                 std::unique_ptr< FunctionType > actualTypeManager( actualType ); // for RAII
    228226                std::list< DeclarationWithType * >::iterator actualBegin = actualType->get_parameters().begin();
    229227                std::list< DeclarationWithType * >::iterator actualEnd = actualType->get_parameters().end();
  • src/InitTweak/InitTweak.cc

    r68f9c43 r8d7bef2  
    122122        public:
    123123                ExprImpl( Expression * expr ) : arg( expr ) {}
    124                 virtual ~ExprImp() = default;
     124                virtual ~ExprImpl() = default;
    125125
    126126                virtual std::list< Expression * > next( std::list< Expression * > & indices ) {
  • src/Makefile.in

    r68f9c43 r8d7bef2  
    250250        SynTree/driver_cfa_cpp-TypeSubstitution.$(OBJEXT) \
    251251        SynTree/driver_cfa_cpp-Attribute.$(OBJEXT) \
    252         SynTree/driver_cfa_cpp-GcTracer.$(OBJEXT) \
    253252        SynTree/driver_cfa_cpp-VarExprReplacer.$(OBJEXT) \
    254253        Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT) \
     
    528527        SynTree/NamedTypeDecl.cc SynTree/TypeDecl.cc \
    529528        SynTree/Initializer.cc SynTree/TypeSubstitution.cc \
    530         SynTree/Attribute.cc SynTree/GcTracer.cc \
    531         SynTree/VarExprReplacer.cc Tuples/TupleAssignment.cc \
    532         Tuples/TupleExpansion.cc Tuples/Explode.cc \
    533         Virtual/ExpandCasts.cc
     529        SynTree/Attribute.cc SynTree/VarExprReplacer.cc \
     530        Tuples/TupleAssignment.cc Tuples/TupleExpansion.cc \
     531        Tuples/Explode.cc Virtual/ExpandCasts.cc
    534532MAINTAINERCLEANFILES = Parser/parser.output ${libdir}/${notdir \
    535533        ${cfa_cpplib_PROGRAMS}}
     
    917915SynTree/driver_cfa_cpp-Attribute.$(OBJEXT): SynTree/$(am__dirstamp) \
    918916        SynTree/$(DEPDIR)/$(am__dirstamp)
    919 SynTree/driver_cfa_cpp-GcTracer.$(OBJEXT): SynTree/$(am__dirstamp) \
    920         SynTree/$(DEPDIR)/$(am__dirstamp)
    921917SynTree/driver_cfa_cpp-VarExprReplacer.$(OBJEXT):  \
    922918        SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
     
    10531049@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionDecl.Po@am__quote@
    10541050@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionType.Po@am__quote@
    1055 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-GcTracer.Po@am__quote@
    10561051@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Initializer.Po@am__quote@
    10571052@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-NamedTypeDecl.Po@am__quote@
     
    25202515@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    25212516@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Attribute.obj `if test -f 'SynTree/Attribute.cc'; then $(CYGPATH_W) 'SynTree/Attribute.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Attribute.cc'; fi`
    2522 
    2523 SynTree/driver_cfa_cpp-GcTracer.o: SynTree/GcTracer.cc
    2524 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-GcTracer.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-GcTracer.Tpo -c -o SynTree/driver_cfa_cpp-GcTracer.o `test -f 'SynTree/GcTracer.cc' || echo '$(srcdir)/'`SynTree/GcTracer.cc
    2525 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-GcTracer.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-GcTracer.Po
    2526 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/GcTracer.cc' object='SynTree/driver_cfa_cpp-GcTracer.o' libtool=no @AMDEPBACKSLASH@
    2527 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2528 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-GcTracer.o `test -f 'SynTree/GcTracer.cc' || echo '$(srcdir)/'`SynTree/GcTracer.cc
    2529 
    2530 SynTree/driver_cfa_cpp-GcTracer.obj: SynTree/GcTracer.cc
    2531 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-GcTracer.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-GcTracer.Tpo -c -o SynTree/driver_cfa_cpp-GcTracer.obj `if test -f 'SynTree/GcTracer.cc'; then $(CYGPATH_W) 'SynTree/GcTracer.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/GcTracer.cc'; fi`
    2532 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-GcTracer.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-GcTracer.Po
    2533 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/GcTracer.cc' object='SynTree/driver_cfa_cpp-GcTracer.obj' libtool=no @AMDEPBACKSLASH@
    2534 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2535 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-GcTracer.obj `if test -f 'SynTree/GcTracer.cc'; then $(CYGPATH_W) 'SynTree/GcTracer.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/GcTracer.cc'; fi`
    25362517
    25372518SynTree/driver_cfa_cpp-VarExprReplacer.o: SynTree/VarExprReplacer.cc
  • src/Parser/ParseNode.h

    r68f9c43 r8d7bef2  
    124124
    125125        virtual void print( std::ostream &os, __attribute__((unused)) int indent = 0 ) const override {
    126                 os << expr.get() << std::endl;
     126                os << expr << std::endl;
    127127        }
    128128        void printOneLine( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const {}
    129129
    130130        template<typename T>
    131         bool isExpressionType() const { return nullptr != dynamic_cast<T>(expr.get()); }
    132 
    133         Expression * build() const { return const_cast<ExpressionNode *>(this)->expr.release(); }
     131        bool isExpressionType() const { return nullptr != dynamic_cast<T>(expr); }
     132
     133        Expression * build() const { return expr; }
    134134  private:
    135135        bool extension = false;
    136         std::unique_ptr<Expression> expr;
     136        Expression* expr;
    137137}; // ExpressionNode
    138138
     
    352352
    353353        virtual StatementNode * clone() const final { assert( false ); return nullptr; }
    354         Statement * build() const { return const_cast<StatementNode *>(this)->stmt.release(); }
     354        Statement * build() const { return stmt; }
    355355
    356356        virtual StatementNode * add_label( const std::string * name, DeclarationNode * attr = nullptr ) {
     
    364364
    365365        virtual void print( std::ostream &os, __attribute__((unused)) int indent = 0 ) const override {
    366                 os << stmt.get() << std::endl;
     366                os << stmt << std::endl;
    367367        }
    368368  private:
    369         std::unique_ptr<Statement> stmt;
     369        Statement* stmt;
    370370}; // StatementNode
    371371
  • src/Parser/StatementNode.cc

    r68f9c43 r8d7bef2  
    1616#include <cassert>                 // for assert, strict_dynamic_cast, assertf
    1717#include <list>                    // for list
    18 #include <memory>                  // for unique_ptr
    1918#include <string>                  // for string
    2019
     
    5049                agg = decl;
    5150        } // if
    52         stmt.reset( new DeclStmt( maybeMoveBuild< Declaration >(agg) ) );
     51        stmt = new DeclStmt{ maybeMoveBuild< Declaration >(agg) };
    5352} // StatementNode::StatementNode
    5453
     
    5857        for ( StatementNode * curr = prev; curr != nullptr; curr = (StatementNode *)curr->get_next() ) {
    5958                StatementNode *node = strict_dynamic_cast< StatementNode * >(curr);
    60                 assert( dynamic_cast< CaseStmt * >(node->stmt.get()) );
     59                assert( dynamic_cast< CaseStmt * >(node->stmt) );
    6160                prev = curr;
    6261        } // for
     
    6665        buildMoveList( stmt, stmts );
    6766        // splice any new Statements to end of current Statements
    68         CaseStmt * caseStmt = dynamic_cast< CaseStmt * >(node->stmt.get());
     67        CaseStmt * caseStmt = dynamic_cast< CaseStmt * >(node->stmt);
    6968        caseStmt->get_statements().splice( caseStmt->get_statements().end(), stmts );
    7069        return this;
  • src/ResolvExpr/AlternativeFinder.cc

    r68f9c43 r8d7bef2  
    2121#include <list>                    // for _List_iterator, list, _List_const_...
    2222#include <map>                     // for _Rb_tree_iterator, map, _Rb_tree_c...
    23 #include <memory>                  // for allocator_traits<>::value_type, unique_ptr
     23#include <memory>                  // for allocator_traits<>::value_type
    2424#include <utility>                 // for pair
    2525#include <vector>                  // for vector
     
    296296                // adds anonymous member interpretations whenever an aggregate value type is seen.
    297297                // it's okay for the aggregate expression to have reference type -- cast it to the base type to treat the aggregate as the referenced value
    298                 std::unique_ptr<Expression> aggrExpr( alt.expr->clone() );
     298                Expression* aggrExpr = alt.expr->clone();
    299299                alt.env.apply( aggrExpr->get_result() );
    300300                Type * aggrType = aggrExpr->get_result();
    301301                if ( dynamic_cast< ReferenceType * >( aggrType ) ) {
    302302                        aggrType = aggrType->stripReferences();
    303                         aggrExpr.reset( new CastExpr( aggrExpr.release(), aggrType->clone() ) );
     303                        aggrExpr = new CastExpr{ aggrExpr, aggrType->clone() };
    304304                }
    305305
    306306                if ( StructInstType *structInst = dynamic_cast< StructInstType* >( aggrExpr->get_result() ) ) {
    307307                        NameExpr nameExpr( "" );
    308                         addAggMembers( structInst, aggrExpr.get(), alt.cost+Cost::safe, alt.env, &nameExpr );
     308                        addAggMembers( structInst, aggrExpr, alt.cost+Cost::safe, alt.env, &nameExpr );
    309309                } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( aggrExpr->get_result() ) ) {
    310310                        NameExpr nameExpr( "" );
    311                         addAggMembers( unionInst, aggrExpr.get(), alt.cost+Cost::safe, alt.env, &nameExpr );
     311                        addAggMembers( unionInst, aggrExpr, alt.cost+Cost::safe, alt.env, &nameExpr );
    312312                } // if
    313313        }
     
    630630        struct ArgPack {
    631631                std::size_t parent;                ///< Index of parent pack
    632                 std::unique_ptr<Expression> expr;  ///< The argument stored here
     632                Expression* expr;                  ///< The argument stored here
    633633                Cost cost;                         ///< The cost of this argument
    634634                TypeEnvironment env;               ///< Environment for this pack
     
    677677                        std::list<Expression*> exprs;
    678678                        const ArgPack* pack = this;
    679                         if ( expr ) { exprs.push_front( expr.release() ); }
     679                        if ( expr ) { exprs.push_front( expr ); }
    680680                        while ( pack->tupleStart == 0 ) {
    681681                                pack = &packs[pack->parent];
     
    684684                        }
    685685                        // reset pack to appropriate tuple
    686                         expr.reset( new TupleExpr( exprs ) );
     686                        expr = new TupleExpr{ exprs };
    687687                        tupleStart = pack->tupleStart - 1;
    688688                        parent = pack->parent;
     
    736736
    737737                                                results.emplace_back(
    738                                                         i, expl.exprs[results[i].nextExpl].get(), copy(results[i].env),
     738                                                        i, expl.exprs[results[i].nextExpl], copy(results[i].env),
    739739                                                        copy(results[i].need), copy(results[i].have),
    740740                                                        copy(results[i].openVars), nextArg, nTuples, Cost::zero, nextExpl,
     
    757757                                                        newResult.parent = i;
    758758                                                        std::list<Expression*> emptyList;
    759                                                         newResult.expr.reset( new TupleExpr( emptyList ) );
     759                                                        newResult.expr = new TupleExpr{ emptyList };
    760760                                                        argType = newResult.expr->get_result();
    761761                                                } else {
     
    764764                                                        newResult.cost = results[i].cost;
    765765                                                        newResult.tupleStart = results[i].tupleStart;
    766                                                         newResult.expr.reset( results[i].expr->clone() );
     766                                                        newResult.expr = results[i].expr->clone();
    767767                                                        argType = newResult.expr->get_result();
    768768
     
    814814                                                // add new result
    815815                                                results.emplace_back(
    816                                                         i, expl.exprs.front().get(), move(env), copy(results[i].need),
     816                                                        i, expl.exprs.front(), move(env), copy(results[i].need),
    817817                                                        copy(results[i].have), move(openVars), nextArg + 1,
    818818                                                        nTuples, expl.cost, expl.exprs.size() == 1 ? 0 : 1, j );
     
    840840                        if ( results[i].hasExpl() ) {
    841841                                const ExplodedActual& expl = results[i].getExpl( args );
    842                                 Expression* expr = expl.exprs[results[i].nextExpl].get();
     842                                Expression* expr = expl.exprs[results[i].nextExpl];
    843843
    844844                                TypeEnvironment env = results[i].env;
     
    911911
    912912                                // consider only first exploded actual
    913                                 Expression* expr = expl.exprs.front().get();
     913                                Expression* expr = expl.exprs.front();
    914914                                Type* actualType = expr->get_result()->clone();
    915915
     
    10141014
    10151015                                                results.emplace_back(
    1016                                                         i, expl.exprs[results[i].nextExpl].get(), copy(results[i].env),
     1016                                                        i, expl.exprs[results[i].nextExpl], copy(results[i].env),
    10171017                                                        copy(results[i].need), copy(results[i].have),
    10181018                                                        copy(results[i].openVars), nextArg, 0, Cost::zero, nextExpl,
     
    10501050                                                // add new result
    10511051                                                results.emplace_back(
    1052                                                         i, expl.exprs.front().get(), move(env), copy(results[i].need),
     1052                                                        i, expl.exprs.front(), move(env), copy(results[i].need),
    10531053                                                        copy(results[i].have), move(openVars), nextArg + 1, 0,
    10541054                                                        expl.cost, expl.exprs.size() == 1 ? 0 : 1, j );
     
    13441344                        Expression * aggrExpr = agg->expr->clone();
    13451345                        referenceToRvalueConversion( aggrExpr, cost );
    1346                         std::unique_ptr<Expression> guard( aggrExpr );
    13471346
    13481347                        // find member of the given type
  • src/ResolvExpr/ExplodedActual.h

    r68f9c43 r8d7bef2  
    1616#pragma once
    1717
    18 #include <memory>
    1918#include <vector>
    2019
     
    2928                TypeEnvironment env;
    3029                Cost cost;
    31                 std::vector< std::unique_ptr<Expression> > exprs;
     30                std::vector< Expression* > exprs;
    3231
    3332                ExplodedActual() : env(), cost(Cost::zero), exprs() {}
  • src/ResolvExpr/Unify.cc

    r68f9c43 r8d7bef2  
    1717#include <iterator>               // for back_insert_iterator, back_inserter
    1818#include <map>                    // for _Rb_tree_const_iterator, _Rb_tree_i...
    19 #include <memory>                 // for unique_ptr
    2019#include <set>                    // for set
    2120#include <string>                 // for string, operator==, operator!=, bas...
     
    165164                                Type *common = 0;
    166165                                // attempt to unify equivalence class type (which has qualifiers stripped, so they must be restored) with the type to bind to
    167                                 std::unique_ptr< Type > newType( curClass.type->clone() );
     166                                Type* newType = curClass.type->clone();
    168167                                newType->get_qualifiers() = typeInst->get_qualifiers();
    169                                 if ( unifyInexact( newType.get(), other, env, needAssertions, haveAssertions, openVars, widenMode & WidenMode( curClass.allowWidening, true ), indexer, common ) ) {
     168                                if ( unifyInexact( newType, other, env, needAssertions, haveAssertions, openVars, widenMode & WidenMode( curClass.allowWidening, true ), indexer, common ) ) {
    170169                                        if ( common ) {
    171170                                                common->get_qualifiers() = Type::Qualifiers();
     
    466465
    467466        template< typename Iterator, typename Func >
    468         std::unique_ptr<Type> combineTypes( Iterator begin, Iterator end, Func & toType ) {
     467        Type* combineTypes( Iterator begin, Iterator end, Func & toType ) {
    469468                std::list< Type * > types;
    470469                for ( ; begin != end; ++begin ) {
     
    472471                        flatten( toType( *begin ), back_inserter( types ) );
    473472                }
    474                 return std::unique_ptr<Type>( new TupleType( Type::Qualifiers(), types ) );
     473                return new TupleType{ Type::Qualifiers(), types };
    475474        }
    476475
     
    487486                        if ( isTtype1 && ! isTtype2 ) {
    488487                                // combine all of the things in list2, then unify
    489                                 return unifyExact( t1, combineTypes( list2Begin, list2End, get_type ).get(), env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
     488                                return unifyExact( t1, combineTypes( list2Begin, list2End, get_type ), env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
    490489                        } else if ( isTtype2 && ! isTtype1 ) {
    491490                                // combine all of the things in list1, then unify
    492                                 return unifyExact( combineTypes( list1Begin, list1End, get_type ).get(), t2, env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
     491                                return unifyExact( combineTypes( list1Begin, list1End, get_type ), t2, env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
    493492                        } else if ( ! unifyExact( t1, t2, env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer ) ) {
    494493                                return false;
     
    500499                        Type * t1 = (*list1Begin)->get_type();
    501500                        if ( Tuples::isTtype( t1 ) ) {
    502                                 return unifyExact( t1, combineTypes( list2Begin, list2End, get_type ).get(), env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
     501                                return unifyExact( t1, combineTypes( list2Begin, list2End, get_type ), env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
    503502                        } else return false;
    504503                } else if ( list2Begin != list2End ) {
     
    506505                        Type * t2 = (*list2Begin)->get_type();
    507506                        if ( Tuples::isTtype( t2 ) ) {
    508                                 return unifyExact( combineTypes( list1Begin, list1End, get_type ).get(), t2, env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
     507                                return unifyExact( combineTypes( list1Begin, list1End, get_type ), t2, env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
    509508                        } else return false;
    510509                } else {
     
    559558                        // flatten the parameter lists for both functions so that tuple structure
    560559                        // doesn't affect unification. Must be a clone so that the types don't change.
    561                         std::unique_ptr<FunctionType> flatFunc( functionType->clone() );
    562                         std::unique_ptr<FunctionType> flatOther( otherFunction->clone() );
     560                        FunctionType* flatFunc = functionType->clone();
     561                        FunctionType* flatOther = otherFunction->clone();
    563562                        flattenList( flatFunc->get_parameters(), flatFunc->get_parameters(), env );
    564563                        flattenList( flatOther->get_parameters(), flatOther->get_parameters(), env );
     
    701700                        if ( isTtype1 && ! isTtype2 ) {
    702701                                // combine all of the things in list2, then unify
    703                                 return unifyExact( t1, combineTypes( list2Begin, list2End, get_type ).get(), env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
     702                                return unifyExact( t1, combineTypes( list2Begin, list2End, get_type ), env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
    704703                        } else if ( isTtype2 && ! isTtype1 ) {
    705704                                // combine all of the things in list1, then unify
    706                                 return unifyExact( combineTypes( list1Begin, list1End, get_type ).get(), t2, env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
     705                                return unifyExact( combineTypes( list1Begin, list1End, get_type ), t2, env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
    707706                        } else if ( ! unifyExact( t1, t2, env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer ) ) {
    708707                                return false;
     
    714713                        Type * t1 = *list1Begin;
    715714                        if ( Tuples::isTtype( t1 ) ) {
    716                                 return unifyExact( t1, combineTypes( list2Begin, list2End, get_type ).get(), env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
     715                                return unifyExact( t1, combineTypes( list2Begin, list2End, get_type ), env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
    717716                        } else return false;
    718717                } else if ( list2Begin != list2End ) {
     
    720719                        Type * t2 = *list2Begin;
    721720                        if ( Tuples::isTtype( t2 ) ) {
    722                                 return unifyExact( combineTypes( list1Begin, list1End, get_type ).get(), t2, env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
     721                                return unifyExact( combineTypes( list1Begin, list1End, get_type ), t2, env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
    723722                        } else return false;
    724723                } else {
     
    729728        void Unify::postvisit(TupleType *tupleType) {
    730729                if ( TupleType *otherTuple = dynamic_cast< TupleType* >( type2 ) ) {
    731                         std::unique_ptr<TupleType> flat1( tupleType->clone() );
    732                         std::unique_ptr<TupleType> flat2( otherTuple->clone() );
     730                        TupleType* flat1 = tupleType->clone();
     731                        TupleType* flat2 = otherTuple->clone();
    733732                        std::list<Type *> types1, types2;
    734733
     
    737736                        flat2->acceptMutator( expander );
    738737
    739                         flatten( flat1.get(), back_inserter( types1 ) );
    740                         flatten( flat2.get(), back_inserter( types2 ) );
     738                        flatten( flat1, back_inserter( types1 ) );
     739                        flatten( flat2, back_inserter( types2 ) );
    741740
    742741                        result = unifyList( types1.begin(), types1.end(), types2.begin(), types2.end(), env, needAssertions, haveAssertions, openVars, indexer );
  • src/SymTab/Validate.cc

    r68f9c43 r8d7bef2  
    197197                void addImplicitTypedef( AggDecl * aggDecl );
    198198
    199                 typedef std::unique_ptr<TypedefDecl> TypedefDeclPtr;
    200                 typedef ScopedMap< std::string, std::pair< TypedefDeclPtr, int > > TypedefMap;
     199                typedef ScopedMap< std::string, std::pair< TypedefDecl*, int > > TypedefMap;
    201200                typedef std::map< std::string, TypeDecl * > TypeDeclMap;
    202201                TypedefMap typedefNames;
     
    746745                        }
    747746                } else {
    748                         typedefNames[ tyDecl->get_name() ] = std::make_pair( TypedefDeclPtr( tyDecl ), scopeLevel );
     747                        typedefNames[ tyDecl->get_name() ] = std::make_pair( tyDecl, scopeLevel );
    749748                } // if
    750749
     
    839838                                type = new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() );
    840839                        } // if
    841                         TypedefDeclPtr tyDecl( new TypedefDecl( aggDecl->get_name(), aggDecl->location, Type::StorageClasses(), type, aggDecl->get_linkage() ) );
    842                         typedefNames[ aggDecl->get_name() ] = std::make_pair( std::move( tyDecl ), scopeLevel );
     840                        TypedefDecl* tyDecl = new TypedefDecl{ aggDecl->get_name(), aggDecl->location, Type::StorageClasses(), type, aggDecl->get_linkage() };
     841                        typedefNames[ aggDecl->get_name() ] = std::make_pair( tyDecl, scopeLevel );
    843842                } // if
    844843        }
  • src/SynTree/ApplicationExpr.cc

    r68f9c43 r8d7bef2  
    1717#include <list>                  // for list
    1818#include <map>                   // for _Rb_tree_const_iterator, map, map<>:...
    19 #include <memory>                // for unique_ptr
    2019#include <ostream>               // for operator<<, ostream, basic_ostream
    2120#include <string>                // for operator<<, string, char_traits
  • src/SynTree/BaseSyntaxNode.h

    r68f9c43 r8d7bef2  
    2424
    2525class BaseSyntaxNode : GC_Object {
     26  friend class GcTracer;
    2627public:
    2728        CodeLocation location;
  • src/SynTree/GcTracer.h

    r68f9c43 r8d7bef2  
    5252static inline const GC& operator<< ( const GC& gc, const std::list<Declaration*>& translationUnit ) {
    5353        PassVisitor<GcTracer> tracer{ gc };
    54         acceptAll( translationUnit, tracer );
     54        acceptAll( const_cast<std::list<Declaration*>&>( translationUnit ), tracer );
    5555        return gc;
    5656}
  • src/SynTree/TypeSubstitution.h

    r68f9c43 r8d7bef2  
    5959        void normalize();
    6060
     61        void accept( Visitor& v ) { v.visit( this ); }
    6162        TypeSubstitution * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    6263
  • src/SynTree/Visitor.h

    r68f9c43 r8d7bef2  
    121121
    122122        virtual void visit( Attribute * attribute ) = 0;
     123
     124        virtual void visit( TypeSubstitution * sub ) = 0;
    123125};
    124126
  • src/SynTree/module.mk

    r68f9c43 r8d7bef2  
    4848       SynTree/TypeSubstitution.cc \
    4949       SynTree/Attribute.cc \
    50        SynTree/GcTracer.cc \
    5150       SynTree/VarExprReplacer.cc
    5251
  • src/Tuples/Explode.cc

    r68f9c43 r8d7bef2  
    8787                                // field is consistent with the type of the tuple expr, since the field
    8888                                // may have changed from type T to T&.
    89                                 return new TupleIndexExpr{ tupleExpr->get_tuple(), tupleExpr->get_index() };
     89                                return new TupleIndexExpr( tupleExpr->get_tuple(), tupleExpr->get_index() );
    9090                        }
    9191                };
Note: See TracChangeset for help on using the changeset viewer.