mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Step 1 in supporting user defined conversion sequences during function resolution.
- add ITypeContainer#setType( IType ) - make IType extend Cloneable and implement clone() for the types.
This commit is contained in:
parent
4fae0d2e17
commit
285899775a
21 changed files with 239 additions and 8 deletions
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
/**
|
/**
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
public interface IType {
|
public interface IType extends Cloneable {
|
||||||
|
public Object clone();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,4 +21,5 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
*/
|
*/
|
||||||
public interface ITypeContainer extends IType{
|
public interface ITypeContainer extends IType{
|
||||||
IType getType();
|
IType getType();
|
||||||
|
void setType( IType type );
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,10 @@ public class CArrayType implements ICArrayType, ITypeContainer {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setType( IType t ){
|
||||||
|
this.type = t;
|
||||||
|
}
|
||||||
|
|
||||||
public void setModifiedArrayModifier(ICASTArrayModifier mod) {
|
public void setModifiedArrayModifier(ICASTArrayModifier mod) {
|
||||||
this.mod = mod;
|
this.mod = mod;
|
||||||
}
|
}
|
||||||
|
@ -78,4 +82,13 @@ public class CArrayType implements ICArrayType, ITypeContainer {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
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.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICBasicType;
|
import org.eclipse.cdt.core.dom.ast.c.ICBasicType;
|
||||||
|
|
||||||
|
@ -83,4 +84,14 @@ public class CBasicType implements ICBasicType {
|
||||||
&& cObj.isUnsigned() == this.isUnsigned()
|
&& cObj.isUnsigned() == this.isUnsigned()
|
||||||
&& cObj.isLongLong() == this.isLongLong());
|
&& cObj.isLongLong() == this.isLongLong());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTEnumerationSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTEnumerationSpecifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,4 +55,13 @@ public class CEnumeration implements IEnumeration {
|
||||||
return CVisitor.getContainingScope( enumSpec );
|
return CVisitor.getContainingScope( enumSpec );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,11 +16,11 @@ import java.util.List;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
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.IASTSimpleDeclaration;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
|
|
@ -59,4 +59,13 @@ public class CFunctionType implements IFunctionType {
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,4 +64,14 @@ public class CPointerType implements ICPointerType, ITypeContainer {
|
||||||
public void setPointer(ICASTPointer pointer) {
|
public void setPointer(ICASTPointer pointer) {
|
||||||
this.pointer = pointer;
|
this.pointer = pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,4 +62,14 @@ public class CQualifiedPointerType implements ICPointerType, ITypeContainer {
|
||||||
if (mod == null || !(mod instanceof ICASTArrayModifier)) return false;
|
if (mod == null || !(mod instanceof ICASTArrayModifier)) return false;
|
||||||
return ((ICASTArrayModifier)mod).isVolatile();
|
return ((ICASTArrayModifier)mod).isVolatile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,4 +82,18 @@ public class CQualifierType implements ICQualifierType, ITypeContainer {
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setType( IType t ){
|
||||||
|
type = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IField;
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
|
||||||
|
|
||||||
|
@ -160,4 +161,14 @@ public class CStructure implements ICompositeType {
|
||||||
public IScope getCompositeScope() {
|
public IScope getCompositeScope() {
|
||||||
return (definition != null ) ? definition.getScope() : null;
|
return (definition != null ) ? definition.getScope() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,10 @@ public class CTypeDef implements ITypedef, ITypeContainer {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setType( IType t ){
|
||||||
|
type = t;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
||||||
*/
|
*/
|
||||||
|
@ -62,4 +66,13 @@ public class CTypeDef implements ITypedef, ITypeContainer {
|
||||||
return CVisitor.getContainingScope( (IASTDeclaration) declarator.getParent() );
|
return CVisitor.getContainingScope( (IASTDeclaration) declarator.getParent() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,24 @@ public class CPPArrayType implements IArrayType, ITypeContainer {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setType( IType t ){
|
||||||
|
this.type = t;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if( obj instanceof IArrayType ){
|
if( obj instanceof IArrayType ){
|
||||||
return ((IArrayType) obj).getType().equals( type );
|
return ((IArrayType) obj).getType().equals( type );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
*/
|
*/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,4 +78,14 @@ public class CPPBasicType implements ICPPBasicType {
|
||||||
public boolean isLong() {
|
public boolean isLong() {
|
||||||
return ( qualifierBits & IS_LONG ) != 0;
|
return ( qualifierBits & IS_LONG ) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,13 @@ import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IField;
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -209,4 +211,22 @@ public class CPPClassType implements ICPPClassType {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType#getConstructors()
|
||||||
|
*/
|
||||||
|
public ICPPConstructor[] getConstructors() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author aniefer
|
* @author aniefer
|
||||||
|
@ -59,4 +60,14 @@ public class CPPEnumeration implements IEnumeration {
|
||||||
return enumSpecifier;
|
return enumSpecifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,11 @@ public class CPPFunctionType implements IFunctionType {
|
||||||
|
|
||||||
if( fps.length != parameters.length )
|
if( fps.length != parameters.length )
|
||||||
return false;
|
return false;
|
||||||
if( ! returnType.equals( ft.getReturnType() ) )
|
|
||||||
|
//constructors & destructors have null return type
|
||||||
|
if( ( returnType == null ) ^ ( ft.getReturnType() == null ) )
|
||||||
|
return false;
|
||||||
|
else if( returnType != null && ! returnType.equals( ft.getReturnType() ) )
|
||||||
return false;
|
return false;
|
||||||
for( int i = 0; i < parameters.length; i++ )
|
for( int i = 0; i < parameters.length; i++ )
|
||||||
if( ! parameters[i].equals( fps[i] ) )
|
if( ! parameters[i].equals( fps[i] ) )
|
||||||
|
@ -63,4 +67,13 @@ public class CPPFunctionType implements IFunctionType {
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,10 @@ public class CPPPointerType implements IPointerType, ITypeContainer {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setType( IType t ){
|
||||||
|
type = t;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IPointerType#isConst()
|
* @see org.eclipse.cdt.core.dom.ast.IPointerType#isConst()
|
||||||
*/
|
*/
|
||||||
|
@ -73,4 +77,14 @@ public class CPPPointerType implements IPointerType, ITypeContainer {
|
||||||
public boolean isVolatile() {
|
public boolean isVolatile() {
|
||||||
return ( operator != null ) ? operator.isVolatile() : false;
|
return ( operator != null ) ? operator.isVolatile() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,4 +66,17 @@ public class CPPQualifierType implements IQualifierType, ITypeContainer {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setType( IType t ){
|
||||||
|
type = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,11 +16,12 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author aniefer
|
* @author aniefer
|
||||||
*/
|
*/
|
||||||
public class CPPReferenceType implements ICPPReferenceType {
|
public class CPPReferenceType implements ICPPReferenceType, ITypeContainer {
|
||||||
IType type = null;
|
IType type = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,10 +38,24 @@ public class CPPReferenceType implements ICPPReferenceType {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setType( IType t ){
|
||||||
|
type = t;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if( obj instanceof ICPPReferenceType ){
|
if( obj instanceof ICPPReferenceType ){
|
||||||
return ((ICPPReferenceType) obj).getType().equals( type );
|
return ((ICPPReferenceType) obj).getType().equals( type );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||||
*/
|
*/
|
||||||
public class CPPTypedef implements ITypedef, ITypeContainer {
|
public class CPPTypedef implements ITypedef, ITypeContainer {
|
||||||
private IASTDeclarator declarator = null;
|
private IASTDeclarator declarator = null;
|
||||||
|
private IType type = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param declarator
|
* @param declarator
|
||||||
*/
|
*/
|
||||||
|
@ -48,7 +50,13 @@ public class CPPTypedef implements ITypedef, ITypeContainer {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.ITypedef#getType()
|
* @see org.eclipse.cdt.core.dom.ast.ITypedef#getType()
|
||||||
*/
|
*/
|
||||||
public IType getType() {
|
public IType getType() {
|
||||||
return CPPVisitor.createType( declarator );
|
if( type == null )
|
||||||
|
type = CPPVisitor.createType( declarator );
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType( IType t ){
|
||||||
|
type = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -78,4 +86,14 @@ public class CPPTypedef implements ITypedef, ITypeContainer {
|
||||||
public IASTNode getPhysicalNode() {
|
public IASTNode getPhysicalNode() {
|
||||||
return declarator;
|
return declarator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone(){
|
||||||
|
IType t = null;
|
||||||
|
try {
|
||||||
|
t = (IType) super.clone();
|
||||||
|
} catch ( CloneNotSupportedException e ) {
|
||||||
|
//not going to happen
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue