Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2005-05-27 15:44:57 +0000
committerAndrew Niefer2005-05-27 15:44:57 +0000
commit52ae549c9f7c94405a98616e9b108eb17f961445 (patch)
tree6020bdca660dfd52611fb65b136acce0f130c893 /core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom
parent349c1e26278a7f9505ea6a7fb81eb00dd756978d (diff)
downloadorg.eclipse.cdt-52ae549c9f7c94405a98616e9b108eb17f961445.tar.gz
org.eclipse.cdt-52ae549c9f7c94405a98616e9b108eb17f961445.tar.xz
org.eclipse.cdt-52ae549c9f7c94405a98616e9b108eb17f961445.zip
Patch from Devin Steffler with modifications (bug 95757)
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCBuiltinSymbolProvider.java42
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java31
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CBasicType.java39
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBasicType.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java13
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTSimpleDeclSpecifier.java18
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPBasicType.java17
9 files changed, 150 insertions, 26 deletions
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 11bda3655aa..bd4d335e0bf 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
@@ -1076,17 +1076,22 @@ public class GCCBuiltinSymbolProvider implements IASTBuiltinSymbolProvider {
private void __builtin_conj() {
IBinding temp = null;
- ICASTSimpleDeclSpecifier complexSds = new CASTSimpleDeclSpecifier();
- complexSds.setType(ICASTSimpleDeclSpecifier.t_Complex);
- IType c_double_complex = new CBasicType(complexSds);
- IType cpp_double_complex = new CPPBasicType(IGPPBasicType.t_Complex, 0);
- IType c_float_complex = c_double_complex;
- IType cpp_float_complex = cpp_double_complex;
+ ICASTSimpleDeclSpecifier doubleComplexSds = new CASTSimpleDeclSpecifier();
+ doubleComplexSds.setType(IASTSimpleDeclSpecifier.t_double);
+ doubleComplexSds.setComplex(true);
+ ICASTSimpleDeclSpecifier floatComplexSds = new CASTSimpleDeclSpecifier();
+ floatComplexSds.setType(IASTSimpleDeclSpecifier.t_float);
+ floatComplexSds.setComplex(true);
+ IType c_double_complex = new CBasicType(doubleComplexSds);
+ IType cpp_double_complex = new GPPBasicType(IGPPBasicType.t_double, GPPBasicType.IS_COMPLEX, null);
+ IType c_float_complex = new CBasicType(floatComplexSds);
+ IType cpp_float_complex = new GPPBasicType(IGPPBasicType.t_float, GPPBasicType.IS_COMPLEX, null);
ICASTSimpleDeclSpecifier longDoubleComplexSds = new CASTSimpleDeclSpecifier();
- longDoubleComplexSds.setType(ICASTSimpleDeclSpecifier.t_Complex);
+ longDoubleComplexSds.setType(IASTSimpleDeclSpecifier.t_double);
+ longDoubleComplexSds.setComplex(true);
longDoubleComplexSds.setLong(true);
IType c_long_double_complex = new CBasicType(longDoubleComplexSds);
- IType cpp_long_double_complex = new CPPBasicType(IGPPBasicType.t_Complex, CPPBasicType.IS_LONG);
+ IType cpp_long_double_complex = new GPPBasicType(IGPPBasicType.t_double, CPPBasicType.IS_LONG & GPPBasicType.IS_COMPLEX, null);
// double complex __builtin_conj(double complex)
if (lang == ParserLanguage.C) {
@@ -1153,17 +1158,22 @@ public class GCCBuiltinSymbolProvider implements IASTBuiltinSymbolProvider {
private void __builtin_creal_cimag() {
IBinding temp = null;
- ICASTSimpleDeclSpecifier complexSds = new CASTSimpleDeclSpecifier();
- complexSds.setType(ICASTSimpleDeclSpecifier.t_Complex);
- IType c_double_complex = new CBasicType(complexSds);
- IType cpp_double_complex = new CPPBasicType(IGPPBasicType.t_Complex, 0);
- IType c_float_complex = c_double_complex;
- IType cpp_float_complex = cpp_double_complex;
+ ICASTSimpleDeclSpecifier doubleComplexSds = new CASTSimpleDeclSpecifier();
+ doubleComplexSds.setType(IASTSimpleDeclSpecifier.t_double);
+ doubleComplexSds.setComplex(true);
+ ICASTSimpleDeclSpecifier floatComplexSds = new CASTSimpleDeclSpecifier();
+ floatComplexSds.setType(IASTSimpleDeclSpecifier.t_float);
+ floatComplexSds.setComplex(true);
+ IType c_double_complex = new CBasicType(doubleComplexSds);
+ IType cpp_double_complex = new GPPBasicType(IGPPBasicType.t_double, GPPBasicType.IS_COMPLEX, null);
+ IType c_float_complex = new CBasicType(floatComplexSds);
+ IType cpp_float_complex = new GPPBasicType(IGPPBasicType.t_float, GPPBasicType.IS_COMPLEX, null);
ICASTSimpleDeclSpecifier longDoubleComplexSds = new CASTSimpleDeclSpecifier();
- longDoubleComplexSds.setType(ICASTSimpleDeclSpecifier.t_Complex);
+ longDoubleComplexSds.setType(IASTSimpleDeclSpecifier.t_double);
+ longDoubleComplexSds.setComplex(true);
longDoubleComplexSds.setLong(true);
IType c_long_double_complex = new CBasicType(longDoubleComplexSds);
- IType cpp_long_double_complex = new CPPBasicType(IGPPBasicType.t_Complex, CPPBasicType.IS_LONG);
+ IType cpp_long_double_complex = new GPPBasicType(IGPPBasicType.t_double, CPPBasicType.IS_LONG & GPPBasicType.IS_COMPLEX, null);
ICASTSimpleDeclSpecifier doubleSds = new CASTSimpleDeclSpecifier();
doubleSds.setType(IASTSimpleDeclSpecifier.t_double);
IType c_double = new CBasicType(doubleSds);
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 8d4fe171148..1a70338d8d4 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
@@ -23,7 +23,8 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements IC
private boolean isShort;
private boolean isLong;
private boolean longlong;
-
+ private boolean complex=false;
+ private boolean imaginary=false;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#getType()
@@ -120,4 +121,32 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements IC
return true;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier#isComplex()
+ */
+ public boolean isComplex() {
+ return complex;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier#setComplex(boolean)
+ */
+ public void setComplex(boolean value) {
+ this.complex = value;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier#isImaginary()
+ */
+ public boolean isImaginary() {
+ return imaginary;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier#setImaginary(boolean)
+ */
+ public void setImaginary(boolean value) {
+ this.imaginary = 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 7cd6f060125..9450b6ec050 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
@@ -11,6 +11,7 @@
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.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
@@ -25,6 +26,8 @@ public class CBasicType implements ICBasicType {
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;
private int type = 0;
private int qualifiers = 0;
@@ -41,12 +44,28 @@ public class CBasicType implements ICBasicType {
( sds.isShort() ? CBasicType.IS_SHORT : 0 ) |
( sds.isSigned() ? CBasicType.IS_SIGNED: 0 ) |
( sds.isUnsigned()? CBasicType.IS_UNSIGNED : 0 ) |
- ( sds.isUnsigned()? CBasicType.IS_LONGLONG : 0 );
+ ( sds.isUnsigned()? 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 if( (qualifiers & ~( IS_COMPLEX | IS_IMAGINARY )) != 0 )
+ type = IBasicType.t_int;
+ }
}
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 if( (qualifiers & ~( IS_COMPLEX | IS_IMAGINARY )) != 0 )
+ type = IBasicType.t_int;
+ }
}
public CBasicType( int type, int qualifiers, IASTExpression value ){
@@ -109,7 +128,9 @@ public class CBasicType implements ICBasicType {
&& cObj.isShort() == this.isShort()
&& cObj.isSigned() == this.isSigned()
&& cObj.isUnsigned() == this.isUnsigned()
- && cObj.isLongLong() == this.isLongLong());
+ && cObj.isLongLong() == this.isLongLong()
+ && cObj.isComplex() == this.isComplex()
+ && cObj.isImaginary() == this.isImaginary());
}
public Object clone(){
@@ -132,4 +153,18 @@ public class CBasicType implements ICBasicType {
public void setValue( IASTExpression expression ){
this.value = expression;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.c.ICBasicType#isComplex()
+ */
+ public boolean isComplex() {
+ return ( qualifiers & IS_COMPLEX) != 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.c.ICBasicType#isImaginary()
+ */
+ public boolean isImaginary() {
+ return ( qualifiers & IS_IMAGINARY) != 0;
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java
index 363c82a4a9b..043971ec5af 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java
@@ -1337,6 +1337,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
boolean isInline = false;
boolean isConst = false, isRestrict = false, isVolatile = false;
boolean isShort = false, isLong = false, isUnsigned = false, isIdentifier = false, isSigned = false, isLongLong = false;
+ boolean isComplex = false, isImaginary = false;
int simpleType = IASTSimpleDeclSpecifier.t_unspecified;
IToken identifier = null;
IASTCompositeTypeSpecifier structSpec = null;
@@ -1446,11 +1447,11 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
break;
case IToken.t__Complex:
last = consume(IToken.t__Complex);
- simpleType = ICASTSimpleDeclSpecifier.t_Complex;
+ isComplex=true;
break;
case IToken.t__Imaginary:
last = consume(IToken.t__Imaginary);
- simpleType = ICASTSimpleDeclSpecifier.t_Imaginary;
+ isImaginary=true;
break;
case IToken.tIDENTIFIER:
@@ -1617,6 +1618,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
declSpec.setUnsigned(isUnsigned);
declSpec.setSigned(isSigned);
declSpec.setShort(isShort);
+ declSpec.setComplex(isComplex);
+ declSpec.setImaginary(isImaginary);
if( typeofExpression != null && last == null ){
((ASTNode)declSpec).setOffsetAndLength( (ASTNode)typeofExpression );
} else {
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 01bf70291e8..b9d88703645 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
@@ -14,6 +14,7 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
+import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
@@ -35,6 +36,11 @@ public class CPPBasicType implements ICPPBasicType {
public CPPBasicType( int t, int bits ){
type = t;
qualifierBits = bits;
+
+ if( type == IBasicType.t_unspecified ){
+ if( (qualifierBits & ( IS_LONG | IS_SHORT | IS_SIGNED | IS_UNSIGNED )) != 0 )
+ type = IBasicType.t_int;
+ }
}
public CPPBasicType( int t, int bits, IASTExpression val ){
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java
index 944df4ecca8..1d03a772ad1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java
@@ -2708,7 +2708,8 @@ public class CPPSemantics {
if( src instanceof IBasicType && trg instanceof IBasicType ){
int sType = ((IBasicType)src).getType();
int tType = ((IBasicType)trg).getType();
- if( ( tType == IBasicType.t_int && ( sType == IBasicType.t_char ||
+ if( ( tType == IBasicType.t_int && ( sType == IBasicType.t_int || //short, long , unsigned etc
+ sType == IBasicType.t_char ||
sType == ICPPBasicType.t_bool ||
sType == ICPPBasicType.t_wchar_t ||
sType == IBasicType.t_unspecified ) ) || //treat unspecified as int
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
index bf1d13a5a52..4ac855c65a6 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
@@ -3169,6 +3169,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
boolean isInline = false, isVirtual = false, isExplicit = false, isFriend = false;
boolean isConst = false, isVolatile = false, isRestrict = false;
boolean isLong = false, isShort = false, isUnsigned = false, isSigned = false, isLongLong = false;
+ boolean isComplex = false, isImaginary = false;
boolean isTypename = false;
int storageClass = IASTDeclSpecifier.sc_unspecified;
@@ -3271,7 +3272,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
- la.getOffset());
}
last = consume(IToken.t__Complex);
- simpleType = IGPPASTSimpleDeclSpecifier.t_Complex;
+ isComplex=true;
break;
case IToken.t__Imaginary:
if (!supportComplex) {
@@ -3279,7 +3280,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
throwBacktrack(la.getOffset(), la.getLength());
}
last = consume(IToken.t__Imaginary);
- simpleType = IGPPASTSimpleDeclSpecifier.t_Imaginary;
+ isImaginary=true;
break;
case IToken.t_char:
simpleType = IASTSimpleDeclSpecifier.t_char;
@@ -3487,10 +3488,14 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return nameSpec;
}
ICPPASTSimpleDeclSpecifier simpleDeclSpec = null;
- if (isLongLong || typeofExpression != null) {
+ if (isComplex || isImaginary || isLongLong || typeofExpression != null) {
simpleDeclSpec = createGPPSimpleDeclSpecifier();
((IGPPASTSimpleDeclSpecifier) simpleDeclSpec)
.setLongLong(isLongLong);
+ ((IGPPASTSimpleDeclSpecifier) simpleDeclSpec)
+ .setComplex(isComplex);
+ ((IGPPASTSimpleDeclSpecifier) simpleDeclSpec)
+ .setImaginary(isImaginary);
if (typeofExpression != null) {
((IGPPASTSimpleDeclSpecifier) simpleDeclSpec)
.setTypeofExpression(typeofExpression);
@@ -3524,7 +3529,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
simpleDeclSpec.setShort(isShort);
simpleDeclSpec.setUnsigned(isUnsigned);
simpleDeclSpec.setSigned(isSigned);
-
+
return simpleDeclSpec;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTSimpleDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTSimpleDeclSpecifier.java
index 44758e35a2b..cf5e243b64c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTSimpleDeclSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTSimpleDeclSpecifier.java
@@ -22,6 +22,8 @@ public class GPPASTSimpleDeclSpecifier extends CPPASTSimpleDeclSpecifier
private boolean longLong;
private boolean restrict;
+ private boolean complex=false;
+ private boolean imaginary=false;
private IASTExpression typeOfExpression;
/* (non-Javadoc)
@@ -79,4 +81,20 @@ public class GPPASTSimpleDeclSpecifier extends CPPASTSimpleDeclSpecifier
return true;
}
+
+ public boolean isComplex() {
+ return complex;
+ }
+
+ public void setComplex(boolean value) {
+ this.complex = value;
+ }
+
+ public boolean isImaginary() {
+ return imaginary;
+ }
+
+ public void setImaginary(boolean value) {
+ this.imaginary = value;
+ }
}
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
index 4be8f9fe5c8..2b1c0743d2a 100644
--- 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
@@ -13,6 +13,7 @@
*/
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;
@@ -22,12 +23,20 @@ import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPBasicType;
*/
public class GPPBasicType extends CPPBasicType implements IGPPBasicType {
public static final int IS_LONGLONG = LAST << 1;
+ public static final int IS_COMPLEX = LAST << 2;
+ public static final int IS_IMAGINARY = LAST << 3;
private IType typeOf;
public GPPBasicType( int type, int bits, IType typeOf ){
super( type, bits );
this.typeOf = typeOf;
+ if( type == IBasicType.t_unspecified ){
+ if((qualifierBits & ( IS_COMPLEX | IS_IMAGINARY )) != 0 )
+ type = IBasicType.t_float;
+ else if( (qualifierBits & IS_LONGLONG) != 0 )
+ type = IBasicType.t_int;
+ }
}
/* (non-Javadoc)
@@ -46,4 +55,12 @@ public class GPPBasicType extends CPPBasicType implements IGPPBasicType {
return typeOf;
}
+ public boolean isComplex() {
+ return ( qualifierBits & IS_COMPLEX ) != 0;
+ }
+
+ public boolean isImaginary() {
+ return ( qualifierBits & IS_IMAGINARY ) != 0;
+ }
+
}

Back to the top