mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
Code formatting.
This commit is contained in:
parent
4f541baeb7
commit
fc22e5fdce
10 changed files with 94 additions and 119 deletions
|
@ -21,7 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public interface ICPPClassType extends ICompositeType, ICPPBinding {
|
public interface ICPPClassType extends ICompositeType, ICPPBinding {
|
||||||
public static final ICPPClassType [] EMPTY_CLASS_ARRAY = new ICPPClassType[0];
|
public static final ICPPClassType[] EMPTY_CLASS_ARRAY = new ICPPClassType[0];
|
||||||
public static final int k_class = ICPPASTCompositeTypeSpecifier.k_class;
|
public static final int k_class = ICPPASTCompositeTypeSpecifier.k_class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,5 +103,5 @@ public interface ICPPClassType extends ICompositeType, ICPPBinding {
|
||||||
* return an array of nested classes/structures
|
* return an array of nested classes/structures
|
||||||
* @throws DOMException
|
* @throws DOMException
|
||||||
*/
|
*/
|
||||||
public ICPPClassType [] getNestedClasses() throws DOMException;
|
public ICPPClassType[] getNestedClasses() throws DOMException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,13 +33,11 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTDeclarator extends ASTNode implements IASTDeclarator, IASTAmbiguityParent {
|
public class CASTDeclarator extends ASTNode implements IASTDeclarator, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IASTInitializer initializer;
|
private IASTInitializer initializer;
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
private IASTDeclarator nestedDeclarator;
|
private IASTDeclarator nestedDeclarator;
|
||||||
private IASTPointerOperator [] pointerOps = null;
|
private IASTPointerOperator[] pointerOps = null;
|
||||||
private int pointerOpsPos=-1;
|
private int pointerOpsPos= -1;
|
||||||
|
|
||||||
|
|
||||||
public CASTDeclarator() {
|
public CASTDeclarator() {
|
||||||
}
|
}
|
||||||
|
@ -54,8 +52,8 @@ public class CASTDeclarator extends ASTNode implements IASTDeclarator, IASTAmbig
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTPointerOperator[] getPointerOperators() {
|
public IASTPointerOperator[] getPointerOperators() {
|
||||||
if( pointerOps == null ) return IASTPointerOperator.EMPTY_ARRAY;
|
if (pointerOps == null) return IASTPointerOperator.EMPTY_ARRAY;
|
||||||
pointerOps = (IASTPointerOperator[]) ArrayUtil.removeNullsAfter( IASTPointerOperator.class, pointerOps, pointerOpsPos );
|
pointerOps = (IASTPointerOperator[]) ArrayUtil.removeNullsAfter(IASTPointerOperator.class, pointerOps, pointerOpsPos);
|
||||||
return pointerOps;
|
return pointerOps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +69,6 @@ public class CASTDeclarator extends ASTNode implements IASTDeclarator, IASTAmbig
|
||||||
return initializer;
|
return initializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setInitializer(IASTInitializer initializer) {
|
public void setInitializer(IASTInitializer initializer) {
|
||||||
this.initializer = initializer;
|
this.initializer = initializer;
|
||||||
if (initializer != null) {
|
if (initializer != null) {
|
||||||
|
@ -84,7 +81,7 @@ public class CASTDeclarator extends ASTNode implements IASTDeclarator, IASTAmbig
|
||||||
if (operator != null) {
|
if (operator != null) {
|
||||||
operator.setParent(this);
|
operator.setParent(this);
|
||||||
operator.setPropertyInParent(POINTER_OPERATOR);
|
operator.setPropertyInParent(POINTER_OPERATOR);
|
||||||
pointerOps = (IASTPointerOperator[]) ArrayUtil.append( IASTPointerOperator.class, pointerOps, ++pointerOpsPos, operator );
|
pointerOps = (IASTPointerOperator[]) ArrayUtil.append(IASTPointerOperator.class, pointerOps, ++pointerOpsPos, operator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,35 +102,36 @@ public class CASTDeclarator extends ASTNode implements IASTDeclarator, IASTAmbig
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept(ASTVisitor action) {
|
||||||
if( action.shouldVisitDeclarators ){
|
if (action.shouldVisitDeclarators) {
|
||||||
switch( action.visit( this ) ){
|
switch(action.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
default : break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getPropertyInParent() != IASTTypeId.ABSTRACT_DECLARATOR && nestedDeclarator == null) {
|
||||||
if( getPropertyInParent() != IASTTypeId.ABSTRACT_DECLARATOR &&
|
if (getParent() instanceof IASTDeclarator) {
|
||||||
nestedDeclarator == null )
|
|
||||||
{
|
|
||||||
if( getParent() instanceof IASTDeclarator )
|
|
||||||
{
|
|
||||||
IASTDeclarator outermostDeclarator = (IASTDeclarator) getParent();
|
IASTDeclarator outermostDeclarator = (IASTDeclarator) getParent();
|
||||||
while( outermostDeclarator.getParent() instanceof IASTDeclarator )
|
while (outermostDeclarator.getParent() instanceof IASTDeclarator)
|
||||||
outermostDeclarator = (IASTDeclarator) outermostDeclarator.getParent();
|
outermostDeclarator = (IASTDeclarator) outermostDeclarator.getParent();
|
||||||
if( outermostDeclarator.getPropertyInParent() != IASTTypeId.ABSTRACT_DECLARATOR )
|
if (outermostDeclarator.getPropertyInParent() != IASTTypeId.ABSTRACT_DECLARATOR &&
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
name != null && !name.accept(action)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (name != null && !name.accept(action)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
|
||||||
}
|
}
|
||||||
if( nestedDeclarator != null ) if( !nestedDeclarator.accept( action ) ) return false;
|
if (nestedDeclarator != null && !nestedDeclarator.accept(action)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
IASTPointerOperator [] ptrOps = getPointerOperators();
|
IASTPointerOperator[] ptrOps = getPointerOperators();
|
||||||
for ( int i = 0; i < ptrOps.length; i++ ) {
|
for (int i = 0; i < ptrOps.length; i++) {
|
||||||
if( !ptrOps[i].accept( action ) ) return false;
|
if (!ptrOps[i].accept(action))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!postAccept(action))
|
if (!postAccept(action))
|
||||||
|
@ -145,67 +143,59 @@ public class CASTDeclarator extends ASTNode implements IASTDeclarator, IASTAmbig
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean postAccept( ASTVisitor action ){
|
protected boolean postAccept(ASTVisitor action) {
|
||||||
if (initializer != null && !initializer.accept(action))
|
if (initializer != null && !initializer.accept(action))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRoleForName(IASTName n ) {
|
public int getRoleForName(IASTName n) {
|
||||||
if( n == this.name )
|
if (n == this.name) {
|
||||||
{
|
|
||||||
IASTNode getParent = getParent();
|
IASTNode getParent = getParent();
|
||||||
boolean fnDtor = ( this instanceof IASTFunctionDeclarator );
|
boolean fnDtor = (this instanceof IASTFunctionDeclarator);
|
||||||
if( getParent instanceof IASTDeclaration )
|
if (getParent instanceof IASTDeclaration) {
|
||||||
{
|
if (getParent instanceof IASTFunctionDefinition)
|
||||||
if( getParent instanceof IASTFunctionDefinition )
|
|
||||||
return r_definition;
|
return r_definition;
|
||||||
if( getParent instanceof IASTSimpleDeclaration )
|
if (getParent instanceof IASTSimpleDeclaration) {
|
||||||
{
|
|
||||||
IASTSimpleDeclaration sd = (IASTSimpleDeclaration) getParent;
|
IASTSimpleDeclaration sd = (IASTSimpleDeclaration) getParent;
|
||||||
int storage = sd.getDeclSpecifier().getStorageClass();
|
int storage = sd.getDeclSpecifier().getStorageClass();
|
||||||
if( getInitializer() != null || storage == IASTDeclSpecifier.sc_typedef )
|
if (getInitializer() != null || storage == IASTDeclSpecifier.sc_typedef)
|
||||||
return r_definition;
|
return r_definition;
|
||||||
|
|
||||||
if( storage == IASTDeclSpecifier.sc_extern ||
|
if (storage == IASTDeclSpecifier.sc_extern || storage == IASTDeclSpecifier.sc_static) {
|
||||||
storage == IASTDeclSpecifier.sc_static )
|
return r_declaration;
|
||||||
{
|
}
|
||||||
return r_declaration;
|
|
||||||
}
|
|
||||||
|
|
||||||
return fnDtor ? r_declaration : r_definition;
|
return fnDtor ? r_declaration : r_definition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( getParent instanceof IASTTypeId )
|
if (getParent instanceof IASTTypeId)
|
||||||
return r_reference;
|
return r_reference;
|
||||||
if( getParent instanceof IASTDeclarator )
|
if (getParent instanceof IASTDeclarator) {
|
||||||
{
|
|
||||||
IASTNode t = getParent;
|
IASTNode t = getParent;
|
||||||
while ( t instanceof IASTDeclarator )
|
while (t instanceof IASTDeclarator)
|
||||||
t = t.getParent();
|
t = t.getParent();
|
||||||
if( t instanceof IASTDeclaration )
|
if (t instanceof IASTDeclaration) {
|
||||||
{
|
if (getParent instanceof IASTFunctionDefinition)
|
||||||
if( getParent instanceof IASTFunctionDefinition )
|
|
||||||
return r_definition;
|
return r_definition;
|
||||||
if( getParent instanceof IASTSimpleDeclaration )
|
if (getParent instanceof IASTSimpleDeclaration) {
|
||||||
{
|
if (getInitializer() != null)
|
||||||
if( getInitializer() != null )
|
|
||||||
return r_definition;
|
return r_definition;
|
||||||
IASTSimpleDeclaration sd = (IASTSimpleDeclaration) getParent;
|
IASTSimpleDeclaration sd = (IASTSimpleDeclaration) getParent;
|
||||||
int storage = sd.getDeclSpecifier().getStorageClass();
|
int storage = sd.getDeclSpecifier().getStorageClass();
|
||||||
if( storage == IASTDeclSpecifier.sc_extern ||
|
if (storage == IASTDeclSpecifier.sc_extern || storage == IASTDeclSpecifier.sc_static) {
|
||||||
storage == IASTDeclSpecifier.sc_static)
|
|
||||||
return r_declaration;
|
return r_declaration;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return fnDtor ? r_declaration : r_definition;
|
return fnDtor ? r_declaration : r_definition;
|
||||||
}
|
}
|
||||||
if( t instanceof IASTTypeId )
|
if (t instanceof IASTTypeId)
|
||||||
return r_reference;
|
return r_reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( getParent instanceof IASTParameterDeclaration )
|
if (getParent instanceof IASTParameterDeclaration)
|
||||||
return ( n.toCharArray().length > 0 ) ? r_definition : r_declaration;
|
return (n.toCharArray().length > 0) ? r_definition : r_declaration;
|
||||||
}
|
}
|
||||||
return r_unclear;
|
return r_unclear;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,8 @@ public class CPPASTDeclarator extends ASTNode implements IASTDeclarator {
|
||||||
private IASTInitializer initializer;
|
private IASTInitializer initializer;
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
private IASTDeclarator nestedDeclarator;
|
private IASTDeclarator nestedDeclarator;
|
||||||
private IASTPointerOperator [] pointerOps = null;
|
private IASTPointerOperator[] pointerOps = null;
|
||||||
private int pointerOpsPos=-1;
|
private int pointerOpsPos= -1;
|
||||||
|
|
||||||
|
|
||||||
public CPPASTDeclarator() {
|
public CPPASTDeclarator() {
|
||||||
}
|
}
|
||||||
|
@ -52,8 +51,8 @@ public class CPPASTDeclarator extends ASTNode implements IASTDeclarator {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTPointerOperator[] getPointerOperators() {
|
public IASTPointerOperator[] getPointerOperators() {
|
||||||
if( pointerOps == null ) return IASTPointerOperator.EMPTY_ARRAY;
|
if (pointerOps == null) return IASTPointerOperator.EMPTY_ARRAY;
|
||||||
pointerOps = (IASTPointerOperator[]) ArrayUtil.removeNullsAfter( IASTPointerOperator.class, pointerOps, pointerOpsPos );
|
pointerOps = (IASTPointerOperator[]) ArrayUtil.removeNullsAfter(IASTPointerOperator.class, pointerOps, pointerOpsPos);
|
||||||
return pointerOps;
|
return pointerOps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +80,7 @@ public class CPPASTDeclarator extends ASTNode implements IASTDeclarator {
|
||||||
if (operator != null) {
|
if (operator != null) {
|
||||||
operator.setParent(this);
|
operator.setParent(this);
|
||||||
operator.setPropertyInParent(POINTER_OPERATOR);
|
operator.setPropertyInParent(POINTER_OPERATOR);
|
||||||
pointerOps = (IASTPointerOperator[]) ArrayUtil.append( IASTPointerOperator.class, pointerOps, ++pointerOpsPos, operator );
|
pointerOps = (IASTPointerOperator[]) ArrayUtil.append(IASTPointerOperator.class, pointerOps, ++pointerOpsPos, operator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +92,6 @@ public class CPPASTDeclarator extends ASTNode implements IASTDeclarator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
|
@ -103,18 +101,18 @@ public class CPPASTDeclarator extends ASTNode implements IASTDeclarator {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept(ASTVisitor action) {
|
||||||
if( action.shouldVisitDeclarators ){
|
if (action.shouldVisitDeclarators) {
|
||||||
switch( action.visit( this ) ){
|
switch(action.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default : break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IASTPointerOperator [] ptrOps = getPointerOperators();
|
IASTPointerOperator[] ptrOps = getPointerOperators();
|
||||||
for ( int i = 0; i < ptrOps.length; i++ ) {
|
for (int i = 0; i < ptrOps.length; i++) {
|
||||||
if( !ptrOps[i].accept( action ) ) return false;
|
if (!ptrOps[i].accept(action)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nestedDeclarator == null && name != null) {
|
if (nestedDeclarator == null && name != null) {
|
||||||
|
@ -147,55 +145,47 @@ public class CPPASTDeclarator extends ASTNode implements IASTDeclarator {
|
||||||
|
|
||||||
public int getRoleForName(IASTName n) {
|
public int getRoleForName(IASTName n) {
|
||||||
IASTNode getParent = getParent();
|
IASTNode getParent = getParent();
|
||||||
boolean fnDtor = ( this instanceof IASTFunctionDeclarator );
|
boolean fnDtor = (this instanceof IASTFunctionDeclarator);
|
||||||
if( getParent instanceof IASTDeclaration )
|
if (getParent instanceof IASTDeclaration) {
|
||||||
{
|
if (getParent instanceof IASTFunctionDefinition)
|
||||||
if( getParent instanceof IASTFunctionDefinition )
|
|
||||||
return r_definition;
|
return r_definition;
|
||||||
if( getParent instanceof IASTSimpleDeclaration ) {
|
if (getParent instanceof IASTSimpleDeclaration) {
|
||||||
final int storage = ((IASTSimpleDeclaration) getParent).getDeclSpecifier().getStorageClass();
|
final int storage = ((IASTSimpleDeclaration) getParent).getDeclSpecifier().getStorageClass();
|
||||||
if( getInitializer() != null || storage == IASTDeclSpecifier.sc_typedef)
|
if (getInitializer() != null || storage == IASTDeclSpecifier.sc_typedef)
|
||||||
return r_definition;
|
return r_definition;
|
||||||
|
|
||||||
if( storage == IASTDeclSpecifier.sc_extern ||
|
if (storage == IASTDeclSpecifier.sc_extern || storage == IASTDeclSpecifier.sc_static) {
|
||||||
storage == IASTDeclSpecifier.sc_static )
|
|
||||||
{
|
|
||||||
return r_declaration;
|
return r_declaration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fnDtor ? r_declaration : r_definition;
|
return fnDtor ? r_declaration : r_definition;
|
||||||
}
|
}
|
||||||
if( getParent instanceof IASTTypeId )
|
if (getParent instanceof IASTTypeId)
|
||||||
return r_reference;
|
return r_reference;
|
||||||
if( getParent instanceof IASTDeclarator )
|
if (getParent instanceof IASTDeclarator) {
|
||||||
{
|
|
||||||
IASTNode t = getParent;
|
IASTNode t = getParent;
|
||||||
while ( t instanceof IASTDeclarator )
|
while (t instanceof IASTDeclarator)
|
||||||
t = t.getParent();
|
t = t.getParent();
|
||||||
if( t instanceof IASTDeclaration )
|
if (t instanceof IASTDeclaration) {
|
||||||
{
|
if (getParent instanceof IASTFunctionDefinition)
|
||||||
if( getParent instanceof IASTFunctionDefinition )
|
|
||||||
return r_definition;
|
return r_definition;
|
||||||
if( getParent instanceof IASTSimpleDeclaration )
|
if (getParent instanceof IASTSimpleDeclaration) {
|
||||||
{
|
if (getInitializer() != null)
|
||||||
if( getInitializer() != null )
|
|
||||||
return r_definition;
|
return r_definition;
|
||||||
IASTSimpleDeclaration sd = (IASTSimpleDeclaration) getParent;
|
IASTSimpleDeclaration sd = (IASTSimpleDeclaration) getParent;
|
||||||
int storage = sd.getDeclSpecifier().getStorageClass();
|
int storage = sd.getDeclSpecifier().getStorageClass();
|
||||||
if( storage == IASTDeclSpecifier.sc_extern ||
|
if (storage == IASTDeclSpecifier.sc_extern || storage == IASTDeclSpecifier.sc_typedef ||
|
||||||
storage == IASTDeclSpecifier.sc_typedef ||
|
storage == IASTDeclSpecifier.sc_static) {
|
||||||
storage == IASTDeclSpecifier.sc_static )
|
|
||||||
{
|
|
||||||
return r_declaration;
|
return r_declaration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fnDtor ? r_declaration : r_definition;
|
return fnDtor ? r_declaration : r_definition;
|
||||||
}
|
}
|
||||||
if( t instanceof IASTTypeId )
|
if (t instanceof IASTTypeId)
|
||||||
return r_reference;
|
return r_reference;
|
||||||
}
|
}
|
||||||
if( getParent instanceof IASTParameterDeclaration )
|
if (getParent instanceof IASTParameterDeclaration)
|
||||||
return ( n.toCharArray().length > 0 ) ? r_definition : r_declaration;
|
return (n.toCharArray().length > 0) ? r_definition : r_declaration;
|
||||||
|
|
||||||
return r_unclear;
|
return r_unclear;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements
|
||||||
|
|
||||||
private ICPPClassTemplatePartialSpecialization[] partialSpecializations = null;
|
private ICPPClassTemplatePartialSpecialization[] partialSpecializations = null;
|
||||||
|
|
||||||
public CPPClassTemplate(IASTName name) {
|
public CPPClassTemplate(IASTName name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -251,7 +251,7 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
int pos= templateParameter.getParameterPosition() & 0xff;
|
int pos= templateParameter.getParameterPosition() & 0xff;
|
||||||
|
|
||||||
int tdeclLen= declarations == null ? 0 : declarations.length;
|
int tdeclLen= declarations == null ? 0 : declarations.length;
|
||||||
for (int i=-1; i<tdeclLen; i++) {
|
for (int i= -1; i < tdeclLen; i++) {
|
||||||
IASTName tdecl;
|
IASTName tdecl;
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
tdecl= definition;
|
tdecl= definition;
|
||||||
|
@ -277,7 +277,7 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
|
|
||||||
int k=0;
|
int k=0;
|
||||||
int tdeclLen= declarations == null ? 0 : declarations.length;
|
int tdeclLen= declarations == null ? 0 : declarations.length;
|
||||||
for (int i=-1; i<tdeclLen && k<updateParams.length; i++) {
|
for (int i= -1; i < tdeclLen && k < updateParams.length; i++) {
|
||||||
IASTName tdecl;
|
IASTName tdecl;
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
tdecl= definition;
|
tdecl= definition;
|
||||||
|
|
|
@ -211,7 +211,7 @@ public abstract class CPPTemplateParameter extends PlatformObject
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
IASTNode node= declarations[0];
|
IASTNode node= declarations[0];
|
||||||
while (node instanceof ICPPASTTemplateParameter == false) {
|
while (!(node instanceof ICPPASTTemplateParameter)) {
|
||||||
if (node == null)
|
if (node == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
|
@ -395,7 +395,7 @@ public class CPPTemplates {
|
||||||
ICPPASTTemplatedTypeTemplateParameter templatedParam = (ICPPASTTemplatedTypeTemplateParameter) parent;
|
ICPPASTTemplatedTypeTemplateParameter templatedParam = (ICPPASTTemplatedTypeTemplateParameter) parent;
|
||||||
binding = templatedParam.getName().resolveBinding();
|
binding = templatedParam.getName().resolveBinding();
|
||||||
}
|
}
|
||||||
return (binding instanceof ICPPTemplateDefinition) ? (ICPPTemplateDefinition) binding : null;
|
return (binding instanceof ICPPTemplateDefinition) ? (ICPPTemplateDefinition) binding : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IBinding createBinding(ICPPASTTemplateParameter templateParameter) {
|
public static IBinding createBinding(ICPPASTTemplateParameter templateParameter) {
|
||||||
|
|
|
@ -66,8 +66,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
|
||||||
|
|
||||||
private ICPPClassScope fScope;
|
private ICPPClassScope fScope;
|
||||||
|
|
||||||
public PDOMCPPClassType(PDOM pdom, PDOMNode parent, ICPPClassType classType)
|
public PDOMCPPClassType(PDOM pdom, PDOMNode parent, ICPPClassType classType) throws CoreException {
|
||||||
throws CoreException {
|
|
||||||
super(pdom, parent, classType.getNameCharArray());
|
super(pdom, parent, classType.getNameCharArray());
|
||||||
|
|
||||||
setKind(classType);
|
setKind(classType);
|
||||||
|
@ -89,7 +88,6 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
|
||||||
return IIndexCPPBindingConstants.CPPCLASSTYPE;
|
return IIndexCPPBindingConstants.CPPCLASSTYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
|
public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
|
||||||
if (newBinding instanceof ICPPClassType) {
|
if (newBinding instanceof ICPPClassType) {
|
||||||
|
@ -142,7 +140,6 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
|
||||||
list.accept(visitor);
|
list.accept(visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private PDOMCPPBase getFirstBase() throws CoreException {
|
private PDOMCPPBase getFirstBase() throws CoreException {
|
||||||
int rec = pdom.getDB().getInt(record + FIRSTBASE);
|
int rec = pdom.getDB().getInt(record + FIRSTBASE);
|
||||||
return rec != 0 ? new PDOMCPPBase(pdom, rec) : null;
|
return rec != 0 ? new PDOMCPPBase(pdom, rec) : null;
|
||||||
|
|
|
@ -85,7 +85,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
||||||
Integer sigHash = IndexCPPSignatureUtil.getSignatureHash(function);
|
Integer sigHash = IndexCPPSignatureUtil.getSignatureHash(function);
|
||||||
pdom.getDB().putInt(record + SIGNATURE_HASH, sigHash != null ? sigHash.intValue() : 0);
|
pdom.getDB().putInt(record + SIGNATURE_HASH, sigHash != null ? sigHash.intValue() : 0);
|
||||||
|
|
||||||
if(setTypes) {
|
if (setTypes) {
|
||||||
initData((ICPPFunctionType) function.getType(), function.getParameters());
|
initData((ICPPFunctionType) function.getType(), function.getParameters());
|
||||||
}
|
}
|
||||||
db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(function));
|
db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(function));
|
||||||
|
@ -94,7 +94,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initData(ICPPFunctionType ftype, IParameter[] params) throws CoreException {
|
public void initData(ICPPFunctionType ftype, IParameter[] params) throws CoreException {
|
||||||
PDOMCPPFunctionType pft= setType(ftype);
|
PDOMCPPFunctionType pft= setType(ftype);
|
||||||
setParameters(pft, params);
|
setParameters(pft, params);
|
||||||
}
|
}
|
||||||
|
@ -132,8 +132,8 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
||||||
db.putInt(record + NUM_PARAMS, params.length);
|
db.putInt(record + NUM_PARAMS, params.length);
|
||||||
db.putInt(record + FIRST_PARAM, 0);
|
db.putInt(record + FIRST_PARAM, 0);
|
||||||
IType[] paramTypes= pft.getParameterTypes();
|
IType[] paramTypes= pft.getParameterTypes();
|
||||||
for (int i=0; i<params.length; ++i) {
|
for (int i= 0; i < params.length; ++i) {
|
||||||
int ptRecord= i<paramTypes.length && paramTypes[i]!=null ? ((PDOMNode) paramTypes[i]).getRecord() : 0;
|
int ptRecord= i < paramTypes.length && paramTypes[i] != null ? ((PDOMNode) paramTypes[i]).getRecord() : 0;
|
||||||
setFirstParameter(new PDOMCPPParameter(pdom, this, params[i], ptRecord));
|
setFirstParameter(new PDOMCPPParameter(pdom, this, params[i], ptRecord));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static int compareSignatures(IPDOMOverloader a, Object b) {
|
protected static int compareSignatures(IPDOMOverloader a, Object b) {
|
||||||
if(b instanceof IPDOMOverloader) {
|
if (b instanceof IPDOMOverloader) {
|
||||||
IPDOMOverloader bb= (IPDOMOverloader) b;
|
IPDOMOverloader bb= (IPDOMOverloader) b;
|
||||||
try {
|
try {
|
||||||
int mySM = a.getSignatureHash();
|
int mySM = a.getSignatureHash();
|
||||||
|
|
|
@ -49,7 +49,6 @@ import org.eclipse.cdt.internal.core.browser.ASTTypeInfo;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class PDOMSearchQuery implements ISearchQuery {
|
public abstract class PDOMSearchQuery implements ISearchQuery {
|
||||||
|
|
||||||
public static final int FIND_DECLARATIONS = 0x1;
|
public static final int FIND_DECLARATIONS = 0x1;
|
||||||
public static final int FIND_DEFINITIONS = 0x2;
|
public static final int FIND_DEFINITIONS = 0x2;
|
||||||
public static final int FIND_REFERENCES = 0x4;
|
public static final int FIND_REFERENCES = 0x4;
|
||||||
|
@ -155,10 +154,9 @@ public abstract class PDOMSearchQuery implements ISearchQuery {
|
||||||
names.addAll(Arrays.asList(ast.getReferences(binding)));
|
names.addAll(Arrays.asList(ast.getReferences(binding)));
|
||||||
|
|
||||||
for (IASTName name : names) {
|
for (IASTName name : names) {
|
||||||
if ( ((flags & FIND_DECLARATIONS) != 0 && name.isDeclaration())
|
if (((flags & FIND_DECLARATIONS) != 0 && name.isDeclaration()) ||
|
||||||
|| ((flags & FIND_DEFINITIONS) != 0 && name.isDefinition())
|
((flags & FIND_DEFINITIONS) != 0 && name.isDefinition()) ||
|
||||||
|| ((flags & FIND_REFERENCES) != 0 && name.isReference())) {
|
((flags & FIND_REFERENCES) != 0 && name.isReference())) {
|
||||||
|
|
||||||
ASTTypeInfo typeInfo= ASTTypeInfo.create(name);
|
ASTTypeInfo typeInfo= ASTTypeInfo.create(name);
|
||||||
if (typeInfo != null) {
|
if (typeInfo != null) {
|
||||||
ITypeReference ref= typeInfo.getResolvedReference();
|
ITypeReference ref= typeInfo.getResolvedReference();
|
||||||
|
|
Loading…
Add table
Reference in a new issue