ASTMatcher.cpp 68.6 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/

30
31
32
33
34
35
36
37
38

//
//  W A R N I N G
//  -------------
//
// This file is automatically generated.
// Changes will be lost.
//

Roberto Raggi's avatar
Roberto Raggi committed
39
#include "AST.h"
40
41
42
43
#include "ASTMatcher.h"

using namespace CPlusPlus;

Roberto Raggi's avatar
Roberto Raggi committed
44
ASTMatcher::ASTMatcher()
Roberto Raggi's avatar
Roberto Raggi committed
45
46
47
48
49
{ }

ASTMatcher::~ASTMatcher()
{ }

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
bool ASTMatcher::match(ObjCSelectorArgumentAST *node, ObjCSelectorArgumentAST *pattern)
{
    (void) node;
    (void) pattern;

    pattern->name_token = node->name_token;

    pattern->colon_token = node->colon_token;

    return true;
}

bool ASTMatcher::match(ObjCSelectorAST *node, ObjCSelectorAST *pattern)
{
    (void) node;
    (void) pattern;

    if (! pattern->selector_argument_list)
        pattern->selector_argument_list = node->selector_argument_list;
    else if (! AST::match(node->selector_argument_list, pattern->selector_argument_list, this))
        return false;

    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
75
bool ASTMatcher::match(SimpleSpecifierAST *node, SimpleSpecifierAST *pattern)
76
{
77
78
79
80
81
    (void) node;
    (void) pattern;

    pattern->specifier_token = node->specifier_token;

82
83
84
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
85
bool ASTMatcher::match(AttributeSpecifierAST *node, AttributeSpecifierAST *pattern)
86
{
87
88
89
90
91
92
93
94
95
96
97
98
    (void) node;
    (void) pattern;

    pattern->attribute_token = node->attribute_token;

    pattern->first_lparen_token = node->first_lparen_token;

    pattern->second_lparen_token = node->second_lparen_token;

    if (! pattern->attribute_list)
        pattern->attribute_list = node->attribute_list;
    else if (! AST::match(node->attribute_list, pattern->attribute_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
99
        return false;
100
101
102
103
104

    pattern->first_rparen_token = node->first_rparen_token;

    pattern->second_rparen_token = node->second_rparen_token;

105
106
107
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
108
bool ASTMatcher::match(AttributeAST *node, AttributeAST *pattern)
109
{
110
111
112
113
114
115
116
117
118
119
120
121
    (void) node;
    (void) pattern;

    pattern->identifier_token = node->identifier_token;

    pattern->lparen_token = node->lparen_token;

    pattern->tag_token = node->tag_token;

    if (! pattern->expression_list)
        pattern->expression_list = node->expression_list;
    else if (! AST::match(node->expression_list, pattern->expression_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
122
        return false;
123
124
125

    pattern->rparen_token = node->rparen_token;

126
127
128
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
129
bool ASTMatcher::match(TypeofSpecifierAST *node, TypeofSpecifierAST *pattern)
130
{
131
132
133
134
135
136
137
138
139
140
    (void) node;
    (void) pattern;

    pattern->typeof_token = node->typeof_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
141
        return false;
142
143
144

    pattern->rparen_token = node->rparen_token;

145
146
147
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
148
bool ASTMatcher::match(DeclaratorAST *node, DeclaratorAST *pattern)
149
{
150
151
152
153
154
155
    (void) node;
    (void) pattern;

    if (! pattern->attribute_list)
        pattern->attribute_list = node->attribute_list;
    else if (! AST::match(node->attribute_list, pattern->attribute_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
156
        return false;
157
158
159
160

    if (! pattern->ptr_operator_list)
        pattern->ptr_operator_list = node->ptr_operator_list;
    else if (! AST::match(node->ptr_operator_list, pattern->ptr_operator_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
161
        return false;
162
163
164
165

    if (! pattern->core_declarator)
        pattern->core_declarator = node->core_declarator;
    else if (! AST::match(node->core_declarator, pattern->core_declarator, this))
Roberto Raggi's avatar
Roberto Raggi committed
166
        return false;
167
168
169
170

    if (! pattern->postfix_declarator_list)
        pattern->postfix_declarator_list = node->postfix_declarator_list;
    else if (! AST::match(node->postfix_declarator_list, pattern->postfix_declarator_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
171
        return false;
172
173
174
175

    if (! pattern->post_attribute_list)
        pattern->post_attribute_list = node->post_attribute_list;
    else if (! AST::match(node->post_attribute_list, pattern->post_attribute_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
176
        return false;
177
178
179
180
181
182

    pattern->equals_token = node->equals_token;

    if (! pattern->initializer)
        pattern->initializer = node->initializer;
    else if (! AST::match(node->initializer, pattern->initializer, this))
Roberto Raggi's avatar
Roberto Raggi committed
183
        return false;
184

185
186
187
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
188
bool ASTMatcher::match(SimpleDeclarationAST *node, SimpleDeclarationAST *pattern)
189
{
190
191
192
193
194
195
196
197
    (void) node;
    (void) pattern;

    pattern->qt_invokable_token = node->qt_invokable_token;

    if (! pattern->decl_specifier_list)
        pattern->decl_specifier_list = node->decl_specifier_list;
    else if (! AST::match(node->decl_specifier_list, pattern->decl_specifier_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
198
        return false;
199
200
201
202

    if (! pattern->declarator_list)
        pattern->declarator_list = node->declarator_list;
    else if (! AST::match(node->declarator_list, pattern->declarator_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
203
        return false;
204
205
206

    pattern->semicolon_token = node->semicolon_token;

207
208
209
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
210
bool ASTMatcher::match(EmptyDeclarationAST *node, EmptyDeclarationAST *pattern)
211
{
212
213
214
215
216
    (void) node;
    (void) pattern;

    pattern->semicolon_token = node->semicolon_token;

217
218
219
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
220
bool ASTMatcher::match(AccessDeclarationAST *node, AccessDeclarationAST *pattern)
221
{
222
223
224
225
226
227
228
229
230
    (void) node;
    (void) pattern;

    pattern->access_specifier_token = node->access_specifier_token;

    pattern->slots_token = node->slots_token;

    pattern->colon_token = node->colon_token;

231
232
233
    return true;
}

234
bool ASTMatcher::match(QtPropertyDeclarationItemAST *node, QtPropertyDeclarationItemAST *pattern)
235
236
237
238
{
    (void) node;
    (void) pattern;

239
    pattern->item_name_token = node->item_name_token;
240

241
242
243
    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
244
        return false;
245

246
247
    return true;
}
248

249
250
251
252
bool ASTMatcher::match(QtPropertyDeclarationAST *node, QtPropertyDeclarationAST *pattern)
{
    (void) node;
    (void) pattern;
253

254
    pattern->property_specifier_token = node->property_specifier_token;
255

256
    pattern->lparen_token = node->lparen_token;
257

258
259
260
    if (! pattern->type_id)
        pattern->type_id = node->type_id;
    else if (! AST::match(node->type_id, pattern->type_id, this))
261
262
        return false;

263
264
265
    if (! pattern->property_name)
        pattern->property_name = node->property_name;
    else if (! AST::match(node->property_name, pattern->property_name, this))
266
267
        return false;

268
269
270
    if (! pattern->property_declaration_items)
        pattern->property_declaration_items = node->property_declaration_items;
    else if (! AST::match(node->property_declaration_items, pattern->property_declaration_items, this))
271
272
        return false;

273
274
    pattern->rparen_token = node->rparen_token;

275
276
277
    return true;
}

278
bool ASTMatcher::match(QtEnumDeclarationAST *node, QtEnumDeclarationAST *pattern)
279
280
281
282
283
284
{
    (void) node;
    (void) pattern;

    pattern->enum_specifier_token = node->enum_specifier_token;

285
286
    pattern->lparen_token = node->lparen_token;

287
288
289
290
291
    if (! pattern->enumerator_list)
        pattern->enumerator_list = node->enumerator_list;
    else if (! AST::match(node->enumerator_list, pattern->enumerator_list, this))
        return false;

292
293
    pattern->rparen_token = node->rparen_token;

294
295
296
    return true;
}

297
bool ASTMatcher::match(QtFlagsDeclarationAST *node, QtFlagsDeclarationAST *pattern)
298
299
300
301
302
303
{
    (void) node;
    (void) pattern;

    pattern->flags_specifier_token = node->flags_specifier_token;

304
305
    pattern->lparen_token = node->lparen_token;

306
307
308
    if (! pattern->flag_enums_list)
        pattern->flag_enums_list = node->flag_enums_list;
    else if (! AST::match(node->flag_enums_list, pattern->flag_enums_list, this))
309
310
        return false;

311
312
    pattern->rparen_token = node->rparen_token;

313
314
315
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
316
bool ASTMatcher::match(AsmDefinitionAST *node, AsmDefinitionAST *pattern)
317
{
318
319
320
321
322
323
324
325
326
327
328
329
330
    (void) node;
    (void) pattern;

    pattern->asm_token = node->asm_token;

    pattern->volatile_token = node->volatile_token;

    pattern->lparen_token = node->lparen_token;

    pattern->rparen_token = node->rparen_token;

    pattern->semicolon_token = node->semicolon_token;

331
332
333
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
334
bool ASTMatcher::match(BaseSpecifierAST *node, BaseSpecifierAST *pattern)
335
{
336
337
338
339
340
341
342
343
344
345
    (void) node;
    (void) pattern;

    pattern->virtual_token = node->virtual_token;

    pattern->access_specifier_token = node->access_specifier_token;

    if (! pattern->name)
        pattern->name = node->name;
    else if (! AST::match(node->name, pattern->name, this))
Roberto Raggi's avatar
Roberto Raggi committed
346
        return false;
347

348
349
350
    return true;
}

351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
bool ASTMatcher::match(CompoundExpressionAST *node, CompoundExpressionAST *pattern)
{
    (void) node;
    (void) pattern;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->compoundStatement)
        pattern->compoundStatement = node->compoundStatement;
    else if (! AST::match(node->compoundStatement, pattern->compoundStatement, this))
        return false;

    pattern->rparen_token = node->rparen_token;

    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
368
bool ASTMatcher::match(CompoundLiteralAST *node, CompoundLiteralAST *pattern)
369
{
370
371
372
373
374
375
376
377
    (void) node;
    (void) pattern;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->type_id)
        pattern->type_id = node->type_id;
    else if (! AST::match(node->type_id, pattern->type_id, this))
Roberto Raggi's avatar
Roberto Raggi committed
378
        return false;
379
380
381
382
383
384

    pattern->rparen_token = node->rparen_token;

    if (! pattern->initializer)
        pattern->initializer = node->initializer;
    else if (! AST::match(node->initializer, pattern->initializer, this))
Roberto Raggi's avatar
Roberto Raggi committed
385
        return false;
386

387
388
389
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
390
bool ASTMatcher::match(QtMethodAST *node, QtMethodAST *pattern)
391
{
392
393
394
395
396
397
398
399
400
401
    (void) node;
    (void) pattern;

    pattern->method_token = node->method_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->declarator)
        pattern->declarator = node->declarator;
    else if (! AST::match(node->declarator, pattern->declarator, this))
Roberto Raggi's avatar
Roberto Raggi committed
402
        return false;
403

404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
    pattern->rparen_token = node->rparen_token;

    return true;
}

bool ASTMatcher::match(QtMemberDeclarationAST *node, QtMemberDeclarationAST *pattern)
{
    (void) node;
    (void) pattern;

    pattern->q_token = node->q_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->type_id)
        pattern->type_id = node->type_id;
    else if (! AST::match(node->type_id, pattern->type_id, this))
        return false;

423
424
    pattern->rparen_token = node->rparen_token;

425
426
427
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
428
bool ASTMatcher::match(BinaryExpressionAST *node, BinaryExpressionAST *pattern)
429
{
430
431
432
433
434
435
    (void) node;
    (void) pattern;

    if (! pattern->left_expression)
        pattern->left_expression = node->left_expression;
    else if (! AST::match(node->left_expression, pattern->left_expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
436
        return false;
437
438
439
440
441
442

    pattern->binary_op_token = node->binary_op_token;

    if (! pattern->right_expression)
        pattern->right_expression = node->right_expression;
    else if (! AST::match(node->right_expression, pattern->right_expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
443
        return false;
444

445
446
447
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
448
bool ASTMatcher::match(CastExpressionAST *node, CastExpressionAST *pattern)
449
{
450
451
452
453
454
455
456
457
    (void) node;
    (void) pattern;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->type_id)
        pattern->type_id = node->type_id;
    else if (! AST::match(node->type_id, pattern->type_id, this))
Roberto Raggi's avatar
Roberto Raggi committed
458
        return false;
459
460
461
462
463
464

    pattern->rparen_token = node->rparen_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
465
        return false;
466

467
468
469
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
470
bool ASTMatcher::match(ClassSpecifierAST *node, ClassSpecifierAST *pattern)
471
{
472
473
474
475
476
477
478
479
    (void) node;
    (void) pattern;

    pattern->classkey_token = node->classkey_token;

    if (! pattern->attribute_list)
        pattern->attribute_list = node->attribute_list;
    else if (! AST::match(node->attribute_list, pattern->attribute_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
480
        return false;
481
482
483
484

    if (! pattern->name)
        pattern->name = node->name;
    else if (! AST::match(node->name, pattern->name, this))
Roberto Raggi's avatar
Roberto Raggi committed
485
        return false;
486
487
488
489
490
491

    pattern->colon_token = node->colon_token;

    if (! pattern->base_clause_list)
        pattern->base_clause_list = node->base_clause_list;
    else if (! AST::match(node->base_clause_list, pattern->base_clause_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
492
        return false;
493
494
495
496
497
498

    pattern->lbrace_token = node->lbrace_token;

    if (! pattern->member_specifier_list)
        pattern->member_specifier_list = node->member_specifier_list;
    else if (! AST::match(node->member_specifier_list, pattern->member_specifier_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
499
        return false;
500
501
502

    pattern->rbrace_token = node->rbrace_token;

503
504
505
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
506
bool ASTMatcher::match(CaseStatementAST *node, CaseStatementAST *pattern)
507
{
508
509
510
511
512
513
514
515
    (void) node;
    (void) pattern;

    pattern->case_token = node->case_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
516
        return false;
517
518
519
520
521
522

    pattern->colon_token = node->colon_token;

    if (! pattern->statement)
        pattern->statement = node->statement;
    else if (! AST::match(node->statement, pattern->statement, this))
Roberto Raggi's avatar
Roberto Raggi committed
523
        return false;
524

525
526
527
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
528
bool ASTMatcher::match(CompoundStatementAST *node, CompoundStatementAST *pattern)
529
{
530
531
532
533
534
535
536
537
    (void) node;
    (void) pattern;

    pattern->lbrace_token = node->lbrace_token;

    if (! pattern->statement_list)
        pattern->statement_list = node->statement_list;
    else if (! AST::match(node->statement_list, pattern->statement_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
538
        return false;
539
540
541

    pattern->rbrace_token = node->rbrace_token;

542
543
544
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
545
bool ASTMatcher::match(ConditionAST *node, ConditionAST *pattern)
546
{
547
548
549
550
551
552
    (void) node;
    (void) pattern;

    if (! pattern->type_specifier_list)
        pattern->type_specifier_list = node->type_specifier_list;
    else if (! AST::match(node->type_specifier_list, pattern->type_specifier_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
553
        return false;
554
555
556
557

    if (! pattern->declarator)
        pattern->declarator = node->declarator;
    else if (! AST::match(node->declarator, pattern->declarator, this))
Roberto Raggi's avatar
Roberto Raggi committed
558
        return false;
559

560
561
562
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
563
bool ASTMatcher::match(ConditionalExpressionAST *node, ConditionalExpressionAST *pattern)
564
{
565
566
567
568
569
570
    (void) node;
    (void) pattern;

    if (! pattern->condition)
        pattern->condition = node->condition;
    else if (! AST::match(node->condition, pattern->condition, this))
Roberto Raggi's avatar
Roberto Raggi committed
571
        return false;
572
573
574
575
576
577

    pattern->question_token = node->question_token;

    if (! pattern->left_expression)
        pattern->left_expression = node->left_expression;
    else if (! AST::match(node->left_expression, pattern->left_expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
578
        return false;
579
580
581
582
583
584

    pattern->colon_token = node->colon_token;

    if (! pattern->right_expression)
        pattern->right_expression = node->right_expression;
    else if (! AST::match(node->right_expression, pattern->right_expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
585
        return false;
586

587
588
589
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
590
bool ASTMatcher::match(CppCastExpressionAST *node, CppCastExpressionAST *pattern)
591
{
592
593
594
595
596
597
598
599
600
601
    (void) node;
    (void) pattern;

    pattern->cast_token = node->cast_token;

    pattern->less_token = node->less_token;

    if (! pattern->type_id)
        pattern->type_id = node->type_id;
    else if (! AST::match(node->type_id, pattern->type_id, this))
Roberto Raggi's avatar
Roberto Raggi committed
602
        return false;
603
604
605
606
607
608
609
610

    pattern->greater_token = node->greater_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
611
        return false;
612
613
614

    pattern->rparen_token = node->rparen_token;

615
616
617
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
618
bool ASTMatcher::match(CtorInitializerAST *node, CtorInitializerAST *pattern)
619
{
620
621
622
623
624
625
626
627
    (void) node;
    (void) pattern;

    pattern->colon_token = node->colon_token;

    if (! pattern->member_initializer_list)
        pattern->member_initializer_list = node->member_initializer_list;
    else if (! AST::match(node->member_initializer_list, pattern->member_initializer_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
628
        return false;
629

630
631
632
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
633
bool ASTMatcher::match(DeclarationStatementAST *node, DeclarationStatementAST *pattern)
634
{
635
636
637
638
639
640
    (void) node;
    (void) pattern;

    if (! pattern->declaration)
        pattern->declaration = node->declaration;
    else if (! AST::match(node->declaration, pattern->declaration, this))
Roberto Raggi's avatar
Roberto Raggi committed
641
        return false;
642

643
644
645
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
646
bool ASTMatcher::match(DeclaratorIdAST *node, DeclaratorIdAST *pattern)
647
{
648
649
650
651
652
653
    (void) node;
    (void) pattern;

    if (! pattern->name)
        pattern->name = node->name;
    else if (! AST::match(node->name, pattern->name, this))
Roberto Raggi's avatar
Roberto Raggi committed
654
        return false;
655

656
657
658
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
659
bool ASTMatcher::match(NestedDeclaratorAST *node, NestedDeclaratorAST *pattern)
660
{
661
662
663
664
665
666
667
668
    (void) node;
    (void) pattern;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->declarator)
        pattern->declarator = node->declarator;
    else if (! AST::match(node->declarator, pattern->declarator, this))
Roberto Raggi's avatar
Roberto Raggi committed
669
        return false;
670
671
672

    pattern->rparen_token = node->rparen_token;

673
674
675
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
676
bool ASTMatcher::match(FunctionDeclaratorAST *node, FunctionDeclaratorAST *pattern)
677
{
678
679
680
681
682
683
684
685
    (void) node;
    (void) pattern;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->parameters)
        pattern->parameters = node->parameters;
    else if (! AST::match(node->parameters, pattern->parameters, this))
Roberto Raggi's avatar
Roberto Raggi committed
686
        return false;
687
688
689
690
691
692

    pattern->rparen_token = node->rparen_token;

    if (! pattern->cv_qualifier_list)
        pattern->cv_qualifier_list = node->cv_qualifier_list;
    else if (! AST::match(node->cv_qualifier_list, pattern->cv_qualifier_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
693
        return false;
694
695
696
697

    if (! pattern->exception_specification)
        pattern->exception_specification = node->exception_specification;
    else if (! AST::match(node->exception_specification, pattern->exception_specification, this))
Roberto Raggi's avatar
Roberto Raggi committed
698
        return false;
699
700
701
702

    if (! pattern->as_cpp_initializer)
        pattern->as_cpp_initializer = node->as_cpp_initializer;
    else if (! AST::match(node->as_cpp_initializer, pattern->as_cpp_initializer, this))
Roberto Raggi's avatar
Roberto Raggi committed
703
        return false;
704

705
706
707
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
708
bool ASTMatcher::match(ArrayDeclaratorAST *node, ArrayDeclaratorAST *pattern)
709
{
710
711
712
713
714
715
716
717
    (void) node;
    (void) pattern;

    pattern->lbracket_token = node->lbracket_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
718
        return false;
719
720
721

    pattern->rbracket_token = node->rbracket_token;

722
723
724
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
725
bool ASTMatcher::match(DeleteExpressionAST *node, DeleteExpressionAST *pattern)
726
{
727
728
729
730
731
732
733
734
735
736
737
738
739
740
    (void) node;
    (void) pattern;

    pattern->scope_token = node->scope_token;

    pattern->delete_token = node->delete_token;

    pattern->lbracket_token = node->lbracket_token;

    pattern->rbracket_token = node->rbracket_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
741
        return false;
742

743
744
745
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
746
bool ASTMatcher::match(DoStatementAST *node, DoStatementAST *pattern)
747
{
748
749
750
751
752
753
754
755
    (void) node;
    (void) pattern;

    pattern->do_token = node->do_token;

    if (! pattern->statement)
        pattern->statement = node->statement;
    else if (! AST::match(node->statement, pattern->statement, this))
Roberto Raggi's avatar
Roberto Raggi committed
756
        return false;
757
758
759
760
761
762
763
764

    pattern->while_token = node->while_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
765
        return false;
766
767
768
769
770

    pattern->rparen_token = node->rparen_token;

    pattern->semicolon_token = node->semicolon_token;

771
772
773
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
774
bool ASTMatcher::match(NamedTypeSpecifierAST *node, NamedTypeSpecifierAST *pattern)
775
{
776
777
778
779
780
781
    (void) node;
    (void) pattern;

    if (! pattern->name)
        pattern->name = node->name;
    else if (! AST::match(node->name, pattern->name, this))
Roberto Raggi's avatar
Roberto Raggi committed
782
        return false;
783

784
785
786
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
787
bool ASTMatcher::match(ElaboratedTypeSpecifierAST *node, ElaboratedTypeSpecifierAST *pattern)
788
{
789
790
791
792
793
794
795
796
    (void) node;
    (void) pattern;

    pattern->classkey_token = node->classkey_token;

    if (! pattern->name)
        pattern->name = node->name;
    else if (! AST::match(node->name, pattern->name, this))
Roberto Raggi's avatar
Roberto Raggi committed
797
        return false;
798

799
800
801
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
802
bool ASTMatcher::match(EnumSpecifierAST *node, EnumSpecifierAST *pattern)
803
{
804
805
806
807
808
809
810
811
    (void) node;
    (void) pattern;

    pattern->enum_token = node->enum_token;

    if (! pattern->name)
        pattern->name = node->name;
    else if (! AST::match(node->name, pattern->name, this))
Roberto Raggi's avatar
Roberto Raggi committed
812
        return false;
813
814
815
816
817
818

    pattern->lbrace_token = node->lbrace_token;

    if (! pattern->enumerator_list)
        pattern->enumerator_list = node->enumerator_list;
    else if (! AST::match(node->enumerator_list, pattern->enumerator_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
819
        return false;
820
821
822

    pattern->rbrace_token = node->rbrace_token;

823
824
825
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
826
bool ASTMatcher::match(EnumeratorAST *node, EnumeratorAST *pattern)
827
{
828
829
830
831
832
833
834
835
836
837
    (void) node;
    (void) pattern;

    pattern->identifier_token = node->identifier_token;

    pattern->equal_token = node->equal_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
838
        return false;
839

840
841
842
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
843
bool ASTMatcher::match(ExceptionDeclarationAST *node, ExceptionDeclarationAST *pattern)
844
{
845
846
847
848
849
850
    (void) node;
    (void) pattern;

    if (! pattern->type_specifier_list)
        pattern->type_specifier_list = node->type_specifier_list;
    else if (! AST::match(node->type_specifier_list, pattern->type_specifier_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
851
        return false;
852
853
854
855

    if (! pattern->declarator)
        pattern->declarator = node->declarator;
    else if (! AST::match(node->declarator, pattern->declarator, this))
Roberto Raggi's avatar
Roberto Raggi committed
856
        return false;
857
858
859

    pattern->dot_dot_dot_token = node->dot_dot_dot_token;

860
861
862
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
863
bool ASTMatcher::match(ExceptionSpecificationAST *node, ExceptionSpecificationAST *pattern)
864
{
865
866
867
868
869
870
871
872
873
874
875
876
    (void) node;
    (void) pattern;

    pattern->throw_token = node->throw_token;

    pattern->lparen_token = node->lparen_token;

    pattern->dot_dot_dot_token = node->dot_dot_dot_token;

    if (! pattern->type_id_list)
        pattern->type_id_list = node->type_id_list;
    else if (! AST::match(node->type_id_list, pattern->type_id_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
877
        return false;
878
879
880

    pattern->rparen_token = node->rparen_token;

881
882
883
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
884
bool ASTMatcher::match(ExpressionOrDeclarationStatementAST *node, ExpressionOrDeclarationStatementAST *pattern)
885
{
886
887
888
889
890
891
    (void) node;
    (void) pattern;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
892
        return false;
893
894
895
896

    if (! pattern->declaration)
        pattern->declaration = node->declaration;
    else if (! AST::match(node->declaration, pattern->declaration, this))
Roberto Raggi's avatar
Roberto Raggi committed
897
        return false;
898

899
900
901
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
902
bool ASTMatcher::match(ExpressionStatementAST *node, ExpressionStatementAST *pattern)
903
{
904
905
906
907
908
909
    (void) node;
    (void) pattern;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
910
        return false;
911
912
913

    pattern->semicolon_token = node->semicolon_token;

914
915
916
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
917
bool ASTMatcher::match(FunctionDefinitionAST *node, FunctionDefinitionAST *pattern)
918
{
919
920
921
922
923
924
925
926
    (void) node;
    (void) pattern;

    pattern->qt_invokable_token = node->qt_invokable_token;

    if (! pattern->decl_specifier_list)
        pattern->decl_specifier_list = node->decl_specifier_list;
    else if (! AST::match(node->decl_specifier_list, pattern->decl_specifier_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
927
        return false;
928
929
930
931

    if (! pattern->declarator)
        pattern->declarator = node->declarator;
    else if (! AST::match(node->declarator, pattern->declarator, this))
Roberto Raggi's avatar
Roberto Raggi committed
932
        return false;
933
934
935
936

    if (! pattern->ctor_initializer)
        pattern->ctor_initializer = node->ctor_initializer;
    else if (! AST::match(node->ctor_initializer, pattern->ctor_initializer, this))
Roberto Raggi's avatar
Roberto Raggi committed
937
        return false;
938
939
940
941

    if (! pattern->function_body)
        pattern->function_body = node->function_body;
    else if (! AST::match(node->function_body, pattern->function_body, this))
Roberto Raggi's avatar
Roberto Raggi committed
942
        return false;
943

944
945
946
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
947
bool ASTMatcher::match(ForeachStatementAST *node, ForeachStatementAST *pattern)
948
{
949
950
951
952
953
954
955
956
957
958
    (void) node;
    (void) pattern;

    pattern->foreach_token = node->foreach_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->type_specifier_list)
        pattern->type_specifier_list = node->type_specifier_list;
    else if (! AST::match(node->type_specifier_list, pattern->type_specifier_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
959
        return false;
960
961
962
963

    if (! pattern->declarator)
        pattern->declarator = node->declarator;
    else if (! AST::match(node->declarator, pattern->declarator, this))
Roberto Raggi's avatar
Roberto Raggi committed
964
        return false;
965
966
967
968

    if (! pattern->initializer)
        pattern->initializer = node->initializer;
    else if (! AST::match(node->initializer, pattern->initializer, this))
Roberto Raggi's avatar
Roberto Raggi committed
969
        return false;
970
971
972
973
974
975

    pattern->comma_token = node->comma_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
976
        return false;
977
978
979
980
981
982

    pattern->rparen_token = node->rparen_token;

    if (! pattern->statement)
        pattern->statement = node->statement;
    else if (! AST::match(node->statement, pattern->statement, this))
Roberto Raggi's avatar
Roberto Raggi committed
983
        return false;
984

985
986
987
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
988
bool ASTMatcher::match(ForStatementAST *node, ForStatementAST *pattern)
989
{
990
991
992
993
994
995
996
997
998
999
    (void) node;
    (void) pattern;

    pattern->for_token = node->for_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->initializer)
        pattern->initializer = node->initializer;
    else if (! AST::match(node->initializer, pattern->initializer, this))
Roberto Raggi's avatar
Roberto Raggi committed
1000
        return false;
1001
1002
1003
1004

    if (! pattern->condition)
        pattern->condition = node->condition;
    else if (! AST::match(node->condition, pattern->condition, this))
Roberto Raggi's avatar
Roberto Raggi committed
1005
        return false;
1006
1007
1008
1009
1010
1011

    pattern->semicolon_token = node->semicolon_token;

    if (! pattern->expression)
        pattern->expression = node->expression;
    else if (! AST::match(node->expression, pattern->expression, this))
Roberto Raggi's avatar
Roberto Raggi committed
1012
        return false;
1013
1014
1015
1016
1017
1018

    pattern->rparen_token = node->rparen_token;

    if (! pattern->statement)
        pattern->statement = node->statement;
    else if (! AST::match(node->statement, pattern->statement, this))
Roberto Raggi's avatar
Roberto Raggi committed
1019
        return false;
1020

1021
1022
1023
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1024
bool ASTMatcher::match(IfStatementAST *node, IfStatementAST *pattern)
1025
{
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
    (void) node;
    (void) pattern;

    pattern->if_token = node->if_token;

    pattern->lparen_token = node->lparen_token;

    if (! pattern->condition)
        pattern->condition = node->condition;
    else if (! AST::match(node->condition, pattern->condition, this))
Roberto Raggi's avatar
Roberto Raggi committed
1036
        return false;
1037
1038
1039
1040
1041
1042

    pattern->rparen_token = node->rparen_token;

    if (! pattern->statement)
        pattern->statement = node->statement;
    else if (! AST::match(node->statement, pattern->statement, this))
Roberto Raggi's avatar
Roberto Raggi committed
1043
        return false;
1044
1045
1046
1047
1048
1049

    pattern->else_token = node->else_token;

    if (! pattern->else_statement)
        pattern->else_statement = node->else_statement;
    else if (! AST::match(node->else_statement, pattern->else_statement, this))
Roberto Raggi's avatar
Roberto Raggi committed
1050
        return false;
1051

1052
1053
1054
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1055
bool ASTMatcher::match(ArrayInitializerAST *node, ArrayInitializerAST *pattern)
1056
{
1057
1058
1059
1060
1061
1062
1063
1064
    (void) node;
    (void) pattern;

    pattern->lbrace_token = node->lbrace_token;

    if (! pattern->expression_list)
        pattern->expression_list = node->expression_list;
    else if (! AST::match(node->expression_list, pattern->expression_list, this))
Roberto Raggi's avatar
Roberto Raggi committed
1065
        return false;
1066
1067
1068

    pattern->rbrace_token = node->rbrace_token;

1069
1070
1071
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1072
bool ASTMatcher::match(LabeledStatementAST *node, LabeledStatementAST *pattern)
1073
{
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
    (void) node;
    (void) pattern;

    pattern->label_token = node->label_token;

    pattern->colon_token = node->colon_token;

    if (! pattern->statement)
        pattern->statement = node->statement;
    else if (! AST::match(node->statement, pattern->statement, this))
Roberto Raggi's avatar
Roberto Raggi committed
1084
        return false;
1085

1086
1087
1088
    return true;
}

Roberto Raggi's avatar
Roberto Raggi committed
1089
bool ASTMatcher::match(LinkageBodyAST *node, LinkageBodyAST *pattern)
1090
{
1091
1092
1093
1094
1095
1096
1097
1098
    (void) node;
    (void) pattern;

    pattern->lbrace_token = node->lbrace_token;

    if (! pattern->declaration_list)
        pattern->declaration_list = node->declaration_list;
    else if (! AST::match(node->declaration_list, pattern->declaration_list, this))