Changeset e3b2474 for src/Parser


Ignore:
Timestamp:
Jul 3, 2018, 3:25:56 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:/u/cforall/software/cfa/cfa-cc

Location:
src/Parser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/LinkageSpec.h

    rc653b37 re3b2474  
    1010// Created On       : Sat May 16 13:24:28 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:32:16 2017
    13 // Update Count     : 14
     12// Last Modified On : Mon Jul  2 07:46:49 2018
     13// Update Count     : 16
    1414//
    1515
     
    2222namespace LinkageSpec {
    2323        // 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, };
    3325
    3426        union Spec {
     
    4234                };
    4335                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 ) {}
    4537                // Operators may go here.
    4638                // Supports == and !=
    47                 constexpr operator unsigned int () const { return val; }
     39                constexpr operator unsigned int() const { return val; }
    4840        };
    4941
  • src/Parser/parser.yy

    rc653b37 re3b2474  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jun 24 10:41:10 2018
    13 // Update Count     : 3587
     12// Last Modified On : Mon Jul  2 20:23:14 2018
     13// Update Count     : 3607
    1414//
    1515
     
    112112        for ( DeclarationNode *iter = declaration; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) {
    113113                iter->set_extension( true );
     114        } // for
     115} // distExt
     116
     117void 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
    114123        } // for
    115124} // distExt
     
    11361145
    11371146waitfor:
    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 ); }
    11491151        ;
    11501152
     
    11631165                { $$ = build_waitfor_timeout( nullptr, $3, $1 ); }
    11641166                // "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; }
    11651169        | when_clause_opt timeout statement WOR when_clause ELSE statement
    11661170                { $$ = build_waitfor_timeout( $2, $3, $1, $7, $5 ); }
     
    23802384          '{' up external_definition_list_opt down '}'          // CFA, namespace
    23812385                {
    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 );
    23872387                        xxx = false;
    23882388                        delete $1;
     
    23912391        | declaration_qualifier_list
    23922392                {
    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 type
     2393                        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
    23952395                }
    23962396          '{' up external_definition_list_opt down '}'          // CFA, namespace
    23972397                {
    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 );
    24032399                        xxx = false;
    24042400                        delete $1;
     
    24122408          '{' up external_definition_list_opt down '}'          // CFA, namespace
    24132409                {
    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 );
    24202412                        xxx = false;
    24212413                        delete $1;
Note: See TracChangeset for help on using the changeset viewer.