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

Removes unused throw declarations, bug 283523.

This commit is contained in:
Markus Schorn 2009-07-15 10:49:09 +00:00
parent 5593bc6a0c
commit 3d7ad1a899
65 changed files with 468 additions and 837 deletions

View file

@ -224,17 +224,13 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
} }
protected static void assertTypeContainer(IType conType, String expQN, Class containerType, Class expContainedType, String expContainedTypeQN) { protected static void assertTypeContainer(IType conType, String expQN, Class containerType, Class expContainedType, String expContainedTypeQN) {
try { assertInstance(conType, ITypeContainer.class);
assertInstance(conType, ITypeContainer.class); assertInstance(conType, containerType);
assertInstance(conType, containerType); IType containedType= ((ITypeContainer)conType).getType();
IType containedType= ((ITypeContainer)conType).getType(); assertInstance(containedType, expContainedType);
assertInstance(containedType, expContainedType); if (expContainedTypeQN != null) {
if (expContainedTypeQN != null) { assertInstance(containedType, IBinding.class);
assertInstance(containedType, IBinding.class); assertQNEquals(expContainedTypeQN, (IBinding) containedType);
assertQNEquals(expContainedTypeQN, (IBinding) containedType);
}
} catch (DOMException de) {
fail(de.getMessage());
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2008 Symbian Software Systems and others. * Copyright (c) 2007, 2009 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -1456,18 +1456,14 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
* @param qn may be null * @param qn may be null
*/ */
static protected void assertPTM(IType type, String cqn, String qn) { static protected void assertPTM(IType type, String cqn, String qn) {
try { assertTrue(type instanceof ICPPPointerToMemberType);
assertTrue(type instanceof ICPPPointerToMemberType); ICPPPointerToMemberType ptmt = (ICPPPointerToMemberType) type;
ICPPPointerToMemberType ptmt = (ICPPPointerToMemberType) type; ICPPClassType classType = (ICPPClassType) ptmt.getMemberOfClass();
ICPPClassType classType = (ICPPClassType) ptmt.getMemberOfClass(); assertQNEquals(cqn, classType);
assertQNEquals(cqn, classType); if(qn!=null) {
if(qn!=null) { assert(ptmt.getType() instanceof ICPPBinding);
assert(ptmt.getType() instanceof ICPPBinding); ICPPBinding tyBinding = (ICPPBinding) ptmt.getType();
ICPPBinding tyBinding = (ICPPBinding) ptmt.getType(); assertQNEquals(qn, tyBinding);
assertQNEquals(qn, tyBinding);
}
} catch(DOMException de) {
fail(de.getMessage());
} }
} }
} }

View file

@ -58,7 +58,6 @@ public class ASTTypeUtil {
private static final String COMMA_SPACE = ", "; //$NON-NLS-1$ private static final String COMMA_SPACE = ", "; //$NON-NLS-1$
private static final String EMPTY_STRING = ""; //$NON-NLS-1$ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
private static final String SPACE = " "; //$NON-NLS-1$ private static final String SPACE = " "; //$NON-NLS-1$
private static final String[] EMPTY_STRING_ARRAY = new String[0];
private static final int DEAULT_ITYPE_SIZE = 2; private static final int DEAULT_ITYPE_SIZE = 2;
/** /**
@ -183,13 +182,7 @@ public class ASTTypeUtil {
* @see #getType(IType, boolean) * @see #getType(IType, boolean)
*/ */
public static String[] getParameterTypeStringArray(IFunctionType type) { public static String[] getParameterTypeStringArray(IFunctionType type) {
IType[] parms = null; IType[] parms = type.getParameterTypes();
try {
parms = type.getParameterTypes();
} catch (DOMException e) {
return EMPTY_STRING_ARRAY;
}
String[] result = new String[parms.length]; String[] result = new String[parms.length];
for (int i = 0; i < parms.length; i++) { for (int i = 0; i < parms.length; i++) {
@ -503,17 +496,9 @@ public class ASTTypeUtil {
} }
} }
if (type instanceof ITypeContainer) { if (type instanceof ITypeContainer) {
try { type = ((ITypeContainer) type).getType();
type = ((ITypeContainer) type).getType();
} catch (DOMException e) {
type= null;
}
} else if (type instanceof IFunctionType) { } else if (type instanceof IFunctionType) {
try { type= ((IFunctionType) type).getReturnType();
type= ((IFunctionType) type).getReturnType();
} catch (DOMException e) {
type= null;
}
} else { } else {
type= null; type= null;
} }
@ -663,54 +648,24 @@ public class ASTTypeUtil {
} }
/** /**
* This can be used to invoke the IType's isConst() if it has an isConst() method. * @deprecated don't use it does something strange
* This returns the result of that invoked isConst() method.
* It is a convenience function so that the structure of IType does not need
* to be known to determine if the IType is const or not.
*
* Note: false is returned if no isConst() method is found
*
* @param type
*/ */
@Deprecated
public static boolean isConst(IType type) { public static boolean isConst(IType type) {
if (type instanceof IQualifierType) { if (type instanceof IQualifierType) {
return ((IQualifierType) type).isConst(); return ((IQualifierType) type).isConst();
} else if (type instanceof ITypeContainer) { } else if (type instanceof ITypeContainer) {
try { return isConst(((ITypeContainer) type).getType());
return isConst(((ITypeContainer) type).getType());
} catch (DOMException e) {
return false;
}
} else if (type instanceof IArrayType) { } else if (type instanceof IArrayType) {
try { return isConst(((IArrayType) type).getType());
return isConst(((IArrayType) type).getType());
} catch (DOMException e) {
return false;
}
} else if (type instanceof ICPPReferenceType) { } else if (type instanceof ICPPReferenceType) {
try { return isConst(((ICPPReferenceType) type).getType());
return isConst(((ICPPReferenceType) type).getType());
} catch (DOMException e) {
return false;
}
} else if (type instanceof IFunctionType) { } else if (type instanceof IFunctionType) {
try { return isConst(((IFunctionType) type).getReturnType());
return isConst(((IFunctionType) type).getReturnType());
} catch (DOMException e) {
return false;
}
} else if (type instanceof IPointerType) { } else if (type instanceof IPointerType) {
try { return isConst(((IPointerType) type).getType());
return isConst(((IPointerType) type).getType());
} catch (DOMException e) {
return false;
}
} else if (type instanceof ITypedef) { } else if (type instanceof ITypedef) {
try { return isConst(((ITypedef) type).getType());
return isConst(((ITypedef) type).getType());
} catch (DOMException e) {
return false;
}
} else { } else {
return false; return false;
} }

View file

@ -17,9 +17,8 @@ package org.eclipse.cdt.core.dom.ast;
public interface IArrayType extends IType { public interface IArrayType extends IType {
/** /**
* get the type that this is an array of * get the type that this is an array of
* @throws DOMException
*/ */
IType getType() throws DOMException; IType getType();
/** /**
* get the expression that represents the size of this array * get the expression that represents the size of this array

View file

@ -18,14 +18,12 @@ public interface IFunctionType extends IType {
/** /**
* get the return type of this function type * get the return type of this function type
* @throws DOMException
*/ */
public IType getReturnType() throws DOMException; public IType getReturnType();
/** /**
* get the adjusted parameter types * get the adjusted parameter types
* ISO C99 6.7.5.3, ISO C++98 8.3.4-3 * ISO C99 6.7.5.3, ISO C++98 8.3.4-3
* @throws DOMException
*/ */
public IType[] getParameterTypes() throws DOMException; public IType[] getParameterTypes();
} }

View file

@ -17,9 +17,8 @@ package org.eclipse.cdt.core.dom.ast;
public interface IPointerType extends IType { public interface IPointerType extends IType {
/** /**
* get the type that this is a pointer to * get the type that this is a pointer to
* @throws DOMException
*/ */
public IType getType() throws DOMException; public IType getType();
/** /**
* is this a const pointer * is this a const pointer

View file

@ -30,7 +30,6 @@ public interface IQualifierType extends IType {
/** /**
* get the type that this is qualifying * get the type that this is qualifying
* @throws DOMException
*/ */
public IType getType() throws DOMException; public IType getType();
} }

View file

@ -19,6 +19,6 @@ public interface ITypedef extends IBinding, IType {
/** /**
* Returns the type that this thing is a typedef of * Returns the type that this thing is a typedef of
*/ */
public IType getType() throws DOMException; public IType getType();
} }

View file

@ -10,7 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp; package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
/** /**
@ -21,8 +20,6 @@ public interface ICPPReferenceType extends IType {
/** /**
* get the type that this is a reference of * get the type that this is a reference of
*
* @throws DOMException
*/ */
public IType getType() throws DOMException; public IType getType();
} }

View file

@ -1,36 +1,29 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2008 IBM Corporation and others. * Copyright (c) 2004, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * Andrew Niefer (IBM Corporation) - initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
/*
* Created on Dec 13, 2004
*/
package org.eclipse.cdt.internal.core.dom.parser; package org.eclipse.cdt.internal.core.dom.parser;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
/** /**
* Internal interface representing types that contain other types * Internal interface representing types that contain other types
* @author aniefer
*/ */
public interface ITypeContainer extends IType { public interface ITypeContainer extends IType {
/** /**
* get the type this contains * get the type this contains
* @throws DOMException
*/ */
IType getType() throws DOMException; IType getType();
/** /**
* set the type this contains * set the type this contains
* @param type
*/ */
void setType(IType type); void setType(IType type);
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Wind River Systems, Inc. and others. * Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -162,20 +162,16 @@ public abstract class VariableReadWriteFlags {
} }
protected int rwArgumentForFunctionCall(final IASTFunctionCallExpression func, int parameterIdx, int indirection) { protected int rwArgumentForFunctionCall(final IASTFunctionCallExpression func, int parameterIdx, int indirection) {
try { final IASTExpression functionNameExpression = func.getFunctionNameExpression();
final IASTExpression functionNameExpression = func.getFunctionNameExpression(); if (functionNameExpression != null) {
if (functionNameExpression != null) { final IType type= functionNameExpression.getExpressionType();
final IType type= functionNameExpression.getExpressionType(); if (type instanceof IFunctionType) {
if (type instanceof IFunctionType) { IType[] ptypes= ((IFunctionType) type).getParameterTypes();
IType[] ptypes= ((IFunctionType) type).getParameterTypes(); if (ptypes != null && ptypes.length > parameterIdx) {
if (ptypes != null && ptypes.length > parameterIdx) { return rwAssignmentToType(ptypes[parameterIdx], indirection);
return rwAssignmentToType(ptypes[parameterIdx], indirection);
}
} }
} }
} }
catch (DOMException e) {
}
return READ | WRITE; // fallback return READ | WRITE; // fallback
} }

View file

@ -13,7 +13,6 @@
package org.eclipse.cdt.internal.core.dom.parser.c; package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression; import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
@ -114,14 +113,10 @@ public class CASTArraySubscriptExpression extends ASTNode implements
public IType getExpressionType() { public IType getExpressionType() {
IType t = getArrayExpression().getExpressionType(); IType t = getArrayExpression().getExpressionType();
try { if (t instanceof IPointerType)
if (t instanceof IPointerType) return ((IPointerType)t).getType();
return ((IPointerType)t).getType(); else if (t instanceof IArrayType)
else if (t instanceof IArrayType) return ((IArrayType)t).getType();
return ((IArrayType)t).getType();
} catch (DOMException e) {
return e.getProblem();
}
return t; return t;
} }
} }

View file

@ -13,7 +13,6 @@
package org.eclipse.cdt.internal.core.dom.parser.c; package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
@ -115,14 +114,10 @@ public class CASTFunctionCallExpression extends ASTNode implements
public IType getExpressionType() { public IType getExpressionType() {
IType type = getFunctionNameExpression().getExpressionType(); IType type = getFunctionNameExpression().getExpressionType();
try { while (type instanceof ITypeContainer)
while (type instanceof ITypeContainer) type = ((ITypeContainer) type).getType();
type = ((ITypeContainer) type).getType(); if (type instanceof IFunctionType)
if (type instanceof IFunctionType) return ((IFunctionType) type).getReturnType();
return ((IFunctionType) type).getReturnType();
} catch (DOMException e) {
return e.getProblem();
}
return null; return null;
} }
} }

View file

@ -13,7 +13,6 @@
package org.eclipse.cdt.internal.core.dom.parser.c; package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression; import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
@ -102,14 +101,10 @@ public class CASTUnaryExpression extends ASTNode implements IASTUnaryExpression,
public IType getExpressionType() { public IType getExpressionType() {
IType type = getOperand().getExpressionType(); IType type = getOperand().getExpressionType();
int op = getOperator(); int op = getOperator();
try { if (op == IASTUnaryExpression.op_star && (type instanceof IPointerType || type instanceof IArrayType)) {
if (op == IASTUnaryExpression.op_star && (type instanceof IPointerType || type instanceof IArrayType)) { return ((ITypeContainer) type).getType();
return ((ITypeContainer) type).getType(); } else if (op == IASTUnaryExpression.op_amper) {
} else if (op == IASTUnaryExpression.op_amper) { return new CPointerType(type, 0);
return new CPointerType(type, 0);
}
} catch (DOMException e) {
return e.getProblem();
} }
return type; return type;
} }

View file

@ -1,23 +1,19 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2008 IBM Corporation and others. * Copyright (c) 2004, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * Devin Steffler (IBM Corporation) - initial API and implementation
*******************************************************************************/ *******************************************************************************/
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.DOMException;
import org.eclipse.cdt.core.dom.ast.IFunctionType; import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
/**
* @author dsteffle
*/
public class CFunctionType implements IFunctionType { public class CFunctionType implements IFunctionType {
IType[] parameters = null; IType[] parameters = null;
IType returnType = null; IType returnType = null;
@ -39,19 +35,11 @@ public class CFunctionType implements IFunctionType {
if( o instanceof IFunctionType ){ if( o instanceof IFunctionType ){
IFunctionType ft = (IFunctionType) o; IFunctionType ft = (IFunctionType) o;
IType [] fps; IType [] fps;
try { fps = ft.getParameterTypes();
fps = ft.getParameterTypes();
} catch ( DOMException e ) {
return false;
}
if( fps.length != parameters.length ) if( fps.length != parameters.length )
return false; return false;
try { if( ! returnType.isSameType( ft.getReturnType() ) )
if( ! returnType.isSameType( ft.getReturnType() ) ) return false;
return false;
} catch ( DOMException e1 ) {
return false;
}
for( int i = 0; i < parameters.length; i++ ) for( int i = 0; i < parameters.length; i++ )
if( ! parameters[i].isSameType( fps[i] ) ) if( ! parameters[i].isSameType( fps[i] ) )
return false; return false;

View file

@ -1,24 +1,20 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2008 IBM Corporation and others. * Copyright (c) 2005, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* 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; package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.c.ICPointerType; import org.eclipse.cdt.core.dom.ast.c.ICPointerType;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
/**
* @author dsteffle
*/
public class CPointerType implements ICPointerType, ITypeContainer { public class CPointerType implements ICPointerType, ITypeContainer {
static public final int IS_CONST = 1; static public final int IS_CONST = 1;
static public final int IS_RESTRICT = 1 << 1; static public final int IS_RESTRICT = 1 << 1;
@ -42,15 +38,11 @@ public class CPointerType implements ICPointerType, ITypeContainer {
if( obj instanceof ICPointerType ){ if( obj instanceof ICPointerType ){
ICPointerType pt = (ICPointerType) obj; ICPointerType pt = (ICPointerType) obj;
try { if( isConst() != pt.isConst() ) return false;
if( isConst() != pt.isConst() ) return false; if( isRestrict() != pt.isRestrict() ) return false;
if( isRestrict() != pt.isRestrict() ) return false; if( isVolatile() != pt.isVolatile() ) return false;
if( isVolatile() != pt.isVolatile() ) return false;
return pt.getType().isSameType( nextType );
return pt.getType().isSameType( nextType );
} catch ( DOMException e ) {
return false;
}
} }
return false; return false;
} }

View file

@ -1,16 +1,15 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2008 IBM Corporation and others. * Copyright (c) 2005, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* 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; package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier; import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
@ -22,9 +21,6 @@ import org.eclipse.cdt.core.dom.ast.c.ICASTTypedefNameSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICQualifierType; import org.eclipse.cdt.core.dom.ast.c.ICQualifierType;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
/**
* @author dsteffle
*/
public class CQualifierType implements ICQualifierType, ITypeContainer { public class CQualifierType implements ICQualifierType, ITypeContainer {
private boolean isConst; private boolean isConst;
@ -57,17 +53,13 @@ public class CQualifierType implements ICQualifierType, ITypeContainer {
if( obj instanceof ICQualifierType ){ if( obj instanceof ICQualifierType ){
ICQualifierType qt = (ICQualifierType) obj; ICQualifierType qt = (ICQualifierType) obj;
try { if( isConst() != qt.isConst() ) return false;
if( isConst() != qt.isConst() ) return false; if( isRestrict() != qt.isRestrict() ) return false;
if( isRestrict() != qt.isRestrict() ) return false; if( isVolatile() != qt.isVolatile() ) return false;
if( isVolatile() != qt.isVolatile() ) return false;
if( type == null )
if( type == null ) return false;
return false; return type.isSameType( qt.getType() );
return type.isSameType( qt.getType() );
} catch ( DOMException e ) {
return false;
}
} }
return false; return false;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2008 IBM Corporation and others. * Copyright (c) 2005, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -86,15 +86,12 @@ public class CTypedef extends PlatformObject implements ITypedef, ITypeContainer
public boolean isSameType( IType t ) { public boolean isSameType( IType t ) {
if( t == this ) if( t == this )
return true; return true;
if( t instanceof ITypedef ) if( t instanceof ITypedef ) {
try { IType temp = getType();
IType temp = getType(); if( temp != null )
if( temp != null ) return temp.isSameType( ((ITypedef)t).getType());
return temp.isSameType( ((ITypedef)t).getType()); return false;
return false; }
} catch ( DOMException e ) {
return false;
}
IType temp = getType(); IType temp = getType();
if( temp != null ) if( temp != null )

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Wind River Systems, Inc. and others. * Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,7 +10,6 @@
*******************************************************************************/ *******************************************************************************/
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.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpressionList; import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
@ -82,21 +81,17 @@ public final class CVariableReadWriteFlags extends VariableReadWriteFlags {
if (indirection == 0) { if (indirection == 0) {
return READ; return READ;
} }
try { while(indirection > 0 && (type instanceof IPointerType)) {
while(indirection > 0 && (type instanceof IPointerType)) { type= ((IPointerType) type).getType();
type= ((IPointerType) type).getType(); indirection--;
indirection--;
}
if (indirection == 0) {
if (type instanceof IQualifierType) {
return ((IQualifierType) type).isConst() ? READ : READ | WRITE;
}
else if (type instanceof IPointerType) {
return ((IPointerType) type).isConst() ? READ : READ | WRITE;
}
}
} }
catch (DOMException e) { if (indirection == 0) {
if (type instanceof IQualifierType) {
return ((IQualifierType) type).isConst() ? READ : READ | WRITE;
}
else if (type instanceof IPointerType) {
return ((IPointerType) type).isConst() ? READ : READ | WRITE;
}
} }
return READ | WRITE; // fallback return READ | WRITE; // fallback
} }

View file

@ -602,11 +602,7 @@ public class CVisitor extends ASTQueries {
IType type = fieldOwner.getExpressionType(); IType type = fieldOwner.getExpressionType();
while (type != null && type instanceof ITypeContainer) { while (type != null && type instanceof ITypeContainer) {
try { type = ((ITypeContainer)type).getType();
type = ((ITypeContainer)type).getType();
} catch (DOMException e) {
return e.getProblem();
}
} }
if (type != null && type instanceof ICompositeType) { if (type != null && type instanceof ICompositeType) {
@ -925,14 +921,10 @@ public class CVisitor extends ASTQueries {
} }
} else if (struct instanceof ITypeContainer) { } else if (struct instanceof ITypeContainer) {
IType type; IType type;
try { type = ((ITypeContainer)struct).getType();
type = ((ITypeContainer)struct).getType(); while (type instanceof ITypeContainer && !(type instanceof CStructure)) {
while (type instanceof ITypeContainer && !(type instanceof CStructure)) { type = ((ITypeContainer)type).getType();
type = ((ITypeContainer)type).getType(); }
}
} catch (DOMException e) {
return e.getProblem();
}
if (type instanceof CStructure) if (type instanceof CStructure)

View file

@ -224,11 +224,7 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
case ICPPASTBinaryExpression.op_pmarrow: case ICPPASTBinaryExpression.op_pmarrow:
case ICPPASTBinaryExpression.op_pmdot: case ICPPASTBinaryExpression.op_pmdot:
if (type2 instanceof ICPPPointerToMemberType) { if (type2 instanceof ICPPPointerToMemberType) {
try { return ((ICPPPointerToMemberType) type2).getType();
return ((ICPPPointerToMemberType) type2).getType();
} catch (DOMException e) {
return e.getProblem();
}
} }
return new ProblemBinding(this, IProblemBinding.SEMANTIC_INVALID_TYPE, getRawSignature().toCharArray()); return new ProblemBinding(this, IProblemBinding.SEMANTIC_INVALID_TYPE, getRawSignature().toCharArray());
} }

View file

@ -13,7 +13,6 @@
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.ASTVisitor; import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator; import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier; import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator; import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
@ -253,11 +252,7 @@ public class CPPASTNewExpression extends ASTNode implements
public IType getExpressionType() { public IType getExpressionType() {
IType t= CPPVisitor.createType(getTypeId()); IType t= CPPVisitor.createType(getTypeId());
if (t instanceof IArrayType) { if (t instanceof IArrayType) {
try { t= ((IArrayType) t).getType();
t= ((IArrayType) t).getType();
} catch (DOMException e) {
return e.getProblem();
}
} }
return new CPPPointerType(t); return new CPPPointerType(t);
} }

View file

@ -12,7 +12,9 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.*; import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVQ;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.REF;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.DOMException;
@ -231,17 +233,13 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
if (type instanceof IProblemBinding) { if (type instanceof IProblemBinding) {
return type; return type;
} }
try { IType operator = findOperatorReturnType();
IType operator = findOperatorReturnType(); if(operator != null) {
if(operator != null) { return operator;
return operator; } else if (type instanceof IPointerType || type instanceof IArrayType) {
} else if (type instanceof IPointerType || type instanceof IArrayType) { return ((ITypeContainer) type).getType();
return ((ITypeContainer) type).getType(); } else if (type instanceof ICPPUnknownType) {
} else if (type instanceof ICPPUnknownType) { return CPPUnknownClass.createUnnamedInstance();
return CPPUnknownClass.createUnnamedInstance();
}
} catch (DOMException e) {
return e.getProblem();
} }
return new ProblemBinding(this, IProblemBinding.SEMANTIC_INVALID_TYPE, this.getRawSignature().toCharArray()); return new ProblemBinding(this, IProblemBinding.SEMANTIC_INVALID_TYPE, this.getRawSignature().toCharArray());
} }

View file

@ -6,25 +6,18 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * Andrew Niefer (IBM Corporation) - initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
/*
* Created on Dec 13, 2004
*/
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.ASTTypeUtil; import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IArrayType; import org.eclipse.cdt.core.dom.ast.IArrayType;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
/**
* @author aniefer
*/
public class CPPArrayType implements IArrayType, ITypeContainer { public class CPPArrayType implements IArrayType, ITypeContainer {
private IType type; private IType type;
private IASTExpression sizeExpression; private IASTExpression sizeExpression;
@ -53,13 +46,9 @@ public class CPPArrayType implements IArrayType, ITypeContainer {
return ((ITypedef) obj).isSameType(this); return ((ITypedef) obj).isSameType(this);
if (obj instanceof IArrayType) { if (obj instanceof IArrayType) {
try { IType objType = ((IArrayType) obj).getType();
IType objType = ((IArrayType) obj).getType(); if (objType != null)
if (objType != null) return objType.isSameType(type);
return objType.isSameType(type);
} catch (DOMException e) {
return false;
}
} }
return false; return false;
} }

View file

@ -51,20 +51,12 @@ public class CPPFunctionType implements ICPPFunctionType {
if (o instanceof ICPPFunctionType) { if (o instanceof ICPPFunctionType) {
ICPPFunctionType ft = (ICPPFunctionType) o; ICPPFunctionType ft = (ICPPFunctionType) o;
IType[] fps; IType[] fps;
try { fps = ft.getParameterTypes();
fps = ft.getParameterTypes(); //constructors & destructors have null return type
} catch (DOMException e) { if ((returnType == null) ^ (ft.getReturnType() == null))
return false; return false;
} else if (returnType != null && ! returnType.isSameType(ft.getReturnType()))
try { return false;
//constructors & destructors have null return type
if ((returnType == null) ^ (ft.getReturnType() == null))
return false;
else if (returnType != null && ! returnType.isSameType(ft.getReturnType()))
return false;
} catch (DOMException e1) {
return false;
}
try { try {
if (parameters.length == 1 && fps.length == 0) { if (parameters.length == 1 && fps.length == 0) {

View file

@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
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.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
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.IType;
@ -57,23 +56,21 @@ public class CPPImplicitTypedef extends CPPTypedef {
@Override @Override
public boolean isSameType(IType t) { public boolean isSameType(IType t) {
if( t == this ) if (t == this)
return true; return true;
if( t instanceof ITypedef ) { if (t instanceof ITypedef) {
IType temp = getType(); IType temp = getType();
if( temp != null ) if (temp != null)
try { return temp.isSameType(((ITypedef) t).getType());
return temp.isSameType( ((ITypedef)t).getType()); return false;
} catch (DOMException e) {} }
return false;
} IType temp;
temp = getType();
IType temp; if (temp != null)
temp = getType(); return temp.isSameType(t);
if( temp != null ) return false;
return temp.isSameType( t ); }
return false;
}
@Override @Override
public Object clone(){ public Object clone(){

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2008 IBM Corporation and others. * Copyright (c) 2005, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -45,12 +45,15 @@ public class CPPParameterSpecialization extends CPPSpecialization implements ICP
} }
@Override @Override
public IType specializeType(IType type) throws DOMException { public IType specializeType(IType type) {
IBinding owner= getOwner(); IBinding owner= getOwner();
if (owner != null) { if (owner != null) {
owner= owner.getOwner(); try {
if (owner instanceof ICPPClassSpecialization) { owner= owner.getOwner();
return CPPTemplates.instantiateType(type, getTemplateParameterMap(), (ICPPClassSpecialization) owner); if (owner instanceof ICPPClassSpecialization) {
return CPPTemplates.instantiateType(type, getTemplateParameterMap(), (ICPPClassSpecialization) owner);
}
} catch (DOMException e) {
} }
} }
return CPPTemplates.instantiateType(type, getTemplateParameterMap(), null); return CPPTemplates.instantiateType(type, getTemplateParameterMap(), null);

View file

@ -12,7 +12,6 @@
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.ASTTypeUtil; import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTPointer; import org.eclipse.cdt.core.dom.ast.IASTPointer;
import org.eclipse.cdt.core.dom.ast.IPointerType; import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
@ -71,10 +70,7 @@ public class CPPPointerType implements IPointerType, ITypeContainer {
IPointerType pt = (IPointerType) o; IPointerType pt = (IPointerType) o;
if (isConst == pt.isConst() && isVolatile == pt.isVolatile()) { if (isConst == pt.isConst() && isVolatile == pt.isVolatile()) {
try { return type.isSameType(pt.getType());
return type.isSameType(pt.getType());
} catch (DOMException e) {
}
} }
return false; return false;
} }

View file

@ -6,22 +6,18 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * Andrew Niefer (IBM Corporation) - initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
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.ASTTypeUtil; import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IQualifierType; import org.eclipse.cdt.core.dom.ast.IQualifierType;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.index.IIndexType; import org.eclipse.cdt.internal.core.index.IIndexType;
/**
* @author aniefer
*/
public class CPPQualifierType implements IQualifierType, ITypeContainer { public class CPPQualifierType implements IQualifierType, ITypeContainer {
private final boolean isConst; private final boolean isConst;
private final boolean isVolatile; private final boolean isVolatile;
@ -40,11 +36,8 @@ public class CPPQualifierType implements IQualifierType, ITypeContainer {
return false; return false;
IQualifierType pt = (IQualifierType) o; IQualifierType pt = (IQualifierType) o;
try { if (isConst() == pt.isConst() && isVolatile() == pt.isVolatile())
if (isConst() == pt.isConst() && isVolatile() == pt.isVolatile()) return type.isSameType(pt.getType());
return type.isSameType(pt.getType());
} catch (DOMException e) {
}
return false; return false;
} }

View file

@ -1,29 +1,21 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2008 IBM Corporation and others. * Copyright (c) 2004, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * Andrew Niefer (IBM Corporation) - initial API and implementation
*******************************************************************************/ *******************************************************************************/
/*
* Created on Dec 15, 2004
*/
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.ASTTypeUtil; import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
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; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
/**
* @author aniefer
*/
public class CPPReferenceType implements ICPPReferenceType, ITypeContainer { public class CPPReferenceType implements ICPPReferenceType, ITypeContainer {
IType type = null; IType type = null;
@ -50,11 +42,7 @@ public class CPPReferenceType implements ICPPReferenceType, ITypeContainer {
return (obj == null); return (obj == null);
if (obj instanceof ICPPReferenceType) { if (obj instanceof ICPPReferenceType) {
try { return type.isSameType(((ICPPReferenceType) obj).getType());
return type.isSameType(((ICPPReferenceType) obj).getType());
} catch (DOMException e) {
return false;
}
} }
return false; return false;
} }

View file

@ -51,7 +51,7 @@ public abstract class CPPSpecialization extends PlatformObject implements ICPPSp
this.argumentMap = argumentMap; this.argumentMap = argumentMap;
} }
public IType specializeType(IType type) throws DOMException { public IType specializeType(IType type) {
if (owner instanceof ICPPClassSpecialization) { if (owner instanceof ICPPClassSpecialization) {
return CPPTemplates.instantiateType(type, getTemplateParameterMap(), (ICPPClassSpecialization) owner); return CPPTemplates.instantiateType(type, getTemplateParameterMap(), (ICPPClassSpecialization) owner);
} else { } else {

View file

@ -65,14 +65,10 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
if (o == this) if (o == this)
return true; return true;
if (o instanceof ITypedef) { if (o instanceof ITypedef) {
try { IType t = getType();
IType t = getType(); if (t != null)
if (t != null) return t.isSameType(((ITypedef)o).getType());
return t.isSameType(((ITypedef)o).getType()); return false;
return false;
} catch (DOMException e) {
return false;
}
} }
IType t = getType(); IType t = getType();

View file

@ -33,7 +33,7 @@ public class CPPTypedefSpecialization extends CPPSpecialization implements IType
final static class RecursionResolvingBinding extends ProblemBinding { final static class RecursionResolvingBinding extends ProblemBinding {
public RecursionResolvingBinding(IASTNode node, char[] arg) { public RecursionResolvingBinding(IASTNode node, char[] arg) {
super(node, IProblemBinding.SEMANTIC_RECURSION_IN_LOOKUP, arg); super(node, IProblemBinding.SEMANTIC_RECURSION_IN_LOOKUP, arg);
Assert.isTrue(CPPASTName.sAllowRecursionBindings, getMessage()); Assert.isTrue(CPPASTNameBase.sAllowRecursionBindings, getMessage());
} }
} }
@ -54,7 +54,7 @@ public class CPPTypedefSpecialization extends CPPSpecialization implements IType
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.ITypedef#getType() * @see org.eclipse.cdt.core.dom.ast.ITypedef#getType()
*/ */
public IType getType() throws DOMException { public IType getType() {
if (type == null) { if (type == null) {
try { try {
if (++fResolutionDepth > MAX_RESOLUTION_DEPTH) { if (++fResolutionDepth > MAX_RESOLUTION_DEPTH) {
@ -66,7 +66,11 @@ public class CPPTypedefSpecialization extends CPPSpecialization implements IType
if (type instanceof ITypedef && type instanceof ICPPSpecialization) { if (type instanceof ITypedef && type instanceof ICPPSpecialization) {
ITypedef td= (ITypedef) type; ITypedef td= (ITypedef) type;
if (CharArrayUtils.equals(td.getNameCharArray(), getNameCharArray())) { if (CharArrayUtils.equals(td.getNameCharArray(), getNameCharArray())) {
IBinding owner= ((ICPPSpecialization) type).getOwner(); IBinding owner= getOwner();
try {
owner = ((ICPPSpecialization) type).getOwner();
} catch (DOMException e) {
}
if (owner instanceof IType) { if (owner instanceof IType) {
if (((IType) owner).isSameType((ICPPClassType) getOwner())) { if (((IType) owner).isSameType((ICPPClassType) getOwner())) {
type = new RecursionResolvingBinding(getDefinition(), getNameCharArray()); type = new RecursionResolvingBinding(getDefinition(), getNameCharArray());
@ -108,23 +112,15 @@ public class CPPTypedefSpecialization extends CPPSpecialization implements IType
if (o == this) if (o == this)
return true; return true;
if (o instanceof ITypedef) { if (o instanceof ITypedef) {
try { IType t = getType();
IType t = getType(); if (t != null)
if (t != null) return t.isSameType(((ITypedef) o).getType());
return t.isSameType(((ITypedef) o).getType()); return false;
return false;
} catch (DOMException e) {
return false;
}
} }
try { IType t = getType();
IType t = getType(); if (t != null)
if (t != null) return t.isSameType(o);
return t.isSameType(o);
} catch (DOMException e) {
return false;
}
return false; return false;
} }

View file

@ -2497,11 +2497,7 @@ public class CPPSemantics {
IType[] result = null; IType[] result = null;
for (int i = 0; i < types.length && types[i] != null; i++) { for (int i = 0; i < types.length && types[i] != null; i++) {
IType[] pts = null; IType[] pts = null;
try { pts = types[i].getParameterTypes();
pts = types[i].getParameterTypes();
} catch (DOMException e) {
continue;
}
if (pts.length > idx) if (pts.length > idx)
result = (IType[]) ArrayUtil.append(IType.class, result, pts[idx]); result = (IType[]) ArrayUtil.append(IType.class, result, pts[idx]);
} }
@ -2732,11 +2728,7 @@ public class CPPSemantics {
IType type = exp.getExpressionType(); IType type = exp.getExpressionType();
if (type instanceof IProblem) if (type instanceof IProblem)
return null; return null;
try { type = ((IPointerType)type).getType();
type = ((IPointerType)type).getType();
} catch (DOMException e) {
return null;
}
IASTTypeId typeId = exp.getTypeId().copy(); IASTTypeId typeId = exp.getTypeId().copy();
IASTExpression sizeExpression = new CPPASTTypeIdExpression(IASTTypeIdExpression.op_sizeof, typeId); IASTExpression sizeExpression = new CPPASTTypeIdExpression(IASTTypeIdExpression.op_sizeof, typeId);
@ -2767,13 +2759,9 @@ public class CPPSemantics {
IType type1 = exp.getOperand().getExpressionType(); IType type1 = exp.getOperand().getExpressionType();
IType ultimateType1 = SemanticUtil.getUltimateTypeUptoPointers(type1); IType ultimateType1 = SemanticUtil.getUltimateTypeUptoPointers(type1);
if (ultimateType1 instanceof IPointerType) { if (ultimateType1 instanceof IPointerType) {
try { IType classType = ((IPointerType)ultimateType1).getType();
IType classType = ((IPointerType)ultimateType1).getType(); if (classType instanceof ICPPClassType)
if (classType instanceof ICPPClassType) return (ICPPClassType) classType;
return (ICPPClassType) classType;
} catch (DOMException e) {
return null;
}
} }
return null; return null;
} }

View file

@ -998,7 +998,7 @@ public class CPPTemplates {
} }
public static void associateTemplateDeclarations(ICPPASTInternalTemplateDeclaration tdecl) { public static void associateTemplateDeclarations(ICPPASTInternalTemplateDeclaration tdecl) {
// find innermost template decl // find innermost template declaration
IASTDeclaration decl= tdecl.getDeclaration(); IASTDeclaration decl= tdecl.getDeclaration();
while (decl instanceof ICPPASTInternalTemplateDeclaration) { while (decl instanceof ICPPASTInternalTemplateDeclaration) {
tdecl= (ICPPASTInternalTemplateDeclaration) decl; tdecl= (ICPPASTInternalTemplateDeclaration) decl;
@ -1006,7 +1006,7 @@ public class CPPTemplates {
} }
final ICPPASTInternalTemplateDeclaration innerMostTDecl= tdecl; final ICPPASTInternalTemplateDeclaration innerMostTDecl= tdecl;
// find name declared in nested declaration // find name declared within the template declaration
IASTName name= getNameForDeclarationInTemplateDeclaration(decl); IASTName name= getNameForDeclarationInTemplateDeclaration(decl);
// count template declarations // count template declarations
@ -1021,7 +1021,7 @@ public class CPPTemplates {
// determine association of names with template declarations // determine association of names with template declarations
boolean lastIsTemplate= true; boolean lastIsTemplate= true;
int additionalLevels= 0; int missingTemplateDecls= 0;
if (name instanceof ICPPASTQualifiedName) { if (name instanceof ICPPASTQualifiedName) {
ICPPASTQualifiedName qname= (ICPPASTQualifiedName) name; ICPPASTQualifiedName qname= (ICPPASTQualifiedName) name;
final IASTName lastName = qname.getLastName(); final IASTName lastName = qname.getLastName();
@ -1030,8 +1030,7 @@ public class CPPTemplates {
// count template-ids // count template-ids
int idcount= 0; int idcount= 0;
final IASTName[] ns= qname.getNames(); final IASTName[] ns= qname.getNames();
for (int j = 0; j < ns.length; j++) { for (final IASTName n : ns) {
final IASTName n = ns[j];
if (n instanceof ICPPASTTemplateId) { if (n instanceof ICPPASTTemplateId) {
idcount++; idcount++;
} }
@ -1051,25 +1050,23 @@ public class CPPTemplates {
} }
if (lastIsID && !isCtorWithTemplateID) { if (lastIsID && !isCtorWithTemplateID) {
additionalLevels= idcount-tdeclcount; missingTemplateDecls= idcount-tdeclcount;
} else { } else {
additionalLevels= idcount+1-tdeclcount; missingTemplateDecls= idcount+1-tdeclcount;
if (additionalLevels > 0) { if (missingTemplateDecls > 0) {
// last name is probably not a template // last name is probably not a template
additionalLevels--; missingTemplateDecls--;
lastIsTemplate= false; lastIsTemplate= false;
CharArraySet tparnames= collectTemplateParameterNames(outerMostTDecl); CharArraySet tparnames= collectTemplateParameterNames(outerMostTDecl);
int j= 0; int j= 0;
IASTName n; for (IASTName n : ns) {
for (int i = 0; i < ns.length; i++) {
n = ns[j];
if (n instanceof ICPPASTTemplateId) { if (n instanceof ICPPASTTemplateId) {
// if we find a dependent id, there can be no explicit specialization. // if we find a dependent id, there can be no explicit specialization.
ICPPASTTemplateId id= (ICPPASTTemplateId) n; ICPPASTTemplateId id= (ICPPASTTemplateId) n;
if (usesTemplateParameter(id, tparnames)) if (usesTemplateParameter(id, tparnames))
break; break;
if (j++ == additionalLevels) { if (j++ == missingTemplateDecls) {
IBinding b= n.resolveBinding(); IBinding b= n.resolveBinding();
if (b instanceof ICPPTemplateInstance && b instanceof ICPPClassType) { if (b instanceof ICPPTemplateInstance && b instanceof ICPPClassType) {
try { try {
@ -1077,7 +1074,7 @@ public class CPPTemplates {
if (!(s instanceof ICPPClassSpecializationScope)) { if (!(s instanceof ICPPClassSpecializationScope)) {
// template-id of an explicit specialization. // template-id of an explicit specialization.
// here we don't have a template declaration. (see 14.7.3.5) // here we don't have a template declaration. (see 14.7.3.5)
additionalLevels++; missingTemplateDecls++;
lastIsTemplate= true; lastIsTemplate= true;
} }
} catch (DOMException e) { } catch (DOMException e) {
@ -1092,12 +1089,12 @@ public class CPPTemplates {
} }
} }
if (additionalLevels < 0) { if (missingTemplateDecls < 0) {
additionalLevels= 0; // too many template declarations missingTemplateDecls= 0; // too many template declarations
} }
// determine nesting level of parent // determine nesting level of parent
int level= additionalLevels; int level= missingTemplateDecls;
if (!CPPVisitor.isFriendFunctionDeclaration(innerMostTDecl.getDeclaration())) { if (!CPPVisitor.isFriendFunctionDeclaration(innerMostTDecl.getDeclaration())) {
node= outerMostTDecl.getParent(); node= outerMostTDecl.getParent();
while (node != null) { while (node != null) {
@ -1556,23 +1553,16 @@ public class CPPTemplates {
static private IType getArgumentTypeForDeduction(IType type, boolean parameterIsAReferenceType) { static private IType getArgumentTypeForDeduction(IType type, boolean parameterIsAReferenceType) {
type = SemanticUtil.getSimplifiedType(type); type = SemanticUtil.getSimplifiedType(type);
if (type instanceof ICPPReferenceType) { if (type instanceof ICPPReferenceType) {
try { type = ((ICPPReferenceType) type).getType();
type = ((ICPPReferenceType) type).getType();
} catch (DOMException e) {
}
} }
IType result = type; IType result = type;
if (!parameterIsAReferenceType) { if (!parameterIsAReferenceType) {
try { if (type instanceof IArrayType) {
if (type instanceof IArrayType) { result = new CPPPointerType(((IArrayType) type).getType());
result = new CPPPointerType(((IArrayType) type).getType()); } else if (type instanceof IFunctionType) {
} else if (type instanceof IFunctionType) { result = new CPPPointerType(type);
result = new CPPPointerType(type); } else {
} else { result = SemanticUtil.getNestedType(type, SemanticUtil.TDEF | SemanticUtil.CVQ | SemanticUtil.PTR_CVQ );
result = SemanticUtil.getNestedType(type, SemanticUtil.TDEF | SemanticUtil.CVQ | SemanticUtil.PTR_CVQ );
}
} catch (DOMException e) {
result = e.getProblem();
} }
} }
return result; return result;
@ -1934,12 +1924,8 @@ public class CPPTemplates {
} }
static private boolean isValidType(IType t) { static private boolean isValidType(IType t) {
try { while (t instanceof ITypeContainer) {
while (t instanceof ITypeContainer) { t = ((ITypeContainer) t).getType();
t = ((ITypeContainer) t).getType();
}
} catch (DOMException e) {
return false;
} }
return !(t instanceof IProblemBinding); return !(t instanceof IProblemBinding);
} }
@ -2030,11 +2016,7 @@ public class CPPTemplates {
if (paramType instanceof IFunctionType) { if (paramType instanceof IFunctionType) {
paramType = new CPPPointerType(paramType); paramType = new CPPPointerType(paramType);
} else if (paramType instanceof IArrayType) { } else if (paramType instanceof IArrayType) {
try { paramType = new CPPPointerType(((IArrayType) paramType).getType());
paramType = new CPPPointerType(((IArrayType) paramType).getType());
} catch (DOMException e) {
paramType = e.getProblem();
}
} }
Cost cost = Conversions.checkStandardConversionSequence(arg, paramType, false); Cost cost = Conversions.checkStandardConversionSequence(arg, paramType, false);
return cost != null && cost.getRank() != Rank.NO_MATCH; return cost != null && cost.getRank() != Rank.NO_MATCH;
@ -2088,30 +2070,25 @@ public class CPPTemplates {
} }
public static boolean isDependentType(IType t) { public static boolean isDependentType(IType t) {
try { while (true) {
while (true) { if (t instanceof ICPPUnknownType)
if (t instanceof ICPPUnknownType) return true;
if (t instanceof ICPPFunctionType) {
final ICPPFunctionType ft = (ICPPFunctionType) t;
if (containsDependentType(ft.getParameterTypes()))
return true; return true;
t= ft.getReturnType();
if (t instanceof ICPPFunctionType) { } else if (t instanceof ICPPPointerToMemberType) {
final ICPPFunctionType ft = (ICPPFunctionType) t; ICPPPointerToMemberType ptmt= (ICPPPointerToMemberType) t;
if (containsDependentType(ft.getParameterTypes())) if (isDependentType(ptmt.getMemberOfClass()))
return true; return true;
t= ft.getReturnType(); t= ptmt.getType();
} else if (t instanceof ICPPPointerToMemberType) { } else if (t instanceof ITypeContainer) {
ICPPPointerToMemberType ptmt= (ICPPPointerToMemberType) t; t= ((ITypeContainer) t).getType();
if (isDependentType(ptmt.getMemberOfClass())) } else {
return true; return false;
t= ptmt.getType();
} else if (t instanceof ITypeContainer) {
t= ((ITypeContainer) t).getType();
} else {
return false;
}
} }
} catch (DOMException e) {
// treat as non-dependent
return false;
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Wind River Systems, Inc. and others. * Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,7 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics; package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression; import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
@ -50,30 +49,21 @@ public final class CPPVariableReadWriteFlags extends VariableReadWriteFlags {
if (!(type instanceof ICPPReferenceType)) { if (!(type instanceof ICPPReferenceType)) {
return READ; return READ;
} }
try { type= ((ICPPReferenceType) type).getType();
type= ((ICPPReferenceType) type).getType();
}
catch (DOMException e) {
return READ; // fallback
}
} }
try { while(indirection > 0 && (type instanceof ITypeContainer)) {
while(indirection > 0 && (type instanceof ITypeContainer)) { if (type instanceof IPointerType) {
if (type instanceof IPointerType) { indirection--;
indirection--;
}
type= ((ITypeContainer) type).getType();
}
if (indirection == 0) {
if (type instanceof IQualifierType) {
return ((IQualifierType) type).isConst() ? READ : READ | WRITE;
}
else if (type instanceof IPointerType) {
return ((IPointerType) type).isConst() ? READ : READ | WRITE;
}
} }
type= ((ITypeContainer) type).getType();
} }
catch (DOMException e) { if (indirection == 0) {
if (type instanceof IQualifierType) {
return ((IQualifierType) type).isConst() ? READ : READ | WRITE;
}
else if (type instanceof IPointerType) {
return ((IPointerType) type).isConst() ? READ : READ | WRITE;
}
} }
return READ | WRITE; // fallback return READ | WRITE; // fallback
} }

View file

@ -624,16 +624,12 @@ public class CPPVisitor extends ASTQueries {
} else if (simpleDecl != null && } else if (simpleDecl != null &&
simpleDecl.getDeclSpecifier().getStorageClass() == IASTDeclSpecifier.sc_typedef) { simpleDecl.getDeclSpecifier().getStorageClass() == IASTDeclSpecifier.sc_typedef) {
if (binding instanceof ICPPInternalBinding && binding instanceof ITypedef && name.isActive()) { if (binding instanceof ICPPInternalBinding && binding instanceof ITypedef && name.isActive()) {
try { IType t1 = ((ITypedef) binding).getType();
IType t1 = ((ITypedef) binding).getType(); IType t2 = createType(declarator);
IType t2 = createType(declarator); if (t1 != null && t2 != null && t1.isSameType(t2)) {
if (t1 != null && t2 != null && t1.isSameType(t2)) { ASTInternal.addDeclaration(binding, name);
ASTInternal.addDeclaration(binding, name); return binding;
return binding; }
}
} catch (DOMException e) {
return e.getProblem();
}
return new ProblemBinding(name, IProblemBinding.SEMANTIC_INVALID_REDECLARATION); return new ProblemBinding(name, IProblemBinding.SEMANTIC_INVALID_REDECLARATION);
} }
// if we don't resolve the target type first, we get a problem binding in case the typedef // if we don't resolve the target type first, we get a problem binding in case the typedef

View file

@ -189,53 +189,49 @@ public class SemanticUtil {
boolean ptr= (options & PTR) != 0; boolean ptr= (options & PTR) != 0;
boolean mptr= (options & MPTR) != 0; boolean mptr= (options & MPTR) != 0;
assert !(ptrcvq && (ptr || mptr)); assert !(ptrcvq && (ptr || mptr));
try { while (true) {
while (true) { IType t= null;
IType t= null; if (type instanceof IPointerType) {
if (type instanceof IPointerType) { final boolean isMbrPtr = type instanceof ICPPPointerToMemberType;
final boolean isMbrPtr = type instanceof ICPPPointerToMemberType; if ((ptr && !isMbrPtr) || (mptr && isMbrPtr)) {
if ((ptr && !isMbrPtr) || (mptr && isMbrPtr)) { t= ((IPointerType) type).getType();
t= ((IPointerType) type).getType(); } else if (ptrcvq) {
} else if (ptrcvq) { if (type instanceof CPPPointerType) {
if (type instanceof CPPPointerType) { return ((CPPPointerType) type).stripQualifiers();
return ((CPPPointerType) type).stripQualifiers(); }
} IPointerType p= (IPointerType) type;
IPointerType p= (IPointerType) type; if (p.isConst() || p.isVolatile()) {
if (p.isConst() || p.isVolatile()) { if (p instanceof ICPPPointerToMemberType) {
if (p instanceof ICPPPointerToMemberType) { final IType memberOfClass = ((ICPPPointerToMemberType) p).getMemberOfClass();
final IType memberOfClass = ((ICPPPointerToMemberType) p).getMemberOfClass(); if (memberOfClass instanceof ICPPClassType)
if (memberOfClass instanceof ICPPClassType) return new CPPPointerToMemberType(p.getType(), memberOfClass, false, false);
return new CPPPointerToMemberType(p.getType(), memberOfClass, false, false); } else {
} else { return new CPPPointerType(p.getType(), false, false);
return new CPPPointerType(p.getType(), false, false);
}
} }
} }
} else if (tdef && type instanceof ITypedef) {
t= ((ITypedef) type).getType();
} else if (type instanceof IQualifierType) {
final IQualifierType qt = (IQualifierType) type;
if (((options & CVQ) != 0)) {
t= qt.getType();
} else if (tdef) {
IType temp= qt.getType();
if (temp instanceof ITypedef) {
temp= getNestedType(temp, TDEF);
return addQualifiers(temp, qt.isConst(), qt.isVolatile());
}
}
} else if ((options & ARRAY) != 0 && type instanceof IArrayType) {
t= ((IArrayType) type).getType();
} else if ((options & REF) != 0 && type instanceof ICPPReferenceType) {
t= ((ICPPReferenceType) type).getType();
} }
if (t == null) } else if (tdef && type instanceof ITypedef) {
return type; t= ((ITypedef) type).getType();
} else if (type instanceof IQualifierType) {
type= t; final IQualifierType qt = (IQualifierType) type;
if (((options & CVQ) != 0)) {
t= qt.getType();
} else if (tdef) {
IType temp= qt.getType();
if (temp instanceof ITypedef) {
temp= getNestedType(temp, TDEF);
return addQualifiers(temp, qt.isConst(), qt.isVolatile());
}
}
} else if ((options & ARRAY) != 0 && type instanceof IArrayType) {
t= ((IArrayType) type).getType();
} else if ((options & REF) != 0 && type instanceof ICPPReferenceType) {
t= ((ICPPReferenceType) type).getType();
} }
} catch (DOMException e) { if (t == null)
return e.getProblem(); return type;
type= t;
} }
} }
@ -353,13 +349,9 @@ public class SemanticUtil {
public static IType adjustParameterType(final IType pt, boolean forFunctionType) { public static IType adjustParameterType(final IType pt, boolean forFunctionType) {
// bug 239975 // bug 239975
IType t= SemanticUtil.getNestedType(pt, TDEF); IType t= SemanticUtil.getNestedType(pt, TDEF);
try { if (t instanceof IArrayType) {
if (t instanceof IArrayType) { IArrayType at = (IArrayType) t;
IArrayType at = (IArrayType) t; return new CPPPointerType(at.getType());
return new CPPPointerType(at.getType());
}
} catch (DOMException e) {
return e.getProblem();
} }
if (t instanceof IFunctionType) { if (t instanceof IFunctionType) {
return new CPPPointerType(pt); return new CPPPointerType(pt);
@ -375,28 +367,25 @@ public class SemanticUtil {
public static IType addQualifiers(IType baseType, boolean cnst, boolean vol) { public static IType addQualifiers(IType baseType, boolean cnst, boolean vol) {
if (cnst || vol) { if (cnst || vol) {
try { if (baseType instanceof IQualifierType) {
if (baseType instanceof IQualifierType) { IQualifierType qt= (IQualifierType) baseType;
IQualifierType qt= (IQualifierType) baseType; if ((cnst && !qt.isConst()) || (vol && !qt.isVolatile())) {
if ((cnst && !qt.isConst()) || (vol && !qt.isVolatile())) { return new CPPQualifierType(qt.getType(), cnst || qt.isConst(), vol || qt.isVolatile());
return new CPPQualifierType(qt.getType(), cnst || qt.isConst(), vol || qt.isVolatile());
}
return baseType;
} else if (baseType instanceof ICPPPointerToMemberType) {
ICPPPointerToMemberType pt= (ICPPPointerToMemberType) baseType;
if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile())) {
return new CPPPointerToMemberType(pt.getType(), pt.getMemberOfClass(), cnst
|| pt.isConst(), vol || pt.isVolatile());
}
return baseType;
} else if (baseType instanceof IPointerType) {
IPointerType pt= (IPointerType) baseType;
if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile())) {
return new CPPPointerType(pt.getType(), cnst || pt.isConst(), vol || pt.isVolatile());
}
return baseType;
} }
} catch (DOMException e) { return baseType;
} else if (baseType instanceof ICPPPointerToMemberType) {
ICPPPointerToMemberType pt= (ICPPPointerToMemberType) baseType;
if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile())) {
return new CPPPointerToMemberType(pt.getType(), pt.getMemberOfClass(), cnst
|| pt.isConst(), vol || pt.isVolatile());
}
return baseType;
} else if (baseType instanceof IPointerType) {
IPointerType pt= (IPointerType) baseType;
if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile())) {
return new CPPPointerType(pt.getType(), cnst || pt.isConst(), vol || pt.isVolatile());
}
return baseType;
} }
return new CPPQualifierType(baseType, cnst, vol); return new CPPQualifierType(baseType, cnst, vol);

View file

@ -1,12 +1,12 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 QNX Software Systems and others. * Copyright (c) 2007, 2009 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* QNX - Initial API and implementation * Bryan Wilkinson (QNX) - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index; package org.eclipse.cdt.internal.core.index;
@ -17,9 +17,6 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
/**
* @author Bryan Wilkinson
*/
public class ArrayTypeClone implements IIndexType, IArrayType, ITypeContainer { public class ArrayTypeClone implements IIndexType, IArrayType, ITypeContainer {
private final IArrayType delegate; private final IArrayType delegate;
private IType type; private IType type;
@ -35,23 +32,19 @@ public class ArrayTypeClone implements IIndexType, IArrayType, ITypeContainer {
if (!(type instanceof IArrayType)) if (!(type instanceof IArrayType))
return false; return false;
try { IType type1= this.getType();
IType type1= this.getType(); if (type1 == null)
if (type1 == null) return false;
return false;
IArrayType rhs = (IArrayType) type; IArrayType rhs = (IArrayType) type;
return type1.isSameType(rhs.getType()); return type1.isSameType(rhs.getType());
} catch (DOMException e) {
}
return false;
} }
public IASTExpression getArraySizeExpression() throws DOMException { public IASTExpression getArraySizeExpression() throws DOMException {
return delegate.getArraySizeExpression(); return delegate.getArraySizeExpression();
} }
public IType getType() throws DOMException { public IType getType() {
if (type == null) { if (type == null) {
return delegate.getType(); return delegate.getType();
} }

View file

@ -1,24 +1,20 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 QNX Software Systems and others. * Copyright (c) 2007, 2009 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* QNX - Initial API and implementation * Bryan Wilkinson (QNX) - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index; package org.eclipse.cdt.internal.core.index;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
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; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
/**
* @author Bryan Wilkinson
*/
public class CPPReferenceTypeClone implements ICPPReferenceType, ITypeContainer, IIndexType { public class CPPReferenceTypeClone implements ICPPReferenceType, ITypeContainer, IIndexType {
private final ICPPReferenceType delegate; private final ICPPReferenceType delegate;
private IType type; private IType type;
@ -27,7 +23,7 @@ public class CPPReferenceTypeClone implements ICPPReferenceType, ITypeContainer,
this.delegate = reference; this.delegate = reference;
} }
public IType getType() throws DOMException { public IType getType() {
if (type == null) { if (type == null) {
return delegate.getType(); return delegate.getType();
} }
@ -42,12 +38,9 @@ public class CPPReferenceTypeClone implements ICPPReferenceType, ITypeContainer,
return false; return false;
ICPPReferenceType rhs = (ICPPReferenceType) type; ICPPReferenceType rhs = (ICPPReferenceType) type;
try { IType type1= getType();
IType type1= getType(); if (type1 != null) {
if (type1 != null) { return type1.isSameType(rhs.getType());
return type1.isSameType(rhs.getType());
}
} catch (DOMException e) {
} }
return false; return false;
} }

View file

@ -1,12 +1,12 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2008 QNX Software Systems and others. * Copyright (c) 2007, 2009 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* QNX - Initial API and implementation * Bryan Wilkinson (QNX) - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index; package org.eclipse.cdt.internal.core.index;
@ -20,9 +20,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
/**
* @author Bryan Wilkinson
*/
public class CPPTypedefClone implements ITypedef, ITypeContainer, IIndexType, ICPPBinding { public class CPPTypedefClone implements ITypedef, ITypeContainer, IIndexType, ICPPBinding {
protected final ITypedef delegate; protected final ITypedef delegate;
private IType type; private IType type;
@ -31,7 +28,7 @@ public class CPPTypedefClone implements ITypedef, ITypeContainer, IIndexType, IC
this.delegate = typedef; this.delegate = typedef;
} }
public IType getType() throws DOMException { public IType getType() {
if (type == null) { if (type == null) {
return delegate.getType(); return delegate.getType();
} }
@ -64,18 +61,14 @@ public class CPPTypedefClone implements ITypedef, ITypeContainer, IIndexType, IC
} }
public boolean isSameType(IType type) { public boolean isSameType(IType type) {
try { IType myrtype = getType();
IType myrtype = getType(); if (myrtype == null)
if (myrtype == null) return false;
return false;
if (type instanceof ITypedef) { if (type instanceof ITypedef) {
type= ((ITypedef) type).getType(); type= ((ITypedef) type).getType();
}
return myrtype.isSameType(type);
} catch (DOMException e) {
} }
return false; return myrtype.isSameType(type);
} }
public void setType(IType type) { public void setType(IType type) {

View file

@ -6,21 +6,17 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* QNX - Initial API and implementation * Bryan Wilkinson (QNX) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index; package org.eclipse.cdt.internal.core.index;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IPointerType; import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
/**
* @author Bryan Wilkinson
*/
public class PointerTypeClone implements IPointerType, ITypeContainer, IIndexType { public class PointerTypeClone implements IPointerType, ITypeContainer, IIndexType {
protected final IPointerType delegate; protected final IPointerType delegate;
private IType type; private IType type;
@ -29,7 +25,7 @@ public class PointerTypeClone implements IPointerType, ITypeContainer, IIndexTyp
this.delegate = pointer; this.delegate = pointer;
} }
public IType getType() throws DOMException { public IType getType() {
if (type == null) { if (type == null) {
return delegate.getType(); return delegate.getType();
} }
@ -55,14 +51,11 @@ public class PointerTypeClone implements IPointerType, ITypeContainer, IIndexTyp
return false; return false;
IPointerType rhs = (IPointerType) type; IPointerType rhs = (IPointerType) type;
try { if (isConst() == rhs.isConst() && isVolatile() == rhs.isVolatile()) {
if (isConst() == rhs.isConst() && isVolatile() == rhs.isVolatile()) { IType type1= getType();
IType type1= getType(); if (type1 != null) {
if (type1 != null) { return type1.isSameType(rhs.getType());
return type1.isSameType(rhs.getType());
}
} }
} catch (DOMException e) {
} }
return false; return false;
} }

View file

@ -1,24 +1,21 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 QNX Software Systems and others. * Copyright (c) 2007, 2009 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* QNX - Initial API and implementation * Bryan Wilkinson (QNX) - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index; package org.eclipse.cdt.internal.core.index;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IQualifierType; import org.eclipse.cdt.core.dom.ast.IQualifierType;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
/**
* @author Bryan Wilkinson
*/
public class QualifierTypeClone implements IQualifierType, ITypeContainer, IIndexType { public class QualifierTypeClone implements IQualifierType, ITypeContainer, IIndexType {
private final IQualifierType delegate; private final IQualifierType delegate;
private IType type; private IType type;
@ -27,7 +24,7 @@ public class QualifierTypeClone implements IQualifierType, ITypeContainer, IInde
this.delegate = qualifier; this.delegate = qualifier;
} }
public IType getType() throws DOMException { public IType getType() {
if (type == null) { if (type == null) {
return delegate.getType(); return delegate.getType();
} }
@ -49,12 +46,9 @@ public class QualifierTypeClone implements IQualifierType, ITypeContainer, IInde
return false; return false;
IQualifierType pt = (IQualifierType) type; IQualifierType pt = (IQualifierType) type;
try { if (isConst() == pt.isConst() && isVolatile() == pt.isVolatile()) {
if (isConst() == pt.isConst() && isVolatile() == pt.isVolatile()) { IType myType= getType();
IType myType= getType(); return myType != null && myType.isSameType(pt.getType());
return myType != null && myType.isSameType(pt.getType());
}
} catch (DOMException e) {
} }
return false; return false;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Symbian Software Systems and others. * Copyright (c) 2007, 2009 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,7 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite; package org.eclipse.cdt.internal.core.index.composite;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IFunctionType; import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.internal.core.index.IIndexType; import org.eclipse.cdt.internal.core.index.IIndexType;
@ -21,7 +20,7 @@ public class CompositeFunctionType extends CompositeType implements IFunctionTyp
super(rtype, cf); super(rtype, cf);
} }
public IType[] getParameterTypes() throws DOMException { public IType[] getParameterTypes() {
IType[] result = ((IFunctionType) type).getParameterTypes(); IType[] result = ((IFunctionType) type).getParameterTypes();
for (int i = 0; i < result.length; i++) { for (int i = 0; i < result.length; i++) {
result[i] = cf.getCompositeType((IIndexType)result[i]); result[i] = cf.getCompositeType((IIndexType)result[i]);
@ -29,7 +28,7 @@ public class CompositeFunctionType extends CompositeType implements IFunctionTyp
return result; return result;
} }
public IType getReturnType() throws DOMException { public IType getReturnType() {
return cf.getCompositeType((IIndexType) ((IFunctionType) type).getReturnType()); return cf.getCompositeType((IIndexType) ((IFunctionType) type).getReturnType());
} }

View file

@ -1,23 +1,22 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Symbian Software Systems and others. * Copyright (c) 2007, 2009 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Andrew Ferguson (Symbian) - Initial implementation * Andrew Ferguson (Symbian) - Initial implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite; package org.eclipse.cdt.internal.core.index.composite;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IPointerType; import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.index.PointerTypeClone; import org.eclipse.cdt.internal.core.index.PointerTypeClone;
public class CompositePointerType extends CompositeTypeContainer implements IPointerType { public class CompositePointerType extends CompositeTypeContainer implements IPointerType {
public CompositePointerType(IPointerType pointerType, ICompositesFactory cf) throws DOMException { public CompositePointerType(IPointerType pointerType, ICompositesFactory cf) {
super((ITypeContainer) pointerType, cf); super((ITypeContainer) pointerType, cf);
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2008 Symbian Software Systems and others. * Copyright (c) 2007, 2009 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,14 +10,13 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite; package org.eclipse.cdt.internal.core.index.composite;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IQualifierType; import org.eclipse.cdt.core.dom.ast.IQualifierType;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.index.QualifierTypeClone; import org.eclipse.cdt.internal.core.index.QualifierTypeClone;
public class CompositeQualifierType extends CompositeTypeContainer implements IQualifierType { public class CompositeQualifierType extends CompositeTypeContainer implements IQualifierType {
public CompositeQualifierType(IQualifierType qualifierType, ICompositesFactory cf) throws DOMException { public CompositeQualifierType(IQualifierType qualifierType, ICompositesFactory cf) {
super((ITypeContainer) qualifierType, cf); super((ITypeContainer) qualifierType, cf);
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Symbian Software Systems and others. * Copyright (c) 2007, 2009 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,11 +8,9 @@
* Contributors: * Contributors:
* Andrew Ferguson (Symbian) - Initial implementation * Andrew Ferguson (Symbian) - Initial implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite; package org.eclipse.cdt.internal.core.index.composite;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.index.IIndexType; import org.eclipse.cdt.internal.core.index.IIndexType;
@ -23,16 +21,12 @@ public class CompositeTypeContainer extends CompositeType implements ITypeContai
super(rtype, cf); super(rtype, cf);
} }
public final IType getType() throws DOMException { public final IType getType() {
return cf.getCompositeType((IIndexType) ((ITypeContainer) type).getType()); return cf.getCompositeType((IIndexType) ((ITypeContainer) type).getType());
} }
@Override @Override
public String toString() { public String toString() {
try { return ASTTypeUtil.getType(getType());
return ASTTypeUtil.getType(getType());
} catch (DOMException e) {
return ""; //$NON-NLS-1$
}
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2008 Symbian Software Systems and others. * Copyright (c) 2007, 2009 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,7 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite; package org.eclipse.cdt.internal.core.index.composite;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.index.IIndexBinding; import org.eclipse.cdt.core.index.IIndexBinding;
@ -26,7 +25,7 @@ public interface ICompositesFactory {
* Returns a composite (in the sense of potentially spanning multiple index fragments - i.e. not to be confused * Returns a composite (in the sense of potentially spanning multiple index fragments - i.e. not to be confused
* with ICompositeType) type for the specified type. * with ICompositeType) type for the specified type.
*/ */
public IType getCompositeType(IIndexType rtype) throws DOMException; public IType getCompositeType(IIndexType rtype);
/** /**
* Returns a composite (index context carrying) binding for the specified binding. It does not * Returns a composite (index context carrying) binding for the specified binding. It does not

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2008 Symbian Software Systems and others. * Copyright (c) 2007, 2009 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -68,7 +68,7 @@ public class CCompositesFactory extends AbstractCompositeFactory {
/* /*
* @see org.eclipse.cdt.internal.core.index.composite.cpp.ICompositesFactory#getCompositeType(org.eclipse.cdt.core.index.IIndex, org.eclipse.cdt.core.dom.ast.IType) * @see org.eclipse.cdt.internal.core.index.composite.cpp.ICompositesFactory#getCompositeType(org.eclipse.cdt.core.index.IIndex, org.eclipse.cdt.core.dom.ast.IType)
*/ */
public IType getCompositeType(IIndexType rtype) throws DOMException { public IType getCompositeType(IIndexType rtype) {
IType result; IType result;
if(rtype==null) { if(rtype==null) {

View file

@ -1,16 +1,15 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Symbian Software Systems and others. * Copyright (c) 2007, 2009 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Andrew Ferguson (Symbian) - Initial implementation * Andrew Ferguson (Symbian) - Initial implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.c; package org.eclipse.cdt.internal.core.index.composite.c;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
@ -23,7 +22,7 @@ class CompositeCTypedef extends CompositeCBinding implements ITypedef, IIndexTyp
super(cf, rbinding); super(cf, rbinding);
} }
public IType getType() throws DOMException { public IType getType() {
IType type = ((ITypedef)rbinding).getType(); IType type = ((ITypedef)rbinding).getType();
return cf.getCompositeType((IIndexType)type); return cf.getCompositeType((IIndexType)type);
} }

View file

@ -12,7 +12,6 @@
package org.eclipse.cdt.internal.core.index.composite.cpp; package org.eclipse.cdt.internal.core.index.composite.cpp;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IArrayType; import org.eclipse.cdt.core.dom.ast.IArrayType;
import org.eclipse.cdt.core.dom.ast.IBasicType; import org.eclipse.cdt.core.dom.ast.IBasicType;
@ -117,7 +116,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.index.composite.cpp.ICompositesFactory#getCompositeType(org.eclipse.cdt.core.index.IIndex, org.eclipse.cdt.core.dom.ast.IType) * @see org.eclipse.cdt.internal.core.index.composite.cpp.ICompositesFactory#getCompositeType(org.eclipse.cdt.core.index.IIndex, org.eclipse.cdt.core.dom.ast.IType)
*/ */
public IType getCompositeType(IIndexType rtype) throws DOMException { public IType getCompositeType(IIndexType rtype) {
IType result; IType result;
if (rtype instanceof ICPPSpecialization) { if (rtype instanceof ICPPSpecialization) {

View file

@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp; package org.eclipse.cdt.internal.core.index.composite.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
import org.eclipse.cdt.internal.core.index.CPPPointerToMemberTypeClone; import org.eclipse.cdt.internal.core.index.CPPPointerToMemberTypeClone;
@ -21,7 +20,7 @@ import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
class CompositeCPPPointerToMemberType extends CompositePointerType implements ICPPPointerToMemberType { class CompositeCPPPointerToMemberType extends CompositePointerType implements ICPPPointerToMemberType {
CompositeCPPPointerToMemberType(ICompositesFactory cf, ICPPPointerToMemberType pointerToMemberType) throws DOMException { CompositeCPPPointerToMemberType(ICompositesFactory cf, ICPPPointerToMemberType pointerToMemberType) {
super(pointerToMemberType, cf); super(pointerToMemberType, cf);
} }

View file

@ -1,16 +1,15 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Symbian Software Systems and others. * Copyright (c) 2007, 2009 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Andrew Ferguson (Symbian) - Initial implementation * Andrew Ferguson (Symbian) - Initial implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp; package org.eclipse.cdt.internal.core.index.composite.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
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; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.index.CPPReferenceTypeClone; import org.eclipse.cdt.internal.core.index.CPPReferenceTypeClone;
@ -18,7 +17,7 @@ import org.eclipse.cdt.internal.core.index.composite.CompositeTypeContainer;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory; import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
class CompositeCPPReferenceType extends CompositeTypeContainer implements ICPPReferenceType { class CompositeCPPReferenceType extends CompositeTypeContainer implements ICPPReferenceType {
public CompositeCPPReferenceType(ICPPReferenceType referenceType, ICompositesFactory cf) throws DOMException { public CompositeCPPReferenceType(ICPPReferenceType referenceType, ICompositesFactory cf) {
super((ITypeContainer) referenceType, cf); super((ITypeContainer) referenceType, cf);
} }

View file

@ -1,16 +1,15 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2008 Symbian Software Systems and others. * Copyright (c) 2007, 2009 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Andrew Ferguson (Symbian) - Initial implementation * Andrew Ferguson (Symbian) - Initial implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp; package org.eclipse.cdt.internal.core.index.composite.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding; import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
@ -24,7 +23,7 @@ class CompositeCPPTypedef extends CompositeCPPBinding implements ITypedef, IInde
super(cf, delegate); super(cf, delegate);
} }
public IType getType() throws DOMException { public IType getType() {
IType type = ((ITypedef)rbinding).getType(); IType type = ((ITypedef)rbinding).getType();
return cf.getCompositeType((IIndexType)type); return cf.getCompositeType((IIndexType)type);
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2008 Symbian Software Systems and others. * Copyright (c) 2007, 2009 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -41,9 +41,9 @@ public class TemplateInstanceUtil {
CPPTemplateParameterMap result= new CPPTemplateParameterMap(keys.length); CPPTemplateParameterMap result= new CPPTemplateParameterMap(keys.length);
try { try {
for(int i = 0; i < keys.length; i++) { for (Integer key : keys) {
ICPPTemplateArgument arg= preresult.getArgument(keys[i]); ICPPTemplateArgument arg= preresult.getArgument(key);
result.put(keys[i], convert(cf, arg)); result.put(key, convert(cf, arg));
} }
} catch(DOMException de) { } catch(DOMException de) {
CCorePlugin.log(de); CCorePlugin.log(de);
@ -148,12 +148,8 @@ public class TemplateInstanceUtil {
@Deprecated @Deprecated
private static IType[] getArguments(ICompositesFactory cf, IType[] result) { private static IType[] getArguments(ICompositesFactory cf, IType[] result) {
try { for(int i=0; i<result.length; i++) {
for(int i=0; i<result.length; i++) { result[i] = cf.getCompositeType((IIndexType)result[i]);
result[i] = cf.getCompositeType((IIndexType)result[i]);
}
} catch(DOMException de) {
CCorePlugin.log(de);
} }
return result; return result;
} }

View file

@ -35,14 +35,10 @@ public class PDOMArrayType extends PDOMNode implements IIndexType, IArrayType, I
public PDOMArrayType(PDOMLinkage linkage, PDOMNode parent, IArrayType type) throws CoreException { public PDOMArrayType(PDOMLinkage linkage, PDOMNode parent, IArrayType type) throws CoreException {
super(linkage, parent); super(linkage, parent);
try { PDOMNode targetTypeNode = getLinkage().addType(this, type.getType());
PDOMNode targetTypeNode = getLinkage().addType(this, type.getType()); if (targetTypeNode != null) {
if (targetTypeNode != null) { long typeRec = targetTypeNode.getRecord();
long typeRec = targetTypeNode.getRecord(); getDB().putRecPtr(record + TYPE, typeRec);
getDB().putRecPtr(record + TYPE, typeRec);
}
} catch (DOMException e) {
CCorePlugin.log(e);
} }
} }
@ -77,16 +73,12 @@ public class PDOMArrayType extends PDOMNode implements IIndexType, IArrayType, I
if( !( type instanceof IArrayType )) if( !( type instanceof IArrayType ))
return false; return false;
try { IType type1= this.getType();
IType type1= this.getType(); if( type1 == null )
if( type1 == null ) return false;
return false;
IArrayType rhs = (IArrayType) type;
IArrayType rhs = (IArrayType) type; return type1.isSameType( rhs.getType() );
return type1.isSameType( rhs.getType() );
} catch (DOMException e) {
}
return false;
} }
public void setType(IType type) { public void setType(IType type) {

View file

@ -15,12 +15,10 @@ package org.eclipse.cdt.internal.core.pdom.dom;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IPointerType; import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
import org.eclipse.cdt.internal.core.Util;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.index.IIndexBindingConstants; import org.eclipse.cdt.internal.core.index.IIndexBindingConstants;
import org.eclipse.cdt.internal.core.index.IIndexType; import org.eclipse.cdt.internal.core.index.IIndexType;
@ -57,25 +55,21 @@ public class PDOMPointerType extends PDOMNode implements IPointerType,
Database db = getDB(); Database db = getDB();
try { // type
// type long typeRec = 0;
long typeRec = 0; byte flags = 0;
byte flags = 0; if (type != null) {
if (type != null) { IType targetType= type.getType();
IType targetType= type.getType(); PDOMNode targetTypeNode = getLinkage().addType(this, targetType);
PDOMNode targetTypeNode = getLinkage().addType(this, targetType); if (targetTypeNode != null)
if (targetTypeNode != null) typeRec = targetTypeNode.getRecord();
typeRec = targetTypeNode.getRecord(); if (type.isConst())
if (type.isConst()) flags |= CONST;
flags |= CONST; if (type.isVolatile())
if (type.isVolatile()) flags |= VOLATILE;
flags |= VOLATILE;
}
db.putRecPtr(record + TYPE, typeRec);
db.putByte(record + FLAGS, flags);
} catch (DOMException e) {
throw new CoreException(Util.createStatus(e));
} }
db.putRecPtr(record + TYPE, typeRec);
db.putByte(record + FLAGS, flags);
} }
@Override @Override
@ -141,14 +135,11 @@ public class PDOMPointerType extends PDOMNode implements IPointerType,
return false; return false;
IPointerType rhs = (IPointerType) type; IPointerType rhs = (IPointerType) type;
try { if (isConst() == rhs.isConst() && isVolatile() == rhs.isVolatile()) {
if (isConst() == rhs.isConst() && isVolatile() == rhs.isVolatile()) { IType type1= getType();
IType type1= getType(); if (type1 != null) {
if (type1 != null) { return type1.isSameType(rhs.getType());
return type1.isSameType(rhs.getType());
}
} }
} catch (DOMException e) {
} }
return false; return false;
} }

View file

@ -14,12 +14,10 @@ package org.eclipse.cdt.internal.core.pdom.dom;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IQualifierType; import org.eclipse.cdt.core.dom.ast.IQualifierType;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.c.ICQualifierType; import org.eclipse.cdt.core.dom.ast.c.ICQualifierType;
import org.eclipse.cdt.internal.core.Util;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.index.IIndexBindingConstants; import org.eclipse.cdt.internal.core.index.IIndexBindingConstants;
import org.eclipse.cdt.internal.core.index.IIndexType; import org.eclipse.cdt.internal.core.index.IIndexType;
@ -56,26 +54,21 @@ public class PDOMQualifierType extends PDOMNode implements IQualifierType, ICQua
Database db = getDB(); Database db = getDB();
// type if (type != null) {
try { IType targetType = type.getType();
if (type != null) { PDOMNode targetTypeNode = getLinkage().addType(this, targetType);
IType targetType = type.getType(); if (targetTypeNode != null) {
PDOMNode targetTypeNode = getLinkage().addType(this, targetType); db.putRecPtr(record + TYPE, targetTypeNode.getRecord());
if (targetTypeNode != null) { }
db.putRecPtr(record + TYPE, targetTypeNode.getRecord()); // flags
} byte flags = 0;
// flags if (type.isConst())
byte flags = 0; flags |= CONST;
if (type.isConst()) if (type.isVolatile())
flags |= CONST; flags |= VOLATILE;
if (type.isVolatile()) if (type instanceof ICQualifierType && ((ICQualifierType)type).isRestrict())
flags |= VOLATILE; flags |= RESTRICT;
if (type instanceof ICQualifierType && ((ICQualifierType)type).isRestrict()) db.putByte(record + FLAGS, flags);
flags |= RESTRICT;
db.putByte(record + FLAGS, flags);
}
} catch (DOMException e) {
throw new CoreException(Util.createStatus(e));
} }
} }
@ -147,15 +140,12 @@ public class PDOMQualifierType extends PDOMNode implements IQualifierType, ICQua
return false; return false;
IQualifierType pt = (IQualifierType) type; IQualifierType pt = (IQualifierType) type;
try { boolean flagsMatch= isConst() == pt.isConst() && isVolatile() == pt.isVolatile();
boolean flagsMatch= isConst() == pt.isConst() && isVolatile() == pt.isVolatile(); if (flagsMatch && type instanceof ICQualifierType)
if (flagsMatch && type instanceof ICQualifierType) flagsMatch &= isRestrict() == ((ICQualifierType) type).isRestrict();
flagsMatch &= isRestrict() == ((ICQualifierType) type).isRestrict(); if (flagsMatch) {
if (flagsMatch) { IType myType= getType();
IType myType= getType(); return myType != null && myType.isSameType(pt.getType());
return myType != null && myType.isSameType(pt.getType());
}
} catch (DOMException e) {
} }
return false; return false;
} }

View file

@ -61,20 +61,17 @@ public class PDOMCFunctionType extends PDOMNode implements IIndexType, IFunction
public PDOMCFunctionType(PDOMLinkage linkage, PDOMNode parent, IFunctionType type) throws CoreException { public PDOMCFunctionType(PDOMLinkage linkage, PDOMNode parent, IFunctionType type) throws CoreException {
super(linkage, parent); super(linkage, parent);
try { PDOMNodeLinkedList list= new PDOMNodeLinkedList(parent.getLinkage(), record + TYPELIST, true);
PDOMNodeLinkedList list= new PDOMNodeLinkedList(parent.getLinkage(), record + TYPELIST, true); setReturnType(type.getReturnType());
setReturnType(type.getReturnType()); IType[] pt= type.getParameterTypes();
IType[] pt= type.getParameterTypes(); for (IType element : pt) {
for (int i = 0; i < pt.length; i++) { PDOMNode typeNode;
PDOMNode typeNode; if (element == null || element instanceof IProblemBinding) {
if (pt[i] == null || pt[i] instanceof IProblemBinding) { typeNode= null;
typeNode= null; } else {
} else { typeNode= linkage.addType(this, element);
typeNode= linkage.addType(this, pt[i]);
}
list.addMember(typeNode);
} }
} catch (DOMException de) { list.addMember(typeNode);
} }
} }

View file

@ -95,8 +95,7 @@ class PDOMCTypedef extends PDOMBinding implements ITypedef, ITypeContainer, IInd
return true; return true;
} }
IType[] params= ft.getParameterTypes(); IType[] params= ft.getParameterTypes();
for (int i = 0; i < params.length; i++) { for (IType param : params) {
IType param = params[i];
if (introducesRecursion(param, tdname)) { if (introducesRecursion(param, tdname)) {
return true; return true;
} }
@ -131,18 +130,14 @@ class PDOMCTypedef extends PDOMBinding implements ITypedef, ITypeContainer, IInd
} }
public boolean isSameType(IType type) { public boolean isSameType(IType type) {
try { IType myrtype = getType();
IType myrtype = getType(); if (myrtype == null)
if (myrtype == null) return false;
return false;
if (type instanceof ITypedef) {
if (type instanceof ITypedef) { type= ((ITypedef)type).getType();
type= ((ITypedef)type).getType();
}
return myrtype.isSameType(type);
} catch (DOMException e) {
} }
return false; return myrtype.isSameType(type);
} }
@Override @Override

View file

@ -12,7 +12,6 @@
package org.eclipse.cdt.internal.core.pdom.dom.cpp; package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBasicType; import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IPointerType; import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
@ -37,10 +36,10 @@ public class PDOMCPPFunctionType extends PDOMCFunctionType implements ICPPFuncti
public boolean isVolatile() { public boolean isVolatile() {
return false; return false;
} }
public IType[] getParameterTypes() throws DOMException { public IType[] getParameterTypes() {
return IType.EMPTY_TYPE_ARRAY; return IType.EMPTY_TYPE_ARRAY;
} }
public IType getReturnType() throws DOMException { public IType getReturnType() {
return FALLBACK_RETURN_TYPE; return FALLBACK_RETURN_TYPE;
} }
public boolean isSameType(IType type) { public boolean isSameType(IType type) {

View file

@ -13,11 +13,9 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
import org.eclipse.cdt.internal.core.Util;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.index.CPPReferenceTypeClone; import org.eclipse.cdt.internal.core.index.CPPReferenceTypeClone;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants; import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
@ -46,19 +44,15 @@ class PDOMCPPReferenceType extends PDOMNode implements ICPPReferenceType, ITypeC
Database db = getDB(); Database db = getDB();
try { // type
// type long typeRec = 0;
long typeRec = 0; if (type != null) {
if (type != null) { IType targetType = type.getType();
IType targetType = type.getType(); PDOMNode targetTypeNode = getLinkage().addType(this, targetType);
PDOMNode targetTypeNode = getLinkage().addType(this, targetType); if (targetTypeNode != null)
if (targetTypeNode != null) typeRec = targetTypeNode.getRecord();
typeRec = targetTypeNode.getRecord();
}
db.putRecPtr(record + TYPE, typeRec);
} catch (DOMException e) {
throw new CoreException(Util.createStatus(e));
} }
db.putRecPtr(record + TYPE, typeRec);
} }
@Override @Override
@ -96,12 +90,9 @@ class PDOMCPPReferenceType extends PDOMNode implements ICPPReferenceType, ITypeC
return false; return false;
ICPPReferenceType rhs = (ICPPReferenceType) type; ICPPReferenceType rhs = (ICPPReferenceType) type;
try { IType type1= getType();
IType type1= getType(); if (type1 != null) {
if (type1 != null) { return type1.isSameType(rhs.getType());
return type1.isSameType(rhs.getType());
}
} catch (DOMException e) {
} }
return false; return false;
} }

View file

@ -100,8 +100,7 @@ class PDOMCPPTypedef extends PDOMCPPBinding implements ITypedef, ITypeContainer,
return true; return true;
} }
IType[] params= ft.getParameterTypes(); IType[] params= ft.getParameterTypes();
for (int i = 0; i < params.length; i++) { for (IType param : params) {
IType param = params[i];
if (introducesRecursion(param, parentRec, tdname)) { if (introducesRecursion(param, parentRec, tdname)) {
return true; return true;
} }
@ -136,21 +135,17 @@ class PDOMCPPTypedef extends PDOMCPPBinding implements ITypedef, ITypeContainer,
} }
public boolean isSameType(IType type) { public boolean isSameType(IType type) {
try { IType myrtype = getType();
IType myrtype = getType(); if (myrtype == null)
if (myrtype == null) return false;
if (type instanceof ITypedef) {
type= ((ITypedef)type).getType();
if (type == null) {
return false; return false;
if (type instanceof ITypedef) {
type= ((ITypedef)type).getType();
if (type == null) {
return false;
}
} }
return myrtype.isSameType(type);
} catch (DOMException e) {
} }
return false; return myrtype.isSameType(type);
} }
@Override @Override

View file

@ -12,11 +12,9 @@
package org.eclipse.cdt.internal.core.pdom.dom.cpp; package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization; import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
import org.eclipse.cdt.internal.core.Util;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTypedefSpecialization; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTypedefSpecialization;
import org.eclipse.cdt.internal.core.index.CPPTypedefClone; import org.eclipse.cdt.internal.core.index.CPPTypedefClone;
@ -55,8 +53,6 @@ class PDOMCPPTypedefSpecialization extends PDOMCPPSpecialization
PDOMNode typeNode = parent.getLinkage().addType(this, type); PDOMNode typeNode = parent.getLinkage().addType(this, type);
if (typeNode != null) if (typeNode != null)
getDB().putRecPtr(record + TYPE, typeNode.getRecord()); getDB().putRecPtr(record + TYPE, typeNode.getRecord());
} catch (DOMException e) {
throw new CoreException(Util.createStatus(e));
} finally { } finally {
if (typedef instanceof CPPTypedefSpecialization) { if (typedef instanceof CPPTypedefSpecialization) {
((CPPTypedefSpecialization) typedef).incResolutionDepth(-1); ((CPPTypedefSpecialization) typedef).incResolutionDepth(-1);
@ -78,7 +74,7 @@ class PDOMCPPTypedefSpecialization extends PDOMCPPSpecialization
return IIndexCPPBindingConstants.CPP_TYPEDEF_SPECIALIZATION; return IIndexCPPBindingConstants.CPP_TYPEDEF_SPECIALIZATION;
} }
public IType getType() throws DOMException { public IType getType() {
try { try {
PDOMNode node = getLinkage().getNode(getDB().getRecPtr(record + TYPE)); PDOMNode node = getLinkage().getNode(getDB().getRecPtr(record + TYPE));
return node instanceof IType ? (IType)node : null; return node instanceof IType ? (IType)node : null;
@ -91,23 +87,16 @@ class PDOMCPPTypedefSpecialization extends PDOMCPPSpecialization
public boolean isSameType(IType o) { public boolean isSameType(IType o) {
if( this.equals(o) ) if( this.equals(o) )
return true; return true;
if( o instanceof ITypedef ) if( o instanceof ITypedef ) {
try { IType t = getType();
IType t = getType(); if( t != null )
if( t != null ) return t.isSameType( ((ITypedef)o).getType());
return t.isSameType( ((ITypedef)o).getType()); return false;
return false; }
} catch ( DOMException e ) {
return false;
}
try { IType t = getType();
IType t = getType(); if( t != null )
if( t != null ) return t.isSameType( o );
return t.isSameType( o );
} catch ( DOMException e ) {
return false;
}
return false; return false;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2008 Wind River Systems, Inc. and others. * Copyright (c) 2005, 2009 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -615,10 +615,7 @@ public class ASTManager {
private static IType getRealType(IType t) { private static IType getRealType(IType t) {
while(t instanceof ITypedef) { while(t instanceof ITypedef) {
try { t= ((ITypedef) t).getType();
t= ((ITypedef) t).getType();
} catch (DOMException e) {
}
} }
return t; return t;
} }