mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-16 12:45:41 +02:00
Fixed Bugzilla Bug 87548 : [DOM AST] IASTName interface lacks methods to determine if name is a declaration, a definition or a reference
This commit is contained in:
parent
79386d0400
commit
f83e7a7c6f
62 changed files with 802 additions and 267 deletions
|
@ -241,6 +241,8 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
assertEquals(IASTDeclSpecifier.sc_typedef, type.getStorageClass());
|
assertEquals(IASTDeclSpecifier.sc_typedef, type.getStorageClass());
|
||||||
// this an anonymous struct
|
// this an anonymous struct
|
||||||
IASTName name_struct = type.getName();
|
IASTName name_struct = type.getName();
|
||||||
|
assertTrue( name_struct.isDeclaration() );
|
||||||
|
assertFalse( name_struct.isReference() );
|
||||||
assertNull("", name_struct.toString()); //$NON-NLS-1$
|
assertNull("", name_struct.toString()); //$NON-NLS-1$
|
||||||
// member - x
|
// member - x
|
||||||
IASTSimpleDeclaration decl_x = (IASTSimpleDeclaration) type
|
IASTSimpleDeclaration decl_x = (IASTSimpleDeclaration) type
|
||||||
|
@ -1707,6 +1709,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
.getDeclSpecifier();
|
.getDeclSpecifier();
|
||||||
ICompositeType A = (ICompositeType) elabSpec.getName().resolveBinding();
|
ICompositeType A = (ICompositeType) elabSpec.getName().resolveBinding();
|
||||||
IASTName name_A1 = elabSpec.getName();
|
IASTName name_A1 = elabSpec.getName();
|
||||||
|
assertTrue( name_A1.isDeclaration() );
|
||||||
|
|
||||||
decl = (IASTSimpleDeclaration) tu.getDeclarations()[1];
|
decl = (IASTSimpleDeclaration) tu.getDeclarations()[1];
|
||||||
IFunction f = (IFunction) decl.getDeclarators()[0].getName()
|
IFunction f = (IFunction) decl.getDeclarators()[0].getName()
|
||||||
|
|
|
@ -16,7 +16,7 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
*
|
*
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public interface IASTCompositeTypeSpecifier extends IASTDeclSpecifier {
|
public interface IASTCompositeTypeSpecifier extends IASTDeclSpecifier , IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>TYPE_NAME</code> represents the relationship between an
|
* <code>TYPE_NAME</code> represents the relationship between an
|
||||||
|
|
|
@ -15,7 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
*
|
*
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public interface IASTDeclarator extends IASTNode {
|
public interface IASTDeclarator extends IASTNode, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant - empty declarator array
|
* Constant - empty declarator array
|
||||||
|
|
|
@ -14,7 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
*
|
*
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public interface IASTElaboratedTypeSpecifier extends IASTDeclSpecifier {
|
public interface IASTElaboratedTypeSpecifier extends IASTDeclSpecifier, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enumeration.
|
* Enumeration.
|
||||||
|
|
|
@ -14,14 +14,14 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
*
|
*
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public interface IASTEnumerationSpecifier extends IASTDeclSpecifier {
|
public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface represents an enumerator member of an enum specifier.
|
* This interface represents an enumerator member of an enum specifier.
|
||||||
*
|
*
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public interface IASTEnumerator extends IASTNode {
|
public interface IASTEnumerator extends IASTNode, IASTNameOwner {
|
||||||
/**
|
/**
|
||||||
* Empty array (constant).
|
* Empty array (constant).
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,7 +17,7 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
*
|
*
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public interface IASTFieldReference extends IASTExpression {
|
public interface IASTFieldReference extends IASTExpression, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>FIELD_OWNER</code> represents the relationship between a
|
* <code>FIELD_OWNER</code> represents the relationship between a
|
||||||
|
|
|
@ -15,7 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
*
|
*
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public interface IASTGotoStatement extends IASTStatement {
|
public interface IASTGotoStatement extends IASTStatement, IASTNameOwner {
|
||||||
|
|
||||||
public static final ASTNodeProperty NAME = new ASTNodeProperty("name"); //$NON-NLS-1$
|
public static final ASTNodeProperty NAME = new ASTNodeProperty("name"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
*
|
*
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public interface IASTIdExpression extends IASTExpression {
|
public interface IASTIdExpression extends IASTExpression, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>ID_NAME</code> represents the relationship between an
|
* <code>ID_NAME</code> represents the relationship between an
|
||||||
|
|
|
@ -15,7 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
*
|
*
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public interface IASTLabelStatement extends IASTStatement {
|
public interface IASTLabelStatement extends IASTStatement, IASTNameOwner {
|
||||||
|
|
||||||
public static final ASTNodeProperty NAME = new ASTNodeProperty("name"); //$NON-NLS-1$
|
public static final ASTNodeProperty NAME = new ASTNodeProperty("name"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
|
@ -47,4 +47,16 @@ public interface IASTName extends IASTNode {
|
||||||
* @return ~ toString().toCharArray()
|
* @return ~ toString().toCharArray()
|
||||||
*/
|
*/
|
||||||
public char[] toCharArray();
|
public char[] toCharArray();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is this name being used in the AST as the introduction of a declaration?
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isDeclaration();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is this name being used in the AST as a reference rather than a declaration?
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isReference();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package org.eclipse.cdt.core.dom.ast;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface repesents a mechanism for a name to discover more information about it's parent.
|
||||||
|
* All interfaces that claim ownership/residence of a name should extend this interface.
|
||||||
|
*
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public interface IASTNameOwner {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Role of name in this context is a declaration.
|
||||||
|
*/
|
||||||
|
public static final int r_declaration = 0;
|
||||||
|
/**
|
||||||
|
* Role of name in this construct is a reference.
|
||||||
|
*/
|
||||||
|
public static final int r_reference = 1;
|
||||||
|
/**
|
||||||
|
* Role is unclear.
|
||||||
|
*/
|
||||||
|
public static final int r_unclear = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the role for the name.
|
||||||
|
*
|
||||||
|
* @param name <code>IASTName</code>
|
||||||
|
* @return r_declaration, r_reference or r_unclear.
|
||||||
|
*/
|
||||||
|
public int getRoleForName( IASTName n );
|
||||||
|
|
||||||
|
}
|
|
@ -16,7 +16,7 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
*
|
*
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public interface IASTNamedTypeSpecifier extends IASTDeclSpecifier {
|
public interface IASTNamedTypeSpecifier extends IASTDeclSpecifier, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>NAME</code> describes the relationship between an
|
* <code>NAME</code> describes the relationship between an
|
||||||
|
|
|
@ -16,7 +16,7 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public interface IASTPreprocessorMacroDefinition extends
|
public interface IASTPreprocessorMacroDefinition extends
|
||||||
IASTPreprocessorStatement {
|
IASTPreprocessorStatement, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>MACRO_NAME</code> describes the relationship between a macro
|
* <code>MACRO_NAME</code> describes the relationship between a macro
|
||||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,7 +51,7 @@ public interface ICPPASTCompositeTypeSpecifier extends
|
||||||
*
|
*
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public static interface ICPPASTBaseSpecifier extends IASTNode {
|
public static interface ICPPASTBaseSpecifier extends IASTNode, IASTNameOwner {
|
||||||
/**
|
/**
|
||||||
* Constant.
|
* Constant.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,12 +13,13 @@ package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTConstructorChainInitializer extends IASTNode {
|
public interface ICPPASTConstructorChainInitializer extends IASTNode, IASTNameOwner {
|
||||||
/**
|
/**
|
||||||
* Constant.
|
* Constant.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface represents a namespace alias in C++. e.g. namespace ABC { int
|
* This interface represents a namespace alias in C++. e.g. namespace ABC { int
|
||||||
|
@ -20,7 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
*
|
*
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTNamespaceAlias extends IASTDeclaration {
|
public interface ICPPASTNamespaceAlias extends IASTDeclaration, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>ALIAS_NAME</code> represents the new namespace name being
|
* <code>ALIAS_NAME</code> represents the new namespace name being
|
||||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
*
|
*
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTNamespaceDefinition extends IASTDeclaration {
|
public interface ICPPASTNamespaceDefinition extends IASTDeclaration, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>OWNED_DECLARATION</code> is the role served by all the nested
|
* <code>OWNED_DECLARATION</code> is the role served by all the nested
|
||||||
|
|
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTPointer;
|
import org.eclipse.cdt.core.dom.ast.IASTPointer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,7 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IASTPointer;
|
||||||
*
|
*
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTPointerToMember extends IASTPointer {
|
public interface ICPPASTPointerToMember extends IASTPointer, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This property refers to the nested name.
|
* This property refers to the nested name.
|
||||||
|
|
|
@ -12,13 +12,14 @@ package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is a qualified name in C++.
|
* This interface is a qualified name in C++.
|
||||||
*
|
*
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTQualifiedName extends IASTName {
|
public interface ICPPASTQualifiedName extends IASTName, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Each IASTName segment has property being <code>SEGMENT_NAME</code>.
|
* Each IASTName segment has property being <code>SEGMENT_NAME</code>.
|
||||||
|
|
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTSimpleTypeTemplateParameter extends
|
public interface ICPPASTSimpleTypeTemplateParameter extends
|
||||||
ICPPASTTemplateParameter {
|
ICPPASTTemplateParameter, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>st_class</code> represents a class.
|
* <code>st_class</code> represents a class.
|
||||||
|
|
|
@ -13,13 +13,14 @@ package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTTemplateId extends IASTName {
|
public interface ICPPASTTemplateId extends IASTName, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TEMPLATE_NAME is the IASTName.
|
* TEMPLATE_NAME is the IASTName.
|
||||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a templated template parameter.
|
* This is a templated template parameter.
|
||||||
|
@ -20,7 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTTemplatedTypeTemplateParameter extends
|
public interface ICPPASTTemplatedTypeTemplateParameter extends
|
||||||
ICPPASTTemplateParameter {
|
ICPPASTTemplateParameter, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PARAMETER
|
* PARAMETER
|
||||||
|
|
|
@ -13,11 +13,12 @@ package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTTypenameExpression extends IASTExpression {
|
public interface ICPPASTTypenameExpression extends IASTExpression, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Was template token consumed?
|
* Was template token consumed?
|
||||||
|
|
|
@ -13,13 +13,14 @@ package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface represents a using declaration.
|
* This interface represents a using declaration.
|
||||||
*
|
*
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTUsingDeclaration extends IASTDeclaration {
|
public interface ICPPASTUsingDeclaration extends IASTDeclaration, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>NAME</code> is the qualified name brought into scope.
|
* <code>NAME</code> is the qualified name brought into scope.
|
||||||
|
|
|
@ -13,13 +13,14 @@ package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface represents a C++ using directive.
|
* This interface represents a C++ using directive.
|
||||||
*
|
*
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTUsingDirective extends IASTDeclaration {
|
public interface ICPPASTUsingDirective extends IASTDeclaration, IASTNameOwner {
|
||||||
/**
|
/**
|
||||||
* Constant.
|
* Constant.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -15,13 +15,14 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the declarator for a K&R C Function.
|
* This is the declarator for a K&R C Function.
|
||||||
*
|
*
|
||||||
* @author dsteffle
|
* @author dsteffle
|
||||||
*/
|
*/
|
||||||
public interface ICASTKnRFunctionDeclarator extends IASTFunctionDeclarator {
|
public interface ICASTKnRFunctionDeclarator extends IASTFunctionDeclarator, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>PARAMETER_NAME</code> refers to the names qualified in a K&R C
|
* <code>PARAMETER_NAME</code> refers to the names qualified in a K&R C
|
||||||
|
|
|
@ -135,4 +135,13 @@ public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName name) {
|
||||||
|
if( name == this.name )
|
||||||
|
return r_declaration;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,11 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
|
|
||||||
|
@ -140,4 +142,29 @@ public class CASTDeclarator extends CASTNode implements IASTDeclarator {
|
||||||
if( initializer != null ) if( !initializer.accept( action ) ) return false;
|
if( initializer != null ) if( !initializer.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName name) {
|
||||||
|
if( name == this.name )
|
||||||
|
{
|
||||||
|
IASTNode getParent = getParent();
|
||||||
|
if( getParent instanceof IASTDeclaration )
|
||||||
|
return r_declaration;
|
||||||
|
if( getParent instanceof IASTTypeId )
|
||||||
|
return r_reference;
|
||||||
|
if( getParent instanceof IASTDeclarator )
|
||||||
|
{
|
||||||
|
IASTNode t = getParent;
|
||||||
|
while ( t instanceof IASTDeclarator )
|
||||||
|
t = t.getParent();
|
||||||
|
if( t instanceof IASTDeclaration )
|
||||||
|
return r_declaration;
|
||||||
|
if( t instanceof IASTTypeId )
|
||||||
|
return r_reference;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,4 +61,13 @@ public class CASTElaboratedTypeSpecifier extends CASTBaseDeclSpecifier implement
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName name) {
|
||||||
|
if( this.name == name )
|
||||||
|
return r_declaration;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,4 +104,13 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName name) {
|
||||||
|
if( this.name == name )
|
||||||
|
return r_declaration;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,4 +63,12 @@ public class CASTEnumerator extends CASTNode implements IASTEnumerator {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( n == name )return r_declaration;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,4 +78,13 @@ public class CASTFieldReference extends CASTNode implements IASTFieldReference {
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName name) {
|
||||||
|
if( name == this.name )
|
||||||
|
return r_reference;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,4 +45,12 @@ public class CASTGotoStatement extends CASTNode implements IASTGotoStatement {
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( n == name ) return r_reference;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,4 +46,12 @@ public class CASTIdExpression extends CASTNode implements IASTIdExpression {
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( n == name ) return r_reference;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,4 +91,14 @@ public class CASTKnRFunctionDeclarator extends CASTDeclarator implements ICASTKn
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CASTDeclarator#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName name) {
|
||||||
|
IASTName [] n = getParameterNames();
|
||||||
|
for( int i = 0; i < n.length; ++i )
|
||||||
|
if( n[i] == name ) return r_unclear;
|
||||||
|
return super.getRoleForName(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,4 +45,12 @@ public class CASTLabelStatement extends CASTNode implements IASTLabelStatement {
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( n == name ) return r_declaration;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@ package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,4 +84,30 @@ public class CASTName extends CASTNode implements IASTName {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTName#isDeclaration()
|
||||||
|
*/
|
||||||
|
public boolean isDeclaration() {
|
||||||
|
IASTNode parent = getParent();
|
||||||
|
if (parent instanceof IASTNameOwner) {
|
||||||
|
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||||
|
if( role == IASTNameOwner.r_reference ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTName#isReference()
|
||||||
|
*/
|
||||||
|
public boolean isReference() {
|
||||||
|
IASTNode parent = getParent();
|
||||||
|
if (parent instanceof IASTNameOwner) {
|
||||||
|
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||||
|
if( role == IASTNameOwner.r_reference ) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,4 +46,12 @@ public class CASTTypedefNameSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( n == name ) return r_reference;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,4 +81,12 @@ public class CPPASTBaseSpecifier extends CPPASTNode implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( name == n ) return r_reference;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,4 +186,13 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName name) {
|
||||||
|
if( name == this.n )
|
||||||
|
return r_declaration;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,4 +57,12 @@ public class CPPASTConstructorChainInitializer extends CPPASTNode implements
|
||||||
if( value != null ) if( !value.accept( action ) ) return false;
|
if( value != null ) if( !value.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( name == n ) return r_reference;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,4 +141,16 @@ public class CPPASTDeclarator extends CPPASTNode implements IASTDeclarator {
|
||||||
if( initializer != null ) if( !initializer.accept( action ) ) return false;
|
if( initializer != null ) if( !initializer.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( name == n )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,4 +62,12 @@ public class CPPASTElaboratedTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( n == name ) return r_reference; //TODO is this right?
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,17 +23,17 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#addEnumerator(org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator)
|
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#addEnumerator(org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator)
|
||||||
*/
|
*/
|
||||||
public void addEnumerator(IASTEnumerator enumerator) {
|
public void addEnumerator(IASTEnumerator enumerator) {
|
||||||
if( enumerators == null )
|
if (enumerators == null) {
|
||||||
{
|
|
||||||
enumerators = new IASTEnumerator[DEFAULT_ENUMERATORS_LIST_SIZE];
|
enumerators = new IASTEnumerator[DEFAULT_ENUMERATORS_LIST_SIZE];
|
||||||
currentIndex = 0;
|
currentIndex = 0;
|
||||||
}
|
}
|
||||||
if( enumerators.length == currentIndex )
|
if (enumerators.length == currentIndex) {
|
||||||
{
|
|
||||||
IASTEnumerator[] old = enumerators;
|
IASTEnumerator[] old = enumerators;
|
||||||
enumerators = new IASTEnumerator[old.length * 2];
|
enumerators = new IASTEnumerator[old.length * 2];
|
||||||
for (int i = 0; i < old.length; ++i)
|
for (int i = 0; i < old.length; ++i)
|
||||||
|
@ -42,11 +42,14 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
enumerators[currentIndex++] = enumerator;
|
enumerators[currentIndex++] = enumerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#getEnumerators()
|
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#getEnumerators()
|
||||||
*/
|
*/
|
||||||
public IASTEnumerator[] getEnumerators() {
|
public IASTEnumerator[] getEnumerators() {
|
||||||
if( enumerators == null ) return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY;
|
if (enumerators == null)
|
||||||
|
return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY;
|
||||||
removeNullEnumerators();
|
removeNullEnumerators();
|
||||||
return enumerators;
|
return enumerators;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +59,8 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
for (int i = 0; i < enumerators.length; ++i)
|
for (int i = 0; i < enumerators.length; ++i)
|
||||||
if (enumerators[i] == null)
|
if (enumerators[i] == null)
|
||||||
++nullCount;
|
++nullCount;
|
||||||
if( nullCount == 0 ) return;
|
if (nullCount == 0)
|
||||||
|
return;
|
||||||
IASTEnumerator[] old = enumerators;
|
IASTEnumerator[] old = enumerators;
|
||||||
int newSize = old.length - nullCount;
|
int newSize = old.length - nullCount;
|
||||||
enumerators = new IASTEnumerator[newSize];
|
enumerators = new IASTEnumerator[newSize];
|
||||||
|
@ -66,24 +70,32 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
}
|
}
|
||||||
|
|
||||||
private int currentIndex = 0;
|
private int currentIndex = 0;
|
||||||
|
|
||||||
private IASTEnumerator[] enumerators = null;
|
private IASTEnumerator[] enumerators = null;
|
||||||
|
|
||||||
private static final int DEFAULT_ENUMERATORS_LIST_SIZE = 4;
|
private static final int DEFAULT_ENUMERATORS_LIST_SIZE = 4;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
*/
|
*/
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#getName()
|
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#getName()
|
||||||
*/
|
*/
|
||||||
public IASTName getName() {
|
public IASTName getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#getUnpreprocessedSignature()
|
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#getUnpreprocessedSignature()
|
||||||
*/
|
*/
|
||||||
public String getUnpreprocessedSignature() {
|
public String getUnpreprocessedSignature() {
|
||||||
|
@ -93,16 +105,33 @@ 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 : return false;
|
case ASTVisitor.PROCESS_ABORT:
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
return false;
|
||||||
default : break;
|
case ASTVisitor.PROCESS_SKIP:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
if (name != null)
|
||||||
|
if (!name.accept(action))
|
||||||
|
return false;
|
||||||
IASTEnumerator[] enums = getEnumerators();
|
IASTEnumerator[] enums = getEnumerators();
|
||||||
for (int i = 0; i < enums.length; i++)
|
for (int i = 0; i < enums.length; i++)
|
||||||
if( !enums[i].accept( action ) ) return false;
|
if (!enums[i].accept(action))
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if (name == n)
|
||||||
|
return r_declaration;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,4 +62,13 @@ public class CPPASTEnumerator extends CPPASTNode implements IASTEnumerator {
|
||||||
if( value != null ) if( !value.accept( action ) ) return false;
|
if( value != null ) if( !value.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( name == n )
|
||||||
|
return r_declaration;
|
||||||
|
return r_reference;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,5 +96,14 @@ public class CPPASTFieldReference extends CPPASTNode implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( n == name )
|
||||||
|
return r_reference;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,4 +46,12 @@ public class CPPASTGotoStatement extends CPPASTNode implements
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( name == n ) return r_reference;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,4 +46,12 @@ 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;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( name == n )return r_reference;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,4 +46,12 @@ public class CPPASTLabelStatement extends CPPASTNode implements
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( n == name ) return r_declaration;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,4 +87,30 @@ public class CPPASTName extends CPPASTNode implements IASTName {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTName#isDeclaration()
|
||||||
|
*/
|
||||||
|
public boolean isDeclaration() {
|
||||||
|
IASTNode parent = getParent();
|
||||||
|
if (parent instanceof IASTNameOwner) {
|
||||||
|
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||||
|
if( role == IASTNameOwner.r_reference ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTName#isReference()
|
||||||
|
*/
|
||||||
|
public boolean isReference() {
|
||||||
|
IASTNode parent = getParent();
|
||||||
|
if (parent instanceof IASTNameOwner) {
|
||||||
|
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||||
|
if( role == IASTNameOwner.r_reference ) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,4 +62,13 @@ public class CPPASTNamedTypeSpecifier extends CPPASTBaseDeclSpecifier implements
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( n == name )
|
||||||
|
return r_reference;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,4 +65,13 @@ public class CPPASTNamespaceAlias extends CPPASTNode implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( alias == n ) return r_declaration;
|
||||||
|
if( qualifiedName == n ) return r_reference;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,4 +116,12 @@ public class CPPASTNamespaceDefinition extends CPPASTNode implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( name == n ) return r_declaration;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,4 +40,13 @@ public class CPPASTPointerToMember extends CPPASTPointer implements
|
||||||
if( n != null ) if( !n.accept( action ) ) return false;
|
if( n != null ) if( !n.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName name ) {
|
||||||
|
if( name == this.n )
|
||||||
|
return r_declaration;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
|
|
||||||
|
@ -49,7 +51,8 @@ public class CPPASTQualifiedName extends CPPASTNode implements
|
||||||
* @see java.lang.Object#toString()
|
* @see java.lang.Object#toString()
|
||||||
*/
|
*/
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if( signature == null ) return ""; //$NON-NLS-1$
|
if (signature == null)
|
||||||
|
return ""; //$NON-NLS-1$
|
||||||
return signature;
|
return signature;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,9 +94,13 @@ public class CPPASTQualifiedName extends CPPASTNode implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private int currentIndex = 0;
|
private int currentIndex = 0;
|
||||||
|
|
||||||
private IASTName[] names = null;
|
private IASTName[] names = null;
|
||||||
|
|
||||||
private static final int DEFAULT_NAMES_LIST_SIZE = 4;
|
private static final int DEFAULT_NAMES_LIST_SIZE = 4;
|
||||||
|
|
||||||
private boolean value;
|
private boolean value;
|
||||||
|
|
||||||
private String signature;
|
private String signature;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -172,18 +179,68 @@ public class CPPASTQualifiedName extends CPPASTNode implements
|
||||||
public boolean accept(ASTVisitor action) {
|
public boolean accept(ASTVisitor action) {
|
||||||
if (action.shouldVisitNames) {
|
if (action.shouldVisitNames) {
|
||||||
switch (action.visit(this)) {
|
switch (action.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT:
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
return false;
|
||||||
default : break;
|
case ASTVisitor.PROCESS_SKIP:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IASTName[] ns = getNames();
|
IASTName[] ns = getNames();
|
||||||
for (int i = 0; i < ns.length; i++) {
|
for (int i = 0; i < ns.length; i++) {
|
||||||
if (i == names.length - 1) {
|
if (i == names.length - 1) {
|
||||||
if( names[i].toCharArray().length > 0 && !names[i].accept( action ) ) return false;
|
if (names[i].toCharArray().length > 0
|
||||||
} else if( !names[i].accept( action ) ) return false;
|
&& !names[i].accept(action))
|
||||||
|
return false;
|
||||||
|
} else if (!names[i].accept(action))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTName#isDeclaration()
|
||||||
|
*/
|
||||||
|
public boolean isDeclaration() {
|
||||||
|
IASTNode parent = getParent();
|
||||||
|
if (parent instanceof IASTNameOwner) {
|
||||||
|
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||||
|
if( role == IASTNameOwner.r_reference ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTName#isReference()
|
||||||
|
*/
|
||||||
|
public boolean isReference() {
|
||||||
|
IASTNode parent = getParent();
|
||||||
|
if (parent instanceof IASTNameOwner) {
|
||||||
|
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||||
|
if( role == IASTNameOwner.r_reference ) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
IASTName [] namez = getNames();
|
||||||
|
for( int i = 0; i < names.length; ++i )
|
||||||
|
if( namez[i] == n )
|
||||||
|
{
|
||||||
|
if( i < names.length - 1 )
|
||||||
|
return r_reference;
|
||||||
|
IASTNode p = getParent();
|
||||||
|
if( i == names.length - 1 && p instanceof IASTNameOwner )
|
||||||
|
return ((IASTNameOwner)p).getRoleForName(this);
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -81,4 +81,13 @@ public class CPPASTSimpleTypeTemplateParameter extends CPPASTNode implements
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( n == name )
|
||||||
|
return r_declaration;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,4 +145,27 @@ public class CPPASTTemplateId extends CPPASTNode implements ICPPASTTemplateId {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTName#isDeclaration()
|
||||||
|
*/
|
||||||
|
public boolean isDeclaration() {
|
||||||
|
return false; //for now this seems to be true
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTName#isReference()
|
||||||
|
*/
|
||||||
|
public boolean isReference() {
|
||||||
|
return true; //for now this seems to be true
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( n == templateName )
|
||||||
|
return r_reference;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,4 +110,13 @@ public class CPPASTTemplatedTypeTemplateParameter extends CPPASTNode implements
|
||||||
if( defaultValue != null ) if( !defaultValue.accept( action ) ) return false;
|
if( defaultValue != null ) if( !defaultValue.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( n == name )
|
||||||
|
return r_declaration;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,4 +80,13 @@ public class CPPASTTypenameExpression extends CPPASTNode implements
|
||||||
if( init != null ) if( !init.accept( action ) ) return false;
|
if( init != null ) if( !init.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( n == name )
|
||||||
|
return r_reference;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,4 +63,13 @@ public class CPPASTUsingDeclaration extends CPPASTNode implements
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( n == name )
|
||||||
|
return r_reference;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,4 +48,13 @@ public class CPPASTUsingDirective extends CPPASTNode implements
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( n == name )
|
||||||
|
return r_reference;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -495,6 +495,13 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog {
|
||||||
public void setExpansion(String exp) {
|
public void setExpansion(String exp) {
|
||||||
this.expansion = exp;
|
this.expansion = exp;
|
||||||
}
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( name == n ) return r_declaration;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,6 +624,22 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new String(name);
|
return new String(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTName#isDeclaration()
|
||||||
|
*/
|
||||||
|
public boolean isDeclaration() {
|
||||||
|
if (getParent() instanceof IASTPreprocessorMacroDefinition && getPropertyInParent() == IASTPreprocessorMacroDefinition.MACRO_NAME )
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTName#isReference()
|
||||||
|
*/
|
||||||
|
public boolean isReference() {
|
||||||
|
return !isDeclaration();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -626,6 +649,13 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog {
|
||||||
IASTPreprocessorObjectStyleMacroDefinition {
|
IASTPreprocessorObjectStyleMacroDefinition {
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
*/
|
||||||
|
public int getRoleForName(IASTName n) {
|
||||||
|
if( name == n ) return r_declaration;
|
||||||
|
return r_unclear;
|
||||||
|
}
|
||||||
|
|
||||||
private String expansion;
|
private String expansion;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue