1 /****************************************************************************
3 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
5 ** This file is part of Qt Jambi.
7 ** ** This file may be used under the terms of the GNU General Public
8 ** License version 2.0 as published by the Free Software Foundation
9 ** and appearing in the file LICENSE.GPL included in the packaging of
10 ** this file. Please review the following information to ensure GNU
11 ** General Public Licensing requirements will be met:
12 ** http://www.trolltech.com/products/qt/opensource.html
14 ** If you are unsure which license is appropriate for your use, please
15 ** review the following information:
16 ** http://www.trolltech.com/products/qt/licensing.html or contact the
17 ** sales department at sales@trolltech.com.
20 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
21 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 ****************************************************************************/
25 /* This file is part of KDevelop
26 Copyright (C) 2002-2005 Roberto Raggi <roberto@kdevelop.org>
28 This library is free software; you can redistribute it and/or
29 modify it under the terms of the GNU Library General Public
30 License version 2 as published by the Free Software Foundation.
32 This library is distributed in the hope that it will be useful,
33 but WITHOUT ANY WARRANTY; without even the implied warranty of
34 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35 Library General Public License for more details.
37 You should have received a copy of the GNU Library General Public License
38 along with this library; see the file COPYING.LIB. If not, write to
39 the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
40 Boston, MA 02110-1301, USA.
43 #include "default_visitor.h"
45 void DefaultVisitor::visitAccessSpecifier(AccessSpecifierAST
*)
50 void DefaultVisitor::visitAsmDefinition(AsmDefinitionAST
*)
55 void DefaultVisitor::visitBaseClause(BaseClauseAST
*node
)
57 visitNodes(this, node
->base_specifiers
);
60 void DefaultVisitor::visitBaseSpecifier(BaseSpecifierAST
*node
)
65 void DefaultVisitor::visitBinaryExpression(BinaryExpressionAST
*node
)
67 visit(node
->left_expression
);
68 visit(node
->right_expression
);
71 void DefaultVisitor::visitCastExpression(CastExpressionAST
*node
)
74 visit(node
->expression
);
77 void DefaultVisitor::visitClassMemberAccess(ClassMemberAccessAST
*node
)
82 void DefaultVisitor::visitClassSpecifier(ClassSpecifierAST
*node
)
84 visit(node
->win_decl_specifiers
);
86 visit(node
->base_clause
);
87 visitNodes(this, node
->member_specs
);
90 void DefaultVisitor::visitCompoundStatement(CompoundStatementAST
*node
)
92 visitNodes(this, node
->statements
);
95 void DefaultVisitor::visitCondition(ConditionAST
*node
)
97 visit(node
->type_specifier
);
98 visit(node
->declarator
);
99 visit(node
->expression
);
102 void DefaultVisitor::visitConditionalExpression(ConditionalExpressionAST
*node
)
104 visit(node
->condition
);
105 visit(node
->left_expression
);
106 visit(node
->right_expression
);
109 void DefaultVisitor::visitCppCastExpression(CppCastExpressionAST
*node
)
111 visit(node
->type_id
);
112 visit(node
->expression
);
113 visitNodes(this, node
->sub_expressions
);
116 void DefaultVisitor::visitCtorInitializer(CtorInitializerAST
*node
)
118 visitNodes(this, node
->member_initializers
);
121 void DefaultVisitor::visitDeclarationStatement(DeclarationStatementAST
*node
)
123 visit(node
->declaration
);
126 void DefaultVisitor::visitDeclarator(DeclaratorAST
*node
)
128 visit(node
->sub_declarator
);
129 visitNodes(this, node
->ptr_ops
);
131 visit(node
->bit_expression
);
132 visitNodes(this, node
->array_dimensions
);
133 visit(node
->parameter_declaration_clause
);
134 visit(node
->exception_spec
);
137 void DefaultVisitor::visitDeleteExpression(DeleteExpressionAST
*node
)
139 visit(node
->expression
);
142 void DefaultVisitor::visitDoStatement(DoStatementAST
*node
)
144 visit(node
->statement
);
145 visit(node
->expression
);
148 void DefaultVisitor::visitElaboratedTypeSpecifier(ElaboratedTypeSpecifierAST
*node
)
153 void DefaultVisitor::visitEnumSpecifier(EnumSpecifierAST
*node
)
156 visitNodes(this, node
->enumerators
);
159 void DefaultVisitor::visitEnumerator(EnumeratorAST
*node
)
161 visit(node
->expression
);
164 void DefaultVisitor::visitExceptionSpecification(ExceptionSpecificationAST
*node
)
166 visitNodes(this, node
->type_ids
);
169 void DefaultVisitor::visitExpressionOrDeclarationStatement(ExpressionOrDeclarationStatementAST
*node
)
171 visit(node
->expression
);
172 visit(node
->declaration
);
175 void DefaultVisitor::visitExpressionStatement(ExpressionStatementAST
*node
)
177 visit(node
->expression
);
180 void DefaultVisitor::visitForStatement(ForStatementAST
*node
)
182 visit(node
->init_statement
);
183 visit(node
->condition
);
184 visit(node
->expression
);
185 visit(node
->statement
);
188 void DefaultVisitor::visitFunctionCall(FunctionCallAST
*node
)
190 visit(node
->arguments
);
193 void DefaultVisitor::visitFunctionDefinition(FunctionDefinitionAST
*node
)
195 visit(node
->type_specifier
);
196 visit(node
->init_declarator
);
197 visit(node
->function_body
);
198 visit(node
->win_decl_specifiers
);
201 void DefaultVisitor::visitIfStatement(IfStatementAST
*node
)
203 visit(node
->condition
);
204 visit(node
->statement
);
205 visit(node
->else_statement
);
208 void DefaultVisitor::visitIncrDecrExpression(IncrDecrExpressionAST
*)
213 void DefaultVisitor::visitInitDeclarator(InitDeclaratorAST
*node
)
215 visit(node
->declarator
);
216 visit(node
->initializer
);
219 void DefaultVisitor::visitInitializer(InitializerAST
*node
)
221 visit(node
->initializer_clause
);
222 visit(node
->expression
);
225 void DefaultVisitor::visitInitializerClause(InitializerClauseAST
*node
)
227 visit(node
->expression
);
230 void DefaultVisitor::visitLabeledStatement(LabeledStatementAST
*)
235 void DefaultVisitor::visitLinkageBody(LinkageBodyAST
*node
)
237 visitNodes(this, node
->declarations
);
240 void DefaultVisitor::visitLinkageSpecification(LinkageSpecificationAST
*node
)
242 visit(node
->linkage_body
);
243 visit(node
->declaration
);
246 void DefaultVisitor::visitMemInitializer(MemInitializerAST
*node
)
248 visit(node
->initializer_id
);
249 visit(node
->expression
);
252 void DefaultVisitor::visitName(NameAST
*node
)
254 visitNodes(this, node
->qualified_names
);
255 visit(node
->unqualified_name
);
258 void DefaultVisitor::visitNamespace(NamespaceAST
*node
)
260 visit(node
->linkage_body
);
263 void DefaultVisitor::visitNamespaceAliasDefinition(NamespaceAliasDefinitionAST
*node
)
265 visit(node
->alias_name
);
268 void DefaultVisitor::visitNewDeclarator(NewDeclaratorAST
*node
)
271 visit(node
->sub_declarator
);
272 visitNodes(this, node
->expressions
);
275 void DefaultVisitor::visitNewExpression(NewExpressionAST
*node
)
277 visit(node
->expression
);
278 visit(node
->type_id
);
279 visit(node
->new_type_id
);
280 visit(node
->new_initializer
);
283 void DefaultVisitor::visitNewInitializer(NewInitializerAST
*node
)
285 visit(node
->expression
);
288 void DefaultVisitor::visitNewTypeId(NewTypeIdAST
*node
)
290 visit(node
->type_specifier
);
291 visit(node
->new_initializer
);
292 visit(node
->new_declarator
);
295 void DefaultVisitor::visitOperator(OperatorAST
*)
300 void DefaultVisitor::visitOperatorFunctionId(OperatorFunctionIdAST
*node
)
303 visit(node
->type_specifier
);
304 visitNodes(this, node
->ptr_ops
);
307 void DefaultVisitor::visitParameterDeclaration(ParameterDeclarationAST
*node
)
309 visit(node
->type_specifier
);
310 visit(node
->declarator
);
311 visit(node
->expression
);
314 void DefaultVisitor::visitParameterDeclarationClause(ParameterDeclarationClauseAST
*node
)
316 visitNodes(this, node
->parameter_declarations
);
319 void DefaultVisitor::visitPostfixExpression(PostfixExpressionAST
*node
)
321 visit(node
->type_specifier
);
322 visit(node
->expression
);
323 visitNodes(this, node
->sub_expressions
);
326 void DefaultVisitor::visitPrimaryExpression(PrimaryExpressionAST
*node
)
328 visit(node
->literal
);
329 visit(node
->expression_statement
);
330 visit(node
->sub_expression
);
334 void DefaultVisitor::visitPtrOperator(PtrOperatorAST
*node
)
336 visit(node
->mem_ptr
);
339 void DefaultVisitor::visitPtrToMember(PtrToMemberAST
*)
344 void DefaultVisitor::visitReturnStatement(ReturnStatementAST
*node
)
346 visit(node
->expression
);
349 void DefaultVisitor::visitSimpleDeclaration(SimpleDeclarationAST
*node
)
351 visit(node
->type_specifier
);
352 visitNodes(this, node
->init_declarators
);
353 visit(node
->win_decl_specifiers
);
356 void DefaultVisitor::visitSimpleTypeSpecifier(SimpleTypeSpecifierAST
*node
)
359 visit(node
->type_id
);
360 visit(node
->expression
);
363 void DefaultVisitor::visitSizeofExpression(SizeofExpressionAST
*node
)
365 visit(node
->type_id
);
366 visit(node
->expression
);
369 void DefaultVisitor::visitStringLiteral(StringLiteralAST
*)
374 void DefaultVisitor::visitSubscriptExpression(SubscriptExpressionAST
*node
)
376 visit(node
->subscript
);
379 void DefaultVisitor::visitSwitchStatement(SwitchStatementAST
*node
)
381 visit(node
->condition
);
382 visit(node
->statement
);
385 void DefaultVisitor::visitTemplateArgument(TemplateArgumentAST
*node
)
387 visit(node
->type_id
);
388 visit(node
->expression
);
391 void DefaultVisitor::visitTemplateDeclaration(TemplateDeclarationAST
*node
)
393 visitNodes(this, node
->template_parameters
);
394 visit(node
->declaration
);
397 void DefaultVisitor::visitTemplateParameter(TemplateParameterAST
*node
)
399 visit(node
->type_parameter
);
400 visit(node
->parameter_declaration
);
403 void DefaultVisitor::visitThrowExpression(ThrowExpressionAST
*node
)
405 visit(node
->expression
);
408 void DefaultVisitor::visitTranslationUnit(TranslationUnitAST
*node
)
410 visitNodes(this, node
->declarations
);
413 void DefaultVisitor::visitTryBlockStatement(TryBlockStatementAST
*)
418 void DefaultVisitor::visitTypeId(TypeIdAST
*node
)
420 visit(node
->type_specifier
);
421 visit(node
->declarator
);
424 void DefaultVisitor::visitTypeIdentification(TypeIdentificationAST
*node
)
427 visit(node
->expression
);
430 void DefaultVisitor::visitTypeParameter(TypeParameterAST
*node
)
433 visit(node
->type_id
);
434 visitNodes(this, node
->template_parameters
);
435 visit(node
->template_name
);
438 void DefaultVisitor::visitTypedef(TypedefAST
*node
)
440 visit(node
->type_specifier
);
441 visitNodes(this, node
->init_declarators
);
444 void DefaultVisitor::visitUnaryExpression(UnaryExpressionAST
*node
)
446 visit(node
->expression
);
449 void DefaultVisitor::visitUnqualifiedName(UnqualifiedNameAST
*node
)
451 visit(node
->operator_id
);
452 visitNodes(this, node
->template_arguments
);
455 void DefaultVisitor::visitUsing(UsingAST
*node
)
460 void DefaultVisitor::visitUsingDirective(UsingDirectiveAST
*node
)
465 void DefaultVisitor::visitWhileStatement(WhileStatementAST
*node
)
467 visit(node
->condition
);
468 visit(node
->statement
);
471 void DefaultVisitor::visitWinDeclSpec(WinDeclSpecAST
*)
476 // kate: space-indent on; indent-width 2; replace-tabs on;