Changeset ff29f08 for src/Parser
- Timestamp:
- May 18, 2018, 2:09:21 PM (6 years ago)
- Branches:
- new-env, with_gc
- Children:
- 2472a19
- Parents:
- f6f0cca3 (diff), c7d8100c (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. - Location:
- src/Parser
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
rf6f0cca3 rff29f08 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Apr 20 22:37:20201813 // Update Count : 10 6312 // Last Modified On : Wed May 16 09:37:17 2018 13 // Update Count : 1070 14 14 // 15 15 … … 526 526 527 527 DeclarationNode * DeclarationNode::addQualifiers( DeclarationNode * q ) { 528 if ( ! q ) { delete q; return this; }// empty qualifier528 if ( ! q ) { return this; } // empty qualifier 529 529 530 530 checkSpecifiers( q ); … … 560 560 561 561 checkQualifiers( type, q->type ); 562 if ( (builtin == Zero || builtin == One) && error.length() == 0 ) {562 if ( (builtin == Zero || builtin == One) && q->type->qualifiers.val != 0 && error.length() == 0 ) { 563 563 SemanticWarning( yylloc, Warning::BadQualifiersZeroOne, Type::QualifiersNames[ilog2( q->type->qualifiers.val )], builtinTypeNames[builtin] ); 564 // appendError( error, string( "questionable qualifiers" ) );565 564 } // if 566 565 addQualifiersToType( q->type, type ); … … 782 781 DeclarationNode * DeclarationNode::addPointer( DeclarationNode * p ) { 783 782 if ( p ) { 784 assert( p->type->kind == TypeData::Pointer || TypeData::Reference );783 assert( p->type->kind == TypeData::Pointer || p->type->kind == TypeData::Reference ); 785 784 setBase( p->type ); 786 785 p->type = nullptr; -
src/Parser/ParseNode.h
rf6f0cca3 rff29f08 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 22 17:49:31201813 // Update Count : 8 2712 // Last Modified On : Mon Apr 30 09:19:17 2018 13 // Update Count : 831 14 14 // 15 15 … … 332 332 bool hasEllipsis; 333 333 LinkageSpec::Spec linkage; 334 Expression * asmName;334 Expression * asmName; 335 335 std::list< Attribute * > attributes; 336 336 InitializerNode * initializer; … … 416 416 Statement * build_finally( StatementNode * stmt ); 417 417 Statement * build_compound( StatementNode * first ); 418 Statement * build_asmstmt( bool voltile, Expression * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr ); 418 Statement * build_asm( bool voltile, Expression * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr ); 419 Statement * build_directive( std::string * directive ); 419 420 WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when ); 420 421 WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when, WaitForStmt * existing ); -
src/Parser/StatementNode.cc
rf6f0cca3 rff29f08 10 10 // Created On : Sat May 16 14:59:41 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 8 14:31:32201813 // Update Count : 3 4812 // Last Modified On : Mon Apr 30 09:21:16 2018 13 // Update Count : 354 14 14 // 15 15 16 16 #include <cassert> // for assert, strict_dynamic_cast, assertf 17 17 #include <list> // for list 18 #include <memory> // for unique_ptr 18 19 #include <string> // for string 19 20 … … 32 33 33 34 34 StatementNode::StatementNode( DeclarationNode * decl ) {35 StatementNode::StatementNode( DeclarationNode * decl ) { 35 36 assert( decl ); 36 DeclarationNode * agg = decl->extractAggregate();37 DeclarationNode * agg = decl->extractAggregate(); 37 38 if ( agg ) { 38 StatementNode * nextStmt = new StatementNode( new DeclStmt( maybeBuild< Declaration >( decl ) ) );39 StatementNode * nextStmt = new StatementNode( new DeclStmt( maybeBuild< Declaration >( decl ) ) ); 39 40 set_next( nextStmt ); 40 41 if ( decl->get_next() ) { … … 52 53 } // StatementNode::StatementNode 53 54 54 StatementNode * StatementNode::append_last_case( StatementNode *stmt ) {55 StatementNode * prev = this;55 StatementNode * StatementNode::append_last_case( StatementNode * stmt ) { 56 StatementNode * prev = this; 56 57 // find end of list and maintain previous pointer 57 58 for ( StatementNode * curr = prev; curr != nullptr; curr = (StatementNode *)curr->get_next() ) { 58 StatementNode * node = strict_dynamic_cast< StatementNode * >(curr);59 StatementNode * node = strict_dynamic_cast< StatementNode * >(curr); 59 60 assert( dynamic_cast< CaseStmt * >(node->stmt) ); 60 61 prev = curr; 61 62 } // for 62 63 // convert from StatementNode list to Statement list 63 StatementNode * node = dynamic_cast< StatementNode * >(prev);64 StatementNode * node = dynamic_cast< StatementNode * >(prev); 64 65 std::list< Statement * > stmts; 65 66 buildMoveList( stmt, stmts ); … … 70 71 } 71 72 72 Statement * build_expr( ExpressionNode *ctl ) {73 Expression * e = maybeMoveBuild< Expression >( ctl );73 Statement * build_expr( ExpressionNode * ctl ) { 74 Expression * e = maybeMoveBuild< Expression >( ctl ); 74 75 75 76 if ( e ) … … 79 80 } 80 81 81 Statement * build_if( IfCtl * ctl, StatementNode *then_stmt, StatementNode *else_stmt ) {82 Statement * thenb, *elseb = 0;82 Statement * build_if( IfCtl * ctl, StatementNode * then_stmt, StatementNode * else_stmt ) { 83 Statement * thenb, * elseb = 0; 83 84 std::list< Statement * > branches; 84 85 buildMoveList< Statement, StatementNode >( then_stmt, branches ); … … 115 116 } 116 117 117 Statement * build_switch( bool isSwitch, ExpressionNode *ctl, StatementNode *stmt ) {118 Statement * build_switch( bool isSwitch, ExpressionNode * ctl, StatementNode * stmt ) { 118 119 std::list< Statement * > branches; 119 120 buildMoveList< Statement, StatementNode >( stmt, branches ); … … 130 131 return new SwitchStmt( maybeMoveBuild< Expression >(ctl), branches ); 131 132 } 132 Statement * build_case( ExpressionNode *ctl ) {133 Statement * build_case( ExpressionNode * ctl ) { 133 134 std::list< Statement * > branches; 134 135 return new CaseStmt( maybeMoveBuild< Expression >(ctl), branches ); 135 136 } 136 Statement * build_default() {137 Statement * build_default() { 137 138 std::list< Statement * > branches; 138 139 return new CaseStmt( nullptr, branches, true ); 139 140 } 140 141 141 Statement * build_while( ExpressionNode *ctl, StatementNode *stmt, bool kind ) {142 Statement * build_while( ExpressionNode * ctl, StatementNode * stmt, bool kind ) { 142 143 std::list< Statement * > branches; 143 144 buildMoveList< Statement, StatementNode >( stmt, branches ); … … 146 147 } 147 148 148 Statement * build_for( ForCtl *forctl, StatementNode *stmt ) {149 Statement * build_for( ForCtl * forctl, StatementNode * stmt ) { 149 150 std::list< Statement * > branches; 150 151 buildMoveList< Statement, StatementNode >( stmt, branches ); … … 156 157 } // if 157 158 158 Expression * cond = 0;159 Expression * cond = 0; 159 160 if ( forctl->condition != 0 ) 160 161 cond = notZeroExpr( maybeMoveBuild< Expression >(forctl->condition) ); 161 162 162 Expression * incr = 0;163 Expression * incr = 0; 163 164 if ( forctl->change != 0 ) 164 165 incr = maybeMoveBuild< Expression >(forctl->change); … … 168 169 } 169 170 170 Statement * build_branch( BranchStmt::Type kind ) {171 Statement * build_branch( BranchStmt::Type kind ) { 171 172 Statement * ret = new BranchStmt( "", kind ); 172 173 return ret; 173 174 } 174 Statement * build_branch( std::string *identifier, BranchStmt::Type kind ) {175 Statement * ret = new BranchStmt( * identifier, kind );175 Statement * build_branch( std::string * identifier, BranchStmt::Type kind ) { 176 Statement * ret = new BranchStmt( * identifier, kind ); 176 177 delete identifier; // allocated by lexer 177 178 return ret; 178 179 } 179 Statement * build_computedgoto( ExpressionNode *ctl ) {180 Statement * build_computedgoto( ExpressionNode * ctl ) { 180 181 return new BranchStmt( maybeMoveBuild< Expression >(ctl), BranchStmt::Goto ); 181 182 } 182 183 183 Statement * build_return( ExpressionNode *ctl ) {184 Statement * build_return( ExpressionNode * ctl ) { 184 185 std::list< Expression * > exps; 185 186 buildMoveList( ctl, exps ); … … 187 188 } 188 189 189 Statement * build_throw( ExpressionNode *ctl ) {190 Statement * build_throw( ExpressionNode * ctl ) { 190 191 std::list< Expression * > exps; 191 192 buildMoveList( ctl, exps ); … … 194 195 } 195 196 196 Statement * build_resume( ExpressionNode *ctl ) {197 Statement * build_resume( ExpressionNode * ctl ) { 197 198 std::list< Expression * > exps; 198 199 buildMoveList( ctl, exps ); … … 201 202 } 202 203 203 Statement * build_resume_at( ExpressionNode *ctl, ExpressionNode *target ) {204 Statement * build_resume_at( ExpressionNode * ctl, ExpressionNode * target ) { 204 205 (void)ctl; 205 206 (void)target; … … 207 208 } 208 209 209 Statement * build_try( StatementNode *try_stmt, StatementNode *catch_stmt, StatementNode *finally_stmt ) {210 Statement * build_try( StatementNode * try_stmt, StatementNode * catch_stmt, StatementNode * finally_stmt ) { 210 211 std::list< CatchStmt * > branches; 211 212 buildMoveList< CatchStmt, StatementNode >( catch_stmt, branches ); 212 CompoundStmt * tryBlock = strict_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));213 FinallyStmt * finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) );213 CompoundStmt * tryBlock = strict_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt)); 214 FinallyStmt * finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) ); 214 215 return new TryStmt( tryBlock, branches, finallyBlock ); 215 216 } 216 Statement * build_catch( CatchStmt::Kind kind, DeclarationNode *decl, ExpressionNode *cond, StatementNode *body ) {217 Statement * build_catch( CatchStmt::Kind kind, DeclarationNode * decl, ExpressionNode * cond, StatementNode * body ) { 217 218 std::list< Statement * > branches; 218 219 buildMoveList< Statement, StatementNode >( body, branches ); … … 220 221 return new CatchStmt( kind, maybeMoveBuild< Declaration >(decl), maybeMoveBuild< Expression >(cond), branches.front() ); 221 222 } 222 Statement * build_finally( StatementNode *stmt ) {223 Statement * build_finally( StatementNode * stmt ) { 223 224 std::list< Statement * > branches; 224 225 buildMoveList< Statement, StatementNode >( stmt, branches ); … … 303 304 } 304 305 305 Statement * build_compound( StatementNode *first ) {306 CompoundStmt * cs = new CompoundStmt();306 Statement * build_compound( StatementNode * first ) { 307 CompoundStmt * cs = new CompoundStmt(); 307 308 buildMoveList( first, cs->get_kids() ); 308 309 return cs; 309 310 } 310 311 311 Statement * build_asmstmt( bool voltile, Expression *instruction, ExpressionNode *output, ExpressionNode *input, ExpressionNode *clobber, LabelNode *gotolabels ) {312 Statement * build_asm( bool voltile, Expression * instruction, ExpressionNode * output, ExpressionNode * input, ExpressionNode * clobber, LabelNode * gotolabels ) { 312 313 std::list< Expression * > out, in; 313 314 std::list< ConstantExpr * > clob; … … 317 318 buildMoveList( clobber, clob ); 318 319 return new AsmStmt( voltile, instruction, out, in, clob, gotolabels ? gotolabels->labels : noLabels ); 320 } 321 322 Statement * build_directive( string * directive ) { 323 return new DirectiveStmt( *directive ); 319 324 } 320 325 -
src/Parser/TypeData.cc
rf6f0cca3 rff29f08 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Apr 17 23:00:52201813 // Update Count : 60 212 // Last Modified On : Thu Apr 26 13:46:07 2018 13 // Update Count : 603 14 14 // 15 15 … … 62 62 enumeration.constants = nullptr; 63 63 enumeration.body = false; 64 break; 64 65 case Aggregate: 65 66 // aggregate = new Aggregate_t; -
src/Parser/lex.ll
rf6f0cca3 rff29f08 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Fri Apr 6 15:16:15201813 * Update Count : 67 012 * Last Modified On : Thu May 3 13:42:40 2018 13 * Update Count : 676 14 14 */ 15 15 … … 174 174 } 175 175 176 /* ignore preprocessor directives (for now)*/177 ^{h_white}*"#"[^\n]*"\n" ;176 /* preprocessor-style directives */ 177 ^{h_white}*"#"[^\n]*"\n" { RETURN_VAL( DIRECTIVE ); } 178 178 179 179 /* ignore C style comments (ALSO HANDLED BY CPP) */ -
src/Parser/parser.yy
rf6f0cca3 rff29f08 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Apr 17 17:10:30201813 // Update Count : 3 14412 // Last Modified On : Fri May 11 17:51:38 2018 13 // Update Count : 3261 14 14 // 15 15 … … 133 133 } // build_postfix_name 134 134 135 bool forall = false ;// aggregate have one or more forall qualifiers ?135 bool forall = false, xxx = false; // aggregate have one or more forall qualifiers ? 136 136 137 137 // https://www.gnu.org/software/bison/manual/bison.html#Location-Type … … 208 208 %token<tok> ATTR_IDENTIFIER ATTR_TYPEDEFname ATTR_TYPEGENname 209 209 %token<tok> INTEGERconstant CHARACTERconstant STRINGliteral 210 %token<tok> DIRECTIVE 210 211 // Floating point constant is broken into three kinds of tokens because of the ambiguity with tuple indexing and 211 212 // overloading constants 0/1, e.g., x.1 is lexed as (x)(.1), where (.1) is a factional constant, but is semantically … … 282 283 %type<decl> aggregate_type aggregate_type_nobody 283 284 284 %type<decl> assertion assertion_list _opt285 %type<decl> assertion assertion_list assertion_list_opt 285 286 286 287 %type<en> bit_subrange_size_opt bit_subrange_size … … 301 302 302 303 %type<decl> field_declaration field_declaration_list field_declarator field_declaring_list 303 %type<en> field field_list field_name fraction_constants 304 %type<en> field field_list field_name fraction_constants_opt 304 305 305 306 %type<decl> external_function_definition function_definition function_array function_declarator function_no_ptr function_ptr … … 498 499 | type_name '.' no_attr_identifier // CFA, nested type 499 500 { SemanticError( yylloc, "Qualified names are currently unimplemented." ); $$ = nullptr; } 501 // { $$ = nullptr; } 500 502 | type_name '.' '[' push field_list pop ']' // CFA, nested type / tuple field selector 501 503 { SemanticError( yylloc, "Qualified names are currently unimplemented." ); $$ = nullptr; } 504 // { $$ = nullptr; } 502 505 | GENERIC '(' assignment_expression ',' generic_assoc_list ')' // C11 503 506 { SemanticError( yylloc, "_Generic is currently unimplemented." ); $$ = nullptr; } … … 532 535 | postfix_expression '.' no_attr_identifier 533 536 { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); } 537 | postfix_expression '.' INTEGERconstant // CFA, tuple index 538 { $$ = new ExpressionNode( build_fieldSel( $1, build_constantInteger( *$3 ) ) ); } 539 | postfix_expression FLOATING_FRACTIONconstant // CFA, tuple index 540 { $$ = new ExpressionNode( build_fieldSel( $1, build_field_name_FLOATING_FRACTIONconstant( *$2 ) ) ); } 534 541 | postfix_expression '.' '[' push field_list pop ']' // CFA, tuple field selector 535 542 { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $5 ) ) ); } 536 | postfix_expression FLOATING_FRACTIONconstant // CFA, tuple index537 { $$ = new ExpressionNode( build_fieldSel( $1, build_field_name_FLOATING_FRACTIONconstant( *$2 ) ) ); }538 543 | postfix_expression ARROW no_attr_identifier 539 544 { 540 545 $$ = new ExpressionNode( build_pfieldSel( $1, *$3 == "0" || *$3 == "1" ? build_constantInteger( *$3 ) : build_varref( $3 ) ) ); 541 546 } 542 | postfix_expression ARROW '[' push field_list pop ']' // CFA, tuple field selector543 { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); }544 547 | postfix_expression ARROW INTEGERconstant // CFA, tuple index 545 548 { $$ = new ExpressionNode( build_pfieldSel( $1, build_constantInteger( *$3 ) ) ); } 549 | postfix_expression ARROW '[' push field_list pop ']' // CFA, tuple field selector 550 { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); } 546 551 | postfix_expression ICR 547 552 { $$ = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, $1 ) ); } … … 596 601 597 602 field_name: 598 INTEGERconstant fraction_constants 603 INTEGERconstant fraction_constants_opt 599 604 { $$ = new ExpressionNode( build_field_name_fraction_constants( build_constantInteger( *$1 ), $2 ) ); } 600 | FLOATINGconstant fraction_constants 605 | FLOATINGconstant fraction_constants_opt 601 606 { $$ = new ExpressionNode( build_field_name_fraction_constants( build_field_name_FLOATINGconstant( *$1 ), $2 ) ); } 602 | no_attr_identifier fraction_constants 607 | no_attr_identifier fraction_constants_opt 603 608 { 604 609 $$ = new ExpressionNode( build_field_name_fraction_constants( build_varref( $1 ), $2 ) ); … … 606 611 ; 607 612 608 fraction_constants :613 fraction_constants_opt: 609 614 // empty 610 615 { $$ = nullptr; } 611 | fraction_constants FLOATING_FRACTIONconstant616 | fraction_constants_opt FLOATING_FRACTIONconstant 612 617 { 613 618 Expression * constant = build_field_name_FLOATING_FRACTIONconstant( *$2 ); … … 875 880 { SemanticError( yylloc, "enable/disable statement is currently unimplemented." ); $$ = nullptr; } 876 881 | asm_statement 882 | DIRECTIVE 883 { $$ = new StatementNode( build_directive( $1 ) ); } 877 884 ; 878 885 … … 1204 1211 asm_statement: 1205 1212 ASM asm_volatile_opt '(' string_literal ')' ';' 1206 { $$ = new StatementNode( build_asm stmt( $2, $4, 0 ) ); }1213 { $$ = new StatementNode( build_asm( $2, $4, 0 ) ); } 1207 1214 | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ')' ';' // remaining GCC 1208 { $$ = new StatementNode( build_asm stmt( $2, $4, $6 ) ); }1215 { $$ = new StatementNode( build_asm( $2, $4, $6 ) ); } 1209 1216 | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ':' asm_operands_opt ')' ';' 1210 { $$ = new StatementNode( build_asm stmt( $2, $4, $6, $8 ) ); }1217 { $$ = new StatementNode( build_asm( $2, $4, $6, $8 ) ); } 1211 1218 | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ':' asm_operands_opt ':' asm_clobbers_list_opt ')' ';' 1212 { $$ = new StatementNode( build_asm stmt( $2, $4, $6, $8, $10 ) ); }1219 { $$ = new StatementNode( build_asm( $2, $4, $6, $8, $10 ) ); } 1213 1220 | ASM asm_volatile_opt GOTO '(' string_literal ':' ':' asm_operands_opt ':' asm_clobbers_list_opt ':' label_list ')' ';' 1214 { $$ = new StatementNode( build_asm stmt( $2, $5, 0, $8, $10, $12 ) ); }1221 { $$ = new StatementNode( build_asm( $2, $5, 0, $8, $10, $12 ) ); } 1215 1222 ; 1216 1223 … … 1866 1873 { 1867 1874 typedefTable.makeTypedef( *$3 ); 1875 if ( forall ) typedefTable.changeKind( *$3, TypedefTable::TG ); // possibly update 1876 forall = false; // reset 1868 1877 $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 ); 1869 1878 } … … 2235 2244 { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); } 2236 2245 | type_specifier identifier_parameter_declarator 2246 | assertion_list 2247 { $$ = DeclarationNode::newTypeParam( DeclarationNode::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); } 2237 2248 ; 2238 2249 … … 2251 2262 // empty 2252 2263 { $$ = nullptr; } 2253 | assertion_list_opt assertion 2264 | assertion_list 2265 ; 2266 2267 assertion_list: // CFA 2268 assertion 2269 | assertion_list assertion 2254 2270 { $$ = $1 ? $1->appendList( $2 ) : $2; } 2255 2271 ; … … 2378 2394 external_definition_list: 2379 2395 external_definition 2380 | external_definition_list push external_definition 2381 { $$ = $1 ? $1->appendList( $3 ) : $3; } 2396 | external_definition_list 2397 { forall = xxx; } 2398 push external_definition 2399 { $$ = $1 ? $1->appendList( $4 ) : $4; } 2382 2400 ; 2383 2401 … … 2393 2411 | ASM '(' string_literal ')' ';' // GCC, global assembler statement 2394 2412 { 2395 $$ = DeclarationNode::newAsmStmt( new StatementNode( build_asm stmt( false, $3, 0 ) ) );2413 $$ = DeclarationNode::newAsmStmt( new StatementNode( build_asm( false, $3, 0 ) ) ); 2396 2414 } 2397 2415 | EXTERN STRINGliteral // C++-style linkage specifier … … 2411 2429 $$ = $2; 2412 2430 } 2413 | type_qualifier_list '{' external_definition_list '}' // CFA, namespace 2431 | type_qualifier_list 2432 { 2433 if ( $1->type->forall ) xxx = forall = true; // remember generic type 2434 } 2435 push '{' external_definition_list '}' // CFA, namespace 2436 { 2437 for ( DeclarationNode * iter = $5; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 2438 if ( isMangled( iter->linkage ) ) { // ignore extern "C" 2439 iter->addQualifiers( $1->clone() ); 2440 } // if 2441 } // for 2442 xxx = false; 2443 delete $1; 2444 $$ = $5; 2445 } 2446 | declaration_qualifier_list 2447 { 2448 if ( $1->type->forall ) xxx = forall = true; // remember generic type 2449 } 2450 push '{' external_definition_list '}' // CFA, namespace 2451 { 2452 for ( DeclarationNode * iter = $5; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 2453 if ( isMangled( iter->linkage ) ) { // ignore extern "C" 2454 iter->addQualifiers( $1->clone() ); 2455 } // if 2456 } // for 2457 xxx = false; 2458 delete $1; 2459 $$ = $5; 2460 } 2461 | declaration_qualifier_list type_qualifier_list 2462 { 2463 // forall must be in the type_qualifier_list 2464 if ( $2->type->forall ) xxx = forall = true; // remember generic type 2465 } 2466 push '{' external_definition_list '}' // CFA, namespace 2467 { 2468 for ( DeclarationNode * iter = $6; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 2469 if ( isMangled( iter->linkage ) && isMangled( $2->linkage ) ) { // ignore extern "C" 2470 iter->addQualifiers( $1->clone() ); 2471 iter->addQualifiers( $2->clone() ); 2472 } // if 2473 } // for 2474 xxx = false; 2475 delete $1; 2476 delete $2; 2477 $$ = $6; 2478 } 2414 2479 ; 2415 2480 … … 2437 2502 with_clause_opt: 2438 2503 // empty 2439 { $$ = nullptr; }2504 { $$ = nullptr; forall = false; } 2440 2505 | WITH '(' tuple_expression_list ')' 2441 { $$ = $3; }2506 { $$ = $3; forall = false; } 2442 2507 ; 2443 2508
Note: See TracChangeset
for help on using the changeset viewer.