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

Workaround for bug 182972, no PDOMCArrayType.

This commit is contained in:
Markus Schorn 2007-04-18 14:58:32 +00:00
parent e085fd2c3e
commit 7184f3a57d

View file

@ -12,11 +12,13 @@ package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IArrayType;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier; import org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.c.ICArrayType; import org.eclipse.cdt.core.dom.ast.c.ICArrayType;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.index.IIndexType;
/** /**
* @author dsteffle * @author dsteffle
@ -36,18 +38,22 @@ public class CArrayType implements ICArrayType, ITypeContainer {
if( obj instanceof ITypedef ) if( obj instanceof ITypedef )
return obj.isSameType( this ); return obj.isSameType( this );
if( obj instanceof ICArrayType ){ if( obj instanceof ICArrayType ){
ICArrayType at = (ICArrayType) obj; ICArrayType at = (ICArrayType) obj;
try { try {
if( isConst() != at.isConst() ) return false; if( isConst() != at.isConst() ) return false;
if( isRestrict() != at.isRestrict() ) return false; if( isRestrict() != at.isRestrict() ) return false;
if( isStatic() != at.isStatic() ) return false; if( isStatic() != at.isStatic() ) return false;
if( isVolatile() != at.isVolatile() ) return false; if( isVolatile() != at.isVolatile() ) return false;
if( isVariableLength() != at.isVariableLength() ) return false; if( isVariableLength() != at.isVariableLength() ) return false;
return at.getType().isSameType( type ); return at.getType().isSameType( type );
} catch ( DOMException e ) { } catch ( DOMException e ) {
return false; return false;
} }
}
// work around for bug 182976, no PDOMCArrayType.
else if (obj instanceof IArrayType && obj instanceof IIndexType) {
return obj.isSameType(this);
} }
return false; return false;
} }