Changeset 24afc53
- Timestamp:
- May 16, 2019, 1:54:43 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 1fb7bfd, f3cc5b6
- Parents:
- 54e41b3 (diff), aa00626 (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. - git-author:
- Aaron Moss <a3moss@…> (05/16/19 13:46:32)
- git-committer:
- Aaron Moss <a3moss@…> (05/16/19 13:54:43)
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/bibliography/pl.bib
r54e41b3 r24afc53 1919 1919 year = 1965, 1920 1920 note = {Reprinted in \cite{Genuys68} pp. 43--112.} 1921 } 1922 1923 @manual{C++20Coroutine19, 1924 keywords = {coroutine}, 1925 contributer = {pabuhr@plg}, 1926 title = {Coroutines (C++20)}, 1927 organization= {cppreference.com}, 1928 month = apr, 1929 year = 2019, 1930 note = {\href{https://en.cppreference.com/w/cpp/language/coroutines}{https://\-en.cppreference.com/\-w/\-cpp/\-language/\-coroutines}}, 1921 1931 } 1922 1932 -
libcfa/src/concurrency/coroutine.hfa
r54e41b3 r24afc53 117 117 // Resume implementation inlined for performance 118 118 forall(dtype T | is_coroutine(T)) 119 static inline voidresume(T & cor) {119 static inline T & resume(T & cor) { 120 120 // optimization : read TLS once and reuse it 121 121 // Safety note: this is preemption safe since if … … 145 145 // always done for performance testing 146 146 CoroutineCtxSwitch( src, dst ); 147 148 return cor; 147 149 } 148 150 -
libcfa/src/fstream.cfa
r54e41b3 r24afc53 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Apr 20 12:03:43201913 // Update Count : 3 1112 // Last Modified On : Thu May 16 08:33:28 2019 13 // Update Count : 328 14 14 // 15 15 … … 27 27 #define IO_MSG "I/O error: " 28 28 29 void ?{}( ofstream & os, void * file , bool sepDefault, bool sepOnOff, bool nlOnOff, bool prt, const char * separator, const char * tupleSeparator) {29 void ?{}( ofstream & os, void * file ) { 30 30 os.file = file; 31 os.sepDefault = sepDefault;32 os.sepOnOff = sepOnOff;33 os.nlOnOff = nlOnOff;34 os.prt = prt;31 os.sepDefault = true; 32 os.sepOnOff = false; 33 os.nlOnOff = true; 34 os.prt = false; 35 35 os.sawNL = false; 36 sepSet( os, separator);36 sepSet( os, " " ); 37 37 sepSetCur( os, sepGet( os ) ); 38 sepSetTuple( os, tupleSeparator);38 sepSetTuple( os, ", " ); 39 39 } 40 40 … … 104 104 105 105 void open( ofstream & os, const char * name, const char * mode ) { 106 FILE * file = fopen( name, mode );106 FILE * file = fopen( name, mode ); 107 107 #ifdef __CFA_DEBUG__ 108 108 if ( file == 0 ) { … … 110 110 } // if 111 111 #endif // __CFA_DEBUG__ 112 (os){ file , true, false, true, false, " ", ", "};112 (os){ file }; 113 113 } // open 114 114 … … 152 152 } // fmt 153 153 154 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_) , true, false, true, false, " ", ", "};154 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_) }; 155 155 ofstream & sout = soutFile; 156 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_) , true, false, true, false, " ", ", "};156 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_) }; 157 157 ofstream & serr = serrFile; 158 158 159 // static ofstream sexitFile = { (FILE *)(&_IO_2_1_stdout_) }; 160 // ofstream & sexit = sexitFile; 161 // static ofstream sabortFile = { (FILE *)(&_IO_2_1_stderr_) }; 162 // ofstream & sabort = sabortFile; 163 164 void nl( ofstream & os ) { 165 if ( getANL( os ) ) (ofstream &)(nl( os )); // implementation only 166 else setPrt( os, false ); // turn off 167 } 159 168 160 169 //--------------------------------------- -
libcfa/src/fstream.hfa
r54e41b3 r24afc53 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Apr 20 12:03:58201913 // Update Count : 15 112 // Last Modified On : Thu May 16 08:34:10 2019 13 // Update Count : 157 14 14 // 15 15 … … 70 70 extern ofstream & sout, & serr; 71 71 72 // extern ofstream & sout, & serr, & sexit, & sabort; 73 // void nl( ofstream & os ); 74 72 75 73 76 struct ifstream { -
libcfa/src/iostream.cfa
r54e41b3 r24afc53 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Apr 20 14:02:43201913 // Update Count : 6 1712 // Last Modified On : Mon May 13 12:46:45 2019 13 // Update Count : 650 14 14 // 15 15 … … 23 23 extern size_t strlen (const char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); 24 24 #include <float.h> // DBL_DIG, LDBL_DIG 25 #include <math.h> // modff, modf, modlf 25 26 #include <complex.h> // creal, cimag 26 27 } … … 156 157 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 157 158 fmt( os, "%g", f ); 159 float tempi; 160 if ( isfinite( f ) && modff( f, &tempi ) == 0.0F ) fmt( os, "." ); // always print decimal point 158 161 return os; 159 162 } // ?|? … … 165 168 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 166 169 fmt( os, "%.*lg", DBL_DIG, d ); 170 // fmt( os, "%lg", d ); 171 double tempi; 172 if ( isfinite( d ) && modf( d, &tempi ) == 0.0D ) fmt( os, "." ); // always print decimal point 167 173 return os; 168 174 } // ?|? … … 174 180 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 175 181 fmt( os, "%.*Lg", LDBL_DIG, ld ); 182 // fmt( os, "%Lg", ld ); 183 long double tempi; 184 if ( isfinite( ld ) && modfl( ld, &tempi ) == 0.0L ) fmt( os, "." ); // always print decimal point 176 185 return os; 177 186 } // ?|? … … 182 191 ostype & ?|?( ostype & os, float _Complex fc ) { 183 192 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 184 fmt( os, "%g%+gi", crealf( fc ), cimagf( fc ) ); 193 float temp = crealf( fc ), tempi; 194 fmt( os, "%g", temp ); 195 if ( isfinite( temp ) && modff( temp, &tempi ) == 0.0F ) fmt( os, "." ); // always print decimal point 196 temp = cimagf( fc ); 197 fmt( os, "%+g", temp ); 198 if ( isfinite( temp ) && modff( temp, &tempi ) == 0.0F ) fmt( os, "." ); // always print decimal point 199 fmt( os, "i" ); 185 200 return os; 186 201 } // ?|? … … 191 206 ostype & ?|?( ostype & os, double _Complex dc ) { 192 207 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 193 fmt( os, "%.*lg%+.*lgi", DBL_DIG, creal( dc ), DBL_DIG, cimag( dc ) ); 208 double temp = creal( dc ), tempi; 209 fmt( os, "%.*lg", DBL_DIG, temp ); 210 if ( isfinite( temp ) && modf( temp, &tempi ) == 0.0D ) fmt( os, "." ); // always print decimal point 211 temp = cimag( dc ); 212 fmt( os, "%+.*lg", DBL_DIG, temp ); 213 if ( isfinite( temp ) && modf( temp, &tempi ) == 0.0D ) fmt( os, "." ); // always print decimal point 214 fmt( os, "i" ); 215 // fmt( os, "%lg%+lgi", creal( dc ), cimag( dc ) ); 194 216 return os; 195 217 } // ?|? … … 200 222 ostype & ?|?( ostype & os, long double _Complex ldc ) { 201 223 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 202 fmt( os, "%.*Lg%+.*Lgi", LDBL_DIG, creall( ldc ), LDBL_DIG, cimagl( ldc ) ); 224 long double temp = creall( ldc ), tempi; 225 fmt( os, "%.*Lg", LDBL_DIG, temp ); 226 if ( isfinite( temp ) && modfl( temp, &tempi ) == 0.0L ) fmt( os, "." ); // always print decimal point 227 temp = cimagl( ldc ); 228 fmt( os, "%+.*Lg", LDBL_DIG, cimagl( ldc ) ); 229 if ( isfinite( temp ) && modfl( temp, &tempi ) == 0.0L ) fmt( os, "." ); // always print decimal point 230 fmt( os, "i" ); 231 // fmt( os, "%Lg%+Lgi", creall( ldc ), cimagl( ldc ) ); 203 232 return os; 204 233 } // ?|? … … 494 523 } // ?|? 495 524 496 497 525 // manipulators 498 526 istype & ?|?( istype & is, istype & (* manip)( istype & ) ) { … … 501 529 502 530 istype & nl( istype & is ) { 503 fmt( is, "%*[ \t\f\n\r\v]" ); // ignore whitespace531 fmt( is, "%*[^\n]" ); // ignore characters to newline 504 532 return is; 505 533 } // nl -
libcfa/src/iostream.hfa
r54e41b3 r24afc53 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri May 3 22:55:04201913 // Update Count : 23 012 // Last Modified On : Sat May 11 10:31:27 2019 13 // Update Count : 232 14 14 // 15 15 … … 190 190 191 191 // manipulators 192 istype & ?|?( istype &, istype & (*)( istype & ) ); 193 istype & nl( istype & is ); 192 194 istype & nlOn( istype & ); 193 195 istype & nlOff( istype & ); 194 istype & ?|?( istype &, istype & (*)( istype & ) );195 istype & nl( istype & is );196 196 } // distribution 197 197 … … 215 215 216 216 // Local Variables: // 217 // mode: c //218 217 // tab-width: 4 // 219 218 // End: // -
src/AST/CVQualifiers.hpp
r54e41b3 r24afc53 59 59 // ordering is a subtype relationship over qualifiers, e.g. `int` => `const int` is free 60 60 61 bool operator== ( Qualifiers a, Qualifiers b ) {62 return (a & EquivQualifiers) == (b& EquivQualifiers);61 inline bool operator== ( Qualifiers a, Qualifiers b ) { 62 return (a.val & EquivQualifiers) == (b.val & EquivQualifiers); 63 63 } 64 bool operator!= ( Qualifiers a, Qualifiers b ) {65 return (a & EquivQualifiers) != (b & EquivQualifiers);64 inline bool operator!= ( Qualifiers a, Qualifiers b ) { 65 return !(a == b); 66 66 } 67 bool operator<= ( Qualifiers a, Qualifiers b ) {67 inline bool operator<= ( Qualifiers a, Qualifiers b ) { 68 68 return a.is_const <= b.is_const // non-const converts to const for free 69 69 && a.is_volatile <= b.is_volatile // non-volatile converts to volatile for free … … 71 71 && a.is_atomic == b.is_atomic; // atomicity must be preserved in free conversion 72 72 } 73 bool operator< ( Qualifiers a, Qualifiers b ) { return a != b && a <= b; }74 bool operator>= ( Qualifiers a, Qualifiers b ) { return b <= a; }75 bool operator> ( Qualifiers a, Qualifiers b ) { return b < a; }73 inline bool operator< ( Qualifiers a, Qualifiers b ) { return a != b && a <= b; } 74 inline bool operator>= ( Qualifiers a, Qualifiers b ) { return b <= a; } 75 inline bool operator> ( Qualifiers a, Qualifiers b ) { return b < a; } 76 76 77 77 } -
src/AST/Decl.cpp
r54e41b3 r24afc53 45 45 } 46 46 47 // --- FunctionDecl 48 49 const Type * FunctionDecl::get_type() const override { return type.get(); } 50 void FunctionDecl::set_type(Type * t) override { type = strict_dynamic_cast< FunctionType* >( t ); } 51 47 52 // --- TypeDecl 48 53 49 54 std::string TypeDecl::typeString() const { 50 55 static const std::string kindNames[] = { "object type", "function type", "tuple type" }; 51 assertf( sizeof(kindNames)/sizeof(kindNames[0]) == DeclarationNode::NoTypeClass-1, 56 assertf( sizeof(kindNames)/sizeof(kindNames[0]) == DeclarationNode::NoTypeClass-1, 52 57 "typeString: kindNames is out of sync." ); 53 58 assertf( kind < sizeof(kindNames)/sizeof(kindNames[0]), "TypeDecl's kind is out of bounds." ); -
src/AST/Decl.hpp
r54e41b3 r24afc53 114 114 }; 115 115 116 /// Object declaration `int foo()` 116 117 class FunctionDecl : public DeclWithType { 117 118 public: … … 126 127 stmts( stmts ) {} 127 128 128 const Type * get_type() const override { return type.get(); }129 void set_type(Type * t) override { type = strict_dynamic_cast< FunctionType* >( t ); }129 const Type * get_type() const override; 130 void set_type(Type * t) override; 130 131 131 132 bool has_body() const { return stmts; } … … 184 185 TypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, Type* b, 185 186 TypeVar::Kind k, bool s, Type* i = nullptr ) 186 : NamedTypeDecl( loc, name, storage, b ), kind( k ), sized( k == TypeVar::Ttype || s ), 187 : NamedTypeDecl( loc, name, storage, b ), kind( k ), sized( k == TypeVar::Ttype || s ), 187 188 init( i ) {} 188 189 -
src/AST/Pass.hpp
r54e41b3 r24afc53 29 29 #include "AST/Init.hpp" 30 30 #include "AST/Stmt.hpp" 31 #include "AST/Type.hpp" 31 32 32 33 #include "AST/Visitor.hpp" … … 189 190 190 191 template< typename node_t > 191 auto call_accept( const node_t * node ) -> decltype( node->accept(*this) ); 192 auto call_accept( const node_t * node ) -> typename std::enable_if< 193 !std::is_base_of<ast::Expr, node_t>::value && 194 !std::is_base_of<ast::Stmt, node_t>::value 195 , decltype( node->accept(*this) ) 196 >::type; 192 197 193 198 template< template <class...> class container_t > -
src/AST/Pass.impl.hpp
r54e41b3 r24afc53 64 64 65 65 std::transform(decls->begin(), decls->end(), it, [](const ast::Decl * decl) -> auto { 66 return new DeclStmt( decl );66 return new DeclStmt( decl->location, decl ); 67 67 }); 68 68 decls->clear(); … … 119 119 template< typename pass_t > 120 120 template< typename node_t > 121 auto Pass< pass_t >::call_accept( const node_t * node ) -> decltype( node->accept(*this) ) { 121 auto Pass< pass_t >::call_accept( const node_t * node ) 122 -> typename std::enable_if< 123 !std::is_base_of<ast::Expr, node_t>::value && 124 !std::is_base_of<ast::Stmt, node_t>::value 125 , decltype( node->accept(*this) ) 126 >::type 127 128 { 122 129 __pedantic_pass_assert( __visit_children() ); 123 130 __pedantic_pass_assert( expr ); … … 296 303 child_t parent_t::*child 297 304 ) { 298 static_assert( std::is_base_of<parent_t, node_t>::value, "Error deduc tiing member object" );305 static_assert( std::is_base_of<parent_t, node_t>::value, "Error deducing member object" ); 299 306 300 307 if(__pass::skip(parent->*child)) return; … … 424 431 new ast::ArrayType( 425 432 new ast::BasicType( ast::BasicType::Char, ast::CV::Qualifiers( ast::CV::Const ) ), 426 nullptr, true, false433 nullptr, VariableLen, DynamicDim 427 434 ) 428 435 ); … … 434 441 ValueGuard< bool > oldInFunction( inFunction ); 435 442 inFunction = true; 436 maybe_accept( node, &FunctionDecl::st atements );443 maybe_accept( node, &FunctionDecl::stmts ); 437 444 maybe_accept( node, &FunctionDecl::attributes ); 438 445 ) … … 537 544 538 545 VISIT( 539 maybe_accept( node, &TypeDecl::assertions , *this);546 maybe_accept( node, &TypeDecl::assertions ); 540 547 541 548 { … … 614 621 } 615 622 623 //-------------------------------------------------------------------------- 624 // ExprStmt 625 template< typename pass_t > 626 const ast::Stmt * ast::Pass< pass_t >::visit( const ExprStmt * node ) { 627 VISIT_START( node ); 628 629 VISIT( 630 maybe_accept( node, &ExprStmt::expr ); 631 ) 632 633 VISIT_END( Stmt, node ); 634 } 635 636 //-------------------------------------------------------------------------- 637 // AsmStmt 638 template< typename pass_t > 639 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::AsmStmt * node ) { 640 VISIT_START( node ) 641 642 VISIT( 643 maybe_accept( node, &AsmStmt::instruction ); 644 maybe_accept( node, &AsmStmt::output ); 645 maybe_accept( node, &AsmStmt::input ); 646 maybe_accept( node, &AsmStmt::clobber ); 647 ) 648 649 VISIT_END( Stmt, node ); 650 } 651 652 //-------------------------------------------------------------------------- 653 // DirectiveStmt 654 template< typename pass_t > 655 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::DirectiveStmt * node ) { 656 VISIT_START( node ) 657 658 VISIT_END( Stmt, node ); 659 } 660 661 //-------------------------------------------------------------------------- 662 // IfStmt 663 template< typename pass_t > 664 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::IfStmt * node ) { 665 VISIT_START( node ); 666 VISIT({ 667 // if statements introduce a level of scope (for the initialization) 668 guard_indexer guard { *this }; 669 maybe_accept( node, &IfStmt::inits ); 670 maybe_accept( node, &IfStmt::cond ); 671 maybe_accept( node, &IfStmt::thenPart ); 672 maybe_accept( node, &IfStmt::elsePart ); 673 }) 674 VISIT_END( Stmt, node ); 675 } 676 677 //-------------------------------------------------------------------------- 678 // WhileStmt 679 template< typename pass_t > 680 const ast::Stmt * ast::Pass< pass_t >::visit( const WhileStmt * node ) { 681 VISIT_START( node ); 682 683 VISIT({ 684 // while statements introduce a level of scope (for the initialization) 685 guard_indexer guard { *this }; 686 maybe_accept( node, &WhileStmt::inits ); 687 maybe_accept( node, &WhileStmt::cond ); 688 maybe_accept( node, &WhileStmt::body ); 689 }) 690 691 VISIT_END( Stmt, node ); 692 } 616 693 617 694 //-------------------------------------------------------------------------- … … 667 744 ) 668 745 669 VISIT_END( Attribute *, node );746 VISIT_END( Attribute, node ); 670 747 } 671 748 -
src/AST/Pass.proto.hpp
r54e41b3 r24afc53 241 241 INDEXER_FUNC1( addUnion , const UnionDecl * ); 242 242 INDEXER_FUNC1( addTrait , const TraitDecl * ); 243 INDEXER_FUNC2( addWith , const std::list< Expression *> &, const Node * );243 INDEXER_FUNC2( addWith , const std::list< ptr<Expr> > &, const Node * ); 244 244 245 245 // A few extra functions have more complicated behaviour, they are hand written -
src/AST/Stmt.hpp
r54e41b3 r24afc53 62 62 private: 63 63 CompoundStmt* clone() const override { return new CompoundStmt{ *this }; } 64 65 /// Must be copied in ALL derived classes 66 template<typename node_t> 67 friend auto mutate(const node_t * node); 64 68 }; 65 69 … … 73 77 private: 74 78 NullStmt* clone() const override { return new NullStmt{ *this }; } 79 80 /// Must be copied in ALL derived classes 81 template<typename node_t> 82 friend auto mutate(const node_t * node); 75 83 }; 76 84 … … 80 88 ptr<Expr> expr; 81 89 82 ExprStmt( const CodeLocation & loc, const Expr* e ) : Stmt(loc), expr(e) {}90 ExprStmt( const CodeLocation & loc, const Expr * e ) : Stmt(loc), expr(e) {} 83 91 84 92 const Stmt * accept( Visitor& v ) const override { return v.visit( this ); } 85 93 private: 86 94 ExprStmt * clone() const override { return new ExprStmt{ *this }; } 95 96 /// Must be copied in ALL derived classes 97 template<typename node_t> 98 friend auto mutate(const node_t * node); 87 99 }; 88 100 … … 106 118 private: 107 119 AsmStmt* clone() const override { return new AsmStmt{ *this }; } 120 121 /// Must be copied in ALL derived classes 122 template<typename node_t> 123 friend auto mutate(const node_t * node); 108 124 }; 109 125 … … 119 135 private: 120 136 DirectiveStmt* clone() const override { return new DirectiveStmt{ *this }; } 137 138 /// Must be copied in ALL derived classes 139 template<typename node_t> 140 friend auto mutate(const node_t * node); 121 141 }; 122 142 … … 137 157 private: 138 158 IfStmt* clone() const override { return new IfStmt{ *this }; } 159 160 /// Must be copied in ALL derived classes 161 template<typename node_t> 162 friend auto mutate(const node_t * node); 139 163 }; 140 164 … … 151 175 private: 152 176 SwitchStmt* clone() const override { return new SwitchStmt{ *this }; } 177 178 /// Must be copied in ALL derived classes 179 template<typename node_t> 180 friend auto mutate(const node_t * node); 153 181 }; 154 182 … … 167 195 private: 168 196 CaseStmt* clone() const override { return new CaseStmt{ *this }; } 197 198 /// Must be copied in ALL derived classes 199 template<typename node_t> 200 friend auto mutate(const node_t * node); 169 201 }; 170 202 … … 184 216 private: 185 217 WhileStmt* clone() const override { return new WhileStmt{ *this }; } 218 219 /// Must be copied in ALL derived classes 220 template<typename node_t> 221 friend auto mutate(const node_t * node); 186 222 }; 187 223 … … 190 226 std::vector<ptr<Stmt>> inits; 191 227 ptr<Expr> cond; 192 ptr<Expr> inc rement;228 ptr<Expr> inc; 193 229 ptr<Stmt> body; 194 230 195 231 ForStmt( const CodeLocation& loc, std::vector<ptr<Stmt>>&& inits, const Expr* cond, 196 const Expr* inc rement, const Stmt* body, std::vector<Label>&& labels = {} )197 : Stmt(loc, std::move(labels)), inits(std::move(inits)), cond(cond), inc rement(increment),232 const Expr* inc, const Stmt* body, std::vector<Label>&& labels = {} ) 233 : Stmt(loc, std::move(labels)), inits(std::move(inits)), cond(cond), inc(inc), 198 234 body(body) {} 199 235 … … 201 237 private: 202 238 ForStmt* clone() const override { return new ForStmt{ *this }; } 239 240 /// Must be copied in ALL derived classes 241 template<typename node_t> 242 friend auto mutate(const node_t * node); 203 243 }; 204 244 … … 225 265 private: 226 266 BranchStmt* clone() const override { return new BranchStmt{ *this }; } 267 268 /// Must be copied in ALL derived classes 269 template<typename node_t> 270 friend auto mutate(const node_t * node); 271 227 272 static const char * kindNames[kindEnd]; 228 273 }; … … 238 283 private: 239 284 ReturnStmt* clone() const override { return new ReturnStmt{ *this }; } 285 286 /// Must be copied in ALL derived classes 287 template<typename node_t> 288 friend auto mutate(const node_t * node); 240 289 }; 241 290 … … 255 304 private: 256 305 ThrowStmt* clone() const override { return new ThrowStmt{ *this }; } 306 307 /// Must be copied in ALL derived classes 308 template<typename node_t> 309 friend auto mutate(const node_t * node); 257 310 }; 258 311 … … 271 324 private: 272 325 TryStmt* clone() const override { return new TryStmt{ *this }; } 326 327 /// Must be copied in ALL derived classes 328 template<typename node_t> 329 friend auto mutate(const node_t * node); 273 330 }; 274 331 … … 289 346 private: 290 347 CatchStmt* clone() const override { return new CatchStmt{ *this }; } 348 349 /// Must be copied in ALL derived classes 350 template<typename node_t> 351 friend auto mutate(const node_t * node); 291 352 }; 292 353 … … 302 363 private: 303 364 FinallyStmt* clone() const override { return new FinallyStmt{ *this }; } 365 366 /// Must be copied in ALL derived classes 367 template<typename node_t> 368 friend auto mutate(const node_t * node); 304 369 }; 305 370 … … 338 403 private: 339 404 WaitForStmt* clone() const override { return new WaitForStmt{ *this }; } 405 406 /// Must be copied in ALL derived classes 407 template<typename node_t> 408 friend auto mutate(const node_t * node); 340 409 }; 341 410 … … 352 421 private: 353 422 WithStmt* clone() const override { return new WithStmt{ *this }; } 423 424 /// Must be copied in ALL derived classes 425 template<typename node_t> 426 friend auto mutate(const node_t * node); 354 427 }; 355 428 … … 364 437 private: 365 438 DeclStmt* clone() const override { return new DeclStmt{ *this }; } 439 440 /// Must be copied in ALL derived classes 441 template<typename node_t> 442 friend auto mutate(const node_t * node); 366 443 }; 367 444 … … 377 454 private: 378 455 ImplicitCtorDtorStmt* clone() const override { return new ImplicitCtorDtorStmt{ *this }; } 456 457 /// Must be copied in ALL derived classes 458 template<typename node_t> 459 friend auto mutate(const node_t * node); 379 460 }; 380 461 … … 390 471 inline void increment( const class ExprStmt * node, Node::ref_type ref ) { node->increment( ref ); } 391 472 inline void decrement( const class ExprStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 392 //inline void increment( const class AsmStmt * node, Node::ref_type ref ) { node->increment( ref ); }393 //inline void decrement( const class AsmStmt * node, Node::ref_type ref ) { node->decrement( ref ); }394 //inline void increment( const class DirectiveStmt * node, Node::ref_type ref ) { node->increment( ref ); }395 //inline void decrement( const class DirectiveStmt * node, Node::ref_type ref ) { node->decrement( ref ); }396 //inline void increment( const class IfStmt * node, Node::ref_type ref ) { node->increment( ref ); }397 //inline void decrement( const class IfStmt * node, Node::ref_type ref ) { node->decrement( ref ); }398 //inline void increment( const class WhileStmt * node, Node::ref_type ref ) { node->increment( ref ); }399 //inline void decrement( const class WhileStmt * node, Node::ref_type ref ) { node->decrement( ref ); }400 //inline void increment( const class ForStmt * node, Node::ref_type ref ) { node->increment( ref ); }401 //inline void decrement( const class ForStmt * node, Node::ref_type ref ) { node->decrement( ref ); }402 //inline void increment( const class SwitchStmt * node, Node::ref_type ref ) { node->increment( ref ); }403 //inline void decrement( const class SwitchStmt * node, Node::ref_type ref ) { node->decrement( ref ); }404 //inline void increment( const class CaseStmt * node, Node::ref_type ref ) { node->increment( ref ); }405 //inline void decrement( const class CaseStmt * node, Node::ref_type ref ) { node->decrement( ref ); }406 //inline void increment( const class BranchStmt * node, Node::ref_type ref ) { node->increment( ref ); }407 //inline void decrement( const class BranchStmt * node, Node::ref_type ref ) { node->decrement( ref ); }408 //inline void increment( const class ReturnStmt * node, Node::ref_type ref ) { node->increment( ref ); }409 //inline void decrement( const class ReturnStmt * node, Node::ref_type ref ) { node->decrement( ref ); }410 //inline void increment( const class ThrowStmt * node, Node::ref_type ref ) { node->increment( ref ); }411 //inline void decrement( const class ThrowStmt * node, Node::ref_type ref ) { node->decrement( ref ); }412 //inline void increment( const class TryStmt * node, Node::ref_type ref ) { node->increment( ref ); }413 //inline void decrement( const class TryStmt * node, Node::ref_type ref ) { node->decrement( ref ); }414 //inline void increment( const class CatchStmt * node, Node::ref_type ref ) { node->increment( ref ); }415 //inline void decrement( const class CatchStmt * node, Node::ref_type ref ) { node->decrement( ref ); }416 //inline void increment( const class FinallyStmt * node, Node::ref_type ref ) { node->increment( ref ); }417 //inline void decrement( const class FinallyStmt * node, Node::ref_type ref ) { node->decrement( ref ); }418 //inline void increment( const class WaitForStmt * node, Node::ref_type ref ) { node->increment( ref ); }419 //inline void decrement( const class WaitForStmt * node, Node::ref_type ref ) { node->decrement( ref ); }420 //inline void increment( const class WithStmt * node, Node::ref_type ref ) { node->increment( ref ); }421 //inline void decrement( const class WithStmt * node, Node::ref_type ref ) { node->decrement( ref ); }422 //inline void increment( const class DeclStmt * node, Node::ref_type ref ) { node->increment( ref ); }423 //inline void decrement( const class DeclStmt * node, Node::ref_type ref ) { node->decrement( ref ); }473 inline void increment( const class AsmStmt * node, Node::ref_type ref ) { node->increment( ref ); } 474 inline void decrement( const class AsmStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 475 inline void increment( const class DirectiveStmt * node, Node::ref_type ref ) { node->increment( ref ); } 476 inline void decrement( const class DirectiveStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 477 inline void increment( const class IfStmt * node, Node::ref_type ref ) { node->increment( ref ); } 478 inline void decrement( const class IfStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 479 inline void increment( const class WhileStmt * node, Node::ref_type ref ) { node->increment( ref ); } 480 inline void decrement( const class WhileStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 481 inline void increment( const class ForStmt * node, Node::ref_type ref ) { node->increment( ref ); } 482 inline void decrement( const class ForStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 483 inline void increment( const class SwitchStmt * node, Node::ref_type ref ) { node->increment( ref ); } 484 inline void decrement( const class SwitchStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 485 inline void increment( const class CaseStmt * node, Node::ref_type ref ) { node->increment( ref ); } 486 inline void decrement( const class CaseStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 487 inline void increment( const class BranchStmt * node, Node::ref_type ref ) { node->increment( ref ); } 488 inline void decrement( const class BranchStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 489 inline void increment( const class ReturnStmt * node, Node::ref_type ref ) { node->increment( ref ); } 490 inline void decrement( const class ReturnStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 491 inline void increment( const class ThrowStmt * node, Node::ref_type ref ) { node->increment( ref ); } 492 inline void decrement( const class ThrowStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 493 inline void increment( const class TryStmt * node, Node::ref_type ref ) { node->increment( ref ); } 494 inline void decrement( const class TryStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 495 inline void increment( const class CatchStmt * node, Node::ref_type ref ) { node->increment( ref ); } 496 inline void decrement( const class CatchStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 497 inline void increment( const class FinallyStmt * node, Node::ref_type ref ) { node->increment( ref ); } 498 inline void decrement( const class FinallyStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 499 inline void increment( const class WaitForStmt * node, Node::ref_type ref ) { node->increment( ref ); } 500 inline void decrement( const class WaitForStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 501 inline void increment( const class WithStmt * node, Node::ref_type ref ) { node->increment( ref ); } 502 inline void decrement( const class WithStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 503 inline void increment( const class DeclStmt * node, Node::ref_type ref ) { node->increment( ref ); } 504 inline void decrement( const class DeclStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 424 505 inline void increment( const class NullStmt * node, Node::ref_type ref ) { node->increment( ref ); } 425 506 inline void decrement( const class NullStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 426 //inline void increment( const class ImplicitCtorDtorStmt * node, Node::ref_type ref ) { node->increment( ref ); }427 //inline void decrement( const class ImplicitCtorDtorStmt * node, Node::ref_type ref ) { node->decrement( ref ); }507 inline void increment( const class ImplicitCtorDtorStmt * node, Node::ref_type ref ) { node->increment( ref ); } 508 inline void decrement( const class ImplicitCtorDtorStmt * node, Node::ref_type ref ) { node->decrement( ref ); } 428 509 429 510 } -
src/Parser/lex.ll
r54e41b3 r24afc53 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Wed Ma r 13 14:54:30201913 * Update Count : 70 712 * Last Modified On : Wed May 15 21:25:27 2019 13 * Update Count : 708 14 14 */ 15 15 … … 265 265 fortran { KEYWORD_RETURN(FORTRAN); } 266 266 ftype { KEYWORD_RETURN(FTYPE); } // CFA 267 generator { KEYWORD_RETURN(GENERATOR); } // CFA 267 268 _Generic { KEYWORD_RETURN(GENERIC); } // C11 268 269 goto { KEYWORD_RETURN(GOTO); } -
src/Parser/parser.yy
r54e41b3 r24afc53 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Apr 15 15:02:56201913 // Update Count : 429 012 // Last Modified On : Wed May 15 21:25:27 2019 13 // Update Count : 4296 14 14 // 15 15 … … 173 173 DeclarationNode * fieldDecl( DeclarationNode * typeSpec, DeclarationNode * fieldList ) { 174 174 if ( ! fieldList ) { // field declarator ? 175 if ( ! ( typeSpec->type && typeSpec->type->kind == TypeData::Aggregate) ) {175 if ( ! ( typeSpec->type && (typeSpec->type->kind == TypeData::Aggregate || typeSpec->type->kind == TypeData::Enum) ) ) { 176 176 stringstream ss; 177 177 typeSpec->type->print( ss ); … … 275 275 %token ENUM STRUCT UNION 276 276 %token EXCEPTION // CFA 277 %token COROUTINE MONITOR THREAD// CFA277 %token GENERATOR COROUTINE MONITOR THREAD // CFA 278 278 %token OTYPE FTYPE DTYPE TTYPE TRAIT // CFA 279 279 %token SIZEOF OFFSETOF … … 677 677 // empty 678 678 { $$ = nullptr; } 679 | ' ?' // CFA, default parameter679 | '@' // CFA, default parameter 680 680 { SemanticError( yylloc, "Default parameter for argument is currently unimplemented." ); $$ = nullptr; } 681 681 // { $$ = new ExpressionNode( build_constantInteger( *new string( "2" ) ) ); } … … 796 796 { $$ = new ExpressionNode( build_cast( $2, $4 ) ); } 797 797 // keyword cast cannot be grouped because of reduction in aggregate_key 798 | '(' GENERATOR '&' ')' cast_expression // CFA 799 { $$ = new ExpressionNode( build_keyword_cast( KeywordCastExpr::Coroutine, $5 ) ); } 798 800 | '(' COROUTINE '&' ')' cast_expression // CFA 799 801 { $$ = new ExpressionNode( build_keyword_cast( KeywordCastExpr::Coroutine, $5 ) ); } … … 2061 2063 | EXCEPTION 2062 2064 { yyy = true; $$ = DeclarationNode::Exception; } 2065 | GENERATOR 2066 { yyy = true; $$ = DeclarationNode::Coroutine; } 2063 2067 | COROUTINE 2064 2068 { yyy = true; $$ = DeclarationNode::Coroutine; } -
tests/.expect/abs.txt
r54e41b3 r24afc53 3 3 signed long int -65 abs 65 4 4 signed long long int -65 abs 65 5 float -65 abs 656 double -65 abs 657 long double -65 abs 658 float _Complex -65 -2i abs 65.03089 double _Complex -65 -2i abs 65.030761951556410 long double _Complex -65 -2i abs 65.03076195155643425 float -65. abs 65. 6 double -65. abs 65. 7 long double -65. abs 65. 8 float _Complex -65.-2.i abs 65.0308 9 double _Complex -65.-2.i abs 65.0307619515564 10 long double _Complex -65.-2.i abs 65.0307619515564342 -
tests/.expect/ato.txt
r54e41b3 r24afc53 22 22 -123.456789012345679 -123.45678901234567890123456789 23 23 -123.456-123.456i -123.456-123.456i 24 0 +0i 2 324 0.+0.i 2 3 25 25 -123.456789012346+123.456789012346i -123.4567890123456+123.4567890123456i 26 26 123.456789012345679-123.456789012345679i 123.45678901234567890123456789-123.45678901234567890123456789i -
tests/.expect/complex.txt
r54e41b3 r24afc53 1 1 x:3+2i y:4+5i z:7+7i 2 x:3 +2i y:4+5i z:7+7i2 x:3.+2.i y:4.+5.i z:7.+7.i 3 3 x:2.1+1.3i y:3.2+4.5i z:5.3+5.8i 4 4 x:2.1+1.3i y:3.2+4.5i z:5.3+5.8i -
tests/.expect/identity.txt
r54e41b3 r24afc53 9 9 double 4.1 10 10 long double 4.1 11 float _Complex -4.1-2 i12 double _Complex -4.1-2 i13 long double _Complex -4.1-2 i11 float _Complex -4.1-2.i 12 double _Complex -4.1-2.i 13 long double _Complex -4.1-2.i -
tests/.expect/math1.txt
r54e41b3 r24afc53 1 fmod:1 1 1 1 1 12 remainder:-1 -1 -11 fmod:1. 1. 1. 1. 1. 1. 2 remainder:-1. -1. -1. 3 3 remquo:7 0.0999999 7 0.1 7 0.0999999999999999999 4 div:7 , 0.2 7, 0.2 7, 0.25 fma:-2 -2 -26 fdim:2 2 24 div:7., 0.2 7., 0.2 7., 0.2 5 fma:-2. -2. -2. 6 fdim:2. 2. 2. 7 7 nan:nan nan nan 8 8 exp:2.71828 2.71828182845905 2.71828182845904524 1.46869+2.28736i 1.46869393991589+2.28735528717884i 1.46869393991588516+2.28735528717884239i 9 exp2:2 2 29 exp2:2. 2. 2. 10 10 expm1:1.71828 1.71828182845905 1.71828182845904524 11 pow:1 1 10.273957+0.583701i 0.273957253830121+0.583700758758615i -0.638110484918098871+0.705394566961838155i11 pow:1. 1. 1. 0.273957+0.583701i 0.273957253830121+0.583700758758615i -0.638110484918098871+0.705394566961838155i 12 12 16 \ 2 = 256 13 13 912673 256 64 -64 0 0 -
tests/.expect/math2.txt
r54e41b3 r24afc53 1 log:0 0 00.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i2 log2:3 3 33 log10:2 2 21 log:0. 0. 0. 0.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i 2 log2:3. 3. 3. 3 log10:2. 2. 2. 4 4 log1p:0.693147 0.693147180559945 0.693147180559945309 5 5 ilogb:0 0 0 6 logb:3 3 37 sqrt:1 1 11.09868+0.45509i 1.09868411346781+0.455089860562227i 1.09868411346780997+0.455089860562227341i8 cbrt:3 3 36 logb:3. 3. 3. 7 sqrt:1. 1. 1. 1.09868+0.45509i 1.09868411346781+0.455089860562227i 1.09868411346780997+0.455089860562227341i 8 cbrt:3. 3. 3. 9 9 hypot:1.41421 1.4142135623731 1.41421356237309505 10 10 sin:0.841471 0.841470984807897 0.841470984807896507 1.29846+0.634964i 1.29845758141598+0.634963914784736i 1.29845758141597729+0.634963914784736108i … … 12 12 tan:1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i 13 13 asin:1.5708 1.5707963267949 1.57079632679489662 0.666239+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i 14 acos:0 0 00.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i14 acos:0. 0. 0. 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i 15 15 atan:0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i 16 16 atan2:0.785398 0.785398163397448 0.78539816339744831 atan:0.785398 0.785398163397448 0.78539816339744831 -
tests/.expect/math3.txt
r54e41b3 r24afc53 2 2 cosh:1.54308 1.54308063481524 1.54308063481524378 0.83373+0.988898i 0.833730025131149+0.988897705762865i 0.833730025131149049+0.988897705762865096i 3 3 tanh:0.761594 0.761594155955765 0.761594155955764888 1.08392+0.271753i 1.08392332733869+0.271752585319512i 1.08392332733869454+0.271752585319511717i 4 acosh:0 0 01.06128+0.904557i 1.06127506190504+0.904556894302381i 1.06127506190503565+0.904556894302381364i4 acosh:0. 0. 0. 1.06128+0.904557i 1.06127506190504+0.904556894302381i 1.06127506190503565+0.904556894302381364i 5 5 asinh:0.881374 0.881373587019543 0.881373587019543025 1.06128+0.666239i 1.06127506190504+0.666239432492515i 1.06127506190503565+0.666239432492515255i 6 6 atanh:inf inf inf 0.402359+1.01722i 0.402359478108525+1.01722196789785i 0.402359478108525094+1.01722196789785137i … … 9 9 lgamma:1.79176 1.79175946922805 1.791759469228055 10 10 lgamma:1.79176 1 1.79175946922805 1 1.791759469228055 1 11 tgamma:6 6 611 tgamma:6 6. 6. -
tests/.expect/math4.txt
r54e41b3 r24afc53 1 floor:1 1 12 ceil:2 2 23 trunc:3 3 34 rint:2 2 21 floor:1. 1. 1. 2 ceil:2. 2. 2. 3 trunc:3. 3. 3. 4 rint:2. 2. 2. 5 5 rint:2 2 2 6 6 rint:2 2 2 7 7 lrint:2 2 2 8 8 llrint:2 2 2 9 nearbyint:4 4 410 round:2 2 29 nearbyint:4. 4. 4. 10 round:2. 2. 2. 11 11 round:2 2 2 12 12 round:2 2 2 13 13 lround:2 2 2 14 14 llround:2 2 2 15 copysign:-1 -1 -115 copysign:-1. -1. -1. 16 16 frexp:0.5 3 0.5 3 0.5 3 17 ldexp:8 8 818 modf:2 0.3 2 0.3 20.319 modf:2 , 0.3 2, 0.3 2, 0.317 ldexp:8. 8. 8. 18 modf:2. 0.3 2. 0.3 2. 0.3 19 modf:2., 0.3 2., 0.3 2., 0.3 20 20 nextafter:2 2 2 21 21 nexttoward:2 2 2 22 scalbn:16 16 1623 scalbln:16 16 1622 scalbn:16. 16. 16. 23 scalbln:16. 16. 16. -
tests/.expect/minmax.txt
r54e41b3 r24afc53 6 6 signed long long int 4 3 min 3 7 7 unsigned long long int 4 3 min 3 8 float 4 3.1 min 3.19 double 4 3.1 min 3.110 long double 4 3.1 min 3.18 float 4. 3.1 min 3.1 9 double 4. 3.1 min 3.1 10 long double 4. 3.1 min 3.1 11 11 12 12 char z a max z … … 17 17 signed long long int 4 3 max 4 18 18 unsigned long long int 4 3 max 4 19 float 4 3.1 max 420 double 4 3.1 max 421 long double 4 3.1 max 419 float 4. 3.1 max 4. 20 double 4. 3.1 max 4. 21 long double 4. 3.1 max 4. -
tests/.expect/references.txt
r54e41b3 r24afc53 35 35 3 36 36 3 37 3 9 { 1 , 7}, [1, 2, 3]37 3 9 { 1., 7. }, [1, 2, 3] 38 38 Destructing a Y 39 39 Destructing a Y
Note: See TracChangeset
for help on using the changeset viewer.