1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Merge remote-tracking branch 'cdt/master' into sd90

This commit is contained in:
Andrew Gvozdev 2011-12-10 22:11:50 -05:00
commit 35f8ff40dc
16 changed files with 361 additions and 351 deletions

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Doug Schaefer (IBM) - Initial API and implementation
* Doug Schaefer (IBM) - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast;
@ -18,11 +18,8 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ILabel extends IBinding {
/**
* Returns the label statement for this label.
*
*/
public IASTLabelStatement getLabelStatement();
}

View file

@ -25,7 +25,6 @@ import org.eclipse.core.runtime.PlatformObject;
* Represents a label.
*/
public class CLabel extends PlatformObject implements ILabel {
private final IASTName labelStatement;
public CLabel(IASTName statement) {
@ -37,42 +36,38 @@ public class CLabel extends PlatformObject implements ILabel {
return labelStatement;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.ILabel#getLabelStatement()
*/
@Override
public IASTLabelStatement getLabelStatement() {
return (IASTLabelStatement) labelStatement.getParent();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
*/
@Override
public String getName() {
return labelStatement.toString();
}
@Override
public char[] getNameCharArray() {
return labelStatement.toCharArray();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
*/
@Override
public IScope getScope() {
return CVisitor.getContainingScope(labelStatement.getParent());
}
@Override
public ILinkage getLinkage() {
return Linkage.C_LINKAGE;
}
@Override
public IBinding getOwner() {
return CVisitor.findEnclosingFunction(labelStatement);
}
@Override
public String toString() {
return getName();
}
}

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Devin Steffler (IBM Rational Software) - Initial API and implementation
* Devin Steffler (IBM Rational Software) - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -34,6 +34,7 @@ public class CPointerType implements ICPointerType, ITypeContainer, ISerializabl
this.qualifiers = qualifiers;
}
@Override
public boolean isSameType(IType obj) {
if (obj == this)
return true;
@ -51,34 +52,27 @@ public class CPointerType implements ICPointerType, ITypeContainer, ISerializabl
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICPointerType#isRestrict()
*/
@Override
public boolean isRestrict() {
return (qualifiers & IS_RESTRICT) != 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IPointerType#getType()
*/
@Override
public IType getType() {
return nextType;
}
@Override
public void setType(IType type) {
nextType = type;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IPointerType#isConst()
*/
@Override
public boolean isConst() {
return (qualifiers & IS_CONST) != 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IPointerType#isVolatile()
*/
@Override
public boolean isVolatile() {
return (qualifiers & IS_VOLATILE) != 0;
}
@ -98,6 +92,7 @@ public class CPointerType implements ICPointerType, ITypeContainer, ISerializabl
this.qualifiers = qualifiers;
}
@Override
public void marshal(ITypeMarshalBuffer buffer) throws CoreException {
int firstByte= ITypeMarshalBuffer.POINTER;
if (isConst()) firstByte |= ITypeMarshalBuffer.FLAG1;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 IBM Corporation and others.
* Copyright (c) 2005, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -51,24 +51,28 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
super(node, id, arg);
}
@Override
public IField findField(String name) {
return null;
}
@Override
public IScope getCompositeScope() {
return this;
}
@Override
public IField[] getFields() {
return IField.EMPTY_FIELD_ARRAY;
}
@Override
public int getKey() {
return k_struct;
}
}
private IASTName[] declarations = null;
private IASTName[] declarations;
private IASTName definition;
private boolean checked;
private ICompositeType typeInIndex;
@ -82,8 +86,9 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
name.setBinding(this);
}
@Override
public IASTNode getPhysicalNode() {
return (definition != null) ? (IASTNode) definition : (IASTNode) declarations[0];
return definition != null ? (IASTNode) definition : (IASTNode) declarations[0];
}
private void checkForDefinition() {
@ -109,11 +114,7 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
checked = true;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
*/
@Override
public String getName() {
if (definition != null)
return definition.toString();
@ -121,6 +122,7 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
return declarations[0].toString();
}
@Override
public char[] getNameCharArray() {
if (definition != null)
return definition.toCharArray();
@ -128,11 +130,7 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
return declarations[0].toCharArray();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
*/
@Override
public IScope getScope() throws DOMException {
IASTDeclSpecifier declSpec = (IASTDeclSpecifier) ((definition != null) ? (IASTNode) definition
.getParent() : declarations[0].getParent());
@ -143,11 +141,7 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
return scope;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getFields()
*/
@Override
public IField[] getFields() {
checkForDefinition();
if (definition == null) {
@ -186,6 +180,7 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
return fields;
}
@Override
public IField findField(String name) {
IScope scope = getCompositeScope();
if (scope == null) {
@ -202,22 +197,14 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
return null;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getKey()
*/
@Override
public int getKey() {
return definition != null ?
((IASTCompositeTypeSpecifier) definition.getParent()).getKey() :
((IASTElaboratedTypeSpecifier) declarations[0].getParent()).getKind();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getCompositeScope()
*/
@Override
public IScope getCompositeScope() {
checkForDefinition();
if (definition != null) {
@ -267,11 +254,7 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
declarations = (IASTName[]) ArrayUtil.append(IASTName.class, declarations, decl);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
*/
@Override
public boolean isSameType(IType type) {
if (type == this)
return true;
@ -280,18 +263,22 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
return false;
}
@Override
public ILinkage getLinkage() {
return Linkage.C_LINKAGE;
}
@Override
public IASTNode[] getDeclarations() {
return declarations;
}
@Override
public IASTNode getDefinition() {
return definition;
}
@Override
public IBinding getOwner() {
IASTNode node = definition;
if (node == null) {
@ -309,6 +296,7 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
return null;
}
@Override
public boolean isAnonymous() {
if (getNameCharArray().length > 0 || definition == null)
return false;
@ -324,4 +312,12 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
}
return false;
}
/**
* For debugging purposes, only.
*/
@Override
public String toString() {
return getName();
}
}

View file

@ -1,17 +1,18 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 IBM Corporation and others.
* Copyright (c) 2005, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM Rational Software - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ILinkage;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
@ -30,87 +31,93 @@ public class CTypedef extends PlatformObject implements ITypedef, ITypeContainer
private final IASTName name;
private IType type = null;
public CTypedef( IASTName name ){
public CTypedef(IASTName name) {
this.name = name;
}
public IASTNode getPhysicalNode(){
@Override
public IASTNode getPhysicalNode() {
return name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.ITypedef#getType()
*/
@Override
public IType getType() {
if (type == null && name.getParent() instanceof IASTDeclarator)
type = CVisitor.createType((IASTDeclarator)name.getParent());
return type;
}
public void setType( IType t ){
@Override
public void setType(IType t) {
type = t;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
*/
@Override
public String getName() {
return name.toString();
}
public char[] getNameCharArray(){
@Override
public char[] getNameCharArray() {
return name.toCharArray();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
*/
@Override
public IScope getScope() {
IASTDeclarator declarator = (IASTDeclarator) name.getParent();
return CVisitor.getContainingScope( declarator.getParent() );
return CVisitor.getContainingScope(declarator.getParent());
}
@Override
public Object clone(){
public Object clone() {
IType t = null;
try {
t = (IType) super.clone();
} catch ( CloneNotSupportedException e ) {
} catch (CloneNotSupportedException e) {
//not going to happen
}
return t;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
*/
public boolean isSameType( IType t ) {
if( t == this )
@Override
public boolean isSameType(IType t) {
if (t == this)
return true;
if( t instanceof ITypedef ) {
if (t instanceof ITypedef) {
IType temp = getType();
if( temp != null )
return temp.isSameType( ((ITypedef)t).getType());
if (temp != null)
return temp.isSameType(((ITypedef)t).getType());
return false;
}
IType temp = getType();
if( temp != null )
return temp.isSameType( t );
if (temp != null)
return temp.isSameType(t);
return false;
}
@Override
public ILinkage getLinkage() {
return Linkage.C_LINKAGE;
}
@Override
public IASTNode[] getDeclarations() {
return IASTNode.EMPTY_NODE_ARRAY;
}
@Override
public IASTNode getDefinition() {
return name;
}
@Override
public IBinding getOwner() {
return CVisitor.findEnclosingFunction(name);
}
@Override
public String toString() {
return getName() + " -> " + ASTTypeUtil.getType(this, true); //$NON-NLS-1$
}
}

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM Rational Software - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -44,6 +44,7 @@ public class CVariable extends PlatformObject implements IInternalVariable, ICIn
declarations = new IASTName[] { name };
}
@Override
public IASTNode getPhysicalNode() {
return declarations[0];
}
@ -54,40 +55,30 @@ public class CVariable extends PlatformObject implements IInternalVariable, ICIn
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IVariable#getType()
*/
@Override
public IType getType() {
if (type == null && declarations[0].getParent() instanceof IASTDeclarator)
type = CVisitor.createType((IASTDeclarator) declarations[0].getParent());
return type;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
*/
@Override
public String getName() {
return declarations[0].toString();
}
@Override
public char[] getNameCharArray() {
return declarations[0].toCharArray();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
*/
@Override
public IScope getScope() {
IASTDeclarator declarator = (IASTDeclarator) declarations[0].getParent();
return CVisitor.getContainingScope(declarator.getParent());
}
@Override
public boolean isStatic() {
return hasStorageClass(IASTDeclSpecifier.sc_static);
}
@ -113,45 +104,37 @@ public class CVariable extends PlatformObject implements IInternalVariable, ICIn
return false;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IVariable#isExtern()
*/
@Override
public boolean isExtern() {
return hasStorageClass(IASTDeclSpecifier.sc_extern);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto()
*/
@Override
public boolean isAuto() {
return hasStorageClass(IASTDeclSpecifier.sc_auto);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IVariable#isRegister()
*/
@Override
public boolean isRegister() {
return hasStorageClass(IASTDeclSpecifier.sc_register);
}
@Override
public ILinkage getLinkage() {
return Linkage.C_LINKAGE;
}
@Override
public IASTNode[] getDeclarations() {
return declarations;
}
@Override
public IASTNode getDefinition() {
return getPhysicalNode();
}
@Override
public IBinding getOwner() {
if (declarations == null || declarations.length == 0)
return null;
@ -159,10 +142,12 @@ public class CVariable extends PlatformObject implements IInternalVariable, ICIn
return CVisitor.findDeclarationOwner(declarations[0], true);
}
@Override
public IValue getInitialValue() {
return getInitialValue(Value.MAX_RECURSION_DEPTH);
}
@Override
public IValue getInitialValue(int maxDepth) {
if (declarations != null) {
for (IASTName decl : declarations) {
@ -200,4 +185,9 @@ public class CVariable extends PlatformObject implements IInternalVariable, ICIn
return ASTQueries.findOutermostDeclarator((IASTDeclarator) node);
}
@Override
public String toString() {
return getName();
}
}

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andrew Niefer (IBM Corporation) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Andrew Niefer (IBM Corporation) - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -25,71 +25,88 @@ import org.eclipse.core.runtime.PlatformObject;
public class CPPLabel extends PlatformObject implements ILabel, ICPPInternalBinding {
private IASTName statement;
public CPPLabel( IASTName statement ) {
public CPPLabel(IASTName statement) {
this.statement = statement;
statement.setBinding( this );
statement.setBinding(this);
}
public IASTNode[] getDeclarations() {
@Override
public IASTNode[] getDeclarations() {
return null;
}
public IASTNode getDefinition() {
@Override
public IASTNode getDefinition() {
return statement;
}
public IASTLabelStatement getLabelStatement() {
if( statement instanceof IASTLabelStatement )
@Override
public IASTLabelStatement getLabelStatement() {
if (statement instanceof IASTLabelStatement)
return (IASTLabelStatement) statement;
// TODO find label statement
return null;
}
public String getName() {
@Override
public String getName() {
return new String(getNameCharArray());
}
public char[] getNameCharArray() {
@Override
public char[] getNameCharArray() {
return statement.getSimpleID();
}
public IScope getScope() {
return CPPVisitor.getContainingScope( statement );
@Override
public IScope getScope() {
return CPPVisitor.getContainingScope(statement);
}
public IASTNode getPhysicalNode() {
return statement;
}
public void setLabelStatement( IASTName labelStatement ) {
public void setLabelStatement(IASTName labelStatement) {
statement = labelStatement;
}
public String[] getQualifiedName() {
@Override
public String[] getQualifiedName() {
return new String[] { getName() };
}
public char[][] getQualifiedNameCharArray() {
return new char [] [] { getNameCharArray() };
@Override
public char[][] getQualifiedNameCharArray() {
return new char[][] { getNameCharArray() };
}
public boolean isGloballyQualified() {
@Override
public boolean isGloballyQualified() {
return false;
}
@Override
public void addDefinition(IASTNode node) {
}
@Override
public void addDeclaration(IASTNode node) {
}
@Override
public ILinkage getLinkage() {
return Linkage.CPP_LINKAGE;
}
@Override
public IBinding getOwner() {
return CPPVisitor.findEnclosingFunction(statement);
}
@Override
public String toString() {
return getName();
}
}

View file

@ -46,6 +46,7 @@ public class CPPPointerType implements IPointerType, ITypeContainer, ISerializab
this(type, false, false, false);
}
@Override
public boolean isSameType(IType o) {
if (o == this)
return true;
@ -68,23 +69,28 @@ public class CPPPointerType implements IPointerType, ITypeContainer, ISerializab
return false;
}
@Override
public IType getType() {
return type;
}
@Override
public void setType(IType t) {
assert t != null;
type = t;
}
@Override
public boolean isConst() {
return isConst;
}
@Override
public boolean isVolatile() {
return isVolatile;
}
@Override
public boolean isRestrict() {
return isRestrict;
}
@ -101,10 +107,6 @@ public class CPPPointerType implements IPointerType, ITypeContainer, ISerializab
}
@Override
public String toString() {
return ASTTypeUtil.getType(this);
}
public void marshal(ITypeMarshalBuffer buffer) throws CoreException {
int firstByte= ITypeMarshalBuffer.POINTER;
if (isConst()) firstByte |= ITypeMarshalBuffer.FLAG1;
@ -121,4 +123,9 @@ public class CPPPointerType implements IPointerType, ITypeContainer, ISerializab
(firstByte & ITypeMarshalBuffer.FLAG2) != 0,
(firstByte & ITypeMarshalBuffer.FLAG3) != 0);
}
@Override
public String toString() {
return ASTTypeUtil.getType(this);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2010 IBM Corporation and others.
* Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -44,21 +44,18 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
name.setBinding(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPBinding#getDeclarations()
*/
public IASTNode[] getDeclarations() {
@Override
public IASTNode[] getDeclarations() {
return declarations;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPBinding#getDefinition()
*/
public IASTNode getDefinition() {
@Override
public IASTNode getDefinition() {
return declarations[0];
}
public boolean isSameType(IType o) {
@Override
public boolean isSameType(IType o) {
if (o == this)
return true;
if (o instanceof ITypedef) {
@ -74,9 +71,7 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.ITypedef#getType()
*/
@Override
public IType getType() {
if (type == null) {
type = CPPVisitor.createType((IASTDeclarator) declarations[0].getParent());
@ -84,27 +79,22 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
return type;
}
@Override
public void setType(IType t) {
type = t;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
*/
@Override
public String getName() {
return new String(getNameCharArray());
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getNameCharArray()
*/
@Override
public char[] getNameCharArray() {
return declarations[0].getSimpleID();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
*/
@Override
public IScope getScope() {
return CPPVisitor.getContainingScope(declarations[0].getParent());
}
@ -120,24 +110,18 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
return t;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getFullyQualifiedName()
*/
public String[] getQualifiedName() {
@Override
public String[] getQualifiedName() {
return CPPVisitor.getQualifiedName(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getFullyQualifiedNameCharArray()
*/
public char[][] getQualifiedNameCharArray() {
@Override
public char[][] getQualifiedNameCharArray() {
return CPPVisitor.getQualifiedNameCharArray(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#isGloballyQualified()
*/
public boolean isGloballyQualified() throws DOMException {
@Override
public boolean isGloballyQualified() throws DOMException {
IScope scope = getScope();
while(scope != null) {
if (scope instanceof ICPPBlockScope)
@ -147,32 +131,27 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/
@Override
public void addDefinition(IASTNode node) {
addDeclaration(node);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDeclaration(org.eclipse.cdt.core.dom.ast.IASTNode)
*/
@Override
public void addDeclaration(IASTNode node) {
IASTName name;
if (node instanceof IASTName) {
if (node.getParent() instanceof ICPPASTQualifiedName) {
name= (IASTName) node.getParent();
} else {
name= (IASTName) node;
}
} else {
if (!(node instanceof IASTName)) {
return;
}
}
if (node.getParent() instanceof ICPPASTQualifiedName) {
name= (IASTName) node.getParent();
} else {
name= (IASTName) node;
}
if (declarations == null) {
declarations = new IASTName[] { name };
} else {
// keep the lowest offset declaration in [0]
// Keep the lowest offset declaration in [0]
if (declarations.length > 0 &&
((ASTNode) node).getOffset() < ((ASTNode) declarations[0]).getOffset()) {
declarations = (IASTName[]) ArrayUtil.prepend(IASTName.class, declarations, name);
@ -182,19 +161,21 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
}
}
@Override
public ILinkage getLinkage() {
return Linkage.CPP_LINKAGE;
}
@Override
public String toString() {
return ASTTypeUtil.getQualifiedName(this) + " -> " + ASTTypeUtil.getType(this, true); //$NON-NLS-1$
}
public IBinding getOwner() {
if (declarations != null && declarations.length > 0) {
return CPPVisitor.findDeclarationOwner(declarations[0], true);
}
return null;
}
@Override
public String toString() {
return ASTTypeUtil.getQualifiedName(this) + " -> " + ASTTypeUtil.getType(this, true); //$NON-NLS-1$
}
}

View file

@ -1,14 +1,14 @@
/*******************************************************************************
* Copyright (c) 2004, 2010 IBM Corporation and others.
* Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andrew Niefer (IBM Corporation) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Ed Swartz (Nokia)
* Andrew Niefer (IBM Corporation) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Ed Swartz (Nokia)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -87,6 +87,7 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
return dtor;
}
@Override
public void addDeclaration(IASTNode node) {
if (!(node instanceof IASTName))
return;
@ -110,23 +111,17 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPBinding#getDeclarations()
*/
public IASTNode[] getDeclarations() {
@Override
public IASTNode[] getDeclarations() {
return fDeclarations;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPBinding#getDefinition()
*/
public IASTNode getDefinition() {
@Override
public IASTNode getDefinition() {
return fDefinition;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IVariable#getType()
*/
@Override
public IType getType() {
if (fType != null) {
return fType;
@ -135,7 +130,7 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
IArrayType firstCandidate= null;
final int length = fDeclarations == null ? 0 : fDeclarations.length;
for (int i = -1; i < length; i++) {
IASTName n = i==-1 ? fDefinition : fDeclarations[i];
IASTName n = i == -1 ? fDefinition : fDeclarations[i];
if (n != null) {
while (n.getParent() instanceof IASTName)
n = (IASTName) n.getParent();
@ -167,7 +162,7 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
fAllResolved= true;
final int length = fDeclarations == null ? 0 : fDeclarations.length;
for (int i = -1; i < length; i++) {
IASTName n = i==-1 ? fDefinition : fDeclarations[i];
IASTName n = i == -1 ? fDefinition : fDeclarations[i];
if (n != null) {
IASTTranslationUnit tu = n.getTranslationUnit();
if (tu != null) {
@ -178,16 +173,12 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
*/
@Override
public String getName() {
return new String(getNameCharArray());
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getNameCharArray()
*/
@Override
public char[] getNameCharArray() {
if (fDeclarations != null) {
return fDeclarations[0].getSimpleID();
@ -195,31 +186,23 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
return fDefinition.getSimpleID();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
*/
@Override
public IScope getScope() {
return CPPVisitor.getContainingScope(fDefinition != null ? fDefinition : fDeclarations[0]);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getFullyQualifiedName()
*/
public String[] getQualifiedName() {
@Override
public String[] getQualifiedName() {
return CPPVisitor.getQualifiedName(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getFullyQualifiedNameCharArray()
*/
public char[][] getQualifiedNameCharArray() {
@Override
public char[][] getQualifiedNameCharArray() {
return CPPVisitor.getQualifiedNameCharArray(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#isGloballyQualified()
*/
public boolean isGloballyQualified() throws DOMException {
@Override
public boolean isGloballyQualified() throws DOMException {
IScope scope = getScope();
while (scope != null) {
if (scope instanceof ICPPBlockScope)
@ -229,9 +212,7 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/
@Override
public void addDefinition(IASTNode node) {
addDeclaration(node);
}
@ -254,37 +235,33 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
}
}
}
if (ns != null && ++i < ns.length)
if (ns != null && ++i < ns.length) {
name = (IASTName) ns[i];
else
} else {
break;
}
} while (name != null);
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable#isMutable()
*/
public boolean isMutable() {
@Override
public boolean isMutable() {
//7.1.1-8 the mutable specifier can only be applied to names of class data members
return false;
}
public boolean isStatic() {
@Override
public boolean isStatic() {
return hasStorageClass(IASTDeclSpecifier.sc_static);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IVariable#isExtern()
*/
public boolean isExtern() {
@Override
public boolean isExtern() {
return hasStorageClass(IASTDeclSpecifier.sc_extern);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IVariable#isExtern()
*/
public boolean isExternC() {
@Override
public boolean isExternC() {
if (CPPVisitor.isExternC(getDefinition())) {
return true;
}
@ -299,38 +276,33 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto()
*/
public boolean isAuto() {
@Override
public boolean isAuto() {
return hasStorageClass(IASTDeclSpecifier.sc_auto);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IVariable#isRegister()
*/
public boolean isRegister() {
@Override
public boolean isRegister() {
return hasStorageClass(IASTDeclSpecifier.sc_register);
}
@Override
public ILinkage getLinkage() {
return Linkage.CPP_LINKAGE;
}
@Override
public IBinding getOwner() {
IASTName node = fDefinition != null ? fDefinition : fDeclarations[0];
return CPPVisitor.findNameOwner(node, !hasStorageClass(IASTDeclSpecifier.sc_extern));
}
@Override
public String toString() {
return getName();
}
public IValue getInitialValue() {
return getInitialValue(Value.MAX_RECURSION_DEPTH);
}
@Override
public IValue getInitialValue(int maxDepth) {
if (fDefinition != null) {
final IValue val= getInitialValue(fDefinition, maxDepth);
@ -382,4 +354,9 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
}
return null;
}
@Override
public String toString() {
return getName();
}
}

View file

@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Doug Schaefer (QNX) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM Corporation
* Doug Schaefer (QNX) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.c;
@ -33,7 +33,6 @@ import org.eclipse.core.runtime.CoreException;
* Typedefs for c
*/
class PDOMCTypedef extends PDOMBinding implements ITypedef, ITypeContainer, IIndexType {
private static final int TYPE_OFFSET = PDOMBinding.RECORD_SIZE + 0;
@SuppressWarnings("hiding")
@ -82,8 +81,7 @@ class PDOMCTypedef extends PDOMBinding implements ITypedef, ITypeContainer, IInd
}
if (type instanceof ITypeContainer) {
type= ((ITypeContainer) type).getType();
}
else if (type instanceof IFunctionType) {
} else if (type instanceof IFunctionType) {
IFunctionType ft= (IFunctionType) type;
if (introducesRecursion(ft.getReturnType(), tdname)) {
return true;
@ -113,6 +111,7 @@ class PDOMCTypedef extends PDOMBinding implements ITypedef, ITypeContainer, IInd
return IIndexCBindingConstants.CTYPEDEF;
}
@Override
public IType getType() {
try {
return getLinkage().loadType(record + TYPE_OFFSET);
@ -122,6 +121,7 @@ class PDOMCTypedef extends PDOMBinding implements ITypedef, ITypeContainer, IInd
}
}
@Override
public boolean isSameType(IType type) {
IType myrtype = getType();
if (myrtype == null)
@ -138,6 +138,7 @@ class PDOMCTypedef extends PDOMBinding implements ITypedef, ITypeContainer, IInd
return getName() + ": " + super.toStringBase(); //$NON-NLS-1$
}
@Override
public void setType(IType type) {
throw new UnsupportedOperationException();
}

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Doug Schaefer (QNX) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Doug Schaefer (QNX) - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -32,7 +32,6 @@ import org.eclipse.core.runtime.CoreException;
* Typedefs for c++
*/
class PDOMCPPTypedef extends PDOMCPPBinding implements ITypedef, ITypeContainer, IIndexType {
private static final int TYPE_OFFSET = PDOMBinding.RECORD_SIZE;
@SuppressWarnings("hiding")
@ -107,6 +106,7 @@ class PDOMCPPTypedef extends PDOMCPPBinding implements ITypedef, ITypeContainer,
return IIndexCPPBindingConstants.CPPTYPEDEF;
}
@Override
public IType getType() {
try {
return getLinkage().loadType(record + TYPE_OFFSET);
@ -116,6 +116,7 @@ class PDOMCPPTypedef extends PDOMCPPBinding implements ITypedef, ITypeContainer,
}
}
@Override
public boolean isSameType(IType type) {
IType myrtype = getType();
if (myrtype == null)
@ -129,12 +130,8 @@ class PDOMCPPTypedef extends PDOMCPPBinding implements ITypedef, ITypeContainer,
}
return myrtype.isSameType(type);
}
@Override
protected String toStringBase() {
return ASTTypeUtil.getQualifiedName(this) + " -> " + super.toStringBase(); //$NON-NLS-1$
}
@Override
public void setType(IType type) {
throw new UnsupportedOperationException();
}
@ -143,4 +140,9 @@ class PDOMCPPTypedef extends PDOMCPPBinding implements ITypedef, ITypeContainer,
public Object clone() {
return new CPPTypedefClone(this);
}
@Override
protected String toStringBase() {
return ASTTypeUtil.getQualifiedName(this) + " -> " + super.toStringBase(); //$NON-NLS-1$
}
}

View file

@ -140,6 +140,7 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
/* (non-Javadoc)
* @see ILabelDecorator#decorateText(String, Object)
*/
@Override
public String decorateText(String text, Object element) {
return text;
}
@ -147,6 +148,7 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
/* (non-Javadoc)
* @see ILabelDecorator#decorateImage(Image, Object)
*/
@Override
public Image decorateImage(Image image, Object obj) {
int adornmentFlags= computeAdornmentFlags(obj);
if (adornmentFlags != 0) {
@ -302,6 +304,7 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
/* (non-Javadoc)
* @see IBaseLabelProvider#dispose()
*/
@Override
public void dispose() {
if (fProblemChangedListener != null) {
CUIPlugin.getDefault().getProblemMarkerManager().removeListener(fProblemChangedListener);
@ -315,6 +318,7 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
/* (non-Javadoc)
* @see IBaseLabelProvider#isLabelProperty(Object, String)
*/
@Override
public boolean isLabelProperty(Object element, String property) {
return true;
}
@ -322,6 +326,7 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
/* (non-Javadoc)
* @see IBaseLabelProvider#addListener(ILabelProviderListener)
*/
@Override
public void addListener(ILabelProviderListener listener) {
if (fListeners == null) {
fListeners= new ListenerList();
@ -329,6 +334,7 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
fListeners.add(listener);
if (fProblemChangedListener == null) {
fProblemChangedListener= new IProblemChangedListener() {
@Override
public void problemsChanged(IResource[] changedResources, boolean isMarkerChange) {
fireProblemsChanged(changedResources, isMarkerChange);
}
@ -340,6 +346,7 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
/* (non-Javadoc)
* @see IBaseLabelProvider#removeListener(ILabelProviderListener)
*/
@Override
public void removeListener(ILabelProviderListener listener) {
if (fListeners != null) {
fListeners.remove(listener);
@ -363,6 +370,7 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration)
*/
@Override
public void decorate(Object element, IDecoration decoration) {
int adornmentFlags= computeAdornmentFlags(element);

View file

@ -18,8 +18,7 @@ import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition;
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.LabelPosition;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblyAnnotationModel;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IBreakpointLocationProvider;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
@ -32,13 +31,11 @@ import org.eclipse.debug.core.IBreakpointManager;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.ILineBreakpoint;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentListener;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.AnnotationModel;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.texteditor.MarkerAnnotation;
import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
@ -47,7 +44,7 @@ import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
* Annotation model for breakpoints in the disassembly.
* Works only with {@link DisassemblyDocument}.
*/
public class BreakpointsAnnotationModel extends AnnotationModel implements IBreakpointListener, IDocumentListener {
public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel implements IBreakpointListener, IDocumentListener {
private Runnable fCatchup;
@ -89,6 +86,7 @@ public class BreakpointsAnnotationModel extends AnnotationModel implements IBrea
/*
* @see org.eclipse.debug.core.IBreakpointListener#breakpointAdded(org.eclipse.debug.core.model.IBreakpoint)
*/
@Override
public void breakpointAdded(IBreakpoint breakpoint) {
addBreakpointAnnotation(breakpoint, true);
}
@ -96,6 +94,7 @@ public class BreakpointsAnnotationModel extends AnnotationModel implements IBrea
/*
* @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
*/
@Override
public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
Annotation a= findAnnotation(breakpoint.getMarker());
if (a != null) {
@ -114,6 +113,7 @@ public class BreakpointsAnnotationModel extends AnnotationModel implements IBrea
/*
* @see org.eclipse.debug.core.IBreakpointListener#breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
*/
@Override
public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
Annotation a= findAnnotation(breakpoint.getMarker());
if (a != null) {
@ -220,64 +220,6 @@ public class BreakpointsAnnotationModel extends AnnotationModel implements IBrea
return null;
}
private Position createPositionFromSourceLine(String fileName, int lineNumber) {
if (fileName != null) {
return getDisassemblyDocument().getSourcePosition(fileName, lineNumber);
}
return null;
}
private Position createPositionFromSourceLine(IFile file, int lineNumber) {
return getDisassemblyDocument().getSourcePosition(file, lineNumber);
}
private Position createPositionFromAddress(BigInteger address) {
if (address != null) {
AddressRangePosition p= getDisassemblyDocument().getDisassemblyPosition(address);
if (p != null && p.fValid) {
return new Position(p.offset, p.length);
}
}
return null;
}
private Position createPositionFromLabel(BigInteger address) {
if (address != null) {
LabelPosition p = getDisassemblyDocument().getLabelPosition(address);
if (p != null && p.fValid) {
return new Position(p.offset, p.length);
}
}
return null;
}
private Position createPositionFromLabel(String label) {
if (label != null) {
try {
Position[] labelPositions = getDisassemblyDocument().getPositions(DisassemblyDocument.CATEGORY_LABELS);
int labelLen = label.length();
for (Position position : labelPositions) {
if (position instanceof LabelPosition) {
String candidate = ((LabelPosition) position).fLabel;
if (candidate != null && candidate.startsWith(label)) {
// exact match or followed by ()
if (candidate.length() == labelLen || candidate.charAt(labelLen) == '(') {
return position;
}
}
}
}
} catch (BadPositionCategoryException exc) {
return null;
}
}
return null;
}
private DisassemblyDocument getDisassemblyDocument() {
return (DisassemblyDocument) fDocument;
}
/**
* Decode given string representation of a non-negative integer. A
* hexadecimal encoded integer is expected to start with <code>0x</code>.
@ -305,15 +247,18 @@ public class BreakpointsAnnotationModel extends AnnotationModel implements IBrea
/*
* @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
*/
@Override
public void documentAboutToBeChanged(DocumentEvent event) {
}
/*
* @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent)
*/
@Override
public void documentChanged(DocumentEvent event) {
if (fCatchup == null && event.fText != null && event.fText.length() > 0) {
fCatchup= new Runnable() {
@Override
public void run() {
if (fCatchup == this) {
catchupWithBreakpoints();

View file

@ -0,0 +1,90 @@
/*******************************************************************************
* Copyright (c) 2011 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional;
import java.math.BigInteger;
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition;
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.LabelPosition;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.DisassemblyDocument;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.AnnotationModel;
public class DisassemblyAnnotationModel extends AnnotationModel {
public DisassemblyAnnotationModel() {
super();
}
private DisassemblyDocument getDisassemblyDocument() {
return (DisassemblyDocument) fDocument;
}
protected Position createPositionFromSourceLine(String fileName, int lineNumber) {
if (fileName != null) {
return getDisassemblyDocument().getSourcePosition(fileName, lineNumber);
}
return null;
}
protected Position createPositionFromSourceLine(IFile file, int lineNumber) {
if (file != null) {
return getDisassemblyDocument().getSourcePosition(file, lineNumber);
}
return null;
}
protected Position createPositionFromAddress(BigInteger address) {
if (address != null) {
AddressRangePosition p= getDisassemblyDocument().getDisassemblyPosition(address);
if (p != null && p.fValid) {
return new Position(p.offset, p.length);
}
}
return null;
}
protected Position createPositionFromLabel(BigInteger address) {
if (address != null) {
LabelPosition p = getDisassemblyDocument().getLabelPosition(address);
if (p != null && p.fValid) {
return new Position(p.offset, p.length);
}
}
return null;
}
protected Position createPositionFromLabel(String label) {
if (label != null) {
try {
Position[] labelPositions = getDisassemblyDocument().getPositions(DisassemblyDocument.CATEGORY_LABELS);
int labelLen = label.length();
for (Position position : labelPositions) {
if (position instanceof LabelPosition) {
String candidate = ((LabelPosition) position).fLabel;
if (candidate != null && candidate.startsWith(label)) {
// exact match or followed by ()
if (candidate.length() == labelLen || candidate.charAt(labelLen) == '(') {
return position;
}
}
}
}
} catch (BadPositionCategoryException exc) {
return null;
}
}
return null;
}
}

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.internal.core.dom.lrparser.c99.bindings;
import org.eclipse.cdt.core.dom.ILinkage;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IScope;
@ -23,7 +24,6 @@ import org.eclipse.core.runtime.PlatformObject;
@SuppressWarnings("restriction")
public class C99Typedef extends PlatformObject implements IC99Binding, ITypedef, ITypeContainer, ITypeable {
private IType type;
private String name;
@ -42,7 +42,6 @@ public class C99Typedef extends PlatformObject implements IC99Binding, ITypedef,
this.name = name;
}
public IType getType() {
return type;
}
@ -63,7 +62,6 @@ public class C99Typedef extends PlatformObject implements IC99Binding, ITypedef,
return name.toCharArray();
}
public boolean isSameType(IType t) {
if(t == this)
return true;
@ -71,7 +69,6 @@ public class C99Typedef extends PlatformObject implements IC99Binding, ITypedef,
if(t instanceof ITypedef)
return type.isSameType(((ITypedef)t).getType());
return type.isSameType(t);
}
@Override
@ -104,4 +101,9 @@ public class C99Typedef extends PlatformObject implements IC99Binding, ITypedef,
}
return null;
}
@Override
public String toString() {
return getName() + " -> " + ASTTypeUtil.getType(this, true); //$NON-NLS-1$
}
}