mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Support for complex, imaginary and long long (bug 209049).
This commit is contained in:
parent
8db78a8929
commit
3a0b436262
11 changed files with 164 additions and 105 deletions
|
@ -24,6 +24,7 @@ import org.eclipse.cdt.core.CCorePlugin;
|
|||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
|
@ -33,6 +34,7 @@ import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
|||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||
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.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||
|
@ -1077,4 +1079,15 @@ public class IndexBugsTests extends BaseTestCase {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// void func_209049(long long x);
|
||||
public void testGPPTypes_Bug209049() throws Exception {
|
||||
StringBuffer[] contents= getContentsForTest(1);
|
||||
final IIndexManager indexManager = CCorePlugin.getIndexManager();
|
||||
IFile f1= TestSourceReader.createFile(fCProject.getProject(), "source.cpp", contents[0].toString());
|
||||
waitForIndexer();
|
||||
IIndexBinding[] bindings= fIndex.findBindings("func_209049".toCharArray(), IndexFilter.ALL, NPM);
|
||||
IFunctionType ft= ((IFunction) bindings[0]).getType();
|
||||
assertEquals("void (long long)", ASTTypeUtil.getType(ft));
|
||||
}
|
||||
}
|
|
@ -108,6 +108,7 @@ public class IndexUpdateTests extends IndexTestBase {
|
|||
IProject project= cpp ? fCppProject.getProject() : fCProject.getProject();
|
||||
fFile= TestSourceReader.createFile(project, "file" + (cpp ? ".cpp" : ".c"), fContents[++fContentUsed].toString());
|
||||
fContentUsed= 0;
|
||||
TestSourceReader.waitUntilFileIsIndexed(fIndex, fFile, INDEXER_WAIT_TIME);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, NPM));
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,6 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
|||
});
|
||||
assertTrue(target.exists());
|
||||
WritablePDOM wpdom= new WritablePDOM(target, new URIRelativeLocationConverter(baseURI), LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
||||
assertEquals(36, wpdom.getDB().getVersion()); // faked version, remove for CDT 4.1
|
||||
verifyProject1Content(wpdom);
|
||||
|
||||
String fid;
|
||||
|
|
|
@ -183,22 +183,25 @@ public class ASTTypeUtil {
|
|||
}
|
||||
|
||||
try {
|
||||
if( needSpace )
|
||||
result.append( SPACE );
|
||||
switch (((IBasicType)type).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;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2007 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
|
||||
|
@ -24,7 +24,10 @@ 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 LAST = IS_UNSIGNED;
|
||||
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 LAST = IS_LONG_LONG;
|
||||
|
||||
// Extra types
|
||||
public static final int t_bool = ICPPASTSimpleDeclSpecifier.t_bool;
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index;
|
||||
|
||||
|
@ -53,4 +54,6 @@ public interface IIndexCPPBindingConstants {
|
|||
int CPP_TYPEDEF_SPECIALIZATION= IIndexBindingConstants.LAST_CONSTANT + 37;
|
||||
int CPP_TEMPLATE_TYPE_PARAMETER= IIndexBindingConstants.LAST_CONSTANT + 38;
|
||||
int CPP_FUNCTION_TYPE= IIndexBindingConstants.LAST_CONSTANT + 39;
|
||||
int GPPBASICTYPE = IIndexBindingConstants.LAST_CONSTANT + 40;
|
||||
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ import org.eclipse.cdt.internal.core.pdom.db.ChunkCache;
|
|||
import org.eclipse.cdt.internal.core.pdom.db.DBProperties;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.ApplyVisitor;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.BindingCollector;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.FindBinding;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMLinkageFactory;
|
||||
|
@ -81,10 +80,8 @@ public class PDOM extends PlatformObject implements IIndexFragment, IPDOM {
|
|||
*/
|
||||
public static final String FRAGMENT_PROPERTY_VALUE_FORMAT_ID= "org.eclipse.cdt.internal.core.pdom.PDOM"; //$NON-NLS-1$
|
||||
|
||||
public static final int CURRENT_VERSION = 39;
|
||||
public static final int MIN_SUPPORTED_VERSION= 36;
|
||||
public static final int MIN_VERSION_TO_WRITE_NESTED_BINDINGS_INDEX= 37; // to be removed in 5.0
|
||||
public static final int MIN_VERSION_TO_WRITE_MACROS_INDEX= 38; // to be removed in 5.0
|
||||
public static final int CURRENT_VERSION = 50;
|
||||
public static final int MIN_SUPPORTED_VERSION= CURRENT_VERSION;
|
||||
|
||||
/**
|
||||
* The earliest PDOM version that the CURRENT_VERSION can be read as. For example,
|
||||
|
@ -94,7 +91,7 @@ public class PDOM extends PlatformObject implements IIndexFragment, IPDOM {
|
|||
* Ideally this would always be CURRENT_VERSION on the basis that CURRENT_VERSION is
|
||||
* not incrementing.
|
||||
*/
|
||||
public static final int EARLIEST_FORWARD_COMPATIBLE_VERSION= 36;
|
||||
public static final int EARLIEST_FORWARD_COMPATIBLE_VERSION= CURRENT_VERSION;
|
||||
|
||||
/*
|
||||
* PDOM internal format history
|
||||
|
@ -141,16 +138,14 @@ public class PDOM extends PlatformObject implements IIndexFragment, IPDOM {
|
|||
* #37#- added index for nested bindings (189811), compatible with version 36 - <<CDT 4.0.1>>
|
||||
* 38 - added b-tree for macros (193056), compatible with version 36 and 37
|
||||
* #39#- added flag for function-style macros (208558), compatible with version 36,37,38 - <<CDT 4.0.2>>
|
||||
* 40 - string optimizations, removed compatibility with prior versions.
|
||||
*/
|
||||
|
||||
public static final int LINKAGES = Database.DATA_AREA;
|
||||
public static final int FILE_INDEX = Database.DATA_AREA + 4;
|
||||
public static final int PROPERTIES = Database.DATA_AREA + 8;
|
||||
public static final int HAS_NESTED_BINDING_BTREES= Database.DATA_AREA + 12;
|
||||
public static final int HAS_MACRO_BTREES= Database.DATA_AREA + 13;
|
||||
// 2-bytes of freedom
|
||||
public static final int MACRO_BTREE= Database.DATA_AREA + 16;
|
||||
public static final int END= Database.DATA_AREA + 20;
|
||||
public static final int MACRO_BTREE= Database.DATA_AREA + 12;
|
||||
public static final int END= Database.DATA_AREA + 16;
|
||||
static {
|
||||
assert END <= Database.CHUNK_SIZE;
|
||||
}
|
||||
|
@ -163,8 +158,6 @@ public class PDOM extends PlatformObject implements IIndexFragment, IPDOM {
|
|||
private File fPath;
|
||||
private IIndexLocationConverter locationConverter;
|
||||
private Map fPDOMLinkageFactoryCache;
|
||||
private boolean fHasBTreeForNestedBindings;
|
||||
private boolean fHasBTreeForMacros;
|
||||
private HashMap fResultCache= new HashMap();
|
||||
|
||||
|
||||
|
@ -197,24 +190,6 @@ public class PDOM extends PlatformObject implements IIndexFragment, IPDOM {
|
|||
int version= db.getVersion();
|
||||
if (version >= MIN_SUPPORTED_VERSION) {
|
||||
readLinkages();
|
||||
fHasBTreeForNestedBindings= db.getByte(HAS_NESTED_BINDING_BTREES) == 1;
|
||||
fHasBTreeForMacros= db.getByte(HAS_MACRO_BTREES) == 1;
|
||||
|
||||
// new PDOM with version ready to write nested bindings index
|
||||
if (!isPermanentlyReadOnly()) {
|
||||
if (version >= MIN_VERSION_TO_WRITE_NESTED_BINDINGS_INDEX) {
|
||||
if (!fHasBTreeForNestedBindings) {
|
||||
fHasBTreeForNestedBindings= true;
|
||||
db.putByte(HAS_NESTED_BINDING_BTREES, (byte) 1);
|
||||
}
|
||||
}
|
||||
if (version >= MIN_VERSION_TO_WRITE_MACROS_INDEX) {
|
||||
if (!fHasBTreeForMacros) {
|
||||
fHasBTreeForMacros= true;
|
||||
db.putByte(HAS_MACRO_BTREES, (byte) 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
db.setLocked(lockCount != 0);
|
||||
}
|
||||
|
@ -313,10 +288,6 @@ public class PDOM extends PlatformObject implements IIndexFragment, IPDOM {
|
|||
|
||||
// Clear out the database, everything is set to zero.
|
||||
db.clear(CURRENT_VERSION);
|
||||
db.putByte(HAS_NESTED_BINDING_BTREES, (byte) 1);
|
||||
db.putByte(HAS_MACRO_BTREES, (byte) 1);
|
||||
fHasBTreeForNestedBindings= true;
|
||||
fHasBTreeForMacros= true;
|
||||
clearCaches();
|
||||
}
|
||||
|
||||
|
@ -786,12 +757,7 @@ public class PDOM extends PlatformObject implements IIndexFragment, IPDOM {
|
|||
try {
|
||||
linkage.accept(visitor);
|
||||
if (!filescope) {
|
||||
if (fHasBTreeForNestedBindings) {
|
||||
linkage.getNestedBindingsIndex().accept(visitor);
|
||||
}
|
||||
else {
|
||||
linkage.accept(new ApplyVisitor(linkage, visitor));
|
||||
}
|
||||
linkage.getNestedBindingsIndex().accept(visitor);
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException e) {
|
||||
|
@ -807,9 +773,6 @@ public class PDOM extends PlatformObject implements IIndexFragment, IPDOM {
|
|||
}
|
||||
|
||||
public IIndexMacro[] findMacros(char[] prefix, boolean isPrefix, boolean isCaseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException {
|
||||
if (!fHasBTreeForMacros) {
|
||||
return IIndexMacro.EMPTY_INDEX_MACRO_ARRAY;
|
||||
}
|
||||
ArrayList result= new ArrayList();
|
||||
MacroCollector visitor = new MacroCollector(this, prefix, isPrefix, isCaseSensitive);
|
||||
visitor.setMonitor(monitor);
|
||||
|
|
|
@ -348,9 +348,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
|
|||
*/
|
||||
public void afterAddBinding(PDOMBinding pdomBinding) throws CoreException {
|
||||
if (pdomBinding.getParentNodeRec() != record) {
|
||||
if (pdom.getDB().getVersion() >= PDOM.MIN_VERSION_TO_WRITE_NESTED_BINDINGS_INDEX) {
|
||||
getNestedBindingsIndex().insert(pdomBinding.getRecord());
|
||||
}
|
||||
getNestedBindingsIndex().insert(pdomBinding.getRecord());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -362,9 +360,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
|
|||
*/
|
||||
public void beforeRemoveBinding(PDOMBinding pdomBinding) throws CoreException {
|
||||
if (pdomBinding.getParentNodeRec() != record) {
|
||||
if (pdom.getDB().getVersion() >= PDOM.MIN_VERSION_TO_WRITE_NESTED_BINDINGS_INDEX) {
|
||||
getNestedBindingsIndex().delete(pdomBinding.getRecord());
|
||||
}
|
||||
getNestedBindingsIndex().delete(pdomBinding.getRecord());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 QNX Software Systems and others.
|
||||
* Copyright (c) 2006, 2007 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* QNX - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
@ -18,7 +19,7 @@ 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;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||
|
@ -35,20 +36,38 @@ class PDOMCPPBasicType extends PDOMNode implements ICPPBasicType, IIndexType {
|
|||
public static final int FLAGS = PDOMNode.RECORD_SIZE + 2; // short
|
||||
|
||||
public static final int RECORD_SIZE = PDOMNode.RECORD_SIZE + 4;
|
||||
|
||||
protected short fFlags= -1;
|
||||
|
||||
public PDOMCPPBasicType(PDOM pdom, int record) {
|
||||
super(pdom, record);
|
||||
}
|
||||
|
||||
public PDOMCPPBasicType(PDOM pdom, PDOMNode parent, ICPPBasicType type) throws CoreException {
|
||||
this(pdom, parent, type, encodeFlags(type));
|
||||
}
|
||||
|
||||
protected PDOMCPPBasicType(PDOM pdom, PDOMNode parent, ICPPBasicType type, final short flags) throws CoreException {
|
||||
super(pdom, parent);
|
||||
|
||||
fFlags= flags;
|
||||
Database db = pdom.getDB();
|
||||
|
||||
db.putShort(record + TYPE_ID, getTypeCode(type));
|
||||
db.putShort(record + FLAGS, flags);
|
||||
}
|
||||
|
||||
private short getTypeCode(ICPPBasicType type) {
|
||||
short tc= IBasicType.t_unspecified;
|
||||
try {
|
||||
tc= (short) type.getType();
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
return tc;
|
||||
}
|
||||
|
||||
protected static short encodeFlags(ICPPBasicType type) {
|
||||
short flags = 0;
|
||||
try {
|
||||
db.putChar(record + TYPE_ID, (char)type.getType());
|
||||
|
||||
char flags = 0;
|
||||
if (type.isLong())
|
||||
flags |= IS_LONG;
|
||||
if (type.isShort())
|
||||
|
@ -57,24 +76,22 @@ class PDOMCPPBasicType extends PDOMNode implements ICPPBasicType, IIndexType {
|
|||
flags |= IS_SIGNED;
|
||||
if (type.isUnsigned())
|
||||
flags |= IS_UNSIGNED;
|
||||
|
||||
db.putChar(record + FLAGS, flags);
|
||||
} catch (DOMException e) {
|
||||
throw new CoreException(Util.createStatus(e));
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
protected int getRecordSize() {
|
||||
return RECORD_SIZE;
|
||||
}
|
||||
|
||||
public int getNodeType() {
|
||||
return PDOMCPPLinkage.CPPBASICTYPE;
|
||||
return IIndexCPPBindingConstants.CPPBASICTYPE;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
try {
|
||||
return pdom.getDB().getChar(record + TYPE_ID);
|
||||
return pdom.getDB().getShort(record + TYPE_ID);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return 0;
|
||||
|
@ -87,44 +104,33 @@ class PDOMCPPBasicType extends PDOMNode implements ICPPBasicType, IIndexType {
|
|||
return null;
|
||||
}
|
||||
|
||||
private char getFlags() throws CoreException {
|
||||
return pdom.getDB().getChar(record + FLAGS);
|
||||
public int getQualifierBits() {
|
||||
if (fFlags == -1) {
|
||||
try {
|
||||
fFlags= pdom.getDB().getShort(record + FLAGS);
|
||||
}
|
||||
catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
fFlags= 0;
|
||||
}
|
||||
}
|
||||
return fFlags;
|
||||
}
|
||||
|
||||
public boolean isLong() throws DOMException {
|
||||
try {
|
||||
return (getFlags() & IS_LONG) != 0;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return false;
|
||||
}
|
||||
return (getQualifierBits() & IS_LONG) != 0;
|
||||
}
|
||||
|
||||
public boolean isShort() throws DOMException {
|
||||
try {
|
||||
return (getFlags() & IS_SHORT) != 0;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return false;
|
||||
}
|
||||
return (getQualifierBits() & IS_SHORT) != 0;
|
||||
}
|
||||
|
||||
public boolean isSigned() throws DOMException {
|
||||
try {
|
||||
return (getFlags() & IS_SIGNED) != 0;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return false;
|
||||
}
|
||||
return (getQualifierBits() & IS_SIGNED) != 0;
|
||||
}
|
||||
|
||||
public boolean isUnsigned() throws DOMException {
|
||||
try {
|
||||
return (getFlags() & IS_UNSIGNED) != 0;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return false;
|
||||
}
|
||||
return (getQualifierBits() & IS_UNSIGNED) != 0;
|
||||
}
|
||||
|
||||
public boolean isSameType(IType rhs) {
|
||||
|
@ -158,13 +164,4 @@ class PDOMCPPBasicType extends PDOMNode implements ICPPBasicType, IIndexType {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public int getQualifierBits() {
|
||||
try {
|
||||
return getFlags();
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPBasicType;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBlockScope;
|
||||
|
@ -589,6 +590,18 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
if (type instanceof IProblemBinding) {
|
||||
return null;
|
||||
}
|
||||
if (type instanceof IGPPBasicType) {
|
||||
IGPPBasicType gbt= (IGPPBasicType) type;
|
||||
IType typeof;
|
||||
try {
|
||||
typeof = gbt.getTypeofType();
|
||||
if (typeof != null) {
|
||||
return addType(parent, typeof);
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
return new PDOMGPPBasicType(pdom, parent, gbt);
|
||||
}
|
||||
if (type instanceof ICPPBasicType) {
|
||||
return new PDOMCPPBasicType(pdom, parent, (ICPPBasicType) type);
|
||||
}
|
||||
|
@ -654,6 +667,8 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
return new PDOMCPPNamespace(pdom, record);
|
||||
case CPPNAMESPACEALIAS:
|
||||
return new PDOMCPPNamespaceAlias(pdom, record);
|
||||
case GPPBASICTYPE:
|
||||
return new PDOMGPPBasicType(pdom, record);
|
||||
case CPPBASICTYPE:
|
||||
return new PDOMCPPBasicType(pdom, record);
|
||||
case CPPPARAMETER:
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPBasicType;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
class PDOMGPPBasicType extends PDOMCPPBasicType implements IGPPBasicType, IIndexType {
|
||||
|
||||
public PDOMGPPBasicType(PDOM pdom, int record) {
|
||||
super(pdom, record);
|
||||
}
|
||||
|
||||
public PDOMGPPBasicType(PDOM pdom, PDOMNode parent, IGPPBasicType type) throws CoreException {
|
||||
super(pdom, parent, type, encodeGPPFlags(type));
|
||||
}
|
||||
|
||||
public int getNodeType() {
|
||||
return IIndexCPPBindingConstants.GPPBASICTYPE;
|
||||
}
|
||||
|
||||
protected static short encodeGPPFlags(IGPPBasicType type) {
|
||||
short flags = encodeFlags(type);
|
||||
try {
|
||||
if (type.isComplex())
|
||||
flags |= IS_COMPLEX;
|
||||
if (type.isImaginary())
|
||||
flags |= IS_IMAGINARY;
|
||||
if (type.isLongLong())
|
||||
flags |= IS_LONG_LONG;
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
public IType getTypeofType() throws DOMException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isComplex() {
|
||||
return (getQualifierBits() & IS_COMPLEX) != 0;
|
||||
}
|
||||
|
||||
public boolean isImaginary() {
|
||||
return (getQualifierBits() & IS_IMAGINARY) != 0;
|
||||
}
|
||||
|
||||
public boolean isLongLong() throws DOMException {
|
||||
return (getQualifierBits() & IS_LONG_LONG) != 0;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue