Ignore:
Timestamp:
Dec 15, 2016, 5:16:42 PM (9 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, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
43385ca, f7ff3fb
Parents:
5802a4f (diff), 596f987b (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' into tuples

Conflicts:

src/ResolvExpr/CommonType.cc
src/tests/.expect/32/extension.txt
src/tests/.expect/32/gccExtensions.txt
src/tests/.expect/64/declarationSpecifier.txt
src/tests/.expect/64/extension.txt
src/tests/.expect/64/gccExtensions.txt
src/tests/.expect/castError.txt
src/tests/Makefile.am

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r5802a4f r66f8528  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Oct 26 17:35:53 2016
    13 // Update Count     : 2066
     12// Last Modified On : Wed Dec 14 21:28:22 2016
     13// Update Count     : 2090
    1414//
    1515
     
    7878%token RESTRICT                                                                                 // C99
    7979%token FORALL LVALUE                                                                    // CFA
    80 %token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED
     80%token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED ZERO_T ONE_T
    8181%token VALIST                                                                                   // GCC
    8282%token BOOL COMPLEX IMAGINARY                                                   // C99
     
    153153%type<fctl> for_control_expression
    154154%type<en> subrange
     155%type<constant> asm_name_opt
    155156%type<en> asm_operands_opt asm_operands_list asm_operand
    156157%type<label> label_list
     
    362363                { $$ = new ExpressionNode( build_varref( $1 ) ); }
    363364        | zero_one
    364                 { $$ = new ExpressionNode( build_varref( $1 ) ); }
     365                { $$ = new ExpressionNode( build_constantZeroOne( *$1 ) ); }
    365366        | tuple
    366367        | '(' comma_expression ')'
     
    412413argument_expression:
    413414        // empty
    414                 { $$ = 0; }                                                                             // use default argument
     415                { $$ = nullptr; }                                                               // use default argument
    415416        | assignment_expression
    416417        ;
     
    443444                { $$ = new ExpressionNode( build_field_name_fraction_constants( build_field_name_FLOATINGconstant( *$1 ), $2 ) ); }
    444445        | no_attr_identifier fraction_constants
    445                 { $$ = new ExpressionNode( build_field_name_fraction_constants( build_varref( $1 ), $2 ) ); }
     446                {
     447                        if( (*$1) == "0" || (*$1) == "1" ) {
     448                                $$ = new ExpressionNode( build_field_name_fraction_constants( build_constantZeroOne( *$1 ), $2 ) );
     449                        } else {
     450                                $$ = new ExpressionNode( build_field_name_fraction_constants( build_varref( $1 ), $2 ) );
     451                        }
     452                }
    446453        ;
    447454
     
    678685comma_expression_opt:
    679686        // empty
    680                 { $$ = 0; }
     687                { $$ = nullptr; }
    681688        | comma_expression
    682689        ;
     
    714721        | '{'
    715722                // Two scopes are necessary because the block itself has a scope, but every declaration within the block also
    716                 // requires its own scope
     723                // requires its own scope.
    717724          push push
    718725          local_label_declaration_opt                                           // GCC, local labels
     
    768775                        // therefore, are removed from the grammar even though C allows it. The change also applies to choose
    769776                        // statement.
    770                         $$ = $7 != 0 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw;
     777                        $$ = $7 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw;
    771778                }
    772779        | CHOOSE '(' comma_expression ')' case_clause           // CFA
     
    775782                {
    776783                        StatementNode *sw = new StatementNode( build_switch( $3, $8 ) );
    777                         $$ = $7 != 0 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw;
     784                        $$ = $7 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw;
    778785                }
    779786        ;
     
    812819switch_clause_list_opt:                                                                 // CFA
    813820        // empty
    814                 { $$ = 0; }
     821                { $$ = nullptr; }
    815822        | switch_clause_list
    816823        ;
     
    825832choose_clause_list_opt:                                                                 // CFA
    826833        // empty
    827                 { $$ = 0; }
     834                { $$ = nullptr; }
    828835        | choose_clause_list
    829836        ;
     
    848855fall_through:                                                                                   // CFA
    849856        FALLTHRU
    850                 { $$ = 0; }
     857                { $$ = nullptr; }
    851858        | FALLTHRU ';'
    852                 { $$ = 0; }
     859                { $$ = nullptr; }
    853860        ;
    854861
     
    984991asm_operands_opt:                                                                               // GCC
    985992        // empty
    986                 { $$ = 0; }                                                                             // use default argument
     993                { $$ = nullptr; }                                                               // use default argument
    987994        | asm_operands_list
    988995        ;
     
    10031010asm_clobbers_list_opt:                                                                  // GCC
    10041011        // empty
    1005                 { $$ = 0; }                                                                             // use default argument
     1012                { $$ = nullptr; }                                                               // use default argument
    10061013        | string_literal
    10071014                { $$ = new ExpressionNode( $1 ); }
    10081015        | asm_clobbers_list_opt ',' string_literal
     1016                // set_last return ParseNode *
    10091017                { $$ = (ExpressionNode *)$1->set_last( new ExpressionNode( $3 ) ); }
    10101018        ;
     
    10271035declaration_list_opt:                                                                   // used at beginning of switch statement
    10281036        pop
    1029                 { $$ = 0; }
     1037                { $$ = nullptr; }
    10301038        | declaration_list
    10311039        ;
     
    10391047old_declaration_list_opt:                                                               // used to declare parameter types in K&R style functions
    10401048        pop
    1041                 { $$ = 0; }
     1049                { $$ = nullptr; }
    10421050        | old_declaration_list
    10431051        ;
     
    11141122                {
    11151123                        typedefTable.setNextIdentifier( *$2 );
    1116                         $$ = $1->addName( $2 );
     1124                        $$ = $1->addName( $2 )->addAsmName( $3 );
    11171125                }
    11181126        | new_abstract_tuple identifier_or_type_name asm_name_opt
    11191127                {
    11201128                        typedefTable.setNextIdentifier( *$2 );
    1121                         $$ = $1->addName( $2 );
     1129                        $$ = $1->addName( $2 )->addAsmName( $3 );
    11221130                }
    11231131        | type_qualifier_list new_abstract_tuple identifier_or_type_name asm_name_opt
    11241132                {
    11251133                        typedefTable.setNextIdentifier( *$3 );
    1126                         $$ = $2->addQualifiers( $1 )->addName( $3 );
     1134                        $$ = $2->addQualifiers( $1 )->addName( $3 )->addAsmName( $4 );
    11271135                }
    11281136        ;
     
    12751283                {
    12761284                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    1277                         $$ = ( $2->addType( $1 ))->addInitializer( $4 );
     1285                        $$ = ( $2->addType( $1 ))->addAsmName( $3 )->addInitializer( $4 );
    12781286                }
    12791287        | declaring_list ',' attribute_list_opt declarator asm_name_opt initializer_opt
    12801288                {
    12811289                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    1282                         $$ = $1->appendList( $1->cloneBaseType( $4->addInitializer( $6 ) ) );
     1290                        $$ = $1->appendList( $1->cloneBaseType( $4->addAsmName( $5 )->addInitializer( $6 ) ) );
    12831291                }
    12841292        ;
     
    13001308type_qualifier_list_opt:                                                                // GCC, used in asm_statement
    13011309        // empty
    1302                 { $$ = 0; }
     1310                { $$ = nullptr; }
    13031311        | type_qualifier_list
    13041312        ;
     
    14101418        | VALIST                                                                                        // GCC, __builtin_va_list
    14111419                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
     1420        | ZERO_T
     1421                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Zero ); }
     1422        | ONE_T
     1423                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::One ); }
    14121424        ;
    14131425
     
    15221534field_declaration_list:
    15231535        // empty
    1524                 { $$ = 0; }
     1536                { $$ = nullptr; }
    15251537        | field_declaration_list field_declaration
    1526                 { $$ = $1 != 0 ? $1->appendList( $2 ) : $2; }
     1538                { $$ = $1 ? $1->appendList( $2 ) : $2; }
    15271539        ;
    15281540
     
    15731585bit_subrange_size_opt:
    15741586        // empty
    1575                 { $$ = 0; }
     1587                { $$ = nullptr; }
    15761588        | bit_subrange_size
    15771589                { $$ = $1; }
     
    16101622enumerator_value_opt:
    16111623        // empty
    1612                 { $$ = 0; }
     1624                { $$ = nullptr; }
    16131625        | '=' constant_expression
    16141626                { $$ = $2; }
     
    16191631new_parameter_type_list_opt:                                                    // CFA
    16201632        // empty
    1621                 { $$ = 0; }
     1633                { $$ = nullptr; }
    16221634        | new_parameter_type_list
    16231635        ;
     
    16541666parameter_type_list_opt:
    16551667        // empty
    1656                 { $$ = 0; }
     1668                { $$ = nullptr; }
    16571669        | parameter_type_list
    16581670        ;
     
    17021714                {
    17031715                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    1704                         $$ = $2->addType( $1 )->addInitializer( new InitializerNode( $3 ) );
     1716                        $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr );
    17051717                }
    17061718        | declaration_specifier type_parameter_redeclarator assignment_opt
    17071719                {
    17081720                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    1709                         $$ = $2->addType( $1 )->addInitializer( new InitializerNode( $3 ) );
     1721                        $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr );
    17101722                }
    17111723        ;
     
    17631775initializer_opt:
    17641776        // empty
    1765                 { $$ = 0; }
     1777                { $$ = nullptr; }
    17661778        | '=' initializer
    17671779                { $$ = $2; }
     
    17771789initializer_list:
    17781790        // empty
    1779                 { $$ = 0; }
     1791                { $$ = nullptr; }
    17801792        | initializer
    17811793        | designation initializer                                       { $$ = $2->set_designators( $1 ); }
     
    18881900assertion_list_opt:                                                                             // CFA
    18891901        // empty
    1890                 { $$ = 0; }
     1902                { $$ = nullptr; }
    18911903        | assertion_list_opt assertion
    1892                 { $$ = $1 != 0 ? $1->appendList( $2 ) : $2; }
     1904                { $$ = $1 ? $1->appendList( $2 ) : $2; }
    18931905        ;
    18941906
     
    19021914                { $$ = $4; }
    19031915        | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list '}' '(' type_name_list ')'
    1904                 { $$ = 0; }
     1916                { $$ = nullptr; }
    19051917        ;
    19061918
     
    20112023                {}                                                                                              // empty input file
    20122024        | external_definition_list
    2013                 { parseTree = parseTree != nullptr ? parseTree->appendList( $1 ) : $1;  }
     2025                { parseTree = parseTree ? parseTree->appendList( $1 ) : $1;     }
    20142026        ;
    20152027
     
    20172029        external_definition
    20182030        | external_definition_list push external_definition
    2019                 { $$ = $1 != nullptr ? $1->appendList( $3 ) : $3; }
     2031                { $$ = $1 ? $1->appendList( $3 ) : $3; }
    20202032        ;
    20212033
    20222034external_definition_list_opt:
    20232035        // empty
    2024                 { $$ = 0; }
     2036                { $$ = nullptr; }
    20252037        | external_definition_list
    20262038        ;
     
    21452157asm_name_opt:                                                                                   // GCC
    21462158        // empty
    2147         | ASM '(' string_literal_list ')' attribute_list_opt { delete $3; }     // FIX ME: unimplemented
     2159                { $$ = nullptr; }
     2160        | ASM '(' string_literal ')' attribute_list_opt
     2161                { $$ = $3; }
    21482162        ;
    21492163
    21502164attribute_list_opt:                                                                             // GCC
    21512165        // empty
    2152                 { $$ = 0; }
     2166                { $$ = nullptr; }
    21532167        | attribute_list
    21542168        ;
     
    21632177        ATTRIBUTE '(' '(' attribute_parameter_list ')' ')'
    21642178        //              { $$ = DeclarationNode::newQualifier( DeclarationNode::Attribute ); }
    2165                 { $$ = 0; }
     2179                { $$ = nullptr; }
    21662180        ;
    21672181
     
    28722886assignment_opt:
    28732887        // empty
    2874                 { $$ = 0; }
     2888                { $$ = nullptr; }
    28752889        | '=' assignment_expression
    28762890                { $$ = $2; }
Note: See TracChangeset for help on using the changeset viewer.