diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java
index 9490f86d4ee..15960b222d2 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java
@@ -18,7 +18,6 @@ import junit.framework.TestSuite;
import org.eclipse.cdt.core.dom.ast.ASTSignatureUtil;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
-import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.ExpansionOverlapsBoundaryException;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
@@ -98,14 +97,12 @@ import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator;
import org.eclipse.cdt.core.dom.ast.c.ICASTPointer;
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICArrayType;
-import org.eclipse.cdt.core.dom.ast.c.ICBasicType;
import org.eclipse.cdt.core.dom.ast.c.ICExternalBinding;
import org.eclipse.cdt.core.dom.ast.c.ICFunctionScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
-import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPBasicType;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ParserLanguage;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
@@ -6281,12 +6278,9 @@ public class AST2Tests extends AST2BaseTest {
}
}
- boolean isLongLong(IType t) throws DOMException {
- if (t instanceof ICBasicType) {
- return ((ICBasicType) t).isLongLong();
- }
- if (t instanceof IGPPBasicType) {
- return ((IGPPBasicType) t).isLongLong();
+ boolean isLongLong(IType t) {
+ if (t instanceof IBasicType) {
+ return ((IBasicType) t).isLongLong();
}
return false;
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
index 70cda103998..723979cc4d0 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
@@ -27,6 +27,7 @@ import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
@@ -1528,8 +1529,8 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
IBinding inst2= CPPTemplates.instantiate(tmplDef, inst.getTemplateArguments());
assertSame(inst, inst2);
- IBinding charInst1= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateArgument(new CPPBasicType(IBasicType.t_char, 0))});
- IBinding charInst2= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateArgument(new CPPBasicType(IBasicType.t_char, 0))});
+ IBinding charInst1= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateArgument(new CPPBasicType(Kind.eChar, 0))});
+ IBinding charInst2= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateArgument(new CPPBasicType(Kind.eChar, 0))});
assertSame(charInst1, charInst2);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java
index 6f8748c1cf0..515d3fa3eac 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java
@@ -18,8 +18,8 @@ import java.util.BitSet;
import java.util.LinkedList;
import java.util.List;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.c.ICArrayType;
-import org.eclipse.cdt.core.dom.ast.c.ICBasicType;
import org.eclipse.cdt.core.dom.ast.c.ICPointerType;
import org.eclipse.cdt.core.dom.ast.c.ICQualifierType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
@@ -32,10 +32,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
-import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPBasicType;
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPPointerType;
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPQualifierType;
-import org.eclipse.cdt.core.parser.GCCKeywords;
import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
@@ -99,7 +97,7 @@ public class ASTTypeUtil {
IType ultimateType = SemanticUtil.getNestedType(parameters[0].getType(), TDEF);
if (ultimateType instanceof IBasicType) {
- if (((IBasicType) ultimateType).getType() == IBasicType.t_void) {
+ if (((IBasicType) ultimateType).getKind() == Kind.eVoid) {
return false;
}
}
@@ -248,120 +246,83 @@ public class ASTTypeUtil {
result.append(Keywords.cpRBRACKET);
} else if (type instanceof IBasicType) {
IBasicType basicType= (IBasicType) type;
- try {
- if (basicType.isSigned()) {
- // 3.9.1.2: signed integer types
- if (!normalize || basicType.getType() == IBasicType.t_char) {
- result.append(Keywords.SIGNED); needSpace = true;
- }
- } else if (basicType.isUnsigned()) {
- if (needSpace) {
- result.append(SPACE); needSpace = false;
- }
- result.append(Keywords.UNSIGNED); needSpace = true;
+ final Kind kind = basicType.getKind();
+ if (basicType.isSigned()) {
+ // 3.9.1.2: signed integer types
+ if (!normalize || kind == Kind.eChar) {
+ result.append(Keywords.SIGNED); needSpace = true;
}
- if (basicType.isLong()) {
- if (needSpace) {
- result.append(SPACE); needSpace = false;
- }
- result.append(Keywords.LONG); needSpace = true;
- } else if (basicType.isShort()) {
- if (needSpace) {
- result.append(SPACE); needSpace = false;
- }
- result.append(Keywords.SHORT); needSpace = true;
+ } else if (basicType.isUnsigned()) {
+ if (needSpace) {
+ result.append(SPACE); needSpace = false;
}
- } catch (DOMException e) {
+ result.append(Keywords.UNSIGNED); needSpace = true;
}
-
- if (type instanceof IGPPBasicType) {
- try {
- if (((IGPPBasicType) type).isLongLong()) {
- if (needSpace) {
- result.append(SPACE); needSpace = false;
- }
- result.append(Keywords.LONG_LONG); needSpace = true;
- }
- if (((IGPPBasicType) type).isComplex()) {
- if (needSpace) {
- result.append(SPACE); needSpace = false;
- }
- result.append(Keywords.c_COMPLEX); needSpace = true;
- }
- if (((IGPPBasicType) type).isImaginary()) {
- if (needSpace) {
- result.append(SPACE); needSpace = false;
- }
- result.append(Keywords.c_IMAGINARY); needSpace = true;
- }
+ if (basicType.isLong()) {
+ if (needSpace) {
+ result.append(SPACE); needSpace = false;
+ }
+ result.append(Keywords.LONG); needSpace = true;
+ } else if (basicType.isShort()) {
+ if (needSpace) {
+ result.append(SPACE); needSpace = false;
+ }
+ result.append(Keywords.SHORT); needSpace = true;
+ } else if (basicType.isLongLong()) {
+ if (needSpace) {
+ result.append(SPACE); needSpace = false;
+ }
+ result.append(Keywords.LONG_LONG); needSpace = true;
+ }
- switch (((IGPPBasicType) type).getType()) {
- case IGPPBasicType.t_typeof:
- result.append(GCCKeywords.TYPEOF);
- break;
- }
- } catch (DOMException e) {
+ if (basicType.isComplex()) {
+ if (needSpace) {
+ result.append(SPACE); needSpace = false;
}
- } else if (type instanceof ICPPBasicType) {
- try {
- switch (((ICPPBasicType) type).getType()) {
- case ICPPBasicType.t_bool:
- result.append(Keywords.BOOL);
- break;
- case ICPPBasicType.t_wchar_t:
- result.append(Keywords.WCHAR_T);
- break;
- }
- } catch (DOMException e) {
- }
- } else if (type instanceof ICBasicType) {
- try {
- if (((ICBasicType) type).isComplex()) {
- if (needSpace) {
- result.append(SPACE); needSpace = false;
- }
- result.append(Keywords.c_COMPLEX); needSpace = true;
- }
- if (((ICBasicType) type).isImaginary()) {
- if (needSpace) {
- result.append(SPACE); needSpace = false;
- }
- result.append(Keywords.c_IMAGINARY); needSpace = true;
- }
-
- switch (((ICBasicType) type).getType()) {
- case ICBasicType.t_Bool:
- result.append(Keywords.c_BOOL);
- break;
- }
- } catch (DOMException e) {
+ result.append(Keywords.c_COMPLEX); needSpace = true;
+ }
+ if ((basicType).isImaginary()) {
+ if (needSpace) {
+ result.append(SPACE); needSpace = false;
}
+ result.append(Keywords.c_IMAGINARY); needSpace = true;
}
- try {
- switch (basicType.getType()) {
- case IBasicType.t_char:
- if (needSpace) result.append(SPACE);
- result.append(Keywords.CHAR);
- break;
- case IBasicType.t_double:
- if (needSpace) result.append(SPACE);
- result.append(Keywords.DOUBLE);
- break;
- case IBasicType.t_float:
- if (needSpace) result.append(SPACE);
- result.append(Keywords.FLOAT);
- break;
- case IBasicType.t_int:
- if (needSpace) result.append(SPACE);
- result.append(Keywords.INT);
- break;
- case IBasicType.t_void:
- if (needSpace) result.append(SPACE);
- result.append(Keywords.VOID);
- break;
+ switch (kind) {
+ case eChar:
+ if (needSpace) result.append(SPACE);
+ result.append(Keywords.CHAR);
+ break;
+ case eDouble:
+ if (needSpace) result.append(SPACE);
+ result.append(Keywords.DOUBLE);
+ break;
+ case eFloat:
+ if (needSpace) result.append(SPACE);
+ result.append(Keywords.FLOAT);
+ break;
+ case eInt:
+ if (needSpace) result.append(SPACE);
+ result.append(Keywords.INT);
+ break;
+ case eVoid:
+ if (needSpace) result.append(SPACE);
+ result.append(Keywords.VOID);
+ break;
+ case eBoolean:
+ if (needSpace) result.append(SPACE);
+ if (basicType instanceof ICPPBasicType) {
+ result.append(Keywords.BOOL);
+ } else {
+ result.append(Keywords.c_BOOL);
}
- } catch (DOMException e) {
+ break;
+ case eWChar:
+ if (needSpace) result.append(SPACE);
+ result.append(Keywords.WCHAR_T);
+ break;
+ case eUnspecified:
+ break;
}
} else if (type instanceof ICPPTemplateParameter) {
final ICPPTemplateParameter tpar = (ICPPTemplateParameter) type;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTSimpleDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTSimpleDeclSpecifier.java
index 95f80ce2571..8ecca73843a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTSimpleDeclSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTSimpleDeclSpecifier.java
@@ -7,11 +7,14 @@
*
* Contributors:
* Doug Schaefer (IBM) - Initial API and implementation
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
+
/**
- * This represents a decl specifier for a built-in type.
+ * This represents a declaration specifier for a built-in type.
*
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
@@ -70,6 +73,12 @@ public interface IASTSimpleDeclSpecifier extends IASTDeclSpecifier {
* (int)
*/
public void setType(int type);
+
+ /**
+ * Sets this declaration specifier to the type based on {@link IBasicType.Kind}.
+ * @since 5.2
+ */
+ public void setType(Kind kind);
/**
* Is the type modified by the signed keyword?
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java
index f650079aaf1..42eba47db76 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java
@@ -18,13 +18,48 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IBasicType extends IType {
+ /**
+ * @since 5.2
+ */
+ enum Kind {
+ eUnspecified, eVoid, eChar, eWChar, eInt, eFloat, eDouble, eBoolean
+ }
/**
- * This returns the built-in type for the declaration. The type is
- * then refined by qualifiers for signed/unsigned and short/long.
- * The type could also be unspecified which usually means int.
- *
+ * This returns the kind of basic type you are looking at. The type is
+ * then refined by qualifiers for signed/unsigned and short/long/long long.
+ * @since 5.2
*/
+ Kind getKind();
+
+
+ public boolean isSigned();
+ public boolean isUnsigned();
+ public boolean isShort();
+ public boolean isLong();
+ /**
+ * @since 5.2
+ */
+ public boolean isLongLong();
+
+ /**
+ * Is complex number? e.g. _Complex t;
+ * @return true if it is a complex number, false otherwise
+ * @since 5.2
+ */
+ public boolean isComplex();
+
+ /**
+ * Is imaginary number? e.g. _Imaginr
+ * @return true if it is an imaginary number, false otherwise
+ * @since 5.2
+ */
+ public boolean isImaginary();
+
+ /**
+ * @deprecated, use the type-safe version getKind(), instead.
+ */
+ @Deprecated
public int getType() throws DOMException;
/**
@@ -33,15 +68,34 @@ public interface IBasicType extends IType {
@Deprecated
public IASTExpression getValue() throws DOMException;
+ /**
+ * @deprecated, use the type-safe version getKind(), instead.
+ */
+ @Deprecated
public static final int t_unspecified = IASTSimpleDeclSpecifier.t_unspecified;
+ /**
+ * @deprecated, use the type-safe version getKind(), instead.
+ */
+ @Deprecated
public static final int t_void = IASTSimpleDeclSpecifier.t_void;
+ /**
+ * @deprecated, use the type-safe version getKind(), instead.
+ */
+ @Deprecated
public static final int t_char = IASTSimpleDeclSpecifier.t_char;
+ /**
+ * @deprecated, use the type-safe version getKind(), instead.
+ */
+ @Deprecated
public static final int t_int = IASTSimpleDeclSpecifier.t_int;
+ /**
+ * @deprecated, use the type-safe version getKind(), instead.
+ */
+ @Deprecated
public static final int t_float = IASTSimpleDeclSpecifier.t_float;
+ /**
+ * @deprecated, use the type-safe version getKind(), instead.
+ */
+ @Deprecated
public static final int t_double = IASTSimpleDeclSpecifier.t_double;
-
- public boolean isSigned() throws DOMException;
- public boolean isUnsigned() throws DOMException;
- public boolean isShort() throws DOMException;
- public boolean isLong() throws DOMException;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICBasicType.java
index 05819050702..d7688b5d0bc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICBasicType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICBasicType.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.c;
-import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBasicType;
/**
@@ -18,20 +17,9 @@ import org.eclipse.cdt.core.dom.ast.IBasicType;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICBasicType extends IBasicType {
- // Extra types in C
+ /**
+ * @deprecated, use the type-safe version getKind(), instead.
+ */
+ @Deprecated
public static final int t_Bool = ICASTSimpleDeclSpecifier.t_Bool;
-
- /**
- * Is complex number? e.g. _Complex t;
- * @return true if it is a complex number, false otherwise
- */
- public boolean isComplex();
-
- /**
- * Is imaginary number? e.g. _Imaginr
- * @return true if it is an imaginary number, false otherwise
- */
- public boolean isImaginary();
-
- public boolean isLongLong() throws DOMException;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPBasicType.java
index 52272b1cb6e..fd850f88f87 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPBasicType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPBasicType.java
@@ -22,19 +22,26 @@ public interface ICPPBasicType extends IBasicType {
public static final int IS_SHORT = 1 << 1;
public static final int IS_SIGNED = 1 << 2;
public static final int IS_UNSIGNED = 1 << 3;
- public static final int IS_COMPLEX = 1 << 4; // for gpp-types
- public static final int IS_IMAGINARY = 1 << 5; // for gpp-types
- public static final int IS_LONG_LONG = 1 << 6; // for gpp-types
+ public static final int IS_COMPLEX = 1 << 4;
+ public static final int IS_IMAGINARY = 1 << 5;
+ public static final int IS_LONG_LONG = 1 << 6;
public static final int LAST = IS_LONG_LONG;
- // Extra types
- public static final int t_bool = ICPPASTSimpleDeclSpecifier.t_bool;
-
- public static final int t_wchar_t = ICPPASTSimpleDeclSpecifier.t_wchar_t;
-
/**
* @return a combination of qualifiers.
* @since 4.0
*/
public int getQualifierBits();
+
+ /**
+ * @deprecated, use the type-safe version getKind(), instead.
+ */
+ @Deprecated
+ public static final int t_bool = ICPPASTSimpleDeclSpecifier.t_bool;
+
+ /**
+ * @deprecated, use the type-safe version getKind(), instead.
+ */
+ @Deprecated
+ public static final int t_wchar_t = ICPPASTSimpleDeclSpecifier.t_wchar_t;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/IGPPBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/IGPPBasicType.java
index 2350fc32b85..9b957758c7d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/IGPPBasicType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/IGPPBasicType.java
@@ -17,24 +17,21 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
/**
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
+ * @deprecated use {@link ICPPBasicType}, instead.
*/
+@Deprecated
public interface IGPPBasicType extends ICPPBasicType {
+
+ /**
+ * @deprecated don't use this constant.
+ */
+ @Deprecated
public static final int t_typeof = IGPPASTSimpleDeclSpecifier.t_typeof;
-
- /**
- * Is complex number? e.g. _Complex t;
- * @return true if it is a complex number, false otherwise
- */
- public boolean isComplex();
-
- /**
- * Is imaginary number? e.g. _Imaginr
- * @return true if it is an imaginary number, false otherwise
- */
- public boolean isImaginary();
-
- public boolean isLongLong() throws DOMException;
+ /**
+ * @deprecated don't use this method.
+ */
+ @Deprecated
public IType getTypeofType() throws DOMException;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CBuiltinSymbolProvider.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CBuiltinSymbolProvider.java
index e041a7fabed..df3e49afd4d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CBuiltinSymbolProvider.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CBuiltinSymbolProvider.java
@@ -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
@@ -13,10 +13,10 @@
package org.eclipse.cdt.internal.core.dom.parser;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
-import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.parser.IBuiltinBindingsProvider;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.c.CBasicType;
@@ -36,10 +36,9 @@ public class CBuiltinSymbolProvider implements IBuiltinBindingsProvider {
static final private IType c_char;
static final private IType c_const_char_p;
- static {
- new CBasicType(IBasicType.t_unspecified, 0);
- c_char = new CBasicType( IBasicType.t_char, 0 );
- c_const_char_p = new CPointerType(new CQualifierType( c_char, true, false, false), 0);
+ static {
+ c_char = new CBasicType(Kind.eChar, 0);
+ c_const_char_p = new CPointerType(new CQualifierType(c_char, true, false, false), 0);
}
private IBinding[] bindings=new IBinding[NUM_BUILTINS];
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCBuiltinSymbolProvider.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCBuiltinSymbolProvider.java
index 2be2e31d2c1..f42f56c0451 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCBuiltinSymbolProvider.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCBuiltinSymbolProvider.java
@@ -15,13 +15,13 @@ package org.eclipse.cdt.internal.core.dom.parser;
import org.eclipse.cdt.core.dom.ILinkage;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
-import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
@@ -43,7 +43,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPImplicitFunction;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPImplicitTypedef;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPQualifierType;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.GPPBasicType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.GPPPointerType;
import org.eclipse.core.runtime.PlatformObject;
@@ -287,35 +286,35 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
static final private IType cpp_FILE_p_r; // implemented as void* restrict
static {
- c_unspecified = new CBasicType(IBasicType.t_unspecified, 0);
- c_char = new CBasicType(IBasicType.t_char, 0);
+ c_unspecified = new CBasicType(Kind.eUnspecified, 0);
+ c_char = new CBasicType(Kind.eChar, 0);
c_char_p = new CPointerType(c_char, 0);
c_char_p_r = new CPointerType(c_char, CPointerType.IS_RESTRICT);
c_const_char_p = new CPointerType(new CQualifierType(c_char, true, false, false), 0);
c_const_char_p_r = new CPointerType(new CQualifierType(c_char, true, false, false), CPointerType.IS_RESTRICT);
- c_double = new CBasicType(IBasicType.t_double, 0);
- c_double_complex = new CBasicType(IBasicType.t_double, CBasicType.IS_COMPLEX);
- c_float = new CBasicType(IBasicType.t_float, 0);
- c_float_complex = new CBasicType(IBasicType.t_float, CBasicType.IS_COMPLEX);
+ c_double = new CBasicType(Kind.eDouble, 0);
+ c_double_complex = new CBasicType(Kind.eDouble, CBasicType.IS_COMPLEX);
+ c_float = new CBasicType(Kind.eFloat, 0);
+ c_float_complex = new CBasicType(Kind.eFloat, CBasicType.IS_COMPLEX);
c_float_p = new CPointerType(c_float, 0);
- c_int = new CBasicType(IBasicType.t_int, 0);
+ c_int = new CBasicType(Kind.eInt, 0);
c_int_p = new CPointerType(c_int, 0);
- c_long_double = new CBasicType(IBasicType.t_double, CBasicType.IS_LONG);
- c_long_double_complex = new CBasicType(IBasicType.t_double, CBasicType.IS_LONG | CBasicType.IS_COMPLEX);
+ c_long_double = new CBasicType(Kind.eDouble, CBasicType.IS_LONG);
+ c_long_double_complex = new CBasicType(Kind.eDouble, CBasicType.IS_LONG | CBasicType.IS_COMPLEX);
c_long_double_p = new CPointerType(c_long_double, 0);
- c_long_int = new CBasicType(IBasicType.t_int, CBasicType.IS_LONG);
- c_long_long_int = new CBasicType(IBasicType.t_int, CBasicType.IS_LONGLONG);
- c_signed_long_int = new CBasicType(IBasicType.t_int, CBasicType.IS_LONG | CBasicType.IS_SIGNED);
- c_unsigned_int = new CBasicType(IBasicType.t_int, CBasicType.IS_UNSIGNED);
- c_unsigned_long = new CBasicType(IBasicType.t_int, CBasicType.IS_LONG | CBasicType.IS_UNSIGNED);
- c_unsigned_long_long = new CBasicType(IBasicType.t_int, CBasicType.IS_LONGLONG | CBasicType.IS_UNSIGNED);
+ c_long_int = new CBasicType(Kind.eInt, CBasicType.IS_LONG);
+ c_long_long_int = new CBasicType(Kind.eInt, CBasicType.IS_LONGLONG);
+ c_signed_long_int = new CBasicType(Kind.eInt, CBasicType.IS_LONG | CBasicType.IS_SIGNED);
+ c_unsigned_int = new CBasicType(Kind.eInt, CBasicType.IS_UNSIGNED);
+ c_unsigned_long = new CBasicType(Kind.eInt, CBasicType.IS_LONG | CBasicType.IS_UNSIGNED);
+ c_unsigned_long_long = new CBasicType(Kind.eInt, CBasicType.IS_LONGLONG | CBasicType.IS_UNSIGNED);
c_va_list = new CFunctionType(c_char_p, new IType[0]); // assumed: char* va_list();
c_size_t = c_unsigned_long; // assumed unsigned long int
- c_void = new CBasicType(IBasicType.t_void, 0);
+ c_void = new CBasicType(Kind.eVoid, 0);
c_void_p = new CPointerType(c_void, 0);
c_void_p_r = new CPointerType(c_void, CPointerType.IS_RESTRICT);
c_const_void_p = new CPointerType(new CQualifierType(c_void, true, false, false), 0);
@@ -323,35 +322,35 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
c_FILE_p_r = c_void_p_r; // implemented as void* restrict
- cpp_unspecified = new CPPBasicType(IBasicType.t_unspecified, 0);
- cpp_char = new CPPBasicType(IBasicType.t_char, 0);
+ cpp_unspecified = new CPPBasicType(Kind.eUnspecified, 0);
+ cpp_char = new CPPBasicType(Kind.eChar, 0);
cpp_char_p = new CPPPointerType(cpp_char);
cpp_char_p_r = new GPPPointerType(cpp_char, false, false, true);
cpp_const_char_p = new CPPPointerType(new CPPQualifierType(cpp_char, true, false));
cpp_const_char_p_r = new GPPPointerType(new CPPQualifierType(cpp_char, true, false), false, false, true);
- cpp_double = new CPPBasicType(IBasicType.t_double, 0);
- cpp_double_complex = new GPPBasicType(IBasicType.t_double, ICPPBasicType.IS_COMPLEX, null);
- cpp_float = new CPPBasicType(IBasicType.t_float, 0);
- cpp_float_complex = new GPPBasicType(IBasicType.t_float, ICPPBasicType.IS_COMPLEX, null);
+ cpp_double = new CPPBasicType(Kind.eDouble, 0);
+ cpp_double_complex = new CPPBasicType(Kind.eDouble, ICPPBasicType.IS_COMPLEX, null);
+ cpp_float = new CPPBasicType(Kind.eFloat, 0);
+ cpp_float_complex = new CPPBasicType(Kind.eFloat, ICPPBasicType.IS_COMPLEX, null);
cpp_float_p = new CPPPointerType(cpp_float);
- cpp_int = new CPPBasicType(IBasicType.t_int, 0);
+ cpp_int = new CPPBasicType(Kind.eInt, 0);
cpp_int_p = new CPPPointerType(cpp_int);
- cpp_long_int = new CPPBasicType(IBasicType.t_int, ICPPBasicType.IS_LONG);
- cpp_long_double = new CPPBasicType(IBasicType.t_double, ICPPBasicType.IS_LONG);
- cpp_long_double_complex = new GPPBasicType(IBasicType.t_double, ICPPBasicType.IS_LONG | ICPPBasicType.IS_COMPLEX, null);
+ cpp_long_int = new CPPBasicType(Kind.eInt, ICPPBasicType.IS_LONG);
+ cpp_long_double = new CPPBasicType(Kind.eDouble, ICPPBasicType.IS_LONG);
+ cpp_long_double_complex = new CPPBasicType(Kind.eDouble, ICPPBasicType.IS_LONG | ICPPBasicType.IS_COMPLEX, null);
cpp_long_double_p = new CPPPointerType(cpp_long_double);
- cpp_long_long_int = new GPPBasicType(IBasicType.t_int, ICPPBasicType.IS_LONG_LONG, null);
- cpp_signed_long_int = new CPPBasicType(IBasicType.t_int, ICPPBasicType.IS_LONG | ICPPBasicType.IS_SIGNED);
+ cpp_long_long_int = new CPPBasicType(Kind.eInt, ICPPBasicType.IS_LONG_LONG, null);
+ cpp_signed_long_int = new CPPBasicType(Kind.eInt, ICPPBasicType.IS_LONG | ICPPBasicType.IS_SIGNED);
- cpp_unsigned_int = new CPPBasicType(IBasicType.t_int, ICPPBasicType.IS_UNSIGNED);
- cpp_unsigned_long = new CPPBasicType(IBasicType.t_int, ICPPBasicType.IS_UNSIGNED | ICPPBasicType.IS_LONG);
- cpp_unsigned_long_long = new GPPBasicType(IBasicType.t_int, ICPPBasicType.IS_UNSIGNED | ICPPBasicType.IS_LONG_LONG, null);
+ cpp_unsigned_int = new CPPBasicType(Kind.eInt, ICPPBasicType.IS_UNSIGNED);
+ cpp_unsigned_long = new CPPBasicType(Kind.eInt, ICPPBasicType.IS_UNSIGNED | ICPPBasicType.IS_LONG);
+ cpp_unsigned_long_long = new CPPBasicType(Kind.eInt, ICPPBasicType.IS_UNSIGNED | ICPPBasicType.IS_LONG_LONG, null);
cpp_size_t = cpp_unsigned_long; // assumed unsigned long int
cpp_va_list = new CPPFunctionType(cpp_char_p, new IType[0]); // assumed: char* va_list();
- cpp_void = new CPPBasicType(IBasicType.t_void, 0);
+ cpp_void = new CPPBasicType(Kind.eVoid, 0);
cpp_void_p = new CPPPointerType(cpp_void);
cpp_void_p_r = new GPPPointerType(cpp_void, false, false, true);
cpp_const_void_p = new CPPPointerType(new CPPQualifierType(cpp_void, true, false));
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTBinaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTBinaryExpression.java
index 4949470a256..fee8a61af55 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTBinaryExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTBinaryExpression.java
@@ -16,9 +16,9 @@ import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTNode;
-import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
@@ -137,9 +137,7 @@ public class CASTBinaryExpression extends ASTNode implements
case op_logicalOr:
case op_equals:
case op_notequals:
- CBasicType basicType = new CBasicType(IBasicType.t_int, 0);
- basicType.setValue(this);
- return basicType;
+ return new CBasicType(Kind.eInt, 0, this);
case IASTBinaryExpression.op_plus:
IType t2 = getOperand2().getExpressionType();
if (CVisitor.unwrapTypedefs(t2) instanceof IPointerType) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTLiteralExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTLiteralExpression.java
index 80405eafa1c..4bb65cbdad6 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTLiteralExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTLiteralExpression.java
@@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
@@ -86,13 +87,13 @@ public class CASTLiteralExpression extends ASTNode implements IASTLiteralExpress
public IType getExpressionType() {
switch (getKind()) {
case IASTLiteralExpression.lk_char_constant:
- return new CBasicType(IBasicType.t_char, 0, this);
+ return new CBasicType(IBasicType.Kind.eChar, 0, this);
case IASTLiteralExpression.lk_float_constant:
return classifyTypeOfFloatLiteral();
case IASTLiteralExpression.lk_integer_constant:
return classifyTypeOfIntLiteral();
case IASTLiteralExpression.lk_string_literal:
- IType type = new CBasicType(IBasicType.t_char, 0, this);
+ IType type = new CBasicType(IBasicType.Kind.eChar, 0, this);
type = new CQualifierType(type, true, false, false);
return new CPointerType(type, 0);
}
@@ -102,15 +103,14 @@ public class CASTLiteralExpression extends ASTNode implements IASTLiteralExpress
private IType classifyTypeOfFloatLiteral() {
final char[] lit= getValue();
final int len= lit.length;
- int kind= IBasicType.t_double;
+ IBasicType.Kind kind= IBasicType.Kind.eDouble;
int flags= 0;
if (len > 0) {
switch (lit[len - 1]) {
case 'f': case 'F':
- kind= IBasicType.t_float;
+ kind= Kind.eFloat;
break;
case 'l': case 'L':
- kind= IBasicType.t_double;
flags |= CBasicType.IS_LONG;
break;
}
@@ -151,7 +151,7 @@ public class CASTLiteralExpression extends ASTNode implements IASTLiteralExpress
} else if (makelong == 1) {
flags |= CBasicType.IS_LONG;
}
- return new CBasicType(IBasicType.t_int, flags, this);
+ return new CBasicType(IBasicType.Kind.eInt, flags, this);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java
index e705e7d84c2..89bad1ab150 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java
@@ -1,22 +1,21 @@
/*******************************************************************************
- * 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
- * Yuan Zhang / Beth Tibbitts (IBM Research)
+ * John Camelon (IBM Rational Software) - Initial API and implementation
+ * Yuan Zhang / Beth Tibbitts (IBM Research)
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
-/**
- * @author jcamelon
- */
public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements ICASTSimpleDeclSpecifier {
private int simpleType;
@@ -72,6 +71,31 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements IC
simpleType = type;
}
+ public void setType(Kind kind) {
+ setType(getType(kind));
+ }
+
+ private int getType(Kind kind) {
+ switch(kind) {
+ case eBoolean:
+ return t_Bool;
+ case eChar:
+ case eWChar:
+ return t_char;
+ case eDouble:
+ return t_double;
+ case eFloat:
+ return t_float;
+ case eInt:
+ return t_int;
+ case eUnspecified:
+ return t_unspecified;
+ case eVoid:
+ return t_void;
+ }
+ return t_unspecified;
+ }
+
public void setShort(boolean value) {
assertNotFrozen();
isShort = value;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CBasicType.java
index d5d6913e637..21f6448552b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CBasicType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CBasicType.java
@@ -6,115 +6,105 @@
* 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
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
-import org.eclipse.cdt.core.dom.ast.IBasicType;
+import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICBasicType;
import org.eclipse.cdt.internal.core.index.IIndexType;
-/**
- * @author dsteffle
- */
public class CBasicType implements ICBasicType {
- static public final int IS_LONG = 1;
- static public final int IS_LONGLONG = 1 << 1;
- static public final int IS_SHORT = 1 << 2;
- static public final int IS_SIGNED = 1 << 3;
- static public final int IS_UNSIGNED = 1 << 4;
- static public final int IS_COMPLEX = 1 << 5;
- static public final int IS_IMAGINARY= 1 << 6;
+ public final static int IS_LONG = 1;
+ public final static int IS_LONGLONG = 1 << 1;
+ public final static int IS_SHORT = 1 << 2;
+ public final static int IS_SIGNED = 1 << 3;
+ public final static int IS_UNSIGNED = 1 << 4;
+ public final static int IS_COMPLEX = 1 << 5;
+ public final static int IS_IMAGINARY= 1 << 6;
- private int type = 0;
+ private final Kind fKind;
private int qualifiers = 0;
private IASTExpression value = null;
- /**
- * keep a reference to the declaration specifier so that duplicate information isn't generated.
- *
- * @param sds the simple declaration specifier
- */
- public CBasicType(ICASTSimpleDeclSpecifier sds) {
- this.type = sds.getType();
- this.qualifiers = ( sds.isLong() ? CBasicType.IS_LONG : 0 ) |
- ( sds.isShort() ? CBasicType.IS_SHORT : 0 ) |
- ( sds.isSigned() ? CBasicType.IS_SIGNED: 0 ) |
- ( sds.isUnsigned()? CBasicType.IS_UNSIGNED : 0 ) |
- ( sds.isLongLong()? CBasicType.IS_LONGLONG : 0 ) |
- ( sds.isComplex() ? CBasicType.IS_COMPLEX : 0 ) |
- ( sds.isImaginary()?CBasicType.IS_IMAGINARY : 0 );
-
- if( type == IBasicType.t_unspecified ){
- if( (qualifiers & ( IS_COMPLEX | IS_IMAGINARY )) != 0 )
- type = IBasicType.t_float;
- else {
- type = IBasicType.t_int;
+ public CBasicType(Kind kind, int qualifiers, IASTExpression value ){
+ if (kind == Kind.eUnspecified) {
+ if ( (qualifiers & (IS_COMPLEX | IS_IMAGINARY)) != 0) {
+ fKind= Kind.eFloat;
+ } else {
+ fKind= Kind.eInt;
}
+ } else {
+ fKind= kind;
}
- }
-
- public CBasicType( int type, int qualifiers ){
- this.type = type;
- this.qualifiers = qualifiers;
-
- if( type == IBasicType.t_unspecified ){
- if( (qualifiers & ( IS_COMPLEX | IS_IMAGINARY )) != 0 )
- type = IBasicType.t_float;
- else {
- type = IBasicType.t_int;
- }
- }
- }
-
- public CBasicType( int type, int qualifiers, IASTExpression value ){
- this.type = type;
this.qualifiers = qualifiers;
this.value = value;
}
+
+ public CBasicType(Kind kind, int qualifiers) {
+ this(kind, qualifiers, null);
+ }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ast.IBasicType#getType()
- */
- public int getType() {
- return type;
+ public CBasicType(ICASTSimpleDeclSpecifier sds) {
+ this (getKind(sds), getQualifiers(sds), null);
+ }
+
+ private static int getQualifiers(ICASTSimpleDeclSpecifier sds) {
+ return ( sds.isLong() ? CBasicType.IS_LONG : 0 ) |
+ ( sds.isShort() ? CBasicType.IS_SHORT : 0 ) |
+ ( sds.isSigned() ? CBasicType.IS_SIGNED: 0 ) |
+ ( sds.isUnsigned()? CBasicType.IS_UNSIGNED : 0 ) |
+ ( sds.isLongLong()? CBasicType.IS_LONGLONG : 0 ) |
+ ( sds.isComplex() ? CBasicType.IS_COMPLEX : 0 ) |
+ ( sds.isImaginary()?CBasicType.IS_IMAGINARY : 0 );
+ }
+
+ private static Kind getKind(ICASTSimpleDeclSpecifier sds) {
+ switch(sds.getType()) {
+ case ICASTSimpleDeclSpecifier.t_Bool:
+ return Kind.eBoolean;
+ case IASTSimpleDeclSpecifier.t_char:
+ return Kind.eChar;
+ case IASTSimpleDeclSpecifier.t_double:
+ return Kind.eDouble;
+ case IASTSimpleDeclSpecifier.t_float:
+ return Kind.eFloat;
+ case IASTSimpleDeclSpecifier.t_int:
+ return Kind.eInt;
+ case IASTSimpleDeclSpecifier.t_void:
+ return Kind.eVoid;
+ default:
+ return Kind.eUnspecified;
+ }
+ }
+
+ public Kind getKind() {
+ return fKind;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ast.IBasicType#isSigned()
- */
public boolean isSigned() {
- return ( qualifiers & IS_SIGNED) != 0;
+ return (qualifiers & IS_SIGNED) != 0;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ast.IBasicType#isUnsigned()
- */
public boolean isUnsigned() {
- return ( qualifiers & IS_UNSIGNED) != 0;
+ return (qualifiers & IS_UNSIGNED) != 0;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ast.IBasicType#isShort()
- */
public boolean isShort() {
- return ( qualifiers & IS_SHORT) != 0;
+ return (qualifiers & IS_SHORT) != 0;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ast.IBasicType#isLong()
- */
public boolean isLong() {
- return ( qualifiers & IS_LONG) != 0;
+ return (qualifiers & IS_LONG) != 0;
}
public boolean isLongLong() {
- return ( qualifiers & IS_LONGLONG) != 0;
+ return (qualifiers & IS_LONGLONG) != 0;
}
public boolean isSameType(IType obj) {
@@ -127,11 +117,11 @@ public class CBasicType implements ICBasicType {
CBasicType cObj = (CBasicType)obj;
- if (type != cObj.type) {
+ if (fKind != cObj.fKind) {
return false;
}
- if (type == IBasicType.t_int) {
+ if (fKind == Kind.eInt) {
//signed int and int are equivalent
return (qualifiers & ~IS_SIGNED) == (cObj.qualifiers & ~IS_SIGNED);
} else {
@@ -155,10 +145,6 @@ public class CBasicType implements ICBasicType {
return value;
}
- public void setValue( IASTExpression expression ){
- this.value = expression;
- }
-
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICBasicType#isComplex()
*/
@@ -172,4 +158,26 @@ public class CBasicType implements ICBasicType {
public boolean isImaginary() {
return ( qualifiers & IS_IMAGINARY) != 0;
}
+
+ @Deprecated
+ public int getType() {
+ switch (fKind) {
+ case eBoolean:
+ return t_Bool;
+ case eChar:
+ case eWChar:
+ return t_char;
+ case eDouble:
+ return t_double;
+ case eFloat:
+ return t_float;
+ case eInt:
+ return t_int;
+ case eVoid:
+ return t_void;
+ case eUnspecified:
+ return t_unspecified;
+ }
+ return t_unspecified;
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java
index c8d94049f53..ffd03b364d6 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java
@@ -52,7 +52,6 @@ import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IArrayType;
-import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.IEnumeration;
@@ -68,6 +67,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.IVariable;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
@@ -651,9 +651,7 @@ public class CVisitor extends ASTQueries {
} catch (DOMException e) {
}
- CBasicType basicType = new CBasicType(IBasicType.t_int, CBasicType.IS_UNSIGNED | CBasicType.IS_LONG);
- basicType.setValue(expr);
- return basicType;
+ return new CBasicType(Kind.eInt, CBasicType.IS_UNSIGNED | CBasicType.IS_LONG, expr);
}
static IType getSize_T(IASTExpression expr) {
@@ -665,7 +663,7 @@ public class CVisitor extends ASTQueries {
}
} catch (DOMException e) {
}
- return new CBasicType(IBasicType.t_int, CBasicType.IS_LONG | CBasicType.IS_UNSIGNED);
+ return new CBasicType(Kind.eInt, CBasicType.IS_LONG | CBasicType.IS_UNSIGNED);
}
static IType unwrapTypedefs(IType type) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java
index e7728df1639..e70fb60b26e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java
@@ -8,6 +8,7 @@
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* Mike Kucera (IBM)
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@@ -20,8 +21,8 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTBinaryExpression;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
@@ -204,9 +205,7 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
case IASTBinaryExpression.op_logicalOr:
case IASTBinaryExpression.op_equals:
case IASTBinaryExpression.op_notequals:
- CPPBasicType basicType= new CPPBasicType(ICPPBasicType.t_bool, 0);
- basicType.setFromExpression(this);
- return basicType;
+ return new CPPBasicType(Kind.eBoolean, 0, this);
case IASTBinaryExpression.op_plus:
if (ultimateType2 instanceof IPointerType) {
return ultimateType2;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java
index 63da8724bfe..335dde02365 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java
@@ -12,9 +12,9 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
-import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLiteralExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
@@ -96,7 +96,7 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
}
case lk_true:
case lk_false:
- return new CPPBasicType(ICPPBasicType.t_bool, 0, this);
+ return new CPPBasicType(Kind.eBoolean, 0, this);
case lk_char_constant:
return new CPPBasicType(getCharType(), 0, this);
case lk_float_constant:
@@ -111,19 +111,19 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
return null;
}
- private int getCharType() {
- return getValue()[0] == 'L' ? ICPPBasicType.t_wchar_t : IBasicType.t_char;
+ private Kind getCharType() {
+ return getValue()[0] == 'L' ? Kind.eWChar : Kind.eChar;
}
private IType classifyTypeOfFloatLiteral() {
final char[] lit= getValue();
final int len= lit.length;
- int kind= IBasicType.t_double;
+ Kind kind= Kind.eDouble;
int flags= 0;
if (len > 0) {
switch (lit[len - 1]) {
case 'f': case 'F':
- kind= IBasicType.t_float;
+ kind= Kind.eFloat;
break;
case 'l': case 'L':
flags |= ICPPBasicType.IS_LONG;
@@ -162,15 +162,10 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
if (makelong > 1) {
flags |= ICPPBasicType.IS_LONG_LONG;
- GPPBasicType result = new GPPBasicType(IBasicType.t_int, flags, null);
- result.setFromExpression(this);
- return result;
- }
-
- if (makelong == 1) {
+ } else if (makelong == 1) {
flags |= ICPPBasicType.IS_LONG;
}
- return new CPPBasicType(IBasicType.t_int, flags, this);
+ return new CPPBasicType(Kind.eInt, flags, this);
}
/**
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java
index 0b24a24807f..a12fe8b99c8 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java
@@ -1,21 +1,20 @@
/*******************************************************************************
- * 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 - Initial API and implementation
+ * John Camelon (IBM) - 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.ASTVisitor;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleDeclSpecifier;
-/**
- * @author jcamelon
- */
public class CPPASTSimpleDeclSpecifier extends CPPASTBaseDeclSpecifier implements ICPPASTSimpleDeclSpecifier {
private int type;
@@ -51,6 +50,32 @@ public class CPPASTSimpleDeclSpecifier extends CPPASTBaseDeclSpecifier implement
this.type = type;
}
+ public void setType(Kind kind) {
+ setType(getType(kind));
+ }
+
+ private int getType(Kind kind) {
+ switch(kind) {
+ case eBoolean:
+ return t_bool;
+ case eChar:
+ return t_char;
+ case eWChar:
+ return t_wchar_t;
+ case eDouble:
+ return t_double;
+ case eFloat:
+ return t_float;
+ case eInt:
+ return t_int;
+ case eUnspecified:
+ return t_unspecified;
+ case eVoid:
+ return t_void;
+ }
+ return t_unspecified;
+ }
+
public boolean isSigned() {
return isSigned;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java
index acd025a87b5..66cf4207f70 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java
@@ -6,7 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM - Initial API and implementation
+ * John Camelon (IBM) - Initial API and implementation
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@@ -97,6 +98,6 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode implements
}
public IType getExpressionType() {
- return new CPPBasicType(st, 0);
+ return new CPPBasicType(CPPBasicType.getKind(st), 0);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java
index 9c30dda8764..7e31c875917 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java
@@ -13,12 +13,12 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ILinkage;
import org.eclipse.cdt.core.dom.ast.IASTName;
-import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IMacroBinding;
import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
@@ -62,11 +62,11 @@ public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPAST
private void addBuiltinOperators(CPPScope theScope) {
// void
- IType cpp_void = new CPPBasicType(IBasicType.t_void, 0);
+ IType cpp_void = new CPPBasicType(Kind.eVoid, 0);
// void *
- IType cpp_void_p = new GPPPointerType(new CPPQualifierType(new CPPBasicType(IBasicType.t_void, 0), false, false), new GPPASTPointer());
+ IType cpp_void_p = new GPPPointerType(new CPPQualifierType(new CPPBasicType(Kind.eVoid, 0), false, false), new GPPASTPointer());
// size_t // assumed: unsigned long int
- IType cpp_size_t = new CPPBasicType(IBasicType.t_int, ICPPBasicType.IS_LONG & ICPPBasicType.IS_UNSIGNED);
+ IType cpp_size_t = new CPPBasicType(Kind.eInt, ICPPBasicType.IS_LONG & ICPPBasicType.IS_UNSIGNED);
// void * operator new (std::size_t);
IBinding temp = null;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java
index 9c2cb79cd61..7b3196be10e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java
@@ -9,6 +9,7 @@
* John Camelon (IBM) - Initial API and implementation
* Sergey Prigogin (Google)
* Mike Kucera (IBM)
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@@ -30,9 +31,9 @@ import org.eclipse.cdt.core.dom.ast.IFunction;
import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUnaryExpression;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
@@ -252,7 +253,7 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
}
if(op == op_not) {
- return new CPPBasicType(ICPPBasicType.t_bool, 0);
+ return new CPPBasicType(Kind.eBoolean, 0);
}
if (type instanceof CPPBasicType) {
((CPPBasicType) type).setFromExpression(this);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBasicType.java
index bd149aa77f9..f3ffafafbe3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBasicType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBasicType.java
@@ -13,96 +13,146 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
-import org.eclipse.cdt.core.dom.ast.IBasicType;
+import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
+import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTSimpleDeclSpecifier;
import org.eclipse.cdt.internal.core.index.IIndexType;
/**
* Integral c++ type.
*/
public class CPPBasicType implements ICPPBasicType {
- protected int qualifierBits = 0;
- protected int type;
- protected IASTExpression expression = null;
+ public static int UNIQUE_TYPE_QUALIFIER= -1;
+ private final Kind fKind;
+ private final int fQualifierBits;
+ private IASTExpression fExpression;
- public CPPBasicType(int t, int bits) {
- type = t;
- qualifierBits = bits;
+ public CPPBasicType(Kind kind, int qualifiers, IASTExpression expression) {
+ if (kind == Kind.eUnspecified) {
+ if ( (qualifiers & (IS_COMPLEX | IS_IMAGINARY)) != 0) {
+ fKind= Kind.eFloat;
+ } else if ( (qualifiers & (IS_LONG | IS_SHORT | IS_SIGNED | IS_UNSIGNED | IS_LONG_LONG)) != 0 ) {
+ fKind= Kind.eInt;
+ } else {
+ fKind= Kind.eUnspecified;
+ }
+ } else {
+ fKind= kind;
+ }
+ fQualifierBits= qualifiers;
+ fExpression= expression;
+ }
- if (type == IBasicType.t_unspecified &&
- (qualifierBits & (IS_LONG | IS_SHORT | IS_SIGNED | IS_UNSIGNED)) != 0) {
- type = IBasicType.t_int;
+ public CPPBasicType(Kind kind, int qualifiers) {
+ this(kind, qualifiers, null);
+ }
+
+ public CPPBasicType(ICPPASTSimpleDeclSpecifier sds) {
+ this (getKind(sds), getQualifiers(sds), null);
+ }
+
+ private static int getQualifiers(ICPPASTSimpleDeclSpecifier sds) {
+ int qualifiers=
+ ( sds.isLong() ? ICPPBasicType.IS_LONG : 0 ) |
+ ( sds.isShort() ? ICPPBasicType.IS_SHORT : 0 ) |
+ ( sds.isSigned() ? ICPPBasicType.IS_SIGNED: 0 ) |
+ ( sds.isUnsigned()? ICPPBasicType.IS_UNSIGNED : 0 );
+ if (sds instanceof IGPPASTSimpleDeclSpecifier) {
+ IGPPASTSimpleDeclSpecifier gsds= (IGPPASTSimpleDeclSpecifier) sds;
+ qualifiers |=
+ ( gsds.isLongLong()? ICPPBasicType.IS_LONG_LONG : 0 ) |
+ ( gsds.isComplex() ? ICPPBasicType.IS_COMPLEX : 0 ) |
+ ( gsds.isImaginary()?ICPPBasicType.IS_IMAGINARY : 0 );
+ }
+ return qualifiers;
+ }
+
+ private static Kind getKind(ICPPASTSimpleDeclSpecifier sds) {
+ return getKind(sds.getType());
+ }
+
+ static Kind getKind(final int simpleDeclSpecType) {
+ switch(simpleDeclSpecType) {
+ case ICPPASTSimpleDeclSpecifier.t_bool:
+ return Kind.eBoolean;
+ case IASTSimpleDeclSpecifier.t_char:
+ return Kind.eChar;
+ case ICPPASTSimpleDeclSpecifier.t_wchar_t:
+ return Kind.eWChar;
+ case IASTSimpleDeclSpecifier.t_double:
+ return Kind.eDouble;
+ case IASTSimpleDeclSpecifier.t_float:
+ return Kind.eFloat;
+ case IASTSimpleDeclSpecifier.t_int:
+ return Kind.eInt;
+ case IASTSimpleDeclSpecifier.t_void:
+ return Kind.eVoid;
+ default:
+ return Kind.eUnspecified;
}
}
- public CPPBasicType(int t, int bits, IASTExpression fromExpression) {
- type = t;
- qualifierBits = bits;
- expression= fromExpression;
- }
public boolean isSameType(IType object) {
if (object == this)
return true;
+ if (fQualifierBits == -1)
+ return false;
+
if (object instanceof ITypedef || object instanceof IIndexType)
return object.isSameType(this);
if (!(object instanceof CPPBasicType))
return false;
- if (type == -1)
- return false;
-
CPPBasicType t = (CPPBasicType) object;
- if (type != t.type)
+ if (fKind != t.fKind)
return false;
- if (type == IBasicType.t_int) {
+ if (fKind == Kind.eInt) {
//signed int and int are equivalent
- return (qualifierBits & ~IS_SIGNED) == (t.qualifierBits & ~IS_SIGNED);
+ return (fQualifierBits & ~IS_SIGNED) == (t.fQualifierBits & ~IS_SIGNED);
}
- return qualifierBits == t.qualifierBits;
+ return fQualifierBits == t.fQualifierBits;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ast.IBasicType#getType()
- */
- public int getType() {
- return type;
+ public Kind getKind() {
+ return fKind;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ast.IBasicType#isSigned()
- */
+
public boolean isSigned() {
- return (qualifierBits & IS_SIGNED) != 0;
+ return (fQualifierBits & IS_SIGNED) != 0;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ast.IBasicType#isUnsigned()
- */
public boolean isUnsigned() {
- return (qualifierBits & IS_UNSIGNED) != 0;
+ return (fQualifierBits & IS_UNSIGNED) != 0;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ast.IBasicType#isShort()
- */
public boolean isShort() {
- return (qualifierBits & IS_SHORT) != 0;
+ return (fQualifierBits & IS_SHORT) != 0;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ast.IBasicType#isLong()
- */
public boolean isLong() {
- return (qualifierBits & IS_LONG) != 0;
+ return (fQualifierBits & IS_LONG) != 0;
}
- @Override
+ public boolean isLongLong() {
+ return (fQualifierBits & IS_LONG_LONG) != 0;
+ }
+
+ public boolean isComplex() {
+ return (fQualifierBits & IS_COMPLEX) != 0;
+ }
+
+ public boolean isImaginary() {
+ return (fQualifierBits & IS_IMAGINARY) != 0;
+ }
+
+ @Override
public Object clone() {
IType t = null;
try {
@@ -113,31 +163,53 @@ public class CPPBasicType implements ICPPBasicType {
return t;
}
- /**
- * @deprecated types don't have values
- */
- @Deprecated
- public IASTExpression getValue() {
- return expression;
- }
-
public void setFromExpression(IASTExpression val) {
- expression = val;
+ fExpression = val;
}
/**
* Returns the expression the type was created for, or null
.
*/
public IASTExpression getCreatedFromExpression() {
- return expression;
+ return fExpression;
}
public int getQualifierBits() {
- return qualifierBits;
+ return fQualifierBits;
}
@Override
public String toString() {
return ASTTypeUtil.getType(this);
}
+
+ @Deprecated
+ public int getType() {
+ switch (fKind) {
+ case eBoolean:
+ return t_bool;
+ case eChar:
+ return t_char;
+ case eWChar:
+ return t_wchar_t;
+ case eDouble:
+ return t_double;
+ case eFloat:
+ return t_float;
+ case eInt:
+ return t_int;
+ case eVoid:
+ return t_void;
+ case eUnspecified:
+ return t_unspecified;
+ }
+ return t_unspecified;
+ }
+ /**
+ * @deprecated types don't have values
+ */
+ @Deprecated
+ public IASTExpression getValue() {
+ return fExpression;
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java
index 907cb5e581a..23cc2752389 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java
@@ -31,12 +31,12 @@ import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
-import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier;
@@ -133,7 +133,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
if (!ia.hasUserDeclaredDestructor()) {
//destructor: ~A()
- ICPPFunctionType ft= CPPVisitor.createImplicitFunctionType(new CPPBasicType(IBasicType.t_unspecified, 0), voidPs, false, false);
+ ICPPFunctionType ft= CPPVisitor.createImplicitFunctionType(new CPPBasicType(Kind.eUnspecified, 0), voidPs, false, false);
char[] dtorName = CharArrayUtils.concat("~".toCharArray(), className); //$NON-NLS-1$
ICPPMethod m = new CPPImplicitMethod(this, dtorName, ft, voidPs);
implicits[i++] = m;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionType.java
index b223e0d5b74..35f30c7de09 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionType.java
@@ -12,11 +12,11 @@
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.IBasicType;
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.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
@@ -58,25 +58,21 @@ public class CPPFunctionType implements ICPPFunctionType {
else if (returnType != null && ! returnType.isSameType(ft.getReturnType()))
return false;
- try {
- if (parameters.length == 1 && fps.length == 0) {
- IType p0= SemanticUtil.getNestedType(parameters[0], SemanticUtil.TDEF);
- if (!(p0 instanceof IBasicType) || ((IBasicType) p0).getType() != IBasicType.t_void)
- return false;
- } else if (fps.length == 1 && parameters.length == 0) {
- IType p0= SemanticUtil.getNestedType(fps[0], SemanticUtil.TDEF);
- if (!(p0 instanceof IBasicType) || ((IBasicType) p0).getType() != IBasicType.t_void)
- return false;
- } else if (parameters.length != fps.length) {
- return false;
- } else {
- for (int i = 0; i < parameters.length; i++) {
- if (parameters[i] == null || ! parameters[i].isSameType(fps[i]))
- return false;
- }
- }
- } catch (DOMException e) {
- return false;
+ if (parameters.length == 1 && fps.length == 0) {
+ IType p0= SemanticUtil.getNestedType(parameters[0], SemanticUtil.TDEF);
+ if (!(p0 instanceof IBasicType) || ((IBasicType) p0).getKind() != Kind.eVoid)
+ return false;
+ } else if (fps.length == 1 && parameters.length == 0) {
+ IType p0= SemanticUtil.getNestedType(fps[0], SemanticUtil.TDEF);
+ if (!(p0 instanceof IBasicType) || ((IBasicType) p0).getKind() != Kind.eVoid)
+ return false;
+ } else if (parameters.length != fps.length) {
+ return false;
+ } else {
+ for (int i = 0; i < parameters.length; i++) {
+ if (parameters[i] == null || ! parameters[i].isSameType(fps[i]))
+ return false;
+ }
}
if (isConst() != ft.isConst() || isVolatile() != ft.isVolatile()) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitConstructor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitConstructor.java
index dcaac232717..3cf358979ab 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitConstructor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitConstructor.java
@@ -11,9 +11,9 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
-import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
@@ -29,7 +29,7 @@ public class CPPImplicitConstructor extends CPPImplicitMethod implements ICPPCon
}
private static ICPPFunctionType createFunctionType(ICPPClassScope scope, IParameter[] params) {
- IType returnType= new CPPBasicType(IBasicType.t_unspecified, 0);
+ IType returnType= new CPPBasicType(Kind.eUnspecified, 0);
return CPPVisitor.createImplicitFunctionType(returnType, params, false, false);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java
index 7192ffdca29..f32fc082741 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java
@@ -24,6 +24,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
@@ -140,7 +141,7 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
if (params.length == 1) {
IType t1 = params[0];
ok = (t1 instanceof IBasicType)
- && ((IBasicType) t1).getType() == IBasicType.t_void;
+ && ((IBasicType) t1).getKind() == Kind.eVoid;
}
}
} else {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ClassTypeHelper.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ClassTypeHelper.java
index 496db44fcc9..a317b94f4c2 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ClassTypeHelper.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ClassTypeHelper.java
@@ -38,6 +38,7 @@ import org.eclipse.cdt.core.dom.ast.IQualifierType;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
@@ -681,7 +682,7 @@ public class ClassTypeHelper {
return KIND_DEFAULT_CTOR;
if (params.length == 1) {
IType t= params[0];
- if (t instanceof IBasicType && ((IBasicType) t).getType() == IBasicType.t_void)
+ if (t instanceof IBasicType && ((IBasicType) t).getKind() == Kind.eVoid)
return KIND_DEFAULT_CTOR;
if (isRefToConstClass(ct, t))
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPBasicType.java
deleted file mode 100644
index 317870b9941..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPBasicType.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 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
- * Markus Schorn (Wind River Systems)
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.dom.parser.cpp;
-
-import org.eclipse.cdt.core.dom.ast.IBasicType;
-import org.eclipse.cdt.core.dom.ast.IType;
-import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTSimpleDeclSpecifier;
-import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPBasicType;
-
-/**
- * @author aniefer
- */
-public class GPPBasicType extends CPPBasicType implements IGPPBasicType {
- private IType typeOf;
-
- public GPPBasicType( int type, int bits, IType typeOf ){
- super( type, bits );
- this.typeOf = typeOf;
- if( this.type == IBasicType.t_unspecified ){
- if((qualifierBits & ( IS_COMPLEX | IS_IMAGINARY )) != 0 )
- this.type = IBasicType.t_float;
- else if( (qualifierBits & IS_LONG_LONG) != 0 )
- this.type = IBasicType.t_int;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPBasicType#isLongLong()
- */
- public boolean isLongLong() {
- return ( qualifierBits & IS_LONG_LONG ) != 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPBasicType#getTypeofType()
- */
- public IType getTypeofType() {
- if( type != IGPPASTSimpleDeclSpecifier.t_typeof )
- return null;
- return typeOf;
- }
-
- public boolean isComplex() {
- return ( qualifierBits & IS_COMPLEX ) != 0;
- }
-
- public boolean isImaginary() {
- return ( qualifierBits & IS_IMAGINARY ) != 0;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
index 9f09445de36..377be8c4937 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
@@ -79,6 +79,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.IVariable;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
@@ -200,7 +201,7 @@ public class CPPSemantics {
public static final String EMPTY_NAME = ""; //$NON-NLS-1$
public static final char[] OPERATOR_ = new char[] {'o','p','e','r','a','t','o','r',' '};
private static final char[] CALL_FUNCTION = "call-function".toCharArray(); //$NON-NLS-1$
- public static final IType VOID_TYPE = new CPPBasicType(IBasicType.t_void, 0);
+ public static final IType VOID_TYPE = new CPPBasicType(Kind.eVoid, 0);
// Set to true for debugging.
public static boolean traceBindingResolution = false;
@@ -1918,7 +1919,7 @@ public class CPPSemantics {
final IType[] argTypes = data.getFunctionArgumentTypes();
if (argTypes.length == 1) {
IType t= getNestedType(argTypes[0], TDEF);
- if (t instanceof IBasicType && ((IBasicType)t).getType() == IBasicType.t_void) {
+ if (t instanceof IBasicType && ((IBasicType)t).getKind() == Kind.eVoid) {
argumentCount= 0;
}
}
@@ -1954,7 +1955,7 @@ public class CPPSemantics {
if (numArgs < 2 && numPars == 1) {
// check for void
IType t = getNestedType(parameterTypes[0], TDEF);
- if (t instanceof IBasicType && ((IBasicType)t).getType() == IBasicType.t_void)
+ if (t instanceof IBasicType && ((IBasicType)t).getKind() == Kind.eVoid)
numPars= 0;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
index 195c5b0fb86..95c1f85d72c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
@@ -47,6 +47,7 @@ import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.IValue;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation;
@@ -1624,7 +1625,7 @@ public class CPPTemplates {
if (parPos >= 0) {
ICPPTemplateArgument old= map.getArgument(parPos);
if (old == null) {
- map.put(parPos, new CPPTemplateArgument(ps, new CPPBasicType(IBasicType.t_int, 0)));
+ map.put(parPos, new CPPTemplateArgument(ps, new CPPBasicType(Kind.eInt, 0)));
} else if (!ps.equals(old.getNonTypeValue())) {
return false;
}
@@ -1769,7 +1770,7 @@ public class CPPTemplates {
if (param instanceof ICPPTemplateNonTypeParameter) {
args[i]= new CPPTemplateArgument(Value.unique(), ((ICPPTemplateNonTypeParameter) param).getType());
} else {
- args[i] = new CPPTemplateArgument(new CPPBasicType(-1, 0));
+ args[i] = new CPPTemplateArgument(new CPPBasicType(Kind.eUnspecified, CPPBasicType.UNIQUE_TYPE_QUALIFIER));
}
}
return args;
@@ -1933,7 +1934,7 @@ public class CPPTemplates {
@Override
public ICPPFunctionType getType() {
if (type == null) {
- type = CPPVisitor.createImplicitFunctionType(new CPPBasicType(IBasicType.t_void, 0), functionParameters, false, false);
+ type = CPPVisitor.createImplicitFunctionType(new CPPBasicType(Kind.eVoid, 0), functionParameters, false, false);
}
return type;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
index 0e880eee8df..65878a0d261 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
@@ -60,7 +60,6 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IASTTypeIdInitializerExpression;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IArrayType;
-import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.IEnumeration;
@@ -76,6 +75,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.IVariable;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
@@ -162,7 +162,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPReferenceType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPScope;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTypedef;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVariable;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.GPPBasicType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.GPPPointerToMemberType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.GPPPointerType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding;
@@ -1663,21 +1662,15 @@ public class CPPVisitor extends ASTQueries {
name = ((IASTEnumerationSpecifier)declSpec).getName();
} else if (declSpec instanceof ICPPASTSimpleDeclSpecifier) {
ICPPASTSimpleDeclSpecifier spec = (ICPPASTSimpleDeclSpecifier) declSpec;
- int bits = (spec.isLong() ? ICPPBasicType.IS_LONG : 0) |
- (spec.isShort() ? ICPPBasicType.IS_SHORT : 0) |
- (spec.isSigned() ? ICPPBasicType.IS_SIGNED: 0) |
- (spec.isUnsigned() ? ICPPBasicType.IS_UNSIGNED : 0);
if (spec instanceof IGPPASTSimpleDeclSpecifier) {
IGPPASTSimpleDeclSpecifier gspec = (IGPPASTSimpleDeclSpecifier) spec;
final IASTExpression typeofExpression = gspec.getTypeofExpression();
if (typeofExpression != null) {
type = typeofExpression.getExpressionType();
- } else {
- bits |= (gspec.isLongLong() ? ICPPBasicType.IS_LONG_LONG : 0);
- type = new GPPBasicType(spec.getType(), bits, null);
}
- } else {
- type = new CPPBasicType(spec.getType(), bits);
+ }
+ if (type == null) {
+ type = new CPPBasicType(spec);
}
}
if (name != null) {
@@ -1770,7 +1763,7 @@ public class CPPVisitor extends ASTQueries {
}
} catch (DOMException e) {
}
- basicType= new CPPBasicType(IBasicType.t_int, ICPPBasicType.IS_LONG | ICPPBasicType.IS_UNSIGNED);
+ basicType= new CPPBasicType(Kind.eInt, ICPPBasicType.IS_LONG | ICPPBasicType.IS_UNSIGNED);
basicType.setFromExpression(binary);
return basicType;
}
@@ -1790,7 +1783,7 @@ public class CPPVisitor extends ASTQueries {
}
} catch (DOMException e) {
}
- return new CPPBasicType(IBasicType.t_int, 0);
+ return new CPPBasicType(Kind.eInt, 0);
}
public static IType get_SIZE_T(IASTNode sizeofExpr) {
@@ -1802,7 +1795,7 @@ public class CPPVisitor extends ASTQueries {
}
} catch (DOMException e) {
}
- return new CPPBasicType(IBasicType.t_int, ICPPBasicType.IS_LONG | ICPPBasicType.IS_UNSIGNED);
+ return new CPPBasicType(Kind.eInt, ICPPBasicType.IS_LONG | ICPPBasicType.IS_UNSIGNED);
}
public static IASTProblem[] getProblems(IASTTranslationUnit tu) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java
index bfadd7b1814..3acb5ce3901 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java
@@ -31,6 +31,7 @@ import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IQualifierType;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
@@ -365,8 +366,7 @@ public class Conversions {
// Select converting constructors
int j= 0;
ICPPConstructor[] convertingCtors= new ICPPConstructor[ctors.length];
- for (int i = 0; i < ctors.length; i++) {
- ICPPConstructor ctor= ctors[i];
+ for (ICPPConstructor ctor : ctors) {
if (!(ctor instanceof IProblemBinding) && !ctor.isExplicit())
convertingCtors[j++]= ctor;
}
@@ -649,30 +649,32 @@ public class Conversions {
boolean canPromote= false;
if (trg instanceof IBasicType) {
IBasicType basicTgt = (IBasicType) trg;
- final int tType = basicTgt.getType();
+ final Kind tKind = basicTgt.getKind();
if (src instanceof IBasicType) {
final IBasicType basicSrc = (IBasicType) src;
- int sType = basicSrc.getType();
- if (tType == IBasicType.t_int) {
- switch (sType) {
- case IBasicType.t_int: // short, and unsigned short
+ Kind sKind = basicSrc.getKind();
+ if (tKind == Kind.eInt) {
+ switch (sKind) {
+ case eInt: // short, and unsigned short
if (basicSrc.isShort()) {
canPromote= true;
}
break;
- case IBasicType.t_char:
- case ICPPBasicType.t_bool:
- case ICPPBasicType.t_wchar_t:
- case IBasicType.t_unspecified: // treat unspecified as int
+ case eChar:
+ case eBoolean:
+ case eWChar:
+ case eUnspecified: // treat unspecified as int
canPromote= true;
break;
+ default:
+ break;
}
- } else if (tType == IBasicType.t_double && sType == IBasicType.t_float) {
+ } else if (tKind == Kind.eDouble && sKind == Kind.eFloat) {
canPromote= true;
}
} else if (src instanceof IEnumeration) {
- if (tType == IBasicType.t_int || tType == IBasicType.t_unspecified) {
+ if (tKind == Kind.eInt || tKind == Kind.eUnspecified) {
if (trg instanceof ICPPBasicType) {
int qualifiers = getEnumIntType((IEnumeration) src);
if (qualifiers == ((ICPPBasicType) trg).getQualifierBits()) {
@@ -714,8 +716,8 @@ public class Conversions {
return true;
}
// 4.12 pointer or pointer to member type can be converted to an rvalue of type bool
- final int tgtType = ((IBasicType) t).getType();
- if (tgtType == ICPPBasicType.t_bool && s instanceof IPointerType) {
+ final Kind tgtKind = ((IBasicType) t).getKind();
+ if (tgtKind == Kind.eBoolean && s instanceof IPointerType) {
cost.setRank(Rank.CONVERSION_PTR_BOOL);
return true;
}
@@ -742,7 +744,7 @@ public class Conversions {
// 4.10-2 an rvalue of type "pointer to cv T", where T is an object type can be
// converted to an rvalue of type "pointer to cv void"
IType tgtPtrTgt= getNestedType(tgtPtr.getType(), TDEF | CVQ | REF);
- if (tgtPtrTgt instanceof IBasicType && ((IBasicType) tgtPtrTgt).getType() == IBasicType.t_void) {
+ if (tgtPtrTgt instanceof IBasicType && ((IBasicType) tgtPtrTgt).getKind() == Kind.eVoid) {
cost.setRank(Rank.CONVERSION);
cost.setInheritanceDistance(Short.MAX_VALUE); // mstodo add distance to last base class
int cv= getCVQualifier(srcPtr.getType());
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexCPPSignatureUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexCPPSignatureUtil.java
index caa4226d28c..d05cf79b67c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexCPPSignatureUtil.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexCPPSignatureUtil.java
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * QNX - Initial API and implementation
+ * Bryan Wilkinson (QNX) - Initial API and implementation
* Andrew Ferguson (Symbian)
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
@@ -21,6 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IFunction;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
@@ -33,8 +34,6 @@ import org.eclipse.core.runtime.CoreException;
/**
* Determines the signatures and signature hashes for bindings that can have
* siblings with the same name.
- *
- * @author Bryan Wilkinson
*/
public class IndexCPPSignatureUtil {
@@ -96,7 +95,7 @@ public class IndexCPPSignatureUtil {
IType[] types = fType.getParameterTypes();
if (types.length == 1) {
if (types[0] instanceof IBasicType) {
- if (((IBasicType) types[0]).getType() == IBasicType.t_void) {
+ if (((IBasicType) types[0]).getKind() == Kind.eVoid) {
types = new IType[0];
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java
index 8d7941d8679..2f9e688ef21 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java
@@ -180,13 +180,14 @@ public class PDOM extends PlatformObject implements IPDOM {
* #83.0# - unconditionally store name in PDOMInclude, bug 272815 - <>
* 84.0 - storing free record pointers as (ptr>>3) and allocated pointers as (ptr-2)>>3 RECPTR_DENSE_VERSION
*
- * CDT 7.0 development (versions not supported on the 6.0.x branch)
+ * CDT 6.1 development (versions not supported on the 6.0.x branch)
* 90.0 - support for array sizes, bug 269926
* 91.0 - storing unknown bindings other than unknown class types, bug 284686.
+ * 92.0 - simplification of basic types, bug 231859.
*/
- private static final int MIN_SUPPORTED_VERSION= version(91, 0);
- private static final int MAX_SUPPORTED_VERSION= version(91, Short.MAX_VALUE);
- private static final int DEFAULT_VERSION = version(91, 0);
+ private static final int MIN_SUPPORTED_VERSION= version(92, 0);
+ private static final int MAX_SUPPORTED_VERSION= version(92, Short.MAX_VALUE);
+ private static final int DEFAULT_VERSION = version(92, 0);
private static int version(int major, int minor) {
return (major << 16) + minor;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCBasicType.java
index eceaa4a1249..2c8c40377a6 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCBasicType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCBasicType.java
@@ -18,7 +18,6 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.c.ICBasicType;
-import org.eclipse.cdt.internal.core.Util;
import org.eclipse.cdt.internal.core.index.IIndexCBindingConstants;
import org.eclipse.cdt.internal.core.index.IIndexType;
import org.eclipse.cdt.internal.core.pdom.db.Database;
@@ -52,24 +51,20 @@ class PDOMCBasicType extends PDOMNode implements ICBasicType, IIndexType {
public PDOMCBasicType(PDOMLinkage linkage, PDOMNode parent, ICBasicType type) throws CoreException {
super(linkage, parent);
- try {
- Database db = getDB();
- db.putChar(record + TYPE_ID, (char)type.getType());
+ Database db = getDB();
+ db.putChar(record + TYPE_ID, (char)type.getKind().ordinal());
- char flags = 0;
- if (type.isLong()) flags |= IS_LONG;
- if (type.isShort()) flags |= IS_SHORT;
- if (type.isSigned()) flags |= IS_SIGNED;
- if (type.isUnsigned()) flags |= IS_UNSIGNED;
- if (type.isLongLong()) flags |= IS_LONGLONG;
- if (type.isImaginary()) flags |= IS_IMAGINARY;
- if (type.isComplex()) flags |= IS_COMPLEX;
+ char flags = 0;
+ if (type.isLong()) flags |= IS_LONG;
+ if (type.isShort()) flags |= IS_SHORT;
+ if (type.isSigned()) flags |= IS_SIGNED;
+ if (type.isUnsigned()) flags |= IS_UNSIGNED;
+ if (type.isLongLong()) flags |= IS_LONGLONG;
+ if (type.isImaginary()) flags |= IS_IMAGINARY;
+ if (type.isComplex()) flags |= IS_COMPLEX;
- db.putChar(record + FLAGS, flags);
- } catch (DOMException e) {
- throw new CoreException(Util.createStatus(e));
- }
+ db.putChar(record + FLAGS, flags);
}
@Override
@@ -82,25 +77,49 @@ class PDOMCBasicType extends PDOMNode implements ICBasicType, IIndexType {
return IIndexCBindingConstants.CBASICTYPE;
}
- public int getType() {
+ public Kind getKind() {
try {
- return getDB().getChar(record + TYPE_ID);
+ int idx= getDB().getChar(record + TYPE_ID);
+ return Kind.values()[idx];
} catch (CoreException e) {
CCorePlugin.log(e);
- return 0;
+ return Kind.eInt;
}
}
+ @Deprecated
+ public int getType() {
+ final Kind kind = getKind();
+ switch (kind) {
+ case eBoolean:
+ return t_Bool;
+ case eChar:
+ case eWChar:
+ return t_char;
+ case eDouble:
+ return t_double;
+ case eFloat:
+ return t_float;
+ case eInt:
+ return t_int;
+ case eVoid:
+ return t_void;
+ case eUnspecified:
+ return t_unspecified;
+ }
+ return t_unspecified;
+ }
+
@Deprecated
public IASTExpression getValue() throws DOMException {
return null;
}
- public boolean isLong() throws DOMException { return flagSet(IS_LONG); }
- public boolean isShort() throws DOMException { return flagSet(IS_SHORT); }
- public boolean isSigned() throws DOMException { return flagSet(IS_SIGNED); }
- public boolean isUnsigned() throws DOMException { return flagSet(IS_UNSIGNED); }
- public boolean isLongLong() throws DOMException { return flagSet(IS_LONGLONG); }
+ public boolean isLong() { return flagSet(IS_LONG); }
+ public boolean isShort() { return flagSet(IS_SHORT); }
+ public boolean isSigned() { return flagSet(IS_SIGNED); }
+ public boolean isUnsigned() { return flagSet(IS_UNSIGNED); }
+ public boolean isLongLong() { return flagSet(IS_LONGLONG); }
public boolean isImaginary() { return flagSet(IS_IMAGINARY); }
public boolean isComplex() { return flagSet(IS_COMPLEX); }
@@ -113,23 +132,14 @@ class PDOMCBasicType extends PDOMNode implements ICBasicType, IIndexType {
return false;
ICBasicType rhs1= (ICBasicType) rhs;
- int type;
- try {
- type = this.getType();
- if (type == -1 || type != rhs1.getType())
- return false;
-
- return (rhs1.getType() == this.getType()
- && rhs1.isLong() == this.isLong()
- && rhs1.isShort() == this.isShort()
- && rhs1.isSigned() == this.isSigned()
- && rhs1.isUnsigned() == this.isUnsigned()
- && rhs1.isLongLong() == this.isLongLong()
- && rhs1.isComplex() == this.isComplex()
- && rhs1.isImaginary() == this.isImaginary());
- } catch (DOMException e) {
- return false;
- }
+ return (rhs1.getKind() == getKind()
+ && rhs1.isLong() == this.isLong()
+ && rhs1.isShort() == this.isShort()
+ && rhs1.isSigned() == this.isSigned()
+ && rhs1.isUnsigned() == this.isUnsigned()
+ && rhs1.isLongLong() == this.isLongLong()
+ && rhs1.isComplex() == this.isComplex()
+ && rhs1.isImaginary() == this.isImaginary());
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunctionType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunctionType.java
index 0f206fefdb1..e57479d2b83 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunctionType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunctionType.java
@@ -18,12 +18,12 @@ import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMNode;
import org.eclipse.cdt.core.dom.IPDOMVisitor;
-import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
import org.eclipse.cdt.internal.core.index.IIndexCBindingConstants;
import org.eclipse.cdt.internal.core.index.IIndexType;
@@ -108,40 +108,36 @@ public class PDOMCFunctionType extends PDOMNode implements IIndexType, IFunction
return type.isSameType(this);
}
- try {
- if (type instanceof IFunctionType) {
- IFunctionType ft = (IFunctionType) type;
- IType rt1= getReturnType();
- IType rt2= ft.getReturnType();
- if (rt1 != rt2) {
- if (rt1 == null || !rt1.isSameType(rt2)) {
- return false;
- }
- }
-
- IType[] params1= getParameterTypes();
- IType[] params2= ft.getParameterTypes();
- if (params1.length == 1 && params2.length == 0) {
- IType p0= SemanticUtil.getNestedType(params1[0], SemanticUtil.TDEF);
- if (!(p0 instanceof IBasicType) || ((IBasicType) p0).getType() != IBasicType.t_void)
- return false;
- } else if (params2.length == 1 && params1.length == 0) {
- IType p0= SemanticUtil.getNestedType(params2[0], SemanticUtil.TDEF);
- if (!(p0 instanceof IBasicType) || ((IBasicType) p0).getType() != IBasicType.t_void)
- return false;
- } else if (params1.length != params2.length) {
+ if (type instanceof IFunctionType) {
+ IFunctionType ft = (IFunctionType) type;
+ IType rt1= getReturnType();
+ IType rt2= ft.getReturnType();
+ if (rt1 != rt2) {
+ if (rt1 == null || !rt1.isSameType(rt2)) {
return false;
- } else {
- for (int i = 0; i < params1.length; i++) {
- if (params1[i] == null || !params1[i].isSameType(params2[i]))
- return false;
- }
}
-
- return true;
}
- return false;
- } catch (DOMException e) {
+
+ IType[] params1= getParameterTypes();
+ IType[] params2= ft.getParameterTypes();
+ if (params1.length == 1 && params2.length == 0) {
+ IType p0= SemanticUtil.getNestedType(params1[0], SemanticUtil.TDEF);
+ if (!(p0 instanceof IBasicType) || ((IBasicType) p0).getKind() != Kind.eVoid)
+ return false;
+ } else if (params2.length == 1 && params1.length == 0) {
+ IType p0= SemanticUtil.getNestedType(params2[0], SemanticUtil.TDEF);
+ if (!(p0 instanceof IBasicType) || ((IBasicType) p0).getKind() != Kind.eVoid)
+ return false;
+ } else if (params1.length != params2.length) {
+ return false;
+ } else {
+ for (int i = 0; i < params1.length; i++) {
+ if (params1[i] == null || !params1[i].isSameType(params2[i]))
+ return false;
+ }
+ }
+
+ return true;
}
return false;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPArgumentList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPArgumentList.java
index 91bdeb05db5..4ba45ab7a7c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPArgumentList.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPArgumentList.java
@@ -12,6 +12,7 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateArgument;
@@ -97,7 +98,7 @@ public class PDOMCPPArgumentList {
ICPPTemplateArgument[] result= new ICPPTemplateArgument[len];
for (int i=0; i