mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Add missing switch cases.
This commit is contained in:
parent
fc1e9a4225
commit
54d378990c
3 changed files with 29 additions and 25 deletions
|
@ -1,13 +1,13 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2010 IBM Corporation and others.
|
* Copyright (c) 2005, 2010 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Devin Steffler (IBM Rational Software) - Initial API and implementation
|
* Devin Steffler (IBM Rational Software) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
public class CBasicType implements ICBasicType, ISerializableType {
|
public class CBasicType implements ICBasicType, ISerializableType {
|
||||||
private final Kind fKind;
|
private final Kind fKind;
|
||||||
private int fModifiers = 0;
|
private int fModifiers;
|
||||||
private IASTExpression value = null;
|
private IASTExpression value;
|
||||||
|
|
||||||
public CBasicType(Kind kind, int modifiers, IASTExpression value) {
|
public CBasicType(Kind kind, int modifiers, IASTExpression value) {
|
||||||
if (kind == Kind.eUnspecified) {
|
if (kind == Kind.eUnspecified) {
|
||||||
|
@ -124,16 +124,16 @@ public class CBasicType implements ICBasicType, ISerializableType {
|
||||||
if (obj instanceof ITypedef)
|
if (obj instanceof ITypedef)
|
||||||
return obj.isSameType(this);
|
return obj.isSameType(this);
|
||||||
|
|
||||||
if (!(obj instanceof ICBasicType)) return false;
|
if (!(obj instanceof ICBasicType))
|
||||||
|
return false;
|
||||||
|
|
||||||
ICBasicType cObj = (ICBasicType)obj;
|
ICBasicType cObj = (ICBasicType)obj;
|
||||||
|
|
||||||
if (fKind != cObj.getKind()) {
|
if (fKind != cObj.getKind())
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (fKind == Kind.eInt) {
|
if (fKind == Kind.eInt) {
|
||||||
//signed int and int are equivalent
|
// Signed int and int are equivalent
|
||||||
return (fModifiers & ~IS_SIGNED) == (cObj.getModifiers() & ~IS_SIGNED);
|
return (fModifiers & ~IS_SIGNED) == (cObj.getModifiers() & ~IS_SIGNED);
|
||||||
} else {
|
} else {
|
||||||
return (fModifiers == cObj.getModifiers());
|
return (fModifiers == cObj.getModifiers());
|
||||||
|
@ -146,7 +146,7 @@ public class CBasicType implements ICBasicType, ISerializableType {
|
||||||
try {
|
try {
|
||||||
t = (IType) super.clone();
|
t = (IType) super.clone();
|
||||||
} catch (CloneNotSupportedException e) {
|
} catch (CloneNotSupportedException e) {
|
||||||
//not going to happen
|
// Not going to happen
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -157,17 +157,11 @@ public class CBasicType implements ICBasicType, ISerializableType {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICBasicType#isComplex()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isComplex() {
|
public boolean isComplex() {
|
||||||
return (fModifiers & IS_COMPLEX) != 0;
|
return (fModifiers & IS_COMPLEX) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICBasicType#isImaginary()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isImaginary() {
|
public boolean isImaginary() {
|
||||||
return (fModifiers & IS_IMAGINARY) != 0;
|
return (fModifiers & IS_IMAGINARY) != 0;
|
||||||
|
@ -222,6 +216,8 @@ public class CBasicType implements ICBasicType, ISerializableType {
|
||||||
case eUnspecified:
|
case eUnspecified:
|
||||||
return t_unspecified;
|
return t_unspecified;
|
||||||
case eNullPtr:
|
case eNullPtr:
|
||||||
|
case eInt128:
|
||||||
|
case eFloat128:
|
||||||
// Null pointer type cannot be expressed wit ha simple decl specifier.
|
// Null pointer type cannot be expressed wit ha simple decl specifier.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,6 +277,8 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
|
||||||
case eUnspecified:
|
case eUnspecified:
|
||||||
return t_unspecified;
|
return t_unspecified;
|
||||||
case eNullPtr:
|
case eNullPtr:
|
||||||
|
case eInt128:
|
||||||
|
case eFloat128:
|
||||||
// Null pointer type cannot be expressed wit ha simple decl specifier.
|
// Null pointer type cannot be expressed wit ha simple decl specifier.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -586,22 +586,24 @@ class BuiltinOperators {
|
||||||
return type instanceof ICPPPointerToMemberType;
|
return type instanceof ICPPPointerToMemberType;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isBoolean(IType type) {
|
private static boolean isBoolean(IType type) {
|
||||||
return type instanceof IBasicType && ((IBasicType) type).getKind() == Kind.eBoolean;
|
return type instanceof IBasicType && ((IBasicType) type).getKind() == Kind.eBoolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isFloatingPoint(IType type) {
|
private static boolean isFloatingPoint(IType type) {
|
||||||
if (type instanceof IBasicType) {
|
if (type instanceof IBasicType) {
|
||||||
IBasicType.Kind kind= ((IBasicType) type).getKind();
|
IBasicType.Kind kind= ((IBasicType) type).getKind();
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case eDouble:
|
case eDouble:
|
||||||
case eFloat:
|
case eFloat:
|
||||||
|
case eFloat128:
|
||||||
return true;
|
return true;
|
||||||
case eBoolean:
|
case eBoolean:
|
||||||
case eChar:
|
case eChar:
|
||||||
case eChar16:
|
case eChar16:
|
||||||
case eChar32:
|
case eChar32:
|
||||||
case eInt:
|
case eInt:
|
||||||
|
case eInt128:
|
||||||
case eWChar:
|
case eWChar:
|
||||||
case eUnspecified:
|
case eUnspecified:
|
||||||
case eVoid:
|
case eVoid:
|
||||||
|
@ -612,7 +614,7 @@ class BuiltinOperators {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isArithmetic(IType type) {
|
private static boolean isArithmetic(IType type) {
|
||||||
if (type instanceof IBasicType) {
|
if (type instanceof IBasicType) {
|
||||||
IBasicType.Kind kind= ((IBasicType) type).getKind();
|
IBasicType.Kind kind= ((IBasicType) type).getKind();
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
|
@ -622,7 +624,9 @@ class BuiltinOperators {
|
||||||
case eChar32:
|
case eChar32:
|
||||||
case eDouble:
|
case eDouble:
|
||||||
case eFloat:
|
case eFloat:
|
||||||
|
case eFloat128:
|
||||||
case eInt:
|
case eInt:
|
||||||
|
case eInt128:
|
||||||
case eWChar:
|
case eWChar:
|
||||||
return true;
|
return true;
|
||||||
case eUnspecified:
|
case eUnspecified:
|
||||||
|
@ -634,7 +638,7 @@ class BuiltinOperators {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isIntegral(IType type) {
|
private static boolean isIntegral(IType type) {
|
||||||
if (type instanceof IBasicType) {
|
if (type instanceof IBasicType) {
|
||||||
IBasicType.Kind kind= ((IBasicType) type).getKind();
|
IBasicType.Kind kind= ((IBasicType) type).getKind();
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
|
@ -643,10 +647,12 @@ class BuiltinOperators {
|
||||||
case eChar16:
|
case eChar16:
|
||||||
case eChar32:
|
case eChar32:
|
||||||
case eInt:
|
case eInt:
|
||||||
|
case eInt128:
|
||||||
case eWChar:
|
case eWChar:
|
||||||
return true;
|
return true;
|
||||||
case eDouble:
|
case eDouble:
|
||||||
case eFloat:
|
case eFloat:
|
||||||
|
case eFloat128:
|
||||||
case eUnspecified:
|
case eUnspecified:
|
||||||
case eVoid:
|
case eVoid:
|
||||||
case eNullPtr:
|
case eNullPtr:
|
||||||
|
|
Loading…
Add table
Reference in a new issue