diff options
author | Andrew Ferguson | 2007-04-14 11:15:55 +0000 |
---|---|---|
committer | Andrew Ferguson | 2007-04-14 11:15:55 +0000 |
commit | 2304aeb61872aff769c137c6fffaf50103c828b9 (patch) | |
tree | 865de58e55be9355a707c498ae4571e0d6267df1 | |
parent | 512a83717e88b600e494d7beba1d65d9187cd960 (diff) | |
download | org.eclipse.cdt-2304aeb61872aff769c137c6fffaf50103c828b9.tar.gz org.eclipse.cdt-2304aeb61872aff769c137c6fffaf50103c828b9.tar.xz org.eclipse.cdt-2304aeb61872aff769c137c6fffaf50103c828b9.zip |
181735: fix a regression, and some (newly exposed) syntax errors in the unit tests
3 files changed, 23 insertions, 7 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMQualifierType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMQualifierType.java index 3e7012efbed..e3b78297dfd 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMQualifierType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMQualifierType.java @@ -18,6 +18,7 @@ import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IQualifierType; import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.ITypedef; +import org.eclipse.cdt.core.dom.ast.c.ICQualifierType; import org.eclipse.cdt.internal.core.Util; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.index.IIndexType; @@ -29,7 +30,7 @@ import org.eclipse.core.runtime.CoreException; * @author Doug Schaefer * */ -public class PDOMQualifierType extends PDOMNode implements IQualifierType, +public class PDOMQualifierType extends PDOMNode implements IQualifierType, ICQualifierType, ITypeContainer, IIndexType { private static final int FLAGS = PDOMNode.RECORD_SIZE; @@ -39,6 +40,7 @@ public class PDOMQualifierType extends PDOMNode implements IQualifierType, private static final int CONST = 0x1; private static final int VOLATILE = 0x2; + private static final int RESTRICT = 0x4; public PDOMQualifierType(PDOM pdom, int record) { super(pdom, record); @@ -65,6 +67,8 @@ public class PDOMQualifierType extends PDOMNode implements IQualifierType, flags |= CONST; if (type.isVolatile()) flags |= VOLATILE; + if (type instanceof ICQualifierType && ((ICQualifierType)type).isRestrict()) + flags |= RESTRICT; db.putByte(record + FLAGS, flags); } catch (DOMException e) { throw new CoreException(Util.createStatus(e)); @@ -111,6 +115,15 @@ public class PDOMQualifierType extends PDOMNode implements IQualifierType, return false; } } + + public boolean isRestrict() { + try { + return (getFlags() & RESTRICT) != 0; + } catch (CoreException e) { + CCorePlugin.log(e); + return false; + } + } public boolean isSameType(IType type) { if( type instanceof ITypedef ) @@ -120,7 +133,10 @@ public class PDOMQualifierType extends PDOMNode implements IQualifierType, IQualifierType pt = (IQualifierType) type; try { - if( isConst() == pt.isConst() && isVolatile() == pt.isVolatile() ) { + boolean flagsMatch= isConst() == pt.isConst() && isVolatile() == pt.isVolatile(); + if(flagsMatch && (type instanceof ICQualifierType)) + flagsMatch &= isRestrict() == ((ICQualifierType)type).isRestrict(); + if(flagsMatch) { IType myType= getType(); return myType != null && myType.isSameType( pt.getType() ); } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CSelectionTestsAnyIndexer.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CSelectionTestsAnyIndexer.java index 097133b57b4..16901694553 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CSelectionTestsAnyIndexer.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CSelectionTestsAnyIndexer.java @@ -162,16 +162,16 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe // }; // enum E {up, down}; // defines // int f(int); // declares - // extern X anotherX; // declares + // extern struct X anotherX; // declares // #include "testCPPSpecDeclsDefs.h" // int a; // defines - // X anX; // defines + // struct X anX; // defines // extern const int c; // declares // int f(int x) {return x+a;} // defines // struct S; // declares // typedef int Int; // declares - // S s; + // struct S s; // Int lhs= s.a+s.b+up+down+anX+0; public void testCPPSpecDeclsDefs() throws Exception { StringBuffer[] buffers= getContents(2); diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/typehierarchy/CTypeHierarchyTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/typehierarchy/CTypeHierarchyTest.java index 215b69ec3af..b66f28ba3a0 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/typehierarchy/CTypeHierarchyTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/typehierarchy/CTypeHierarchyTest.java @@ -36,7 +36,7 @@ public class CTypeHierarchyTest extends TypeHierarchyBaseTest { // enum E1 {e1, e2}; // typedef enum E2 {e3, e4} TE2; // enum E3 {e5, e6}; - // typedef E3 TE3; + // typedef enum E3 TE3; public void testEnumC() throws Exception { String content= getContentsForTest(1)[0].toString(); IFile file= createFile(getProject(), "enum.c", content); @@ -73,7 +73,7 @@ public class CTypeHierarchyTest extends TypeHierarchyBaseTest { // enum E1 {e1, e2}; // typedef enum E2 {e3, e4} TE2; // enum E3 {e5, e6}; - // typedef E3 TE3; + // typedef enum E3 TE3; public void testEnumCFromMember() throws Exception { String content= getContentsForTest(1)[0].toString(); IFile file= createFile(getProject(), "enummem.c", content); |