Changeset 8d7bef2
- Timestamp:
- Mar 20, 2018, 5:12:25 PM (5 years ago)
- Branches:
- new-env, with_gc
- Children:
- 7e4b44d
- Parents:
- 68f9c43
- Location:
- src
- Files:
-
- 1 deleted
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/FixMain.cc
r68f9c43 r8d7bef2 29 29 namespace CodeGen { 30 30 bool FixMain::replace_main = false; 31 std::unique_ptr<FunctionDecl>FixMain::main_signature = nullptr;31 FunctionDecl* FixMain::main_signature = nullptr; 32 32 33 33 template<typename container> … … 41 41 SemanticError(functionDecl, "Multiple definition of main routine\n"); 42 42 } 43 main_signature .reset( functionDecl->clone() );43 main_signature = functionDecl; 44 44 } 45 45 -
src/CodeGen/FixMain.h
r68f9c43 r8d7bef2 40 40 private: 41 41 static bool replace_main; 42 static std::unique_ptr<FunctionDecl>main_signature;42 static FunctionDecl* main_signature; 43 43 }; 44 44 }; -
src/CodeGen/FixNames.cc
r68f9c43 r8d7bef2 16 16 #include "FixNames.h" 17 17 18 #include <memory> // for unique_ptr19 18 #include <string> // for string, operator!=, operator== 20 19 … … 47 46 std::string mangle_main() { 48 47 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 }; 52 51 main_type->get_returnVals().push_back( 53 52 new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) 54 53 ); 55 54 56 auto && name = SymTab::Mangler::mangle( mainDecl .get());55 auto && name = SymTab::Mangler::mangle( mainDecl ); 57 56 // std::cerr << name << std::endl; 58 57 return name; … … 60 59 std::string mangle_main_args() { 61 60 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 }; 65 64 main_type->get_returnVals().push_back( 66 65 new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) … … 77 76 ); 78 77 79 auto&& name = SymTab::Mangler::mangle( mainDecl .get());78 auto&& name = SymTab::Mangler::mangle( mainDecl ); 80 79 // std::cerr << name << std::endl; 81 80 return name; -
src/Common/GC.h
r68f9c43 r8d7bef2 66 66 inline const GC& operator<< (const GC& gc, const T& x) { return gc; } 67 67 68 inline void traceAll(const GC& gc) {}68 inline void traceAll(const GC&) {} 69 69 70 70 /// Marks all arguments as live in current generation … … 94 94 class GC_Traceable { 95 95 friend class GC; 96 friend class GcTracer; 96 protected: 97 mutable bool mark; 97 98 98 mutable bool mark;99 protected:100 99 /// override to trace any child objects 101 virtual void trace(const GC& gc) const {}100 virtual void trace(const GC&) const {} 102 101 }; 103 102 -
src/Concurrency/Keywords.cc
r68f9c43 r8d7bef2 200 200 StructDecl* dtor_guard_decl = nullptr; 201 201 202 static std::unique_ptr< Type >generic_func;202 static Type* generic_func; 203 203 }; 204 204 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 }; 211 206 212 207 //----------------------------------------------------------------------------- -
src/Concurrency/Waitfor.cc
r68f9c43 r8d7bef2 137 137 StructDecl * decl_acceptable = nullptr; 138 138 StructDecl * decl_monitor = nullptr; 139 140 static std::unique_ptr< Type > generic_func;141 139 142 140 UniqueName namer_acc = "__acceptables_"s; -
src/GenPoly/GenPoly.cc
r68f9c43 r8d7bef2 437 437 Type * newType = arg->clone(); 438 438 if ( env ) env->apply( newType ); 439 std::unique_ptr<Type> manager( newType );440 439 // if the argument's type is polymorphic, we don't need to box again! 441 440 return ! isPolyType( newType ); -
src/GenPoly/Specialize.cc
r68f9c43 r8d7bef2 17 17 #include <iterator> // for back_insert_iterator, back_i... 18 18 #include <map> // for _Rb_tree_iterator, _Rb_tree_... 19 #include <memory> // for unique_ptr20 19 #include <string> // for string 21 20 #include <tuple> // for get … … 225 224 env->apply( actualType ); 226 225 } 227 std::unique_ptr< FunctionType > actualTypeManager( actualType ); // for RAII228 226 std::list< DeclarationWithType * >::iterator actualBegin = actualType->get_parameters().begin(); 229 227 std::list< DeclarationWithType * >::iterator actualEnd = actualType->get_parameters().end(); -
src/InitTweak/InitTweak.cc
r68f9c43 r8d7bef2 122 122 public: 123 123 ExprImpl( Expression * expr ) : arg( expr ) {} 124 virtual ~ExprImp () = default;124 virtual ~ExprImpl() = default; 125 125 126 126 virtual std::list< Expression * > next( std::list< Expression * > & indices ) { -
src/Makefile.in
r68f9c43 r8d7bef2 250 250 SynTree/driver_cfa_cpp-TypeSubstitution.$(OBJEXT) \ 251 251 SynTree/driver_cfa_cpp-Attribute.$(OBJEXT) \ 252 SynTree/driver_cfa_cpp-GcTracer.$(OBJEXT) \253 252 SynTree/driver_cfa_cpp-VarExprReplacer.$(OBJEXT) \ 254 253 Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT) \ … … 528 527 SynTree/NamedTypeDecl.cc SynTree/TypeDecl.cc \ 529 528 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 534 532 MAINTAINERCLEANFILES = Parser/parser.output ${libdir}/${notdir \ 535 533 ${cfa_cpplib_PROGRAMS}} … … 917 915 SynTree/driver_cfa_cpp-Attribute.$(OBJEXT): SynTree/$(am__dirstamp) \ 918 916 SynTree/$(DEPDIR)/$(am__dirstamp) 919 SynTree/driver_cfa_cpp-GcTracer.$(OBJEXT): SynTree/$(am__dirstamp) \920 SynTree/$(DEPDIR)/$(am__dirstamp)921 917 SynTree/driver_cfa_cpp-VarExprReplacer.$(OBJEXT): \ 922 918 SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp) … … 1053 1049 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionDecl.Po@am__quote@ 1054 1050 @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@1056 1051 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Initializer.Po@am__quote@ 1057 1052 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-NamedTypeDecl.Po@am__quote@ … … 2520 2515 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2521 2516 @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.cc2524 @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.cc2525 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-GcTracer.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-GcTracer.Po2526 @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.cc2529 2530 SynTree/driver_cfa_cpp-GcTracer.obj: SynTree/GcTracer.cc2531 @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.Po2533 @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`2536 2517 2537 2518 SynTree/driver_cfa_cpp-VarExprReplacer.o: SynTree/VarExprReplacer.cc -
src/Parser/ParseNode.h
r68f9c43 r8d7bef2 124 124 125 125 virtual void print( std::ostream &os, __attribute__((unused)) int indent = 0 ) const override { 126 os << expr .get()<< std::endl;126 os << expr << std::endl; 127 127 } 128 128 void printOneLine( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const {} 129 129 130 130 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; } 134 134 private: 135 135 bool extension = false; 136 std::unique_ptr<Expression>expr;136 Expression* expr; 137 137 }; // ExpressionNode 138 138 … … 352 352 353 353 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; } 355 355 356 356 virtual StatementNode * add_label( const std::string * name, DeclarationNode * attr = nullptr ) { … … 364 364 365 365 virtual void print( std::ostream &os, __attribute__((unused)) int indent = 0 ) const override { 366 os << stmt .get()<< std::endl;366 os << stmt << std::endl; 367 367 } 368 368 private: 369 std::unique_ptr<Statement>stmt;369 Statement* stmt; 370 370 }; // StatementNode 371 371 -
src/Parser/StatementNode.cc
r68f9c43 r8d7bef2 16 16 #include <cassert> // for assert, strict_dynamic_cast, assertf 17 17 #include <list> // for list 18 #include <memory> // for unique_ptr19 18 #include <string> // for string 20 19 … … 50 49 agg = decl; 51 50 } // if 52 stmt .reset( new DeclStmt( maybeMoveBuild< Declaration >(agg) ) );51 stmt = new DeclStmt{ maybeMoveBuild< Declaration >(agg) }; 53 52 } // StatementNode::StatementNode 54 53 … … 58 57 for ( StatementNode * curr = prev; curr != nullptr; curr = (StatementNode *)curr->get_next() ) { 59 58 StatementNode *node = strict_dynamic_cast< StatementNode * >(curr); 60 assert( dynamic_cast< CaseStmt * >(node->stmt .get()) );59 assert( dynamic_cast< CaseStmt * >(node->stmt) ); 61 60 prev = curr; 62 61 } // for … … 66 65 buildMoveList( stmt, stmts ); 67 66 // 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); 69 68 caseStmt->get_statements().splice( caseStmt->get_statements().end(), stmts ); 70 69 return this; -
src/ResolvExpr/AlternativeFinder.cc
r68f9c43 r8d7bef2 21 21 #include <list> // for _List_iterator, list, _List_const_... 22 22 #include <map> // for _Rb_tree_iterator, map, _Rb_tree_c... 23 #include <memory> // for allocator_traits<>::value_type , unique_ptr23 #include <memory> // for allocator_traits<>::value_type 24 24 #include <utility> // for pair 25 25 #include <vector> // for vector … … 296 296 // adds anonymous member interpretations whenever an aggregate value type is seen. 297 297 // 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(); 299 299 alt.env.apply( aggrExpr->get_result() ); 300 300 Type * aggrType = aggrExpr->get_result(); 301 301 if ( dynamic_cast< ReferenceType * >( aggrType ) ) { 302 302 aggrType = aggrType->stripReferences(); 303 aggrExpr .reset( new CastExpr( aggrExpr.release(), aggrType->clone() ) );303 aggrExpr = new CastExpr{ aggrExpr, aggrType->clone() }; 304 304 } 305 305 306 306 if ( StructInstType *structInst = dynamic_cast< StructInstType* >( aggrExpr->get_result() ) ) { 307 307 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 ); 309 309 } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( aggrExpr->get_result() ) ) { 310 310 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 ); 312 312 } // if 313 313 } … … 630 630 struct ArgPack { 631 631 std::size_t parent; ///< Index of parent pack 632 std::unique_ptr<Expression> expr;///< The argument stored here632 Expression* expr; ///< The argument stored here 633 633 Cost cost; ///< The cost of this argument 634 634 TypeEnvironment env; ///< Environment for this pack … … 677 677 std::list<Expression*> exprs; 678 678 const ArgPack* pack = this; 679 if ( expr ) { exprs.push_front( expr .release()); }679 if ( expr ) { exprs.push_front( expr ); } 680 680 while ( pack->tupleStart == 0 ) { 681 681 pack = &packs[pack->parent]; … … 684 684 } 685 685 // reset pack to appropriate tuple 686 expr .reset( new TupleExpr( exprs ) );686 expr = new TupleExpr{ exprs }; 687 687 tupleStart = pack->tupleStart - 1; 688 688 parent = pack->parent; … … 736 736 737 737 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), 739 739 copy(results[i].need), copy(results[i].have), 740 740 copy(results[i].openVars), nextArg, nTuples, Cost::zero, nextExpl, … … 757 757 newResult.parent = i; 758 758 std::list<Expression*> emptyList; 759 newResult.expr .reset( new TupleExpr( emptyList ) );759 newResult.expr = new TupleExpr{ emptyList }; 760 760 argType = newResult.expr->get_result(); 761 761 } else { … … 764 764 newResult.cost = results[i].cost; 765 765 newResult.tupleStart = results[i].tupleStart; 766 newResult.expr .reset( results[i].expr->clone());766 newResult.expr = results[i].expr->clone(); 767 767 argType = newResult.expr->get_result(); 768 768 … … 814 814 // add new result 815 815 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), 817 817 copy(results[i].have), move(openVars), nextArg + 1, 818 818 nTuples, expl.cost, expl.exprs.size() == 1 ? 0 : 1, j ); … … 840 840 if ( results[i].hasExpl() ) { 841 841 const ExplodedActual& expl = results[i].getExpl( args ); 842 Expression* expr = expl.exprs[results[i].nextExpl] .get();842 Expression* expr = expl.exprs[results[i].nextExpl]; 843 843 844 844 TypeEnvironment env = results[i].env; … … 911 911 912 912 // consider only first exploded actual 913 Expression* expr = expl.exprs.front() .get();913 Expression* expr = expl.exprs.front(); 914 914 Type* actualType = expr->get_result()->clone(); 915 915 … … 1014 1014 1015 1015 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), 1017 1017 copy(results[i].need), copy(results[i].have), 1018 1018 copy(results[i].openVars), nextArg, 0, Cost::zero, nextExpl, … … 1050 1050 // add new result 1051 1051 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), 1053 1053 copy(results[i].have), move(openVars), nextArg + 1, 0, 1054 1054 expl.cost, expl.exprs.size() == 1 ? 0 : 1, j ); … … 1344 1344 Expression * aggrExpr = agg->expr->clone(); 1345 1345 referenceToRvalueConversion( aggrExpr, cost ); 1346 std::unique_ptr<Expression> guard( aggrExpr );1347 1346 1348 1347 // find member of the given type -
src/ResolvExpr/ExplodedActual.h
r68f9c43 r8d7bef2 16 16 #pragma once 17 17 18 #include <memory>19 18 #include <vector> 20 19 … … 29 28 TypeEnvironment env; 30 29 Cost cost; 31 std::vector< std::unique_ptr<Expression>> exprs;30 std::vector< Expression* > exprs; 32 31 33 32 ExplodedActual() : env(), cost(Cost::zero), exprs() {} -
src/ResolvExpr/Unify.cc
r68f9c43 r8d7bef2 17 17 #include <iterator> // for back_insert_iterator, back_inserter 18 18 #include <map> // for _Rb_tree_const_iterator, _Rb_tree_i... 19 #include <memory> // for unique_ptr20 19 #include <set> // for set 21 20 #include <string> // for string, operator==, operator!=, bas... … … 165 164 Type *common = 0; 166 165 // 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(); 168 167 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 ) ) { 170 169 if ( common ) { 171 170 common->get_qualifiers() = Type::Qualifiers(); … … 466 465 467 466 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 ) { 469 468 std::list< Type * > types; 470 469 for ( ; begin != end; ++begin ) { … … 472 471 flatten( toType( *begin ), back_inserter( types ) ); 473 472 } 474 return std::unique_ptr<Type>( new TupleType( Type::Qualifiers(), types ) );473 return new TupleType{ Type::Qualifiers(), types }; 475 474 } 476 475 … … 487 486 if ( isTtype1 && ! isTtype2 ) { 488 487 // 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 ); 490 489 } else if ( isTtype2 && ! isTtype1 ) { 491 490 // 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 ); 493 492 } else if ( ! unifyExact( t1, t2, env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer ) ) { 494 493 return false; … … 500 499 Type * t1 = (*list1Begin)->get_type(); 501 500 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 ); 503 502 } else return false; 504 503 } else if ( list2Begin != list2End ) { … … 506 505 Type * t2 = (*list2Begin)->get_type(); 507 506 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 ); 509 508 } else return false; 510 509 } else { … … 559 558 // flatten the parameter lists for both functions so that tuple structure 560 559 // 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(); 563 562 flattenList( flatFunc->get_parameters(), flatFunc->get_parameters(), env ); 564 563 flattenList( flatOther->get_parameters(), flatOther->get_parameters(), env ); … … 701 700 if ( isTtype1 && ! isTtype2 ) { 702 701 // 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 ); 704 703 } else if ( isTtype2 && ! isTtype1 ) { 705 704 // 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 ); 707 706 } else if ( ! unifyExact( t1, t2, env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer ) ) { 708 707 return false; … … 714 713 Type * t1 = *list1Begin; 715 714 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 ); 717 716 } else return false; 718 717 } else if ( list2Begin != list2End ) { … … 720 719 Type * t2 = *list2Begin; 721 720 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 ); 723 722 } else return false; 724 723 } else { … … 729 728 void Unify::postvisit(TupleType *tupleType) { 730 729 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(); 733 732 std::list<Type *> types1, types2; 734 733 … … 737 736 flat2->acceptMutator( expander ); 738 737 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 ) ); 741 740 742 741 result = unifyList( types1.begin(), types1.end(), types2.begin(), types2.end(), env, needAssertions, haveAssertions, openVars, indexer ); -
src/SymTab/Validate.cc
r68f9c43 r8d7bef2 197 197 void addImplicitTypedef( AggDecl * aggDecl ); 198 198 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; 201 200 typedef std::map< std::string, TypeDecl * > TypeDeclMap; 202 201 TypedefMap typedefNames; … … 746 745 } 747 746 } else { 748 typedefNames[ tyDecl->get_name() ] = std::make_pair( TypedefDeclPtr( tyDecl ), scopeLevel );747 typedefNames[ tyDecl->get_name() ] = std::make_pair( tyDecl, scopeLevel ); 749 748 } // if 750 749 … … 839 838 type = new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() ); 840 839 } // if 841 TypedefDecl Ptr 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 ); 843 842 } // if 844 843 } -
src/SynTree/ApplicationExpr.cc
r68f9c43 r8d7bef2 17 17 #include <list> // for list 18 18 #include <map> // for _Rb_tree_const_iterator, map, map<>:... 19 #include <memory> // for unique_ptr20 19 #include <ostream> // for operator<<, ostream, basic_ostream 21 20 #include <string> // for operator<<, string, char_traits -
src/SynTree/BaseSyntaxNode.h
r68f9c43 r8d7bef2 24 24 25 25 class BaseSyntaxNode : GC_Object { 26 friend class GcTracer; 26 27 public: 27 28 CodeLocation location; -
src/SynTree/GcTracer.h
r68f9c43 r8d7bef2 52 52 static inline const GC& operator<< ( const GC& gc, const std::list<Declaration*>& translationUnit ) { 53 53 PassVisitor<GcTracer> tracer{ gc }; 54 acceptAll( translationUnit, tracer );54 acceptAll( const_cast<std::list<Declaration*>&>( translationUnit ), tracer ); 55 55 return gc; 56 56 } -
src/SynTree/TypeSubstitution.h
r68f9c43 r8d7bef2 59 59 void normalize(); 60 60 61 void accept( Visitor& v ) { v.visit( this ); } 61 62 TypeSubstitution * acceptMutator( Mutator & m ) { return m.mutate( this ); } 62 63 -
src/SynTree/Visitor.h
r68f9c43 r8d7bef2 121 121 122 122 virtual void visit( Attribute * attribute ) = 0; 123 124 virtual void visit( TypeSubstitution * sub ) = 0; 123 125 }; 124 126 -
src/SynTree/module.mk
r68f9c43 r8d7bef2 48 48 SynTree/TypeSubstitution.cc \ 49 49 SynTree/Attribute.cc \ 50 SynTree/GcTracer.cc \51 50 SynTree/VarExprReplacer.cc 52 51 -
src/Tuples/Explode.cc
r68f9c43 r8d7bef2 87 87 // field is consistent with the type of the tuple expr, since the field 88 88 // 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() ); 90 90 } 91 91 };
Note: See TracChangeset
for help on using the changeset viewer.