1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix for 152846 by Betty Tibbitts, calling ASTVisitor.leave() for cpp

This commit is contained in:
Markus Schorn 2007-01-22 14:44:45 +00:00
parent d66c6bfc64
commit 63d92fc558
74 changed files with 665 additions and 75 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -17,6 +17,12 @@ package org.eclipse.cdt.core.dom.ast;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator; import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
/**
* Visitor allows traversal of AST. <br>
* visit() methods implement a top-down traversal, and <br>
* leave() methods implement a bottom-up traversal.
*
*/
public abstract class ASTVisitor { public abstract class ASTVisitor {
/** /**
@ -109,8 +115,8 @@ public abstract class ASTVisitor {
return PROCESS_CONTINUE; return PROCESS_CONTINUE;
} }
/* /**
* leave method. * leave methods - implement a bottom-up traversal
*/ */
public int leave(IASTTranslationUnit tu) { public int leave(IASTTranslationUnit tu) {
return PROCESS_CONTINUE; return PROCESS_CONTINUE;

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -31,7 +31,7 @@ public abstract class CASTVisitor extends ASTVisitor {
/** /**
* Function to override if you wish to visit designators in your * Function to override if you wish to visit designators in your
* implementation. * implementation. This does a top-down traversal.
* *
* @param designator * @param designator
* @return * @return
@ -39,7 +39,12 @@ public abstract class CASTVisitor extends ASTVisitor {
public int visit(ICASTDesignator designator) { public int visit(ICASTDesignator designator) {
return PROCESS_CONTINUE; return PROCESS_CONTINUE;
} }
/**
* Function to override if you wish to visit designators in your
* implementation: this does a bottom-up traversal.
* @param designator
* @return
*/
public int leave(ICASTDesignator designator) { public int leave(ICASTDesignator designator) {
return PROCESS_CONTINUE; return PROCESS_CONTINUE;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -19,6 +19,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBas
/** /**
* C++ specific visitor class. * C++ specific visitor class.
* <br>The visit() methods implement a top-down traversal of the AST,
* and the leave() methods implement a bottom-up traversal.
* *
* @author jcamelon * @author jcamelon
*/ */
@ -69,4 +71,36 @@ public abstract class CPPASTVisitor extends ASTVisitor {
public int visit(ICPPASTTemplateParameter parameter) { public int visit(ICPPASTTemplateParameter parameter) {
return PROCESS_CONTINUE; return PROCESS_CONTINUE;
} }
/**
* Visit BaseSpecifiers.
* Bottom-up traversal.
*
* @param specifier
* @return
*/
public int leave(ICPPASTBaseSpecifier specifier) {
return PROCESS_CONTINUE;
}
/**
* Visit namespace definitions.
* Bottom-up traversal.
*
* @param namespace
* @return
*/
public int leave(ICPPASTNamespaceDefinition namespace) {
return PROCESS_CONTINUE;
}
/**
* Visit template parameter.
* Bottom-up traversal.
*
* @param parameter
* @return
*/
public int leave(ICPPASTTemplateParameter parameter) {
return PROCESS_CONTINUE;
}
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005 IBM Corporation and others. * Copyright (c) 2005, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -94,6 +94,14 @@ public class CASTFunctionDefinition extends CASTNode implements
if( declSpecifier != null ) if( !declSpecifier.accept( action ) ) return false; if( declSpecifier != null ) if( !declSpecifier.accept( action ) ) return false;
if( declarator != null ) if( !declarator.accept( action ) ) return false; if( declarator != null ) if( !declarator.accept( action ) ) return false;
if( bodyStatement != null ) if( !bodyStatement.accept( action ) ) return false; if( bodyStatement != null ) if( !bodyStatement.accept( action ) ) return false;
//BRT is this an omission in original?
if( action.shouldVisitDeclarations ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -42,6 +42,13 @@ public class CPPASTASMDeclaration extends CPPASTNode implements
default : break; default : break;
} }
} }
if( action.shouldVisitDeclarations ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -9,7 +9,7 @@
* IBM - Initial API and implementation * IBM - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
//no change for leave()
import java.util.Arrays; import java.util.Arrays;
import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.ASTVisitor;

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -54,6 +54,14 @@ public class CPPASTArraySubscriptExpression extends CPPASTNode implements
if( !arrayExpression.accept( action ) ) return false; if( !arrayExpression.accept( action ) ) return false;
if( subscriptExp != null ) if( subscriptExp != null )
if( !subscriptExp.accept( action ) ) return false; if( !subscriptExp.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -78,6 +78,15 @@ public class CPPASTBaseSpecifier extends CPPASTNode implements
} }
if( !name.accept( action ) ) return false; if( !name.accept( action ) ) return false;
if( action instanceof CPPASTVisitor &&
((CPPASTVisitor)action).shouldVisitBaseSpecifiers ){
switch( ((CPPASTVisitor)action).leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -62,6 +62,14 @@ public class CPPASTBinaryExpression extends CPPASTNode implements
if( operand1 != null ) if( !operand1.accept( action ) ) return false; if( operand1 != null ) if( !operand1.accept( action ) ) return false;
if( operand2 != null ) if( !operand2.accept( action ) ) return false; if( operand2 != null ) if( !operand2.accept( action ) ) return false;
if(action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -27,6 +27,14 @@ public class CPPASTBreakStatement extends CPPASTNode implements
default : break; default : break;
} }
} }
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -46,6 +46,14 @@ public class CPPASTCaseStatement extends CPPASTNode implements
} }
} }
if( expression != null ) if( !expression.accept( action ) ) return false; if( expression != null ) if( !expression.accept( action ) ) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -48,6 +48,14 @@ public class CPPASTCastExpression extends CPPASTUnaryExpression implements
if( typeId != null ) if( !typeId.accept( action ) ) return false; if( typeId != null ) if( !typeId.accept( action ) ) return false;
IASTExpression op = getOperand(); IASTExpression op = getOperand();
if( op != null ) if( !op.accept( action ) ) return false; if( op != null ) if( !op.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }
} }

View file

@ -79,6 +79,14 @@ public class CPPASTCatchHandler extends CPPASTNode implements
} }
if( declaration != null ) if( !declaration.accept( action ) ) return false; if( declaration != null ) if( !declaration.accept( action ) ) return false;
if( body != null ) if( !body.accept( action ) ) return false; if( body != null ) if( !body.accept( action ) ) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -134,6 +134,13 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
for( int i = 0; i < decls.length; i++ ) for( int i = 0; i < decls.length; i++ )
if( !decls[i].accept( action ) ) return false; if( !decls[i].accept( action ) ) return false;
if( action.shouldVisitDeclSpecifiers ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -65,6 +65,13 @@ public class CPPASTCompoundStatement extends CPPASTNode implements
for ( int i = 0; i < s.length; i++ ) { for ( int i = 0; i < s.length; i++ ) {
if( !s[i].accept( action ) ) return false; if( !s[i].accept( action ) ) return false;
} }
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -40,6 +40,14 @@ public class CPPASTCompoundStatementExpression extends CPPASTNode implements
} }
if( statement != null ) if( !statement.accept( action ) ) return false; if( statement != null ) if( !statement.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -62,6 +62,14 @@ public class CPPASTConditionalExpression extends CPPASTNode implements
if( condition != null ) if( !condition.accept( action ) ) return false; if( condition != null ) if( !condition.accept( action ) ) return false;
if( postive != null ) if( !postive.accept( action ) ) return false; if( postive != null ) if( !postive.accept( action ) ) return false;
if( negative != null ) if( !negative.accept( action ) ) return false; if( negative != null ) if( !negative.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -47,6 +47,13 @@ public class CPPASTConstructorInitializer extends CPPASTNode implements
} }
} }
if( exp != null ) if( !exp.accept( action ) ) return false; if( exp != null ) if( !exp.accept( action ) ) return false;
if( action.shouldVisitInitializers ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -27,6 +27,13 @@ public class CPPASTContinueStatement extends CPPASTNode implements
default : break; default : break;
} }
} }
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }
} }

View file

@ -47,6 +47,13 @@ public class CPPASTDeclarationStatement extends CPPASTNode implements
} }
} }
if( declaration != null ) if( !declaration.accept( action ) ) return false; if( declaration != null ) if( !declaration.accept( action ) ) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -127,6 +127,14 @@ public class CPPASTDeclarator extends CPPASTNode implements IASTDeclarator {
if( nestedDeclarator != null ) if( !nestedDeclarator.accept( action ) ) return false; if( nestedDeclarator != null ) if( !nestedDeclarator.accept( action ) ) return false;
if( action.shouldVisitDeclarators ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return postAccept( action ); return postAccept( action );
} }

View file

@ -26,6 +26,13 @@ public class CPPASTDefaultStatement extends CPPASTNode implements
default : break; default : break;
} }
} }
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -59,6 +59,14 @@ public class CPPASTDeleteExpression extends CPPASTNode implements
} }
if( operand != null ) if( !operand.accept( action ) ) return false; if( operand != null ) if( !operand.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -62,6 +62,13 @@ public class CPPASTDoStatement extends CPPASTNode implements IASTDoStatement, IA
} }
if( body != null ) if( !body.accept( action ) ) return false; if( body != null ) if( !body.accept( action ) ) return false;
if( condition != null ) if( !condition.accept( action ) ) return false; if( condition != null ) if( !condition.accept( action ) ) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -66,6 +66,13 @@ public class CPPASTElaboratedTypeSpecifier extends CPPASTBaseDeclSpecifier
} }
} }
if( name != null ) if( !name.accept( action ) ) return false; if( name != null ) if( !name.accept( action ) ) return false;
if( action.shouldVisitDeclSpecifiers ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -81,12 +81,9 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (action.shouldVisitDeclSpecifiers) { if (action.shouldVisitDeclSpecifiers) {
switch (action.visit(this)) { switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: case ASTVisitor.PROCESS_ABORT : return false;
return false; case ASTVisitor.PROCESS_SKIP : return true;
case ASTVisitor.PROCESS_SKIP: default: break;
return true;
default:
break;
} }
} }
if (name != null) if (name != null)
@ -97,6 +94,14 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
if (!enums[i].accept(action)) if (!enums[i].accept(action))
return false; return false;
if( action.shouldVisitDeclSpecifiers ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -62,6 +62,14 @@ public class CPPASTEnumerator extends CPPASTNode implements IASTEnumerator, IAST
} }
if( name != null ) if( !name.accept( action ) ) return false; if( name != null ) if( !name.accept( action ) ) return false;
if( value != null ) if( !value.accept( action ) ) return false; if( value != null ) if( !value.accept( action ) ) return false;
if( action.shouldVisitEnumerators ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -48,6 +48,14 @@ public class CPPASTExplicitTemplateInstantiation extends CPPASTNode implements
} }
if( declaration != null ) if( !declaration.accept( action ) ) return false; if( declaration != null ) if( !declaration.accept( action ) ) return false;
if( action.shouldVisitDeclarations ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -48,6 +48,13 @@ public class CPPASTExpressionList extends CPPASTNode implements
for( int i = 0; i < exps.length; i++ ) for( int i = 0; i < exps.length; i++ )
if( !exps[i].accept( action ) ) return false; if( !exps[i].accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -46,6 +46,13 @@ public class CPPASTExpressionStatement extends CPPASTNode implements
} }
} }
if( expression != null ) if( !expression.accept( action ) ) return false; if( expression != null ) if( !expression.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -72,6 +72,14 @@ public class CPPASTFieldReference extends CPPASTNode implements
if( owner != null ) if( !owner.accept( action ) ) return false; if( owner != null ) if( !owner.accept( action ) ) return false;
if( name != null ) if( !name.accept( action ) ) return false; if( name != null ) if( !name.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -97,6 +97,14 @@ public class CPPASTForStatement extends CPPASTNode implements IASTForStatement,
if( cond_declaration != null ) if( !cond_declaration.accept( action ) ) return false; if( cond_declaration != null ) if( !cond_declaration.accept( action ) ) return false;
if( iterationExpression != null ) if( !iterationExpression.accept( action ) ) return false; if( iterationExpression != null ) if( !iterationExpression.accept( action ) ) return false;
if( body != null ) if( !body.accept( action ) ) return false; if( body != null ) if( !body.accept( action ) ) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -52,6 +52,14 @@ public class CPPASTFunctionCallExpression extends CPPASTNode implements
if( functionName != null ) if( !functionName.accept( action ) ) return false; if( functionName != null ) if( !functionName.accept( action ) ) return false;
if( parameter != null ) if( !parameter.accept( action ) ) return false; if( parameter != null ) if( !parameter.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -91,6 +91,14 @@ public class CPPASTFunctionDefinition extends CPPASTNode implements
if( declSpecifier != null ) if( !declSpecifier.accept( action ) ) return false; if( declSpecifier != null ) if( !declSpecifier.accept( action ) ) return false;
if( declarator != null ) if( !declarator.accept( action ) ) return false; if( declarator != null ) if( !declarator.accept( action ) ) return false;
if( bodyStatement != null ) if( !bodyStatement.accept( action ) ) return false; if( bodyStatement != null ) if( !bodyStatement.accept( action ) ) return false;
if( action.shouldVisitDeclarations ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -44,6 +44,14 @@ public class CPPASTGotoStatement extends CPPASTNode implements
} }
} }
if( name != null ) if( !name.accept( action ) ) return false; if( name != null ) if( !name.accept( action ) ) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -39,6 +39,14 @@ public class CPPASTIdExpression extends CPPASTNode implements IASTIdExpression {
} }
if( name != null ) if( !name.accept( action ) ) return false; if( name != null ) if( !name.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -84,6 +84,14 @@ public class CPPASTIfStatement extends CPPASTNode implements ICPPASTIfStatement,
if( thenClause != null ) if( !thenClause.accept( action ) ) return false; if( thenClause != null ) if( !thenClause.accept( action ) ) return false;
if( elseClause != null ) if( !elseClause.accept( action ) ) return false; if( elseClause != null ) if( !elseClause.accept( action ) ) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -47,6 +47,14 @@ public class CPPASTInitializerExpression extends CPPASTNode implements
} }
} }
if( exp != null ) if( !exp.accept( action ) ) return false; if( exp != null ) if( !exp.accept( action ) ) return false;
if( action.shouldVisitInitializers ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -54,6 +54,13 @@ public class CPPASTInitializerList extends CPPASTNode implements
for ( int i = 0; i < list.length; i++ ) { for ( int i = 0; i < list.length; i++ ) {
if( !list[i].accept( action ) ) return false; if( !list[i].accept( action ) ) return false;
} }
if( action.shouldVisitInitializers ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -49,6 +49,14 @@ public class CPPASTLabelStatement extends CPPASTNode implements
} }
if( name != null ) if( !name.accept( action ) ) return false; if( name != null ) if( !name.accept( action ) ) return false;
if( nestedStatement != null ) if( !nestedStatement.accept( action ) ) return false; if( nestedStatement != null ) if( !nestedStatement.accept( action ) ) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -67,6 +67,15 @@ public class CPPASTLinkageSpecification extends CPPASTNode implements
IASTDeclaration [] decls = getDeclarations(); IASTDeclaration [] decls = getDeclarations();
for( int i = 0; i < decls.length; i++ ) for( int i = 0; i < decls.length; i++ )
if( !decls[i].accept( action ) ) return false; if( !decls[i].accept( action ) ) return false;
if( action.shouldVisitDeclarations ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -48,6 +48,13 @@ public class CPPASTLiteralExpression extends CPPASTNode implements
default : break; default : break;
} }
} }
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -117,6 +117,17 @@ public class CPPASTName extends CPPASTNode implements IASTName {
break; break;
} }
} }
if (action.shouldVisitNames) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT:
return false;
case ASTVisitor.PROCESS_SKIP:
return true;
default:
break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -60,6 +60,14 @@ public class CPPASTNamedTypeSpecifier extends CPPASTBaseDeclSpecifier implements
} }
} }
if( name != null ) if( !name.accept( action ) ) return false; if( name != null ) if( !name.accept( action ) ) return false;
if( action.shouldVisitDeclSpecifiers ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -62,6 +62,14 @@ public class CPPASTNamespaceAlias extends CPPASTNode implements
if( alias != null ) if( !alias.accept( action ) ) return false; if( alias != null ) if( !alias.accept( action ) ) return false;
if( qualifiedName != null ) if( !qualifiedName.accept( action ) ) return false; if( qualifiedName != null ) if( !qualifiedName.accept( action ) ) return false;
if( action.shouldVisitDeclarations ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -87,6 +87,14 @@ public class CPPASTNamespaceDefinition extends CPPASTNode implements
for ( int i = 0; i < decls.length; i++ ) for ( int i = 0; i < decls.length; i++ )
if( !decls[i].accept( action ) ) return false; if( !decls[i].accept( action ) ) return false;
if( action instanceof CPPASTVisitor &&
((CPPASTVisitor)action).shouldVisitNamespaces ){
switch( ((CPPASTVisitor)action).leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -99,6 +99,14 @@ public class CPPASTNewExpression extends CPPASTNode implements
if( !exps[i].accept( action ) ) return false; if( !exps[i].accept( action ) ) return false;
if( initializer != null ) if( !initializer.accept( action ) ) return false; if( initializer != null ) if( !initializer.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -26,6 +26,13 @@ public class CPPASTNullStatement extends CPPASTNode implements
default : break; default : break;
} }
} }
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -63,6 +63,14 @@ public class CPPASTParameterDeclaration extends CPPASTNode implements
if( declSpec != null ) if( !declSpec.accept( action ) ) return false; if( declSpec != null ) if( !declSpec.accept( action ) ) return false;
if( declarator != null ) if( !declarator.accept( action ) ) return false; if( declarator != null ) if( !declarator.accept( action ) ) return false;
if( action.shouldVisitParameterDeclarations ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -282,7 +282,7 @@ public class CPPASTProblem extends CPPASTNode implements IASTProblem {
file = f.getFileName(); file = f.getFileName();
offset = f.getNodeOffset(); offset = f.getNodeOffset();
} }
Object[] args = new Object[] { msg, file, new Integer(offset) }; //$NON-NLS-1$ Object[] args = new Object[] { msg, file, new Integer(offset) };
message = ParserMessages.getFormattedString(AST_PROBLEM_PATTERN, args); message = ParserMessages.getFormattedString(AST_PROBLEM_PATTERN, args);
return message; return message;
} }
@ -328,6 +328,13 @@ public class CPPASTProblem extends CPPASTNode implements IASTProblem {
default : break; default : break;
} }
} }
if( action.shouldVisitProblems ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -27,6 +27,13 @@ public class CPPASTProblemDeclaration extends CPPASTProblemOwner implements
default : break; default : break;
} }
} }
if( action.shouldVisitDeclarations ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -28,6 +28,13 @@ public class CPPASTProblemExpression extends CPPASTProblemOwner implements
default : break; default : break;
} }
} }
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -26,6 +26,13 @@ public class CPPASTProblemStatement extends CPPASTProblemOwner implements
default : break; default : break;
} }
} }
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -185,6 +185,16 @@ public class CPPASTQualifiedName extends CPPASTNode implements
} else if (!names[i].accept(action)) } else if (!names[i].accept(action))
return false; return false;
} }
if (action.shouldVisitNames) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT:
return false;
case ASTVisitor.PROCESS_SKIP:
return true;
default:
break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -55,6 +55,14 @@ public class CPPASTReturnStatement extends CPPASTNode implements
if (retValue != null) if (retValue != null)
if (!retValue.accept(action)) if (!retValue.accept(action))
return false; return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -103,6 +103,13 @@ public class CPPASTSimpleDeclSpecifier extends CPPASTBaseDeclSpecifier
default : break; default : break;
} }
} }
if( action.shouldVisitDeclSpecifiers ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -72,6 +72,14 @@ public class CPPASTSimpleDeclaration extends CPPASTNode implements
IASTDeclarator [] dtors = getDeclarators(); IASTDeclarator [] dtors = getDeclarators();
for( int i = 0; i < dtors.length; i++ ) for( int i = 0; i < dtors.length; i++ )
if( !dtors[i].accept( action ) ) return false; if( !dtors[i].accept( action ) ) return false;
if( action.shouldVisitDeclarations ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -52,6 +52,14 @@ public class CPPASTSimpleTypeConstructorExpression extends CPPASTNode implements
} }
if( init != null ) if( !init.accept( action ) ) return false; if( init != null ) if( !init.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -80,6 +80,14 @@ public class CPPASTSimpleTypeTemplateParameter extends CPPASTNode implements
if( name != null ) if( !name.accept( action ) ) return false; if( name != null ) if( !name.accept( action ) ) return false;
if( typeId != null ) if( !typeId.accept( action ) ) return false; if( typeId != null ) if( !typeId.accept( action ) ) return false;
if( action instanceof CPPASTVisitor &&
((CPPASTVisitor)action).shouldVisitTemplateParameters ){
switch( ((CPPASTVisitor)action).leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -69,6 +69,14 @@ public class CPPASTSwitchStatement extends CPPASTNode implements
if( controller != null ) if( !controller.accept( action ) ) return false; if( controller != null ) if( !controller.accept( action ) ) return false;
if( decl != null ) if( !decl.accept( action ) ) return false; if( decl != null ) if( !decl.accept( action ) ) return false;
if( body != null ) if( !body.accept( action ) ) return false; if( body != null ) if( !body.accept( action ) ) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -93,6 +93,14 @@ public class CPPASTTemplateDeclaration extends CPPASTNode implements
} }
if( declaration != null ) if( !declaration.accept( action ) ) return false; if( declaration != null ) if( !declaration.accept( action ) ) return false;
if( action.shouldVisitDeclarations ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -110,6 +110,13 @@ public class CPPASTTemplateId extends CPPASTNode implements ICPPASTTemplateId, I
for ( int i = 0; i < nodes.length; i++ ) { for ( int i = 0; i < nodes.length; i++ ) {
if( !nodes[i].accept( action ) ) return false; if( !nodes[i].accept( action ) ) return false;
} }
if( action.shouldVisitNames ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -52,6 +52,14 @@ public class CPPASTTemplateSpecialization extends CPPASTNode implements
} }
if( declaration != null ) if( !declaration.accept( action ) ) return false; if( declaration != null ) if( !declaration.accept( action ) ) return false;
if( action.shouldVisitDeclarations ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -88,6 +88,15 @@ public class CPPASTTemplatedTypeTemplateParameter extends CPPASTNode implements
} }
if( name != null ) if( !name.accept( action ) ) return false; if( name != null ) if( !name.accept( action ) ) return false;
if( defaultValue != null ) if( !defaultValue.accept( action ) ) return false; if( defaultValue != null ) if( !defaultValue.accept( action ) ) return false;
if( action instanceof CPPASTVisitor &&
((CPPASTVisitor)action).shouldVisitTemplateParameters ){
switch( ((CPPASTVisitor)action).leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -51,6 +51,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionTryBlockDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTOperatorName; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTOperatorName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace; import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage; import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
@ -135,7 +136,7 @@ public class CPPASTTranslationUnit extends CPPASTNode implements
// void * // void *
IType cpp_void_p = new GPPPointerType(new CPPQualifierType(new CPPBasicType(IBasicType.t_void, 0), false, false), new GPPASTPointer()); IType cpp_void_p = new GPPPointerType(new CPPQualifierType(new CPPBasicType(IBasicType.t_void, 0), false, false), new GPPASTPointer());
// size_t // assumed: unsigned long int // size_t // assumed: unsigned long int
IType cpp_size_t = new CPPBasicType(IBasicType.t_int, CPPBasicType.IS_LONG & CPPBasicType.IS_UNSIGNED); IType cpp_size_t = new CPPBasicType(IBasicType.t_int, ICPPBasicType.IS_LONG & ICPPBasicType.IS_UNSIGNED);
// void * operator new (std::size_t); // void * operator new (std::size_t);
IBinding temp = null; IBinding temp = null;
@ -555,6 +556,14 @@ public class CPPASTTranslationUnit extends CPPASTNode implements
for( int i = 0; i < ds.length; i++ ){ for( int i = 0; i < ds.length; i++ ){
if( !ds[i].accept( action ) ) return false; if( !ds[i].accept( action ) ) return false;
} }
if( action.shouldVisitTranslationUnit){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -75,6 +75,14 @@ public class CPPASTTryBlockStatement extends CPPASTNode implements
for ( int i = 0; i < handlers.length; i++ ) { for ( int i = 0; i < handlers.length; i++ ) {
if( !handlers[i].accept( action ) ) return false; if( !handlers[i].accept( action ) ) return false;
} }
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -62,6 +62,14 @@ public class CPPASTTypeId extends CPPASTNode implements IASTTypeId {
if( declSpec != null ) if( !declSpec.accept( action ) ) return false; if( declSpec != null ) if( !declSpec.accept( action ) ) return false;
if( absDecl != null ) if( !absDecl.accept( action ) ) return false; if( absDecl != null ) if( !absDecl.accept( action ) ) return false;
if( action.shouldVisitTypeIds ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -50,6 +50,14 @@ public class CPPASTTypeIdExpression extends CPPASTNode implements
} }
if( typeId != null ) if( !typeId.accept( action ) ) return false; if( typeId != null ) if( !typeId.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -63,6 +63,14 @@ public class CPPASTTypenameExpression extends CPPASTNode implements
if( name != null ) if( !name.accept( action ) ) return false; if( name != null ) if( !name.accept( action ) ) return false;
if( init != null ) if( !init.accept( action ) ) return false; if( init != null ) if( !init.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -52,6 +52,14 @@ public class CPPASTUnaryExpression extends CPPASTNode implements
} }
if( operand != null ) if( !operand.accept( action ) ) return false; if( operand != null ) if( !operand.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -61,6 +61,14 @@ public class CPPASTUsingDeclaration extends CPPASTNode implements
} }
if( name != null ) if( !name.accept( action ) ) return false; if( name != null ) if( !name.accept( action ) ) return false;
if( action.shouldVisitDeclarations ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -46,6 +46,14 @@ public class CPPASTUsingDirective extends CPPASTNode implements
} }
if( name != null ) if( !name.accept( action ) ) return false; if( name != null ) if( !name.accept( action ) ) return false;
if( action.shouldVisitDeclarations ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -82,6 +82,14 @@ public class CPPASTWhileStatement extends CPPASTNode implements
if( condition != null ) if( !condition.accept( action ) ) return false; if( condition != null ) if( !condition.accept( action ) ) return false;
if( condition2 != null ) if( !condition2.accept( action ) ) return false; if( condition2 != null ) if( !condition2.accept( action ) ) return false;
if( body != null ) if( !body.accept( action ) ) return false; if( body != null ) if( !body.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others. * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -79,6 +79,13 @@ public class GPPASTSimpleDeclSpecifier extends CPPASTSimpleDeclSpecifier
if( typeOfExpression != null ) if( typeOfExpression != null )
if( !typeOfExpression.accept( action ) ) return false; if( !typeOfExpression.accept( action ) ) return false;
if( action.shouldVisitDeclSpecifiers ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true; return true;
} }