mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Removes unused throw declarations, bug 283523.
This commit is contained in:
parent
5593bc6a0c
commit
3d7ad1a899
65 changed files with 468 additions and 837 deletions
|
@ -224,17 +224,13 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
}
|
||||
|
||||
protected static void assertTypeContainer(IType conType, String expQN, Class containerType, Class expContainedType, String expContainedTypeQN) {
|
||||
try {
|
||||
assertInstance(conType, ITypeContainer.class);
|
||||
assertInstance(conType, containerType);
|
||||
IType containedType= ((ITypeContainer)conType).getType();
|
||||
assertInstance(containedType, expContainedType);
|
||||
if (expContainedTypeQN != null) {
|
||||
assertInstance(containedType, IBinding.class);
|
||||
assertQNEquals(expContainedTypeQN, (IBinding) containedType);
|
||||
}
|
||||
} catch (DOMException de) {
|
||||
fail(de.getMessage());
|
||||
assertInstance(conType, ITypeContainer.class);
|
||||
assertInstance(conType, containerType);
|
||||
IType containedType= ((ITypeContainer)conType).getType();
|
||||
assertInstance(containedType, expContainedType);
|
||||
if (expContainedTypeQN != null) {
|
||||
assertInstance(containedType, IBinding.class);
|
||||
assertQNEquals(expContainedTypeQN, (IBinding) containedType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -1456,18 +1456,14 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
|||
* @param qn may be null
|
||||
*/
|
||||
static protected void assertPTM(IType type, String cqn, String qn) {
|
||||
try {
|
||||
assertTrue(type instanceof ICPPPointerToMemberType);
|
||||
ICPPPointerToMemberType ptmt = (ICPPPointerToMemberType) type;
|
||||
ICPPClassType classType = (ICPPClassType) ptmt.getMemberOfClass();
|
||||
assertQNEquals(cqn, classType);
|
||||
if(qn!=null) {
|
||||
assert(ptmt.getType() instanceof ICPPBinding);
|
||||
ICPPBinding tyBinding = (ICPPBinding) ptmt.getType();
|
||||
assertQNEquals(qn, tyBinding);
|
||||
}
|
||||
} catch(DOMException de) {
|
||||
fail(de.getMessage());
|
||||
assertTrue(type instanceof ICPPPointerToMemberType);
|
||||
ICPPPointerToMemberType ptmt = (ICPPPointerToMemberType) type;
|
||||
ICPPClassType classType = (ICPPClassType) ptmt.getMemberOfClass();
|
||||
assertQNEquals(cqn, classType);
|
||||
if(qn!=null) {
|
||||
assert(ptmt.getType() instanceof ICPPBinding);
|
||||
ICPPBinding tyBinding = (ICPPBinding) ptmt.getType();
|
||||
assertQNEquals(qn, tyBinding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ public class ASTTypeUtil {
|
|||
private static final String COMMA_SPACE = ", "; //$NON-NLS-1$
|
||||
private static final String EMPTY_STRING = ""; //$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;
|
||||
|
||||
/**
|
||||
|
@ -183,13 +182,7 @@ public class ASTTypeUtil {
|
|||
* @see #getType(IType, boolean)
|
||||
*/
|
||||
public static String[] getParameterTypeStringArray(IFunctionType type) {
|
||||
IType[] parms = null;
|
||||
try {
|
||||
parms = type.getParameterTypes();
|
||||
} catch (DOMException e) {
|
||||
return EMPTY_STRING_ARRAY;
|
||||
}
|
||||
|
||||
IType[] parms = type.getParameterTypes();
|
||||
String[] result = new String[parms.length];
|
||||
|
||||
for (int i = 0; i < parms.length; i++) {
|
||||
|
@ -503,17 +496,9 @@ public class ASTTypeUtil {
|
|||
}
|
||||
}
|
||||
if (type instanceof ITypeContainer) {
|
||||
try {
|
||||
type = ((ITypeContainer) type).getType();
|
||||
} catch (DOMException e) {
|
||||
type= null;
|
||||
}
|
||||
type = ((ITypeContainer) type).getType();
|
||||
} else if (type instanceof IFunctionType) {
|
||||
try {
|
||||
type= ((IFunctionType) type).getReturnType();
|
||||
} catch (DOMException e) {
|
||||
type= null;
|
||||
}
|
||||
type= ((IFunctionType) type).getReturnType();
|
||||
} else {
|
||||
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.
|
||||
* 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 don't use it does something strange
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean isConst(IType type) {
|
||||
if (type instanceof IQualifierType) {
|
||||
return ((IQualifierType) type).isConst();
|
||||
} else if (type instanceof ITypeContainer) {
|
||||
try {
|
||||
return isConst(((ITypeContainer) type).getType());
|
||||
} catch (DOMException e) {
|
||||
return false;
|
||||
}
|
||||
return isConst(((ITypeContainer) type).getType());
|
||||
} else if (type instanceof IArrayType) {
|
||||
try {
|
||||
return isConst(((IArrayType) type).getType());
|
||||
} catch (DOMException e) {
|
||||
return false;
|
||||
}
|
||||
return isConst(((IArrayType) type).getType());
|
||||
} else if (type instanceof ICPPReferenceType) {
|
||||
try {
|
||||
return isConst(((ICPPReferenceType) type).getType());
|
||||
} catch (DOMException e) {
|
||||
return false;
|
||||
}
|
||||
return isConst(((ICPPReferenceType) type).getType());
|
||||
} else if (type instanceof IFunctionType) {
|
||||
try {
|
||||
return isConst(((IFunctionType) type).getReturnType());
|
||||
} catch (DOMException e) {
|
||||
return false;
|
||||
}
|
||||
return isConst(((IFunctionType) type).getReturnType());
|
||||
} else if (type instanceof IPointerType) {
|
||||
try {
|
||||
return isConst(((IPointerType) type).getType());
|
||||
} catch (DOMException e) {
|
||||
return false;
|
||||
}
|
||||
return isConst(((IPointerType) type).getType());
|
||||
} else if (type instanceof ITypedef) {
|
||||
try {
|
||||
return isConst(((ITypedef) type).getType());
|
||||
} catch (DOMException e) {
|
||||
return false;
|
||||
}
|
||||
return isConst(((ITypedef) type).getType());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -17,9 +17,8 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
public interface IArrayType extends IType {
|
||||
/**
|
||||
* 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
|
||||
|
|
|
@ -18,14 +18,12 @@ public interface IFunctionType extends IType {
|
|||
|
||||
/**
|
||||
* get the return type of this function type
|
||||
* @throws DOMException
|
||||
*/
|
||||
public IType getReturnType() throws DOMException;
|
||||
public IType getReturnType();
|
||||
|
||||
/**
|
||||
* get the adjusted parameter types
|
||||
* ISO C99 6.7.5.3, ISO C++98 8.3.4-3
|
||||
* @throws DOMException
|
||||
*/
|
||||
public IType[] getParameterTypes() throws DOMException;
|
||||
public IType[] getParameterTypes();
|
||||
}
|
||||
|
|
|
@ -17,9 +17,8 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
public interface IPointerType extends IType {
|
||||
/**
|
||||
* get the type that this is a pointer to
|
||||
* @throws DOMException
|
||||
*/
|
||||
public IType getType() throws DOMException;
|
||||
public IType getType();
|
||||
|
||||
/**
|
||||
* is this a const pointer
|
||||
|
|
|
@ -30,7 +30,6 @@ public interface IQualifierType extends IType {
|
|||
|
||||
/**
|
||||
* get the type that this is qualifying
|
||||
* @throws DOMException
|
||||
*/
|
||||
public IType getType() throws DOMException;
|
||||
public IType getType();
|
||||
}
|
||||
|
|
|
@ -19,6 +19,6 @@ public interface ITypedef extends IBinding, IType {
|
|||
/**
|
||||
* Returns the type that this thing is a typedef of
|
||||
*/
|
||||
public IType getType() throws DOMException;
|
||||
public IType getType();
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
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
|
||||
*
|
||||
* @throws DOMException
|
||||
*/
|
||||
public IType getType() throws DOMException;
|
||||
public IType getType();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM 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;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
|
||||
/**
|
||||
* Internal interface representing types that contain other types
|
||||
* @author aniefer
|
||||
*/
|
||||
public interface ITypeContainer extends IType {
|
||||
/**
|
||||
* get the type this contains
|
||||
* @throws DOMException
|
||||
*/
|
||||
IType getType() throws DOMException;
|
||||
IType getType();
|
||||
|
||||
/**
|
||||
* set the type this contains
|
||||
* @param type
|
||||
*/
|
||||
void setType(IType type);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* 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) {
|
||||
try {
|
||||
final IASTExpression functionNameExpression = func.getFunctionNameExpression();
|
||||
if (functionNameExpression != null) {
|
||||
final IType type= functionNameExpression.getExpressionType();
|
||||
if (type instanceof IFunctionType) {
|
||||
IType[] ptypes= ((IFunctionType) type).getParameterTypes();
|
||||
if (ptypes != null && ptypes.length > parameterIdx) {
|
||||
return rwAssignmentToType(ptypes[parameterIdx], indirection);
|
||||
}
|
||||
final IASTExpression functionNameExpression = func.getFunctionNameExpression();
|
||||
if (functionNameExpression != null) {
|
||||
final IType type= functionNameExpression.getExpressionType();
|
||||
if (type instanceof IFunctionType) {
|
||||
IType[] ptypes= ((IFunctionType) type).getParameterTypes();
|
||||
if (ptypes != null && ptypes.length > parameterIdx) {
|
||||
return rwAssignmentToType(ptypes[parameterIdx], indirection);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (DOMException e) {
|
||||
}
|
||||
return READ | WRITE; // fallback
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
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.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
|
@ -114,14 +113,10 @@ public class CASTArraySubscriptExpression extends ASTNode implements
|
|||
|
||||
public IType getExpressionType() {
|
||||
IType t = getArrayExpression().getExpressionType();
|
||||
try {
|
||||
if (t instanceof IPointerType)
|
||||
return ((IPointerType)t).getType();
|
||||
else if (t instanceof IArrayType)
|
||||
return ((IArrayType)t).getType();
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
}
|
||||
if (t instanceof IPointerType)
|
||||
return ((IPointerType)t).getType();
|
||||
else if (t instanceof IArrayType)
|
||||
return ((IArrayType)t).getType();
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
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.IASTFunctionCallExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
|
@ -115,14 +114,10 @@ public class CASTFunctionCallExpression extends ASTNode implements
|
|||
|
||||
public IType getExpressionType() {
|
||||
IType type = getFunctionNameExpression().getExpressionType();
|
||||
try {
|
||||
while (type instanceof ITypeContainer)
|
||||
type = ((ITypeContainer) type).getType();
|
||||
if (type instanceof IFunctionType)
|
||||
return ((IFunctionType) type).getReturnType();
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
}
|
||||
while (type instanceof ITypeContainer)
|
||||
type = ((ITypeContainer) type).getType();
|
||||
if (type instanceof IFunctionType)
|
||||
return ((IFunctionType) type).getReturnType();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
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.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||
|
@ -102,14 +101,10 @@ public class CASTUnaryExpression extends ASTNode implements IASTUnaryExpression,
|
|||
public IType getExpressionType() {
|
||||
IType type = getOperand().getExpressionType();
|
||||
int op = getOperator();
|
||||
try {
|
||||
if (op == IASTUnaryExpression.op_star && (type instanceof IPointerType || type instanceof IArrayType)) {
|
||||
return ((ITypeContainer) type).getType();
|
||||
} else if (op == IASTUnaryExpression.op_amper) {
|
||||
return new CPointerType(type, 0);
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
if (op == IASTUnaryExpression.op_star && (type instanceof IPointerType || type instanceof IArrayType)) {
|
||||
return ((ITypeContainer) type).getType();
|
||||
} else if (op == IASTUnaryExpression.op_amper) {
|
||||
return new CPointerType(type, 0);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Devin Steffler (IBM Corporation) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
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.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
|
||||
/**
|
||||
* @author dsteffle
|
||||
*/
|
||||
public class CFunctionType implements IFunctionType {
|
||||
IType[] parameters = null;
|
||||
IType returnType = null;
|
||||
|
@ -39,19 +35,11 @@ public class CFunctionType implements IFunctionType {
|
|||
if( o instanceof IFunctionType ){
|
||||
IFunctionType ft = (IFunctionType) o;
|
||||
IType [] fps;
|
||||
try {
|
||||
fps = ft.getParameterTypes();
|
||||
} catch ( DOMException e ) {
|
||||
return false;
|
||||
}
|
||||
fps = ft.getParameterTypes();
|
||||
if( fps.length != parameters.length )
|
||||
return false;
|
||||
try {
|
||||
if( ! returnType.isSameType( ft.getReturnType() ) )
|
||||
return false;
|
||||
} catch ( DOMException e1 ) {
|
||||
return false;
|
||||
}
|
||||
if( ! returnType.isSameType( ft.getReturnType() ) )
|
||||
return false;
|
||||
for( int i = 0; i < parameters.length; i++ )
|
||||
if( ! parameters[i].isSameType( fps[i] ) )
|
||||
return false;
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* Devin Steffler (IBM Rational Software) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
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.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICPointerType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
|
||||
/**
|
||||
* @author dsteffle
|
||||
*/
|
||||
public class CPointerType implements ICPointerType, ITypeContainer {
|
||||
static public final int IS_CONST = 1;
|
||||
static public final int IS_RESTRICT = 1 << 1;
|
||||
|
@ -42,15 +38,11 @@ public class CPointerType implements ICPointerType, ITypeContainer {
|
|||
|
||||
if( obj instanceof ICPointerType ){
|
||||
ICPointerType pt = (ICPointerType) obj;
|
||||
try {
|
||||
if( isConst() != pt.isConst() ) return false;
|
||||
if( isRestrict() != pt.isRestrict() ) return false;
|
||||
if( isVolatile() != pt.isVolatile() ) return false;
|
||||
if( isConst() != pt.isConst() ) return false;
|
||||
if( isRestrict() != pt.isRestrict() ) return false;
|
||||
if( isVolatile() != pt.isVolatile() ) return false;
|
||||
|
||||
return pt.getType().isSameType( nextType );
|
||||
} catch ( DOMException e ) {
|
||||
return false;
|
||||
}
|
||||
return pt.getType().isSameType( nextType );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* Devin Steffler (IBM Rational Software) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
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.IASTElaboratedTypeSpecifier;
|
||||
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.internal.core.dom.parser.ITypeContainer;
|
||||
|
||||
/**
|
||||
* @author dsteffle
|
||||
*/
|
||||
public class CQualifierType implements ICQualifierType, ITypeContainer {
|
||||
|
||||
private boolean isConst;
|
||||
|
@ -57,17 +53,13 @@ public class CQualifierType implements ICQualifierType, ITypeContainer {
|
|||
|
||||
if( obj instanceof ICQualifierType ){
|
||||
ICQualifierType qt = (ICQualifierType) obj;
|
||||
try {
|
||||
if( isConst() != qt.isConst() ) return false;
|
||||
if( isRestrict() != qt.isRestrict() ) return false;
|
||||
if( isVolatile() != qt.isVolatile() ) return false;
|
||||
if( isConst() != qt.isConst() ) return false;
|
||||
if( isRestrict() != qt.isRestrict() ) return false;
|
||||
if( isVolatile() != qt.isVolatile() ) return false;
|
||||
|
||||
if( type == null )
|
||||
return false;
|
||||
return type.isSameType( qt.getType() );
|
||||
} catch ( DOMException e ) {
|
||||
return false;
|
||||
}
|
||||
if( type == null )
|
||||
return false;
|
||||
return type.isSameType( qt.getType() );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* 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 ) {
|
||||
if( t == this )
|
||||
return true;
|
||||
if( t instanceof ITypedef )
|
||||
try {
|
||||
IType temp = getType();
|
||||
if( temp != null )
|
||||
return temp.isSameType( ((ITypedef)t).getType());
|
||||
return false;
|
||||
} catch ( DOMException e ) {
|
||||
return false;
|
||||
}
|
||||
if( t instanceof ITypedef ) {
|
||||
IType temp = getType();
|
||||
if( temp != null )
|
||||
return temp.isSameType( ((ITypedef)t).getType());
|
||||
return false;
|
||||
}
|
||||
|
||||
IType temp = getType();
|
||||
if( temp != null )
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
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.IASTExpressionList;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
||||
|
@ -82,21 +81,17 @@ public final class CVariableReadWriteFlags extends VariableReadWriteFlags {
|
|||
if (indirection == 0) {
|
||||
return READ;
|
||||
}
|
||||
try {
|
||||
while(indirection > 0 && (type instanceof IPointerType)) {
|
||||
type= ((IPointerType) type).getType();
|
||||
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;
|
||||
}
|
||||
}
|
||||
while(indirection > 0 && (type instanceof IPointerType)) {
|
||||
type= ((IPointerType) type).getType();
|
||||
indirection--;
|
||||
}
|
||||
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
|
||||
}
|
||||
|
|
|
@ -602,11 +602,7 @@ public class CVisitor extends ASTQueries {
|
|||
|
||||
IType type = fieldOwner.getExpressionType();
|
||||
while (type != null && type instanceof ITypeContainer) {
|
||||
try {
|
||||
type = ((ITypeContainer)type).getType();
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
}
|
||||
type = ((ITypeContainer)type).getType();
|
||||
}
|
||||
|
||||
if (type != null && type instanceof ICompositeType) {
|
||||
|
@ -925,14 +921,10 @@ public class CVisitor extends ASTQueries {
|
|||
}
|
||||
} else if (struct instanceof ITypeContainer) {
|
||||
IType type;
|
||||
try {
|
||||
type = ((ITypeContainer)struct).getType();
|
||||
while (type instanceof ITypeContainer && !(type instanceof CStructure)) {
|
||||
type = ((ITypeContainer)type).getType();
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
}
|
||||
type = ((ITypeContainer)struct).getType();
|
||||
while (type instanceof ITypeContainer && !(type instanceof CStructure)) {
|
||||
type = ((ITypeContainer)type).getType();
|
||||
}
|
||||
|
||||
|
||||
if (type instanceof CStructure)
|
||||
|
|
|
@ -224,11 +224,7 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
|
|||
case ICPPASTBinaryExpression.op_pmarrow:
|
||||
case ICPPASTBinaryExpression.op_pmdot:
|
||||
if (type2 instanceof ICPPPointerToMemberType) {
|
||||
try {
|
||||
return ((ICPPPointerToMemberType) type2).getType();
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
}
|
||||
return ((ICPPPointerToMemberType) type2).getType();
|
||||
}
|
||||
return new ProblemBinding(this, IProblemBinding.SEMANTIC_INVALID_TYPE, getRawSignature().toCharArray());
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
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.IASTArrayModifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
|
@ -253,11 +252,7 @@ public class CPPASTNewExpression extends ASTNode implements
|
|||
public IType getExpressionType() {
|
||||
IType t= CPPVisitor.createType(getTypeId());
|
||||
if (t instanceof IArrayType) {
|
||||
try {
|
||||
t= ((IArrayType) t).getType();
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
}
|
||||
t= ((IArrayType) t).getType();
|
||||
}
|
||||
return new CPPPointerType(t);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
*******************************************************************************/
|
||||
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.DOMException;
|
||||
|
@ -231,17 +233,13 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
|
|||
if (type instanceof IProblemBinding) {
|
||||
return type;
|
||||
}
|
||||
try {
|
||||
IType operator = findOperatorReturnType();
|
||||
if(operator != null) {
|
||||
return operator;
|
||||
} else if (type instanceof IPointerType || type instanceof IArrayType) {
|
||||
return ((ITypeContainer) type).getType();
|
||||
} else if (type instanceof ICPPUnknownType) {
|
||||
return CPPUnknownClass.createUnnamedInstance();
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
IType operator = findOperatorReturnType();
|
||||
if(operator != null) {
|
||||
return operator;
|
||||
} else if (type instanceof IPointerType || type instanceof IArrayType) {
|
||||
return ((ITypeContainer) type).getType();
|
||||
} else if (type instanceof ICPPUnknownType) {
|
||||
return CPPUnknownClass.createUnnamedInstance();
|
||||
}
|
||||
return new ProblemBinding(this, IProblemBinding.SEMANTIC_INVALID_TYPE, this.getRawSignature().toCharArray());
|
||||
}
|
||||
|
|
|
@ -6,25 +6,18 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* 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;
|
||||
|
||||
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.IArrayType;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*/
|
||||
public class CPPArrayType implements IArrayType, ITypeContainer {
|
||||
private IType type;
|
||||
private IASTExpression sizeExpression;
|
||||
|
@ -53,13 +46,9 @@ public class CPPArrayType implements IArrayType, ITypeContainer {
|
|||
return ((ITypedef) obj).isSameType(this);
|
||||
|
||||
if (obj instanceof IArrayType) {
|
||||
try {
|
||||
IType objType = ((IArrayType) obj).getType();
|
||||
if (objType != null)
|
||||
return objType.isSameType(type);
|
||||
} catch (DOMException e) {
|
||||
return false;
|
||||
}
|
||||
IType objType = ((IArrayType) obj).getType();
|
||||
if (objType != null)
|
||||
return objType.isSameType(type);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -51,20 +51,12 @@ public class CPPFunctionType implements ICPPFunctionType {
|
|||
if (o instanceof ICPPFunctionType) {
|
||||
ICPPFunctionType ft = (ICPPFunctionType) o;
|
||||
IType[] fps;
|
||||
try {
|
||||
fps = ft.getParameterTypes();
|
||||
} catch (DOMException e) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
//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;
|
||||
}
|
||||
fps = ft.getParameterTypes();
|
||||
//constructors & destructors have null return type
|
||||
if ((returnType == null) ^ (ft.getReturnType() == null))
|
||||
return false;
|
||||
else if (returnType != null && ! returnType.isSameType(ft.getReturnType()))
|
||||
return false;
|
||||
|
||||
try {
|
||||
if (parameters.length == 1 && fps.length == 0) {
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
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.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
|
@ -57,23 +56,21 @@ public class CPPImplicitTypedef extends CPPTypedef {
|
|||
|
||||
@Override
|
||||
public boolean isSameType(IType t) {
|
||||
if( t == this )
|
||||
return true;
|
||||
if( t instanceof ITypedef ) {
|
||||
IType temp = getType();
|
||||
if( temp != null )
|
||||
try {
|
||||
return temp.isSameType( ((ITypedef)t).getType());
|
||||
} catch (DOMException e) {}
|
||||
return false;
|
||||
}
|
||||
if (t == this)
|
||||
return true;
|
||||
if (t instanceof ITypedef) {
|
||||
IType temp = getType();
|
||||
if (temp != null)
|
||||
return temp.isSameType(((ITypedef) t).getType());
|
||||
return false;
|
||||
}
|
||||
|
||||
IType temp;
|
||||
temp = getType();
|
||||
if( temp != null )
|
||||
return temp.isSameType( t );
|
||||
return false;
|
||||
}
|
||||
IType temp;
|
||||
temp = getType();
|
||||
if (temp != null)
|
||||
return temp.isSameType(t);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone(){
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -45,12 +45,15 @@ public class CPPParameterSpecialization extends CPPSpecialization implements ICP
|
|||
}
|
||||
|
||||
@Override
|
||||
public IType specializeType(IType type) throws DOMException {
|
||||
public IType specializeType(IType type) {
|
||||
IBinding owner= getOwner();
|
||||
if (owner != null) {
|
||||
owner= owner.getOwner();
|
||||
if (owner instanceof ICPPClassSpecialization) {
|
||||
return CPPTemplates.instantiateType(type, getTemplateParameterMap(), (ICPPClassSpecialization) owner);
|
||||
try {
|
||||
owner= owner.getOwner();
|
||||
if (owner instanceof ICPPClassSpecialization) {
|
||||
return CPPTemplates.instantiateType(type, getTemplateParameterMap(), (ICPPClassSpecialization) owner);
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
}
|
||||
return CPPTemplates.instantiateType(type, getTemplateParameterMap(), null);
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
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.IPointerType;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
|
@ -71,10 +70,7 @@ public class CPPPointerType implements IPointerType, ITypeContainer {
|
|||
|
||||
IPointerType pt = (IPointerType) o;
|
||||
if (isConst == pt.isConst() && isVolatile == pt.isVolatile()) {
|
||||
try {
|
||||
return type.isSameType(pt.getType());
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
return type.isSameType(pt.getType());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -6,22 +6,18 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Andrew Niefer (IBM Corporation) - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
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.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*/
|
||||
public class CPPQualifierType implements IQualifierType, ITypeContainer {
|
||||
private final boolean isConst;
|
||||
private final boolean isVolatile;
|
||||
|
@ -40,11 +36,8 @@ public class CPPQualifierType implements IQualifierType, ITypeContainer {
|
|||
return false;
|
||||
|
||||
IQualifierType pt = (IQualifierType) o;
|
||||
try {
|
||||
if (isConst() == pt.isConst() && isVolatile() == pt.isVolatile())
|
||||
return type.isSameType(pt.getType());
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
if (isConst() == pt.isConst() && isVolatile() == pt.isVolatile())
|
||||
return type.isSameType(pt.getType());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM 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;
|
||||
|
||||
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.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*/
|
||||
public class CPPReferenceType implements ICPPReferenceType, ITypeContainer {
|
||||
IType type = null;
|
||||
|
||||
|
@ -50,11 +42,7 @@ public class CPPReferenceType implements ICPPReferenceType, ITypeContainer {
|
|||
return (obj == null);
|
||||
|
||||
if (obj instanceof ICPPReferenceType) {
|
||||
try {
|
||||
return type.isSameType(((ICPPReferenceType) obj).getType());
|
||||
} catch (DOMException e) {
|
||||
return false;
|
||||
}
|
||||
return type.isSameType(((ICPPReferenceType) obj).getType());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public abstract class CPPSpecialization extends PlatformObject implements ICPPSp
|
|||
this.argumentMap = argumentMap;
|
||||
}
|
||||
|
||||
public IType specializeType(IType type) throws DOMException {
|
||||
public IType specializeType(IType type) {
|
||||
if (owner instanceof ICPPClassSpecialization) {
|
||||
return CPPTemplates.instantiateType(type, getTemplateParameterMap(), (ICPPClassSpecialization) owner);
|
||||
} else {
|
||||
|
|
|
@ -65,14 +65,10 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
|
|||
if (o == this)
|
||||
return true;
|
||||
if (o instanceof ITypedef) {
|
||||
try {
|
||||
IType t = getType();
|
||||
if (t != null)
|
||||
return t.isSameType(((ITypedef)o).getType());
|
||||
return false;
|
||||
} catch (DOMException e) {
|
||||
return false;
|
||||
}
|
||||
IType t = getType();
|
||||
if (t != null)
|
||||
return t.isSameType(((ITypedef)o).getType());
|
||||
return false;
|
||||
}
|
||||
|
||||
IType t = getType();
|
||||
|
|
|
@ -33,7 +33,7 @@ public class CPPTypedefSpecialization extends CPPSpecialization implements IType
|
|||
final static class RecursionResolvingBinding extends ProblemBinding {
|
||||
public RecursionResolvingBinding(IASTNode node, char[] 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)
|
||||
* @see org.eclipse.cdt.core.dom.ast.ITypedef#getType()
|
||||
*/
|
||||
public IType getType() throws DOMException {
|
||||
public IType getType() {
|
||||
if (type == null) {
|
||||
try {
|
||||
if (++fResolutionDepth > MAX_RESOLUTION_DEPTH) {
|
||||
|
@ -66,7 +66,11 @@ public class CPPTypedefSpecialization extends CPPSpecialization implements IType
|
|||
if (type instanceof ITypedef && type instanceof ICPPSpecialization) {
|
||||
ITypedef td= (ITypedef) type;
|
||||
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 (((IType) owner).isSameType((ICPPClassType) getOwner())) {
|
||||
type = new RecursionResolvingBinding(getDefinition(), getNameCharArray());
|
||||
|
@ -108,23 +112,15 @@ public class CPPTypedefSpecialization extends CPPSpecialization implements IType
|
|||
if (o == this)
|
||||
return true;
|
||||
if (o instanceof ITypedef) {
|
||||
try {
|
||||
IType t = getType();
|
||||
if (t != null)
|
||||
return t.isSameType(((ITypedef) o).getType());
|
||||
return false;
|
||||
} catch (DOMException e) {
|
||||
return false;
|
||||
}
|
||||
IType t = getType();
|
||||
if (t != null)
|
||||
return t.isSameType(((ITypedef) o).getType());
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
IType t = getType();
|
||||
if (t != null)
|
||||
return t.isSameType(o);
|
||||
} catch (DOMException e) {
|
||||
return false;
|
||||
}
|
||||
IType t = getType();
|
||||
if (t != null)
|
||||
return t.isSameType(o);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -2497,11 +2497,7 @@ public class CPPSemantics {
|
|||
IType[] result = null;
|
||||
for (int i = 0; i < types.length && types[i] != null; i++) {
|
||||
IType[] pts = null;
|
||||
try {
|
||||
pts = types[i].getParameterTypes();
|
||||
} catch (DOMException e) {
|
||||
continue;
|
||||
}
|
||||
pts = types[i].getParameterTypes();
|
||||
if (pts.length > idx)
|
||||
result = (IType[]) ArrayUtil.append(IType.class, result, pts[idx]);
|
||||
}
|
||||
|
@ -2732,11 +2728,7 @@ public class CPPSemantics {
|
|||
IType type = exp.getExpressionType();
|
||||
if (type instanceof IProblem)
|
||||
return null;
|
||||
try {
|
||||
type = ((IPointerType)type).getType();
|
||||
} catch (DOMException e) {
|
||||
return null;
|
||||
}
|
||||
type = ((IPointerType)type).getType();
|
||||
|
||||
IASTTypeId typeId = exp.getTypeId().copy();
|
||||
IASTExpression sizeExpression = new CPPASTTypeIdExpression(IASTTypeIdExpression.op_sizeof, typeId);
|
||||
|
@ -2767,13 +2759,9 @@ public class CPPSemantics {
|
|||
IType type1 = exp.getOperand().getExpressionType();
|
||||
IType ultimateType1 = SemanticUtil.getUltimateTypeUptoPointers(type1);
|
||||
if (ultimateType1 instanceof IPointerType) {
|
||||
try {
|
||||
IType classType = ((IPointerType)ultimateType1).getType();
|
||||
if (classType instanceof ICPPClassType)
|
||||
return (ICPPClassType) classType;
|
||||
} catch (DOMException e) {
|
||||
return null;
|
||||
}
|
||||
IType classType = ((IPointerType)ultimateType1).getType();
|
||||
if (classType instanceof ICPPClassType)
|
||||
return (ICPPClassType) classType;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -998,7 +998,7 @@ public class CPPTemplates {
|
|||
}
|
||||
|
||||
public static void associateTemplateDeclarations(ICPPASTInternalTemplateDeclaration tdecl) {
|
||||
// find innermost template decl
|
||||
// find innermost template declaration
|
||||
IASTDeclaration decl= tdecl.getDeclaration();
|
||||
while (decl instanceof ICPPASTInternalTemplateDeclaration) {
|
||||
tdecl= (ICPPASTInternalTemplateDeclaration) decl;
|
||||
|
@ -1006,7 +1006,7 @@ public class CPPTemplates {
|
|||
}
|
||||
final ICPPASTInternalTemplateDeclaration innerMostTDecl= tdecl;
|
||||
|
||||
// find name declared in nested declaration
|
||||
// find name declared within the template declaration
|
||||
IASTName name= getNameForDeclarationInTemplateDeclaration(decl);
|
||||
|
||||
// count template declarations
|
||||
|
@ -1021,7 +1021,7 @@ public class CPPTemplates {
|
|||
|
||||
// determine association of names with template declarations
|
||||
boolean lastIsTemplate= true;
|
||||
int additionalLevels= 0;
|
||||
int missingTemplateDecls= 0;
|
||||
if (name instanceof ICPPASTQualifiedName) {
|
||||
ICPPASTQualifiedName qname= (ICPPASTQualifiedName) name;
|
||||
final IASTName lastName = qname.getLastName();
|
||||
|
@ -1030,8 +1030,7 @@ public class CPPTemplates {
|
|||
// count template-ids
|
||||
int idcount= 0;
|
||||
final IASTName[] ns= qname.getNames();
|
||||
for (int j = 0; j < ns.length; j++) {
|
||||
final IASTName n = ns[j];
|
||||
for (final IASTName n : ns) {
|
||||
if (n instanceof ICPPASTTemplateId) {
|
||||
idcount++;
|
||||
}
|
||||
|
@ -1051,25 +1050,23 @@ public class CPPTemplates {
|
|||
}
|
||||
|
||||
if (lastIsID && !isCtorWithTemplateID) {
|
||||
additionalLevels= idcount-tdeclcount;
|
||||
missingTemplateDecls= idcount-tdeclcount;
|
||||
} else {
|
||||
additionalLevels= idcount+1-tdeclcount;
|
||||
if (additionalLevels > 0) {
|
||||
missingTemplateDecls= idcount+1-tdeclcount;
|
||||
if (missingTemplateDecls > 0) {
|
||||
// last name is probably not a template
|
||||
additionalLevels--;
|
||||
missingTemplateDecls--;
|
||||
lastIsTemplate= false;
|
||||
CharArraySet tparnames= collectTemplateParameterNames(outerMostTDecl);
|
||||
int j= 0;
|
||||
IASTName n;
|
||||
for (int i = 0; i < ns.length; i++) {
|
||||
n = ns[j];
|
||||
for (IASTName n : ns) {
|
||||
if (n instanceof ICPPASTTemplateId) {
|
||||
// if we find a dependent id, there can be no explicit specialization.
|
||||
ICPPASTTemplateId id= (ICPPASTTemplateId) n;
|
||||
if (usesTemplateParameter(id, tparnames))
|
||||
break;
|
||||
|
||||
if (j++ == additionalLevels) {
|
||||
if (j++ == missingTemplateDecls) {
|
||||
IBinding b= n.resolveBinding();
|
||||
if (b instanceof ICPPTemplateInstance && b instanceof ICPPClassType) {
|
||||
try {
|
||||
|
@ -1077,7 +1074,7 @@ public class CPPTemplates {
|
|||
if (!(s instanceof ICPPClassSpecializationScope)) {
|
||||
// template-id of an explicit specialization.
|
||||
// here we don't have a template declaration. (see 14.7.3.5)
|
||||
additionalLevels++;
|
||||
missingTemplateDecls++;
|
||||
lastIsTemplate= true;
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
|
@ -1092,12 +1089,12 @@ public class CPPTemplates {
|
|||
}
|
||||
}
|
||||
|
||||
if (additionalLevels < 0) {
|
||||
additionalLevels= 0; // too many template declarations
|
||||
if (missingTemplateDecls < 0) {
|
||||
missingTemplateDecls= 0; // too many template declarations
|
||||
}
|
||||
|
||||
// determine nesting level of parent
|
||||
int level= additionalLevels;
|
||||
int level= missingTemplateDecls;
|
||||
if (!CPPVisitor.isFriendFunctionDeclaration(innerMostTDecl.getDeclaration())) {
|
||||
node= outerMostTDecl.getParent();
|
||||
while (node != null) {
|
||||
|
@ -1556,23 +1553,16 @@ public class CPPTemplates {
|
|||
static private IType getArgumentTypeForDeduction(IType type, boolean parameterIsAReferenceType) {
|
||||
type = SemanticUtil.getSimplifiedType(type);
|
||||
if (type instanceof ICPPReferenceType) {
|
||||
try {
|
||||
type = ((ICPPReferenceType) type).getType();
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
type = ((ICPPReferenceType) type).getType();
|
||||
}
|
||||
IType result = type;
|
||||
if (!parameterIsAReferenceType) {
|
||||
try {
|
||||
if (type instanceof IArrayType) {
|
||||
result = new CPPPointerType(((IArrayType) type).getType());
|
||||
} else if (type instanceof IFunctionType) {
|
||||
result = new CPPPointerType(type);
|
||||
} else {
|
||||
result = SemanticUtil.getNestedType(type, SemanticUtil.TDEF | SemanticUtil.CVQ | SemanticUtil.PTR_CVQ );
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
result = e.getProblem();
|
||||
if (type instanceof IArrayType) {
|
||||
result = new CPPPointerType(((IArrayType) type).getType());
|
||||
} else if (type instanceof IFunctionType) {
|
||||
result = new CPPPointerType(type);
|
||||
} else {
|
||||
result = SemanticUtil.getNestedType(type, SemanticUtil.TDEF | SemanticUtil.CVQ | SemanticUtil.PTR_CVQ );
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -1934,12 +1924,8 @@ public class CPPTemplates {
|
|||
}
|
||||
|
||||
static private boolean isValidType(IType t) {
|
||||
try {
|
||||
while (t instanceof ITypeContainer) {
|
||||
t = ((ITypeContainer) t).getType();
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
return false;
|
||||
while (t instanceof ITypeContainer) {
|
||||
t = ((ITypeContainer) t).getType();
|
||||
}
|
||||
return !(t instanceof IProblemBinding);
|
||||
}
|
||||
|
@ -2030,11 +2016,7 @@ public class CPPTemplates {
|
|||
if (paramType instanceof IFunctionType) {
|
||||
paramType = new CPPPointerType(paramType);
|
||||
} else if (paramType instanceof IArrayType) {
|
||||
try {
|
||||
paramType = new CPPPointerType(((IArrayType) paramType).getType());
|
||||
} catch (DOMException e) {
|
||||
paramType = e.getProblem();
|
||||
}
|
||||
paramType = new CPPPointerType(((IArrayType) paramType).getType());
|
||||
}
|
||||
Cost cost = Conversions.checkStandardConversionSequence(arg, paramType, false);
|
||||
return cost != null && cost.getRank() != Rank.NO_MATCH;
|
||||
|
@ -2088,30 +2070,25 @@ public class CPPTemplates {
|
|||
}
|
||||
|
||||
public static boolean isDependentType(IType t) {
|
||||
try {
|
||||
while (true) {
|
||||
if (t instanceof ICPPUnknownType)
|
||||
return true;
|
||||
while (true) {
|
||||
if (t instanceof ICPPUnknownType)
|
||||
return true;
|
||||
|
||||
if (t instanceof ICPPFunctionType) {
|
||||
final ICPPFunctionType ft = (ICPPFunctionType) t;
|
||||
if (containsDependentType(ft.getParameterTypes()))
|
||||
return true;
|
||||
t= ft.getReturnType();
|
||||
} else if (t instanceof ICPPPointerToMemberType) {
|
||||
ICPPPointerToMemberType ptmt= (ICPPPointerToMemberType) t;
|
||||
if (isDependentType(ptmt.getMemberOfClass()))
|
||||
return true;
|
||||
t= ptmt.getType();
|
||||
} else if (t instanceof ITypeContainer) {
|
||||
t= ((ITypeContainer) t).getType();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (t instanceof ICPPFunctionType) {
|
||||
final ICPPFunctionType ft = (ICPPFunctionType) t;
|
||||
if (containsDependentType(ft.getParameterTypes()))
|
||||
return true;
|
||||
t= ft.getReturnType();
|
||||
} else if (t instanceof ICPPPointerToMemberType) {
|
||||
ICPPPointerToMemberType ptmt= (ICPPPointerToMemberType) t;
|
||||
if (isDependentType(ptmt.getMemberOfClass()))
|
||||
return true;
|
||||
t= ptmt.getType();
|
||||
} else if (t instanceof ITypeContainer) {
|
||||
t= ((ITypeContainer) t).getType();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
// treat as non-dependent
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
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.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||
|
@ -50,30 +49,21 @@ public final class CPPVariableReadWriteFlags extends VariableReadWriteFlags {
|
|||
if (!(type instanceof ICPPReferenceType)) {
|
||||
return READ;
|
||||
}
|
||||
try {
|
||||
type= ((ICPPReferenceType) type).getType();
|
||||
}
|
||||
catch (DOMException e) {
|
||||
return READ; // fallback
|
||||
}
|
||||
type= ((ICPPReferenceType) type).getType();
|
||||
}
|
||||
try {
|
||||
while(indirection > 0 && (type instanceof ITypeContainer)) {
|
||||
if (type instanceof IPointerType) {
|
||||
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;
|
||||
}
|
||||
while(indirection > 0 && (type instanceof ITypeContainer)) {
|
||||
if (type instanceof IPointerType) {
|
||||
indirection--;
|
||||
}
|
||||
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
|
||||
}
|
||||
|
|
|
@ -624,16 +624,12 @@ public class CPPVisitor extends ASTQueries {
|
|||
} else if (simpleDecl != null &&
|
||||
simpleDecl.getDeclSpecifier().getStorageClass() == IASTDeclSpecifier.sc_typedef) {
|
||||
if (binding instanceof ICPPInternalBinding && binding instanceof ITypedef && name.isActive()) {
|
||||
try {
|
||||
IType t1 = ((ITypedef) binding).getType();
|
||||
IType t2 = createType(declarator);
|
||||
if (t1 != null && t2 != null && t1.isSameType(t2)) {
|
||||
ASTInternal.addDeclaration(binding, name);
|
||||
return binding;
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
}
|
||||
IType t1 = ((ITypedef) binding).getType();
|
||||
IType t2 = createType(declarator);
|
||||
if (t1 != null && t2 != null && t1.isSameType(t2)) {
|
||||
ASTInternal.addDeclaration(binding, name);
|
||||
return binding;
|
||||
}
|
||||
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
|
||||
|
|
|
@ -189,53 +189,49 @@ public class SemanticUtil {
|
|||
boolean ptr= (options & PTR) != 0;
|
||||
boolean mptr= (options & MPTR) != 0;
|
||||
assert !(ptrcvq && (ptr || mptr));
|
||||
try {
|
||||
while (true) {
|
||||
IType t= null;
|
||||
if (type instanceof IPointerType) {
|
||||
final boolean isMbrPtr = type instanceof ICPPPointerToMemberType;
|
||||
if ((ptr && !isMbrPtr) || (mptr && isMbrPtr)) {
|
||||
t= ((IPointerType) type).getType();
|
||||
} else if (ptrcvq) {
|
||||
if (type instanceof CPPPointerType) {
|
||||
return ((CPPPointerType) type).stripQualifiers();
|
||||
}
|
||||
IPointerType p= (IPointerType) type;
|
||||
if (p.isConst() || p.isVolatile()) {
|
||||
if (p instanceof ICPPPointerToMemberType) {
|
||||
final IType memberOfClass = ((ICPPPointerToMemberType) p).getMemberOfClass();
|
||||
if (memberOfClass instanceof ICPPClassType)
|
||||
return new CPPPointerToMemberType(p.getType(), memberOfClass, false, false);
|
||||
} else {
|
||||
return new CPPPointerType(p.getType(), false, false);
|
||||
}
|
||||
while (true) {
|
||||
IType t= null;
|
||||
if (type instanceof IPointerType) {
|
||||
final boolean isMbrPtr = type instanceof ICPPPointerToMemberType;
|
||||
if ((ptr && !isMbrPtr) || (mptr && isMbrPtr)) {
|
||||
t= ((IPointerType) type).getType();
|
||||
} else if (ptrcvq) {
|
||||
if (type instanceof CPPPointerType) {
|
||||
return ((CPPPointerType) type).stripQualifiers();
|
||||
}
|
||||
IPointerType p= (IPointerType) type;
|
||||
if (p.isConst() || p.isVolatile()) {
|
||||
if (p instanceof ICPPPointerToMemberType) {
|
||||
final IType memberOfClass = ((ICPPPointerToMemberType) p).getMemberOfClass();
|
||||
if (memberOfClass instanceof ICPPClassType)
|
||||
return new CPPPointerToMemberType(p.getType(), memberOfClass, false, false);
|
||||
} else {
|
||||
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)
|
||||
return type;
|
||||
|
||||
type= t;
|
||||
} 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();
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
if (t == null)
|
||||
return type;
|
||||
|
||||
type= t;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -353,13 +349,9 @@ public class SemanticUtil {
|
|||
public static IType adjustParameterType(final IType pt, boolean forFunctionType) {
|
||||
// bug 239975
|
||||
IType t= SemanticUtil.getNestedType(pt, TDEF);
|
||||
try {
|
||||
if (t instanceof IArrayType) {
|
||||
IArrayType at = (IArrayType) t;
|
||||
return new CPPPointerType(at.getType());
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
if (t instanceof IArrayType) {
|
||||
IArrayType at = (IArrayType) t;
|
||||
return new CPPPointerType(at.getType());
|
||||
}
|
||||
if (t instanceof IFunctionType) {
|
||||
return new CPPPointerType(pt);
|
||||
|
@ -375,28 +367,25 @@ public class SemanticUtil {
|
|||
|
||||
public static IType addQualifiers(IType baseType, boolean cnst, boolean vol) {
|
||||
if (cnst || vol) {
|
||||
try {
|
||||
if (baseType instanceof IQualifierType) {
|
||||
IQualifierType qt= (IQualifierType) baseType;
|
||||
if ((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;
|
||||
if (baseType instanceof IQualifierType) {
|
||||
IQualifierType qt= (IQualifierType) baseType;
|
||||
if ((cnst && !qt.isConst()) || (vol && !qt.isVolatile())) {
|
||||
return new CPPQualifierType(qt.getType(), cnst || qt.isConst(), vol || qt.isVolatile());
|
||||
}
|
||||
} 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);
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
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.internal.core.dom.parser.ITypeContainer;
|
||||
|
||||
/**
|
||||
* @author Bryan Wilkinson
|
||||
*/
|
||||
public class ArrayTypeClone implements IIndexType, IArrayType, ITypeContainer {
|
||||
private final IArrayType delegate;
|
||||
private IType type;
|
||||
|
@ -35,23 +32,19 @@ public class ArrayTypeClone implements IIndexType, IArrayType, ITypeContainer {
|
|||
if (!(type instanceof IArrayType))
|
||||
return false;
|
||||
|
||||
try {
|
||||
IType type1= this.getType();
|
||||
if (type1 == null)
|
||||
return false;
|
||||
IType type1= this.getType();
|
||||
if (type1 == null)
|
||||
return false;
|
||||
|
||||
IArrayType rhs = (IArrayType) type;
|
||||
return type1.isSameType(rhs.getType());
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
return false;
|
||||
IArrayType rhs = (IArrayType) type;
|
||||
return type1.isSameType(rhs.getType());
|
||||
}
|
||||
|
||||
public IASTExpression getArraySizeExpression() throws DOMException {
|
||||
return delegate.getArraySizeExpression();
|
||||
}
|
||||
|
||||
public IType getType() throws DOMException {
|
||||
public IType getType() {
|
||||
if (type == null) {
|
||||
return delegate.getType();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
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.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
|
||||
/**
|
||||
* @author Bryan Wilkinson
|
||||
*/
|
||||
public class CPPReferenceTypeClone implements ICPPReferenceType, ITypeContainer, IIndexType {
|
||||
private final ICPPReferenceType delegate;
|
||||
private IType type;
|
||||
|
@ -27,7 +23,7 @@ public class CPPReferenceTypeClone implements ICPPReferenceType, ITypeContainer,
|
|||
this.delegate = reference;
|
||||
}
|
||||
|
||||
public IType getType() throws DOMException {
|
||||
public IType getType() {
|
||||
if (type == null) {
|
||||
return delegate.getType();
|
||||
}
|
||||
|
@ -42,12 +38,9 @@ public class CPPReferenceTypeClone implements ICPPReferenceType, ITypeContainer,
|
|||
return false;
|
||||
|
||||
ICPPReferenceType rhs = (ICPPReferenceType) type;
|
||||
try {
|
||||
IType type1= getType();
|
||||
if (type1 != null) {
|
||||
return type1.isSameType(rhs.getType());
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
IType type1= getType();
|
||||
if (type1 != null) {
|
||||
return type1.isSameType(rhs.getType());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
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.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
* @author Bryan Wilkinson
|
||||
*/
|
||||
public class CPPTypedefClone implements ITypedef, ITypeContainer, IIndexType, ICPPBinding {
|
||||
protected final ITypedef delegate;
|
||||
private IType type;
|
||||
|
@ -31,7 +28,7 @@ public class CPPTypedefClone implements ITypedef, ITypeContainer, IIndexType, IC
|
|||
this.delegate = typedef;
|
||||
}
|
||||
|
||||
public IType getType() throws DOMException {
|
||||
public IType getType() {
|
||||
if (type == null) {
|
||||
return delegate.getType();
|
||||
}
|
||||
|
@ -64,18 +61,14 @@ public class CPPTypedefClone implements ITypedef, ITypeContainer, IIndexType, IC
|
|||
}
|
||||
|
||||
public boolean isSameType(IType type) {
|
||||
try {
|
||||
IType myrtype = getType();
|
||||
if (myrtype == null)
|
||||
return false;
|
||||
IType myrtype = getType();
|
||||
if (myrtype == null)
|
||||
return false;
|
||||
|
||||
if (type instanceof ITypedef) {
|
||||
type= ((ITypedef) type).getType();
|
||||
}
|
||||
return myrtype.isSameType(type);
|
||||
} catch (DOMException e) {
|
||||
if (type instanceof ITypedef) {
|
||||
type= ((ITypedef) type).getType();
|
||||
}
|
||||
return false;
|
||||
return myrtype.isSameType(type);
|
||||
}
|
||||
|
||||
public void setType(IType type) {
|
||||
|
|
|
@ -6,21 +6,17 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* 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;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
|
||||
/**
|
||||
* @author Bryan Wilkinson
|
||||
*/
|
||||
public class PointerTypeClone implements IPointerType, ITypeContainer, IIndexType {
|
||||
protected final IPointerType delegate;
|
||||
private IType type;
|
||||
|
@ -29,7 +25,7 @@ public class PointerTypeClone implements IPointerType, ITypeContainer, IIndexTyp
|
|||
this.delegate = pointer;
|
||||
}
|
||||
|
||||
public IType getType() throws DOMException {
|
||||
public IType getType() {
|
||||
if (type == null) {
|
||||
return delegate.getType();
|
||||
}
|
||||
|
@ -55,14 +51,11 @@ public class PointerTypeClone implements IPointerType, ITypeContainer, IIndexTyp
|
|||
return false;
|
||||
|
||||
IPointerType rhs = (IPointerType) type;
|
||||
try {
|
||||
if (isConst() == rhs.isConst() && isVolatile() == rhs.isVolatile()) {
|
||||
IType type1= getType();
|
||||
if (type1 != null) {
|
||||
return type1.isSameType(rhs.getType());
|
||||
}
|
||||
if (isConst() == rhs.isConst() && isVolatile() == rhs.isVolatile()) {
|
||||
IType type1= getType();
|
||||
if (type1 != null) {
|
||||
return type1.isSameType(rhs.getType());
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
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.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
|
||||
/**
|
||||
* @author Bryan Wilkinson
|
||||
*/
|
||||
public class QualifierTypeClone implements IQualifierType, ITypeContainer, IIndexType {
|
||||
private final IQualifierType delegate;
|
||||
private IType type;
|
||||
|
@ -27,7 +24,7 @@ public class QualifierTypeClone implements IQualifierType, ITypeContainer, IInde
|
|||
this.delegate = qualifier;
|
||||
}
|
||||
|
||||
public IType getType() throws DOMException {
|
||||
public IType getType() {
|
||||
if (type == null) {
|
||||
return delegate.getType();
|
||||
}
|
||||
|
@ -49,12 +46,9 @@ public class QualifierTypeClone implements IQualifierType, ITypeContainer, IInde
|
|||
return false;
|
||||
|
||||
IQualifierType pt = (IQualifierType) type;
|
||||
try {
|
||||
if (isConst() == pt.isConst() && isVolatile() == pt.isVolatile()) {
|
||||
IType myType= getType();
|
||||
return myType != null && myType.isSameType(pt.getType());
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
if (isConst() == pt.isConst() && isVolatile() == pt.isVolatile()) {
|
||||
IType myType= getType();
|
||||
return myType != null && myType.isSameType(pt.getType());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
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.IType;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
|
@ -21,7 +20,7 @@ public class CompositeFunctionType extends CompositeType implements IFunctionTyp
|
|||
super(rtype, cf);
|
||||
}
|
||||
|
||||
public IType[] getParameterTypes() throws DOMException {
|
||||
public IType[] getParameterTypes() {
|
||||
IType[] result = ((IFunctionType) type).getParameterTypes();
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = cf.getCompositeType((IIndexType)result[i]);
|
||||
|
@ -29,7 +28,7 @@ public class CompositeFunctionType extends CompositeType implements IFunctionTyp
|
|||
return result;
|
||||
}
|
||||
|
||||
public IType getReturnType() throws DOMException {
|
||||
public IType getReturnType() {
|
||||
return cf.getCompositeType((IIndexType) ((IFunctionType) type).getReturnType());
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
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.IType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
import org.eclipse.cdt.internal.core.index.PointerTypeClone;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -10,14 +10,13 @@
|
|||
*******************************************************************************/
|
||||
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.IType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
import org.eclipse.cdt.internal.core.index.QualifierTypeClone;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,11 +8,9 @@
|
|||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.index.composite;
|
||||
|
||||
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.internal.core.dom.parser.ITypeContainer;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
|
@ -23,16 +21,12 @@ public class CompositeTypeContainer extends CompositeType implements ITypeContai
|
|||
super(rtype, cf);
|
||||
}
|
||||
|
||||
public final IType getType() throws DOMException {
|
||||
public final IType getType() {
|
||||
return cf.getCompositeType((IIndexType) ((ITypeContainer) type).getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
try {
|
||||
return ASTTypeUtil.getType(getType());
|
||||
} catch (DOMException e) {
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
return ASTTypeUtil.getType(getType());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
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.IType;
|
||||
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
|
||||
* 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
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* 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)
|
||||
*/
|
||||
public IType getCompositeType(IIndexType rtype) throws DOMException {
|
||||
public IType getCompositeType(IIndexType rtype) {
|
||||
IType result;
|
||||
|
||||
if(rtype==null) {
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
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.ITypedef;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
|
@ -23,7 +22,7 @@ class CompositeCTypedef extends CompositeCBinding implements ITypedef, IIndexTyp
|
|||
super(cf, rbinding);
|
||||
}
|
||||
|
||||
public IType getType() throws DOMException {
|
||||
public IType getType() {
|
||||
IType type = ((ITypedef)rbinding).getType();
|
||||
return cf.getCompositeType((IIndexType)type);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
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.IArrayType;
|
||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||
|
@ -117,7 +116,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
|
|||
/* (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)
|
||||
*/
|
||||
public IType getCompositeType(IIndexType rtype) throws DOMException {
|
||||
public IType getCompositeType(IIndexType rtype) {
|
||||
IType result;
|
||||
|
||||
if (rtype instanceof ICPPSpecialization) {
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
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.cpp.ICPPPointerToMemberType;
|
||||
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 {
|
||||
|
||||
CompositeCPPPointerToMemberType(ICompositesFactory cf, ICPPPointerToMemberType pointerToMemberType) throws DOMException {
|
||||
CompositeCPPPointerToMemberType(ICompositesFactory cf, ICPPPointerToMemberType pointerToMemberType) {
|
||||
super(pointerToMemberType, cf);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
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.internal.core.dom.parser.ITypeContainer;
|
||||
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;
|
||||
|
||||
class CompositeCPPReferenceType extends CompositeTypeContainer implements ICPPReferenceType {
|
||||
public CompositeCPPReferenceType(ICPPReferenceType referenceType, ICompositesFactory cf) throws DOMException {
|
||||
public CompositeCPPReferenceType(ICPPReferenceType referenceType, ICompositesFactory cf) {
|
||||
super((ITypeContainer) referenceType, cf);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
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.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||
|
@ -24,7 +23,7 @@ class CompositeCPPTypedef extends CompositeCPPBinding implements ITypedef, IInde
|
|||
super(cf, delegate);
|
||||
}
|
||||
|
||||
public IType getType() throws DOMException {
|
||||
public IType getType() {
|
||||
IType type = ((ITypedef)rbinding).getType();
|
||||
return cf.getCompositeType((IIndexType)type);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -41,9 +41,9 @@ public class TemplateInstanceUtil {
|
|||
CPPTemplateParameterMap result= new CPPTemplateParameterMap(keys.length);
|
||||
|
||||
try {
|
||||
for(int i = 0; i < keys.length; i++) {
|
||||
ICPPTemplateArgument arg= preresult.getArgument(keys[i]);
|
||||
result.put(keys[i], convert(cf, arg));
|
||||
for (Integer key : keys) {
|
||||
ICPPTemplateArgument arg= preresult.getArgument(key);
|
||||
result.put(key, convert(cf, arg));
|
||||
}
|
||||
} catch(DOMException de) {
|
||||
CCorePlugin.log(de);
|
||||
|
@ -148,12 +148,8 @@ public class TemplateInstanceUtil {
|
|||
|
||||
@Deprecated
|
||||
private static IType[] getArguments(ICompositesFactory cf, IType[] result) {
|
||||
try {
|
||||
for(int i=0; i<result.length; i++) {
|
||||
result[i] = cf.getCompositeType((IIndexType)result[i]);
|
||||
}
|
||||
} catch(DOMException de) {
|
||||
CCorePlugin.log(de);
|
||||
for(int i=0; i<result.length; i++) {
|
||||
result[i] = cf.getCompositeType((IIndexType)result[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -35,14 +35,10 @@ public class PDOMArrayType extends PDOMNode implements IIndexType, IArrayType, I
|
|||
|
||||
public PDOMArrayType(PDOMLinkage linkage, PDOMNode parent, IArrayType type) throws CoreException {
|
||||
super(linkage, parent);
|
||||
try {
|
||||
PDOMNode targetTypeNode = getLinkage().addType(this, type.getType());
|
||||
if (targetTypeNode != null) {
|
||||
long typeRec = targetTypeNode.getRecord();
|
||||
getDB().putRecPtr(record + TYPE, typeRec);
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
CCorePlugin.log(e);
|
||||
PDOMNode targetTypeNode = getLinkage().addType(this, type.getType());
|
||||
if (targetTypeNode != null) {
|
||||
long typeRec = targetTypeNode.getRecord();
|
||||
getDB().putRecPtr(record + TYPE, typeRec);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,16 +73,12 @@ public class PDOMArrayType extends PDOMNode implements IIndexType, IArrayType, I
|
|||
if( !( type instanceof IArrayType ))
|
||||
return false;
|
||||
|
||||
try {
|
||||
IType type1= this.getType();
|
||||
if( type1 == null )
|
||||
return false;
|
||||
IType type1= this.getType();
|
||||
if( type1 == null )
|
||||
return false;
|
||||
|
||||
IArrayType rhs = (IArrayType) type;
|
||||
return type1.isSameType( rhs.getType() );
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
return false;
|
||||
IArrayType rhs = (IArrayType) type;
|
||||
return type1.isSameType( rhs.getType() );
|
||||
}
|
||||
|
||||
public void setType(IType type) {
|
||||
|
|
|
@ -15,12 +15,10 @@ package org.eclipse.cdt.internal.core.pdom.dom;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
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.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
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.index.IIndexBindingConstants;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
|
@ -57,25 +55,21 @@ public class PDOMPointerType extends PDOMNode implements IPointerType,
|
|||
|
||||
Database db = getDB();
|
||||
|
||||
try {
|
||||
// type
|
||||
long typeRec = 0;
|
||||
byte flags = 0;
|
||||
if (type != null) {
|
||||
IType targetType= type.getType();
|
||||
PDOMNode targetTypeNode = getLinkage().addType(this, targetType);
|
||||
if (targetTypeNode != null)
|
||||
typeRec = targetTypeNode.getRecord();
|
||||
if (type.isConst())
|
||||
flags |= CONST;
|
||||
if (type.isVolatile())
|
||||
flags |= VOLATILE;
|
||||
}
|
||||
db.putRecPtr(record + TYPE, typeRec);
|
||||
db.putByte(record + FLAGS, flags);
|
||||
} catch (DOMException e) {
|
||||
throw new CoreException(Util.createStatus(e));
|
||||
// type
|
||||
long typeRec = 0;
|
||||
byte flags = 0;
|
||||
if (type != null) {
|
||||
IType targetType= type.getType();
|
||||
PDOMNode targetTypeNode = getLinkage().addType(this, targetType);
|
||||
if (targetTypeNode != null)
|
||||
typeRec = targetTypeNode.getRecord();
|
||||
if (type.isConst())
|
||||
flags |= CONST;
|
||||
if (type.isVolatile())
|
||||
flags |= VOLATILE;
|
||||
}
|
||||
db.putRecPtr(record + TYPE, typeRec);
|
||||
db.putByte(record + FLAGS, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -141,14 +135,11 @@ public class PDOMPointerType extends PDOMNode implements IPointerType,
|
|||
return false;
|
||||
|
||||
IPointerType rhs = (IPointerType) type;
|
||||
try {
|
||||
if (isConst() == rhs.isConst() && isVolatile() == rhs.isVolatile()) {
|
||||
IType type1= getType();
|
||||
if (type1 != null) {
|
||||
return type1.isSameType(rhs.getType());
|
||||
}
|
||||
if (isConst() == rhs.isConst() && isVolatile() == rhs.isVolatile()) {
|
||||
IType type1= getType();
|
||||
if (type1 != null) {
|
||||
return type1.isSameType(rhs.getType());
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -14,12 +14,10 @@ package org.eclipse.cdt.internal.core.pdom.dom;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
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.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
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.index.IIndexBindingConstants;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
|
@ -56,26 +54,21 @@ public class PDOMQualifierType extends PDOMNode implements IQualifierType, ICQua
|
|||
|
||||
Database db = getDB();
|
||||
|
||||
// type
|
||||
try {
|
||||
if (type != null) {
|
||||
IType targetType = type.getType();
|
||||
PDOMNode targetTypeNode = getLinkage().addType(this, targetType);
|
||||
if (targetTypeNode != null) {
|
||||
db.putRecPtr(record + TYPE, targetTypeNode.getRecord());
|
||||
}
|
||||
// flags
|
||||
byte flags = 0;
|
||||
if (type.isConst())
|
||||
flags |= CONST;
|
||||
if (type.isVolatile())
|
||||
flags |= VOLATILE;
|
||||
if (type instanceof ICQualifierType && ((ICQualifierType)type).isRestrict())
|
||||
flags |= RESTRICT;
|
||||
db.putByte(record + FLAGS, flags);
|
||||
if (type != null) {
|
||||
IType targetType = type.getType();
|
||||
PDOMNode targetTypeNode = getLinkage().addType(this, targetType);
|
||||
if (targetTypeNode != null) {
|
||||
db.putRecPtr(record + TYPE, targetTypeNode.getRecord());
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
throw new CoreException(Util.createStatus(e));
|
||||
// flags
|
||||
byte flags = 0;
|
||||
if (type.isConst())
|
||||
flags |= CONST;
|
||||
if (type.isVolatile())
|
||||
flags |= VOLATILE;
|
||||
if (type instanceof ICQualifierType && ((ICQualifierType)type).isRestrict())
|
||||
flags |= RESTRICT;
|
||||
db.putByte(record + FLAGS, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,15 +140,12 @@ public class PDOMQualifierType extends PDOMNode implements IQualifierType, ICQua
|
|||
return false;
|
||||
|
||||
IQualifierType pt = (IQualifierType) type;
|
||||
try {
|
||||
boolean flagsMatch= isConst() == pt.isConst() && isVolatile() == pt.isVolatile();
|
||||
if (flagsMatch && type instanceof ICQualifierType)
|
||||
flagsMatch &= isRestrict() == ((ICQualifierType) type).isRestrict();
|
||||
if (flagsMatch) {
|
||||
IType myType= getType();
|
||||
return myType != null && myType.isSameType(pt.getType());
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
boolean flagsMatch= isConst() == pt.isConst() && isVolatile() == pt.isVolatile();
|
||||
if (flagsMatch && type instanceof ICQualifierType)
|
||||
flagsMatch &= isRestrict() == ((ICQualifierType) type).isRestrict();
|
||||
if (flagsMatch) {
|
||||
IType myType= getType();
|
||||
return myType != null && myType.isSameType(pt.getType());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -61,20 +61,17 @@ public class PDOMCFunctionType extends PDOMNode implements IIndexType, IFunction
|
|||
public PDOMCFunctionType(PDOMLinkage linkage, PDOMNode parent, IFunctionType type) throws CoreException {
|
||||
super(linkage, parent);
|
||||
|
||||
try {
|
||||
PDOMNodeLinkedList list= new PDOMNodeLinkedList(parent.getLinkage(), record + TYPELIST, true);
|
||||
setReturnType(type.getReturnType());
|
||||
IType[] pt= type.getParameterTypes();
|
||||
for (int i = 0; i < pt.length; i++) {
|
||||
PDOMNode typeNode;
|
||||
if (pt[i] == null || pt[i] instanceof IProblemBinding) {
|
||||
typeNode= null;
|
||||
} else {
|
||||
typeNode= linkage.addType(this, pt[i]);
|
||||
}
|
||||
list.addMember(typeNode);
|
||||
PDOMNodeLinkedList list= new PDOMNodeLinkedList(parent.getLinkage(), record + TYPELIST, true);
|
||||
setReturnType(type.getReturnType());
|
||||
IType[] pt= type.getParameterTypes();
|
||||
for (IType element : pt) {
|
||||
PDOMNode typeNode;
|
||||
if (element == null || element instanceof IProblemBinding) {
|
||||
typeNode= null;
|
||||
} else {
|
||||
typeNode= linkage.addType(this, element);
|
||||
}
|
||||
} catch (DOMException de) {
|
||||
list.addMember(typeNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -95,8 +95,7 @@ class PDOMCTypedef extends PDOMBinding implements ITypedef, ITypeContainer, IInd
|
|||
return true;
|
||||
}
|
||||
IType[] params= ft.getParameterTypes();
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
IType param = params[i];
|
||||
for (IType param : params) {
|
||||
if (introducesRecursion(param, tdname)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -131,18 +130,14 @@ class PDOMCTypedef extends PDOMBinding implements ITypedef, ITypeContainer, IInd
|
|||
}
|
||||
|
||||
public boolean isSameType(IType type) {
|
||||
try {
|
||||
IType myrtype = getType();
|
||||
if (myrtype == null)
|
||||
return false;
|
||||
IType myrtype = getType();
|
||||
if (myrtype == null)
|
||||
return false;
|
||||
|
||||
if (type instanceof ITypedef) {
|
||||
type= ((ITypedef)type).getType();
|
||||
}
|
||||
return myrtype.isSameType(type);
|
||||
} catch (DOMException e) {
|
||||
if (type instanceof ITypedef) {
|
||||
type= ((ITypedef)type).getType();
|
||||
}
|
||||
return false;
|
||||
return myrtype.isSameType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
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.IPointerType;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
|
@ -37,10 +36,10 @@ public class PDOMCPPFunctionType extends PDOMCFunctionType implements ICPPFuncti
|
|||
public boolean isVolatile() {
|
||||
return false;
|
||||
}
|
||||
public IType[] getParameterTypes() throws DOMException {
|
||||
public IType[] getParameterTypes() {
|
||||
return IType.EMPTY_TYPE_ARRAY;
|
||||
}
|
||||
public IType getReturnType() throws DOMException {
|
||||
public IType getReturnType() {
|
||||
return FALLBACK_RETURN_TYPE;
|
||||
}
|
||||
public boolean isSameType(IType type) {
|
||||
|
|
|
@ -13,11 +13,9 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
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.ITypedef;
|
||||
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.index.CPPReferenceTypeClone;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||
|
@ -46,19 +44,15 @@ class PDOMCPPReferenceType extends PDOMNode implements ICPPReferenceType, ITypeC
|
|||
|
||||
Database db = getDB();
|
||||
|
||||
try {
|
||||
// type
|
||||
long typeRec = 0;
|
||||
if (type != null) {
|
||||
IType targetType = type.getType();
|
||||
PDOMNode targetTypeNode = getLinkage().addType(this, targetType);
|
||||
if (targetTypeNode != null)
|
||||
typeRec = targetTypeNode.getRecord();
|
||||
}
|
||||
db.putRecPtr(record + TYPE, typeRec);
|
||||
} catch (DOMException e) {
|
||||
throw new CoreException(Util.createStatus(e));
|
||||
// type
|
||||
long typeRec = 0;
|
||||
if (type != null) {
|
||||
IType targetType = type.getType();
|
||||
PDOMNode targetTypeNode = getLinkage().addType(this, targetType);
|
||||
if (targetTypeNode != null)
|
||||
typeRec = targetTypeNode.getRecord();
|
||||
}
|
||||
db.putRecPtr(record + TYPE, typeRec);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,12 +90,9 @@ class PDOMCPPReferenceType extends PDOMNode implements ICPPReferenceType, ITypeC
|
|||
return false;
|
||||
|
||||
ICPPReferenceType rhs = (ICPPReferenceType) type;
|
||||
try {
|
||||
IType type1= getType();
|
||||
if (type1 != null) {
|
||||
return type1.isSameType(rhs.getType());
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
IType type1= getType();
|
||||
if (type1 != null) {
|
||||
return type1.isSameType(rhs.getType());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -100,8 +100,7 @@ class PDOMCPPTypedef extends PDOMCPPBinding implements ITypedef, ITypeContainer,
|
|||
return true;
|
||||
}
|
||||
IType[] params= ft.getParameterTypes();
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
IType param = params[i];
|
||||
for (IType param : params) {
|
||||
if (introducesRecursion(param, parentRec, tdname)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -136,21 +135,17 @@ class PDOMCPPTypedef extends PDOMCPPBinding implements ITypedef, ITypeContainer,
|
|||
}
|
||||
|
||||
public boolean isSameType(IType type) {
|
||||
try {
|
||||
IType myrtype = getType();
|
||||
if (myrtype == null)
|
||||
return false;
|
||||
IType myrtype = getType();
|
||||
if (myrtype == null)
|
||||
return false;
|
||||
|
||||
if (type instanceof ITypedef) {
|
||||
type= ((ITypedef)type).getType();
|
||||
if (type == null) {
|
||||
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
|
||||
|
|
|
@ -12,11 +12,9 @@
|
|||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
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.ITypedef;
|
||||
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.cpp.CPPTypedefSpecialization;
|
||||
import org.eclipse.cdt.internal.core.index.CPPTypedefClone;
|
||||
|
@ -55,8 +53,6 @@ class PDOMCPPTypedefSpecialization extends PDOMCPPSpecialization
|
|||
PDOMNode typeNode = parent.getLinkage().addType(this, type);
|
||||
if (typeNode != null)
|
||||
getDB().putRecPtr(record + TYPE, typeNode.getRecord());
|
||||
} catch (DOMException e) {
|
||||
throw new CoreException(Util.createStatus(e));
|
||||
} finally {
|
||||
if (typedef instanceof CPPTypedefSpecialization) {
|
||||
((CPPTypedefSpecialization) typedef).incResolutionDepth(-1);
|
||||
|
@ -78,7 +74,7 @@ class PDOMCPPTypedefSpecialization extends PDOMCPPSpecialization
|
|||
return IIndexCPPBindingConstants.CPP_TYPEDEF_SPECIALIZATION;
|
||||
}
|
||||
|
||||
public IType getType() throws DOMException {
|
||||
public IType getType() {
|
||||
try {
|
||||
PDOMNode node = getLinkage().getNode(getDB().getRecPtr(record + TYPE));
|
||||
return node instanceof IType ? (IType)node : null;
|
||||
|
@ -91,23 +87,16 @@ class PDOMCPPTypedefSpecialization extends PDOMCPPSpecialization
|
|||
public boolean isSameType(IType o) {
|
||||
if( this.equals(o) )
|
||||
return true;
|
||||
if( o instanceof ITypedef )
|
||||
try {
|
||||
IType t = getType();
|
||||
if( t != null )
|
||||
return t.isSameType( ((ITypedef)o).getType());
|
||||
return false;
|
||||
} catch ( DOMException e ) {
|
||||
return false;
|
||||
}
|
||||
if( o instanceof ITypedef ) {
|
||||
IType t = getType();
|
||||
if( t != null )
|
||||
return t.isSameType( ((ITypedef)o).getType());
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
IType t = getType();
|
||||
if( t != null )
|
||||
return t.isSameType( o );
|
||||
} catch ( DOMException e ) {
|
||||
return false;
|
||||
}
|
||||
IType t = getType();
|
||||
if( t != null )
|
||||
return t.isSameType( o );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -615,10 +615,7 @@ public class ASTManager {
|
|||
|
||||
private static IType getRealType(IType t) {
|
||||
while(t instanceof ITypedef) {
|
||||
try {
|
||||
t= ((ITypedef) t).getType();
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
t= ((ITypedef) t).getType();
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue