Changeset e3b2474 for src/Parser
- Timestamp:
- Jul 3, 2018, 3:25:56 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 638ac26
- Parents:
- c653b37 (diff), bbe1a87 (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:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/LinkageSpec.h
rc653b37 re3b2474 10 10 // Created On : Sat May 16 13:24:28 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:32:16 201713 // Update Count : 1 412 // Last Modified On : Mon Jul 2 07:46:49 2018 13 // Update Count : 16 14 14 // 15 15 … … 22 22 namespace LinkageSpec { 23 23 // All linkage specs are some combination of these flags: 24 enum { 25 Mangle = 1 << 0, 26 Generate = 1 << 1, 27 Overrideable = 1 << 2, 28 Builtin = 1 << 3, 29 GccBuiltin = 1 << 4, 30 31 NoOfSpecs = 1 << 5, 32 }; 24 enum { Mangle = 1 << 0, Generate = 1 << 1, Overrideable = 1 << 2, Builtin = 1 << 3, GccBuiltin = 1 << 4, NoOfSpecs = 1 << 5, }; 33 25 34 26 union Spec { … … 42 34 }; 43 35 constexpr Spec( unsigned int val ) : val( val ) {} 44 constexpr Spec( Spec const & other ) : val( other.val ) {}36 constexpr Spec( Spec const & other ) : val( other.val ) {} 45 37 // Operators may go here. 46 38 // Supports == and != 47 constexpr operator unsigned int 39 constexpr operator unsigned int() const { return val; } 48 40 }; 49 41 -
src/Parser/parser.yy
rc653b37 re3b2474 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Jun 24 10:41:10201813 // Update Count : 3 58712 // Last Modified On : Mon Jul 2 20:23:14 2018 13 // Update Count : 3607 14 14 // 15 15 … … 112 112 for ( DeclarationNode *iter = declaration; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 113 113 iter->set_extension( true ); 114 } // for 115 } // distExt 116 117 void distQual( DeclarationNode * declaration, DeclarationNode * qualifiers ) { 118 // distribute qualifiers across all declarations in a distribution statemement 119 for ( DeclarationNode * iter = declaration; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 120 if ( isMangled( iter->linkage ) ) { // ignore extern "C" 121 iter->addQualifiers( qualifiers->clone() ); 122 } // if 114 123 } // for 115 124 } // distExt … … 1136 1145 1137 1146 waitfor: 1138 WAITFOR '(' identifier ')' 1139 { 1140 $$ = new ExpressionNode( new NameExpr( *$3 ) ); 1141 delete $3; 1142 } 1143 | WAITFOR '(' identifier ',' argument_expression_list ')' 1144 { 1145 $$ = new ExpressionNode( new NameExpr( *$3 ) ); 1146 $$->set_last( $5 ); 1147 delete $3; 1148 } 1147 WAITFOR '(' cast_expression ')' 1148 { $$ = $3; } 1149 | WAITFOR '(' cast_expression ',' argument_expression_list ')' 1150 { $$ = (ExpressionNode *)$3->set_last( $5 ); } 1149 1151 ; 1150 1152 … … 1163 1165 { $$ = build_waitfor_timeout( nullptr, $3, $1 ); } 1164 1166 // "else" must be conditional after timeout or timeout is never triggered (i.e., it is meaningless) 1167 | when_clause_opt timeout statement WOR ELSE statement 1168 { SemanticError( yylloc, "else clause must be conditional after timeout or timeout never triggered." ); $$ = nullptr; } 1165 1169 | when_clause_opt timeout statement WOR when_clause ELSE statement 1166 1170 { $$ = build_waitfor_timeout( $2, $3, $1, $7, $5 ); } … … 2380 2384 '{' up external_definition_list_opt down '}' // CFA, namespace 2381 2385 { 2382 for ( DeclarationNode * iter = $5; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 2383 if ( isMangled( iter->linkage ) ) { // ignore extern "C" 2384 iter->addQualifiers( $1->clone() ); 2385 } // if 2386 } // for 2386 distQual( $5, $1 ); 2387 2387 xxx = false; 2388 2388 delete $1; … … 2391 2391 | declaration_qualifier_list 2392 2392 { 2393 if ( $1->type ->qualifiers.val ) { SemanticError( yylloc, "CV qualifiers cannot be distributed; only storage-class and forall qualifiers." ); }2394 if ( $1->type ->forall ) xxx = forall = true; // remember generic type2393 if ( $1->type && $1->type->qualifiers.val ) { SemanticError( yylloc, "CV qualifiers cannot be distributed; only storage-class and forall qualifiers." ); } 2394 if ( $1->type && $1->type->forall ) xxx = forall = true; // remember generic type 2395 2395 } 2396 2396 '{' up external_definition_list_opt down '}' // CFA, namespace 2397 2397 { 2398 for ( DeclarationNode * iter = $5; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 2399 if ( isMangled( iter->linkage ) ) { // ignore extern "C" 2400 iter->addQualifiers( $1->clone() ); 2401 } // if 2402 } // for 2398 distQual( $5, $1 ); 2403 2399 xxx = false; 2404 2400 delete $1; … … 2412 2408 '{' up external_definition_list_opt down '}' // CFA, namespace 2413 2409 { 2414 for ( DeclarationNode * iter = $6; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 2415 if ( isMangled( iter->linkage ) && isMangled( $2->linkage ) ) { // ignore extern "C" 2416 iter->addQualifiers( $1->clone() ); 2417 iter->addQualifiers( $2->clone() ); 2418 } // if 2419 } // for 2410 distQual( $6, $2 ); 2411 distQual( $6, $1 ); 2420 2412 xxx = false; 2421 2413 delete $1;
Note: See TracChangeset
for help on using the changeset viewer.