Changeset 28e58fd for src/Parser


Ignore:
Timestamp:
Aug 25, 2017, 10:38:34 AM (9 years ago)
Author:
Thierry Delisle <tdelisle@…>
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, stuck-waitfor-destruct, with_gc
Children:
800d275
Parents:
af08051 (diff), 3eab308c (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:software/cfa/cfa-cc

Location:
src/Parser
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    raf08051 r28e58fd  
    340340} // DeclarationNode::newTypeDecl
    341341
    342 DeclarationNode * DeclarationNode::newPointer( DeclarationNode * qualifiers ) {
    343         DeclarationNode * newnode = new DeclarationNode;
    344         newnode->type = new TypeData( TypeData::Pointer );
     342DeclarationNode * DeclarationNode::newPointer( DeclarationNode * qualifiers, OperKinds kind ) {
     343        DeclarationNode * newnode = new DeclarationNode;
     344        newnode->type = new TypeData( kind == OperKinds::PointTo ? TypeData::Pointer : TypeData::Reference );
    345345        if ( qualifiers ) {
    346346                return newnode->addQualifiers( qualifiers );
     
    759759DeclarationNode * DeclarationNode::addPointer( DeclarationNode * p ) {
    760760        if ( p ) {
    761                 assert( p->type->kind == TypeData::Pointer );
     761                assert( p->type->kind == TypeData::Pointer || TypeData::Reference );
    762762                setBase( p->type );
    763763                p->type = nullptr;
     
    781781DeclarationNode * DeclarationNode::addNewPointer( DeclarationNode * p ) {
    782782        if ( p ) {
    783                 assert( p->type->kind == TypeData::Pointer );
     783                assert( p->type->kind == TypeData::Pointer || p->type->kind == TypeData::Reference );
    784784                if ( type ) {
    785785                        switch ( type->kind ) {
  • src/Parser/ExpressionNode.cc

    raf08051 r28e58fd  
    314314Expression * build_unary_ptr( OperKinds op, ExpressionNode * expr_node ) {
    315315        std::list< Expression * > args;
    316         args.push_back( new AddressExpr( maybeMoveBuild< Expression >(expr_node) ) );
     316        args.push_back(  maybeMoveBuild< Expression >(expr_node) ); // xxx
    317317        return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
    318318} // build_unary_ptr
     
    327327Expression * build_binary_ptr( OperKinds op, ExpressionNode * expr_node1, ExpressionNode * expr_node2 ) {
    328328        std::list< Expression * > args;
    329         args.push_back( new AddressExpr( maybeMoveBuild< Expression >(expr_node1) ) );
     329        args.push_back( maybeMoveBuild< Expression >(expr_node1) );
    330330        args.push_back( maybeMoveBuild< Expression >(expr_node2) );
    331331        return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
  • src/Parser/ParseNode.h

    raf08051 r28e58fd  
    243243        static DeclarationNode * newTraitUse( const std::string * name, ExpressionNode * params );
    244244        static DeclarationNode * newTypeDecl( std::string * name, DeclarationNode * typeParams );
    245         static DeclarationNode * newPointer( DeclarationNode * qualifiers );
     245        static DeclarationNode * newPointer( DeclarationNode * qualifiers, OperKinds kind );
    246246        static DeclarationNode * newArray( ExpressionNode * size, DeclarationNode * qualifiers, bool isStatic );
    247247        static DeclarationNode * newVarArray( DeclarationNode * qualifiers );
  • src/Parser/TypeData.cc

    raf08051 r28e58fd  
    3535          case Unknown:
    3636          case Pointer:
     37          case Reference:
    3738          case EnumConstant:
    3839                // nothing else to initialize
     
    104105          case Unknown:
    105106          case Pointer:
     107          case Reference:
    106108          case EnumConstant:
    107109                // nothing to destroy
     
    170172          case EnumConstant:
    171173          case Pointer:
     174          case Reference:
    172175                // nothing else to copy
    173176                break;
     
    405408                        // add dtor:  void ^?{}(T *)
    406409                        FunctionType * dtorType = new FunctionType( Type::Qualifiers(), false );
    407                         dtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     410                        dtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    408411                        td->get_assertions().push_front( new FunctionDecl( "^?{}", Type::StorageClasses(), LinkageSpec::Cforall, dtorType, nullptr ) );
    409412
    410413                        // add copy ctor:  void ?{}(T *, T)
    411414                        FunctionType * copyCtorType = new FunctionType( Type::Qualifiers(), false );
    412                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     415                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    413416                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    414417                        td->get_assertions().push_front( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, copyCtorType, nullptr ) );
     
    416419                        // add default ctor:  void ?{}(T *)
    417420                        FunctionType * ctorType = new FunctionType( Type::Qualifiers(), false );
    418                         ctorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     421                        ctorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    419422                        td->get_assertions().push_front( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, ctorType, nullptr ) );
    420423
    421424                        // add assignment operator:  T * ?=?(T *, T)
    422425                        FunctionType * assignType = new FunctionType( Type::Qualifiers(), false );
    423                         assignType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     426                        assignType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    424427                        assignType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    425428                        assignType->get_returnVals().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
     
    441444          case TypeData::Array:
    442445                return buildArray( td );
     446          case TypeData::Reference:
     447                return buildReference( td );
    443448          case TypeData::Function:
    444449                return buildFunction( td );
     
    619624        buildForall( td->forall, at->get_forall() );
    620625        return at;
    621 } // buildPointer
     626} // buildArray
     627
     628ReferenceType * buildReference( const TypeData * td ) {
     629        ReferenceType * rt;
     630        if ( td->base ) {
     631                rt = new ReferenceType( buildQualifiers( td ), typebuild( td->base ) );
     632        } else {
     633                rt = new ReferenceType( buildQualifiers( td ), new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
     634        } // if
     635        buildForall( td->forall, rt->get_forall() );
     636        return rt;
     637} // buildReference
    622638
    623639AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
  • src/Parser/TypeData.h

    raf08051 r28e58fd  
    2626
    2727struct TypeData {
    28         enum Kind { Basic, Pointer, Array, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic,
     28        enum Kind { Basic, Pointer, Array, Reference, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic,
    2929                                SymbolicInst, Tuple, Typeof, Builtin, Unknown };
    3030
     
    109109PointerType * buildPointer( const TypeData * );
    110110ArrayType * buildArray( const TypeData * );
     111ReferenceType * buildReference( const TypeData * );
    111112AggregateDecl * buildAggregate( const TypeData *, std::list< Attribute * > );
    112113ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes, LinkageSpec::Spec linkage );
  • src/Parser/lex.ll

    raf08051 r28e58fd  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Thu Jul 27 21:46:06 2017
    13  * Update Count     : 550
     12 * Last Modified On : Tue Aug 22 22:43:39 2017
     13 * Update Count     : 558
    1414 */
    1515
     
    4545#define NUMERIC_RETURN(x)       rm_underscore(); RETURN_VAL( x ) // numeric constant
    4646#define KEYWORD_RETURN(x)       RETURN_CHAR( x )                        // keyword
     47#define QKEYWORD_RETURN(x)      typedefTable.isKind( yytext ); RETURN_VAL(x); // quasi-keyword
    4748#define IDENTIFIER_RETURN()     RETURN_VAL( typedefTable.isKind( yytext ) )
    4849#define ATTRIBUTE_RETURN()      RETURN_VAL( ATTR_IDENTIFIER )
     
    236237__label__               { KEYWORD_RETURN(LABEL); }                              // GCC
    237238long                    { KEYWORD_RETURN(LONG); }
    238 lvalue                  { KEYWORD_RETURN(LVALUE); }                             // CFA
    239239monitor                 { KEYWORD_RETURN(MONITOR); }                    // CFA
    240240mutex                   { KEYWORD_RETURN(MUTEX); }                              // CFA
     
    261261throw                   { KEYWORD_RETURN(THROW); }                              // CFA
    262262throwResume             { KEYWORD_RETURN(THROWRESUME); }                // CFA
     263timeout                 { QKEYWORD_RETURN(TIMEOUT); }                   // CFA
    263264trait                   { KEYWORD_RETURN(TRAIT); }                              // CFA
    264265try                             { KEYWORD_RETURN(TRY); }                                // CFA
     
    277278__volatile              { KEYWORD_RETURN(VOLATILE); }                   // GCC
    278279__volatile__    { KEYWORD_RETURN(VOLATILE); }                   // GCC
     280waitfor                 { KEYWORD_RETURN(WAITFOR); }
     281or                              { QKEYWORD_RETURN(WOR); }                               // CFA
     282when                    { KEYWORD_RETURN(WHEN); }
    279283while                   { KEYWORD_RETURN(WHILE); }
    280284with                    { KEYWORD_RETURN(WITH); }                               // CFA
  • src/Parser/parser.yy

    raf08051 r28e58fd  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Aug 20 09:21:54 2017
    13 // Update Count     : 2573
     12// Last Modified On : Wed Aug 23 21:08:08 2017
     13// Update Count     : 2704
    1414//
    1515
     
    119119%token RESTRICT                                                                                 // C99
    120120%token ATOMIC                                                                                   // C11
    121 %token FORALL LVALUE MUTEX VIRTUAL                                              // CFA
     121%token FORALL MUTEX VIRTUAL                                             // CFA
    122122%token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED
    123123%token BOOL COMPLEX IMAGINARY                                                   // C99
     
    131131%token ATTRIBUTE EXTENSION                                                              // GCC
    132132%token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN
    133 %token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH // CFA
     133%token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH WHEN WAITFOR // CFA
    134134%token ASM                                                                                              // C99, extension ISO/IEC 9899:1999 Section J.5.10(1)
    135135%token ALIGNAS ALIGNOF GENERIC STATICASSERT                             // C11
     
    137137// names and constants: lexer differentiates between identifier and typedef names
    138138%token<tok> IDENTIFIER                  QUOTED_IDENTIFIER               TYPEDEFname                             TYPEGENname
     139%token<tok> TIMEOUT                             WOR
    139140%token<tok> ATTR_IDENTIFIER             ATTR_TYPEDEFname                ATTR_TYPEGENname
    140141%token<tok> INTEGERconstant             CHARACTERconstant               STRINGliteral
     
    161162%type<tok> identifier  no_attr_identifier
    162163%type<tok> identifier_or_type_name  no_attr_identifier_or_type_name  attr_name
     164%type<tok> quasi_keyword
    163165%type<constant> string_literal
    164166%type<str> string_literal_list
     
    190192%type<sn> iteration_statement                   jump_statement
    191193%type<sn> with_statement                                exception_statement                     asm_statement
     194%type<sn> when_clause_opt                               waitfor_statement                       waitfor_clause                          waitfor                         timeout
    192195%type<sn> fall_through_opt                              fall_through
    193196%type<sn> statement                                             statement_list
     
    197200%type<sn> case_clause                                   case_value_list                         case_label                                      case_label_list
    198201%type<sn> switch_clause_list_opt                switch_clause_list                      choose_clause_list_opt          choose_clause_list
    199 %type<sn> /* handler_list */                    handler_clause                          finally_clause
     202%type<sn> handler_clause                                finally_clause
    200203%type<catch_kind> handler_key
    201204
     
    295298// Handle single shift/reduce conflict for dangling else by shifting the ELSE token. For example, this string
    296299// is ambiguous:
    297 // .---------.                          matches IF '(' comma_expression ')' statement
     300// .---------.                          matches IF '(' comma_expression ')' statement . (reduce)
    298301// if ( C ) S1 else S2
    299 // `-----------------'          matches IF '(' comma_expression ')' statement ELSE statement */
    300 
    301 %nonassoc THEN  // rule precedence for IF '(' comma_expression ')' statement
    302 %nonassoc ELSE  // token precedence for start of else clause in IF statement
     302// `-----------------'          matches IF '(' comma_expression ')' statement . (shift) ELSE statement */
     303// Similar issues exit with the waitfor statement.
     304
     305// Order of these lines matters (low-to-high precedence). THEN is left associative over WOR/TIMEOUT/ELSE, WOR is left
     306// associative over TIMEOUT/ELSE, and TIMEOUT is left associative over ELSE.
     307%precedence THEN        // rule precedence for IF/WAITFOR statement
     308%precedence WOR         // token precedence for start of WOR in WAITFOR statement
     309%precedence TIMEOUT     // token precedence for start of TIMEOUT in WAITFOR statement
     310%precedence ELSE        // token precedence for start of else clause in IF/WAITFOR statement
    303311
    304312%start translation_unit                                                                 // parse-tree root
     
    353361        ;
    354362
     363quasi_keyword:                                                                                  // CFA
     364        TIMEOUT
     365        | WOR
     366        ;
     367
    355368identifier:
    356369        IDENTIFIER
    357370        | ATTR_IDENTIFIER                                                                       // CFA
     371        | quasi_keyword
    358372        ;
    359373
    360374no_attr_identifier:
    361375        IDENTIFIER
     376        | quasi_keyword
    362377        ;
    363378
     
    380395primary_expression:
    381396        IDENTIFIER                                                                                      // typedef name cannot be used as a variable name
     397                { $$ = new ExpressionNode( build_varref( $1 ) ); }
     398        | quasi_keyword
    382399                { $$ = new ExpressionNode( build_varref( $1 ) ); }
    383400        | tuple
     
    548565        | '&'                                                                           { $$ = OperKinds::AddressOf; }
    549566                // GCC, address of label must be handled by semantic check for ref,ref,label
    550 //      | ANDAND                                                                        { $$ = OperKinds::And; }
     567        | ANDAND                                                                        { $$ = OperKinds::And; }
    551568        ;
    552569
     
    670687        conditional_expression
    671688        | unary_expression assignment_operator assignment_expression
    672                 { $$ = new ExpressionNode( build_binary_ptr( $2, $1, $3 ) ); }
     689                { $$ = new ExpressionNode( build_binary_val( $2, $1, $3 ) ); }
    673690        ;
    674691
     
    736753        | jump_statement
    737754        | with_statement
     755        | waitfor_statement
    738756        | exception_statement
    739757        | asm_statement
     
    955973
    956974with_statement:
    957         WITH '(' tuple_expression_list ')' compound_statement
    958                 { $$ = (StatementNode *)0; }                                    // FIX ME
     975        WITH '(' tuple_expression_list ')' statement
     976                { $$ = nullptr; }                                                               // FIX ME
     977        ;
     978
     979when_clause_opt:
     980        // empty
     981                { $$ = nullptr; }                                                               // FIX ME
     982        | WHEN '(' comma_expression ')'
     983                { $$ = nullptr; }                                                               // FIX ME
     984        ;
     985
     986waitfor:
     987        WAITFOR '(' identifier ')'
     988                { $$ = nullptr; }                                                               // FIX ME
     989        | WAITFOR '(' identifier ',' argument_expression_list ')'
     990                { $$ = nullptr; }                                                               // FIX ME
     991        ;
     992
     993timeout:
     994        TIMEOUT '(' comma_expression ')'
     995                { $$ = nullptr; }                                                               // FIX ME
     996        ;
     997
     998waitfor_clause:
     999        when_clause_opt waitfor statement %prec THEN
     1000                { $$ = nullptr; }                                                               // FIX ME
     1001        | when_clause_opt waitfor statement WOR waitfor_clause
     1002                { $$ = nullptr; }                                                               // FIX ME
     1003        | when_clause_opt timeout statement %prec THEN
     1004                { $$ = nullptr; }                                                               // FIX ME
     1005        | when_clause_opt ELSE statement
     1006                { $$ = nullptr; }                                                               // FIX ME
     1007        | when_clause_opt timeout statement WOR when_clause_opt ELSE statement
     1008                { $$ = nullptr; }                                                               // FIX ME
     1009        ;
     1010
     1011waitfor_statement:
     1012        when_clause_opt waitfor statement %prec THEN
     1013                { $$ = nullptr; }                                                               // FIX ME
     1014        | when_clause_opt waitfor statement WOR waitfor_clause
     1015                { $$ = nullptr; }                                                               // FIX ME
    9591016        ;
    9601017
     
    9671024                { $$ = new StatementNode( build_try( $2, $3, $4 ) ); }
    9681025        ;
    969 
    970 //handler_list:
    971 //      handler_clause
    972 //              // ISO/IEC 9899:1999 Section 15.3(6 ) If present, a "..." handler shall be the last handler for its try block.
    973 //      | CATCH '(' ELLIPSIS ')' compound_statement
    974 //              { $$ = new StatementNode( build_catch( 0, $5, true ) ); }
    975 //      | handler_clause CATCH '(' ELLIPSIS ')' compound_statement
    976 //              { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( 0, $6, true ) ) ); }
    977 //      | CATCHRESUME '(' ELLIPSIS ')' compound_statement
    978 //              { $$ = new StatementNode( build_catch( 0, $5, true ) ); }
    979 //      | handler_clause CATCHRESUME '(' ELLIPSIS ')' compound_statement
    980 //              { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( 0, $6, true ) ) ); }
    981 //      ;
    9821026
    9831027handler_clause:
     
    14391483        | VOLATILE
    14401484                { $$ = DeclarationNode::newTypeQualifier( Type::Volatile ); }
    1441         | LVALUE                                                                                        // CFA
    1442                 { $$ = DeclarationNode::newTypeQualifier( Type::Lvalue ); }
    14431485        | MUTEX
    14441486                { $$ = DeclarationNode::newTypeQualifier( Type::Mutex ); }
     
    22412283with_clause_opt:
    22422284        // empty
    2243                 { $$ = (StatementNode *)0; }                                    // FIX ME
     2285                { $$ = nullptr; }                                                               // FIX ME
    22442286        | WITH '(' tuple_expression_list ')'
    2245                 { $$ = (StatementNode *)0; }                                    // FIX ME
     2287                { $$ = nullptr; }                                                               // FIX ME
    22462288        ;
    22472289
     
    23632405attr_name:                                                                                              // GCC
    23642406        IDENTIFIER
     2407        | quasi_keyword
    23652408        | TYPEDEFname
    23662409        | TYPEGENname
     
    24212464variable_ptr:
    24222465        ptrref_operator variable_declarator
    2423                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }
     2466                { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
    24242467        | ptrref_operator type_qualifier_list variable_declarator
    2425                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
     2468                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
    24262469        | '(' variable_ptr ')' attribute_list_opt
    24272470                { $$ = $2->addQualifiers( $4 ); }                               // redundant parenthesis
     
    24692512function_ptr:
    24702513        ptrref_operator function_declarator
    2471                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }
     2514                { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
    24722515        | ptrref_operator type_qualifier_list function_declarator
    2473                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
     2516                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
    24742517        | '(' function_ptr ')'
    24752518                { $$ = $2; }
     
    25092552KR_function_ptr:
    25102553        ptrref_operator KR_function_declarator
    2511                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }
     2554                { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
    25122555        | ptrref_operator type_qualifier_list KR_function_declarator
    2513                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
     2556                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
    25142557        | '(' KR_function_ptr ')'
    25152558                { $$ = $2; }
     
    25532596type_ptr:
    25542597        ptrref_operator variable_type_redeclarator
    2555                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }
     2598                { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
    25562599        | ptrref_operator type_qualifier_list variable_type_redeclarator
    2557                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
     2600                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
    25582601        | '(' type_ptr ')' attribute_list_opt
    25592602                { $$ = $2->addQualifiers( $4 ); }
     
    25972640identifier_parameter_ptr:
    25982641        ptrref_operator identifier_parameter_declarator
    2599                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }
     2642                { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
    26002643        | ptrref_operator type_qualifier_list identifier_parameter_declarator
    2601                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
     2644                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
    26022645        | '(' identifier_parameter_ptr ')' attribute_list_opt
    26032646                { $$ = $2->addQualifiers( $4 ); }
     
    26572700type_parameter_ptr:
    26582701        ptrref_operator type_parameter_redeclarator
    2659                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }
     2702                { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
    26602703        | ptrref_operator type_qualifier_list type_parameter_redeclarator
    2661                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
     2704                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
    26622705        | '(' type_parameter_ptr ')' attribute_list_opt
    26632706                { $$ = $2->addQualifiers( $4 ); }
     
    27002743abstract_ptr:
    27012744        ptrref_operator
    2702                 { $$ = DeclarationNode::newPointer( 0 ); }
     2745                { $$ = DeclarationNode::newPointer( 0, $1 ); }
    27032746        | ptrref_operator type_qualifier_list
    2704                 { $$ = DeclarationNode::newPointer( $2 ); }
     2747                { $$ = DeclarationNode::newPointer( $2, $1 ); }
    27052748        | ptrref_operator abstract_declarator
    2706                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }
     2749                { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
    27072750        | ptrref_operator type_qualifier_list abstract_declarator
    2708                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
     2751                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
    27092752        | '(' abstract_ptr ')' attribute_list_opt
    27102753                { $$ = $2->addQualifiers( $4 ); }
     
    27892832abstract_parameter_ptr:
    27902833        ptrref_operator
    2791                 { $$ = DeclarationNode::newPointer( nullptr ); }
     2834                { $$ = DeclarationNode::newPointer( nullptr, $1 ); }
    27922835        | ptrref_operator type_qualifier_list
    2793                 { $$ = DeclarationNode::newPointer( $2 ); }
     2836                { $$ = DeclarationNode::newPointer( $2, $1 ); }
    27942837        | ptrref_operator abstract_parameter_declarator
    2795                 { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr ) ); }
     2838                { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); }
    27962839        | ptrref_operator type_qualifier_list abstract_parameter_declarator
    2797                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
     2840                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
    27982841        | '(' abstract_parameter_ptr ')' attribute_list_opt
    27992842                { $$ = $2->addQualifiers( $4 ); }
     
    28682911variable_abstract_ptr:
    28692912        ptrref_operator
    2870                 { $$ = DeclarationNode::newPointer( 0 ); }
     2913                { $$ = DeclarationNode::newPointer( 0, $1 ); }
    28712914        | ptrref_operator type_qualifier_list
    2872                 { $$ = DeclarationNode::newPointer( $2 ); }
     2915                { $$ = DeclarationNode::newPointer( $2, $1 ); }
    28732916        | ptrref_operator variable_abstract_declarator
    2874                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }
     2917                { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
    28752918        | ptrref_operator type_qualifier_list variable_abstract_declarator
    2876                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
     2919                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
    28772920        | '(' variable_abstract_ptr ')' attribute_list_opt
    28782921                { $$ = $2->addQualifiers( $4 ); }
     
    29142957                // No SUE declaration in parameter list.
    29152958        ptrref_operator type_specifier_nobody
    2916                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
     2959                { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
    29172960        | type_qualifier_list ptrref_operator type_specifier_nobody
    2918                 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }
     2961                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
    29192962        | ptrref_operator cfa_abstract_function
    2920                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
     2963                { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
    29212964        | type_qualifier_list ptrref_operator cfa_abstract_function
    2922                 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }
     2965                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
    29232966        | ptrref_operator cfa_identifier_parameter_declarator_tuple
    2924                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
     2967                { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
    29252968        | type_qualifier_list ptrref_operator cfa_identifier_parameter_declarator_tuple
    2926                 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }
     2969                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
    29272970        ;
    29282971
     
    30023045cfa_abstract_ptr:                                                                               // CFA
    30033046        ptrref_operator type_specifier
    3004                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
     3047                { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
    30053048        | type_qualifier_list ptrref_operator type_specifier
    3006                 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }
     3049                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
    30073050        | ptrref_operator cfa_abstract_function
    3008                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
     3051                { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
    30093052        | type_qualifier_list ptrref_operator cfa_abstract_function
    3010                 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }
     3053                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
    30113054        | ptrref_operator cfa_abstract_declarator_tuple
    3012                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
     3055                { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
    30133056        | type_qualifier_list ptrref_operator cfa_abstract_declarator_tuple
    3014                 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }
     3057                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
    30153058        ;
    30163059
Note: See TracChangeset for help on using the changeset viewer.