mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
0f13c1b8f1
commit
372f3ef066
34 changed files with 498 additions and 536 deletions
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.model.tests;
|
||||
|
||||
|
@ -25,7 +25,6 @@ import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
|||
|
||||
/**
|
||||
* @author bnicolle
|
||||
*
|
||||
*/
|
||||
public class IStructureTests extends IntegratedCModelTest {
|
||||
/**
|
||||
|
@ -56,29 +55,29 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
* containing all its public members named "test*"
|
||||
*/
|
||||
public static Test suite() {
|
||||
TestSuite suite= new TestSuite( IStructureTests.class.getName() );
|
||||
TestSuite suite= new TestSuite(IStructureTests.class.getName());
|
||||
|
||||
// TODO check C-only behaviour using C_NATURE vs CC_NATURE
|
||||
|
||||
// Interface tests:
|
||||
suite.addTest( new IStructureTests("testGetChildrenOfTypeStruct"));
|
||||
suite.addTest( new IStructureTests("testGetChildrenOfTypeClass")); // C++ only
|
||||
suite.addTest( new IStructureTests("testGetFields"));
|
||||
//Bug# 38985: solved. suite.addTest( new IStructureTests("testGetFieldsHack"));
|
||||
suite.addTest( new IStructureTests("testGetField"));
|
||||
suite.addTest( new IStructureTests("testGetMethods")); // C++ only
|
||||
//Bug# 38985: solved. suite.addTest( new IStructureTests("testGetMethodsHack")); // C++ only
|
||||
suite.addTest( new IStructureTests("testGetMethod")); // C++ only
|
||||
suite.addTest( new IStructureTests("testIsStruct"));
|
||||
suite.addTest( new IStructureTests("testIsClass")); // C++ only
|
||||
suite.addTest( new IStructureTests("testIsUnion"));
|
||||
suite.addTest( new IStructureTests("testIsAbstract")); // C++ only
|
||||
suite.addTest( new IStructureTests("testGetBaseTypes")); // C++ only
|
||||
suite.addTest( new IStructureTests("testGetAccessControl")); // C++ only
|
||||
suite.addTest(new IStructureTests("testGetChildrenOfTypeStruct"));
|
||||
suite.addTest(new IStructureTests("testGetChildrenOfTypeClass")); // C++ only
|
||||
suite.addTest(new IStructureTests("testGetFields"));
|
||||
//Bug# 38985: solved. suite.addTest(new IStructureTests("testGetFieldsHack"));
|
||||
suite.addTest(new IStructureTests("testGetField"));
|
||||
suite.addTest(new IStructureTests("testGetMethods")); // C++ only
|
||||
//Bug# 38985: solved. suite.addTest(new IStructureTests("testGetMethodsHack")); // C++ only
|
||||
suite.addTest(new IStructureTests("testGetMethod")); // C++ only
|
||||
suite.addTest(new IStructureTests("testIsStruct"));
|
||||
suite.addTest(new IStructureTests("testIsClass")); // C++ only
|
||||
suite.addTest(new IStructureTests("testIsUnion"));
|
||||
suite.addTest(new IStructureTests("testIsAbstract")); // C++ only
|
||||
suite.addTest(new IStructureTests("testGetBaseTypes")); // C++ only
|
||||
suite.addTest(new IStructureTests("testGetAccessControl")); // C++ only
|
||||
|
||||
// Language Specification tests:
|
||||
suite.addTest( new IStructureTests("testAnonymousStructObject"));
|
||||
suite.addTest( new IStructureTests("testInnerStruct"));
|
||||
suite.addTest(new IStructureTests("testAnonymousStructObject"));
|
||||
suite.addTest(new IStructureTests("testInnerStruct"));
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
@ -92,9 +91,9 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
"testStruct8"
|
||||
};
|
||||
assertEquals(myExpectedStructs.length,arrayStructs.size());
|
||||
for(int i=0; i<myExpectedStructs.length; i++) {
|
||||
for (int i= 0; i < myExpectedStructs.length; i++) {
|
||||
IStructure myIStruct = (IStructure) arrayStructs.get(i);
|
||||
assertNotNull( "Failed on "+i, myIStruct);
|
||||
assertNotNull("Failed on " + i, myIStruct);
|
||||
assertEquals(myExpectedStructs[i], myIStruct.getElementName());
|
||||
}
|
||||
}
|
||||
|
@ -103,11 +102,11 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
List arrayClasses = tu.getChildrenOfType(ICElement.C_CLASS);
|
||||
String[] myExpectedClasses = {
|
||||
"testClass1", "testClass2NoSemicolon", "testClass3", "testClass4Abstract",
|
||||
"testClass5", "testClass6"};
|
||||
"testClass5", "testClass6" };
|
||||
assertEquals(myExpectedClasses.length,arrayClasses.size());
|
||||
for(int i=0; i<myExpectedClasses.length; i++) {
|
||||
for (int i= 0; i < myExpectedClasses.length; i++) {
|
||||
IStructure myIStruct = (IStructure) arrayClasses.get(i);
|
||||
assertNotNull( "Failed on "+i, myIStruct);
|
||||
assertNotNull("Failed on " + i, myIStruct);
|
||||
assertEquals(myExpectedClasses[i], myIStruct.getElementName());
|
||||
}
|
||||
}
|
||||
|
@ -122,9 +121,9 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
"m_field4","m_field5","m_field6",
|
||||
};
|
||||
assertEquals(myExpectedFields.length, myArrayIField.length);
|
||||
for(int i=0; i<myArrayIField.length; i++) {
|
||||
assertNotNull( "Failed on "+i, myArrayIField[i]);
|
||||
assertEquals("Failed on "+i,
|
||||
for (int i= 0; i < myArrayIField.length; i++) {
|
||||
assertNotNull("Failed on " + i, myArrayIField[i]);
|
||||
assertEquals("Failed on " + i,
|
||||
myExpectedFields[i], myArrayIField[i].getElementName());
|
||||
}
|
||||
}
|
||||
|
@ -140,10 +139,10 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
};
|
||||
List myArrayIField = myIStruct.getChildrenOfType(ICElement.C_FIELD);
|
||||
assertEquals(myExpectedFields.length, myArrayIField.size());
|
||||
for(int i=0; i<myArrayIField.size(); i++) {
|
||||
for (int i= 0; i < myArrayIField.size(); i++) {
|
||||
IField myIField = (IField) myArrayIField.get(i);
|
||||
assertNotNull( "Failed on "+i, myIField );
|
||||
assertEquals("Failed on "+i,
|
||||
assertNotNull("Failed on " + i, myIField);
|
||||
assertEquals("Failed on " + i,
|
||||
myExpectedFields[i], myIField.getElementName());
|
||||
}
|
||||
}
|
||||
|
@ -155,17 +154,17 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
"m_field1","m_field2","m_field3",
|
||||
"m_field4","m_field5","m_field6",
|
||||
};
|
||||
for(int i=0; i<myExpectedFields.length; i++) {
|
||||
IField myIField = myIStruct.getField( myExpectedFields[i] );
|
||||
assertNotNull( "Failed on "+i, myIField);
|
||||
for (int i= 0; i < myExpectedFields.length; i++) {
|
||||
IField myIField = myIStruct.getField(myExpectedFields[i]);
|
||||
assertNotNull("Failed on " + i, myIField);
|
||||
}
|
||||
|
||||
String[] myUnexpectedFields = {
|
||||
"m_field7","m_field8","m_field9",
|
||||
};
|
||||
for(int i=0; i<myUnexpectedFields.length; i++) {
|
||||
IField myIField = myIStruct.getField( myUnexpectedFields[i] );
|
||||
assertNull( "Failed on "+i, myIField);
|
||||
for (int i= 0; i < myUnexpectedFields.length; i++) {
|
||||
IField myIField = myIStruct.getField(myUnexpectedFields[i]);
|
||||
assertNull("Failed on " + i, myIField);
|
||||
}
|
||||
}
|
||||
public void testGetMethods() throws CModelException {
|
||||
|
@ -177,9 +176,9 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
"method1","method2","testStruct1","~testStruct1"
|
||||
};
|
||||
assertEquals(myExpectedMethods.length, myArrayIMethod.length);
|
||||
for(int i=0; i<myArrayIMethod.length; i++) {
|
||||
assertNotNull( "Failed on "+i, myArrayIMethod[i]);
|
||||
assertEquals("Failed on "+i,
|
||||
for (int i= 0; i < myArrayIMethod.length; i++) {
|
||||
assertNotNull("Failed on " + i, myArrayIMethod[i]);
|
||||
assertEquals("Failed on " + i,
|
||||
myExpectedMethods[i], myArrayIMethod[i].getElementName());
|
||||
}
|
||||
}
|
||||
|
@ -189,15 +188,15 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
List myArrayStructs = tu.getChildrenOfType(ICElement.C_STRUCT);
|
||||
IStructure myIStruct = (IStructure) myArrayStructs.get(0);
|
||||
List myArrayIMethod = myIStruct.getChildrenOfType(ICElement.C_METHOD_DECLARATION);
|
||||
myArrayIMethod.addAll( myIStruct.getChildrenOfType(ICElement.C_METHOD) );
|
||||
myArrayIMethod.addAll(myIStruct.getChildrenOfType(ICElement.C_METHOD));
|
||||
String[] myExpectedMethods = {
|
||||
"method1","method2","testStruct1","~testStruct1"
|
||||
};
|
||||
assertEquals(myExpectedMethods.length, myArrayIMethod.size());
|
||||
for(int i=0; i<myArrayIMethod.size(); i++) {
|
||||
for (int i= 0; i < myArrayIMethod.size(); i++) {
|
||||
IMethodDeclaration myIMethod = (IMethodDeclaration) myArrayIMethod.get(i);
|
||||
assertNotNull( "Failed on "+i, myIMethod);
|
||||
assertEquals("Failed on "+i,
|
||||
assertNotNull("Failed on " + i, myIMethod);
|
||||
assertEquals("Failed on " + i,
|
||||
myExpectedMethods[i], myIMethod.getElementName());
|
||||
}
|
||||
}
|
||||
|
@ -208,17 +207,17 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
String[] myExpectedMethods = {
|
||||
"method1","method2","testStruct1","~testStruct1"
|
||||
};
|
||||
for(int i=0; i<myExpectedMethods.length; i++) {
|
||||
IMethodDeclaration myIMethod = myIStruct.getMethod( myExpectedMethods[i] );
|
||||
assertNotNull( "Failed on "+i, myIMethod);
|
||||
for (int i= 0; i < myExpectedMethods.length; i++) {
|
||||
IMethodDeclaration myIMethod = myIStruct.getMethod(myExpectedMethods[i]);
|
||||
assertNotNull("Failed on " + i, myIMethod);
|
||||
}
|
||||
|
||||
String[] myUnexpectedMethods = {
|
||||
"method7","method8","method9",
|
||||
};
|
||||
for(int i=0; i<myUnexpectedMethods.length; i++) {
|
||||
IMethodDeclaration myIMethod = myIStruct.getMethod( myUnexpectedMethods[i] );
|
||||
assertNull( "Failed on "+i, myIMethod);
|
||||
for (int i= 0; i < myUnexpectedMethods.length; i++) {
|
||||
IMethodDeclaration myIMethod = myIStruct.getMethod(myUnexpectedMethods[i]);
|
||||
assertNull("Failed on " + i, myIMethod);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,23 +228,22 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
try {
|
||||
myElementUnion = tu.getElement("testUnion1");
|
||||
myElementNonUnion = tu.getElement("testStruct1");
|
||||
} catch (CModelException e) {
|
||||
assertNotNull("CModelException thrown", e);
|
||||
}
|
||||
catch( CModelException c )
|
||||
{
|
||||
assertNotNull("CModelException thrown",c);
|
||||
}
|
||||
assertNotNull( myElementUnion );
|
||||
assertTrue( myElementUnion.getElementType()==ICElement.C_UNION );
|
||||
assertNotNull(myElementUnion);
|
||||
assertTrue(myElementUnion.getElementType() == ICElement.C_UNION);
|
||||
IStructure myStructUnion = (IStructure) myElementUnion;
|
||||
assertNotNull( myStructUnion );
|
||||
assertTrue( myStructUnion.isUnion() );
|
||||
assertNotNull(myStructUnion);
|
||||
assertTrue(myStructUnion.isUnion());
|
||||
|
||||
assertNotNull( myElementNonUnion );
|
||||
assertTrue( myElementNonUnion.getElementType()!=ICElement.C_UNION );
|
||||
assertNotNull(myElementNonUnion);
|
||||
assertTrue(myElementNonUnion.getElementType() != ICElement.C_UNION);
|
||||
IStructure myStructNonUnion = (IStructure) myElementNonUnion;
|
||||
assertNotNull( myStructNonUnion );
|
||||
assertFalse( myStructNonUnion.isUnion() );
|
||||
assertNotNull(myStructNonUnion);
|
||||
assertFalse(myStructNonUnion.isUnion());
|
||||
}
|
||||
|
||||
public void testIsStruct() throws CModelException {
|
||||
ITranslationUnit tu = getTU();
|
||||
ICElement myElementStruct = null;
|
||||
|
@ -253,22 +251,20 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
try {
|
||||
myElementStruct = tu.getElement("testStruct1");
|
||||
myElementNonStruct = tu.getElement("testClass1");
|
||||
} catch (CModelException e) {
|
||||
assertNotNull("CModelException thrown", e);
|
||||
}
|
||||
catch( CModelException c )
|
||||
{
|
||||
assertNotNull("CModelException thrown",c);
|
||||
}
|
||||
assertNotNull( myElementStruct );
|
||||
assertTrue( myElementStruct.getElementType()==ICElement.C_STRUCT );
|
||||
assertNotNull(myElementStruct);
|
||||
assertTrue(myElementStruct.getElementType() == ICElement.C_STRUCT);
|
||||
IStructure myStructStruct = (IStructure) myElementStruct;
|
||||
assertNotNull( myStructStruct );
|
||||
assertTrue( myStructStruct.isStruct() );
|
||||
assertNotNull(myStructStruct);
|
||||
assertTrue(myStructStruct.isStruct());
|
||||
|
||||
assertNotNull( myElementNonStruct );
|
||||
assertTrue( myElementNonStruct.getElementType()!=ICElement.C_STRUCT );
|
||||
assertNotNull(myElementNonStruct);
|
||||
assertTrue(myElementNonStruct.getElementType() != ICElement.C_STRUCT);
|
||||
IStructure myStructNonStruct = (IStructure) myElementNonStruct;
|
||||
assertNotNull( myStructNonStruct );
|
||||
assertFalse( myStructNonStruct.isStruct() );
|
||||
assertNotNull(myStructNonStruct);
|
||||
assertFalse(myStructNonStruct.isStruct());
|
||||
}
|
||||
|
||||
public void testIsClass() throws CModelException {
|
||||
|
@ -278,22 +274,20 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
try {
|
||||
myElementClass = tu.getElement("testClass1");
|
||||
myElementNonClass = tu.getElement("testStruct1");
|
||||
} catch (CModelException e) {
|
||||
assertNotNull("CModelException thrown", e);
|
||||
}
|
||||
catch( CModelException c )
|
||||
{
|
||||
assertNotNull("CModelException thrown",c);
|
||||
}
|
||||
assertNotNull( myElementClass );
|
||||
assertTrue( myElementClass.getElementType()==ICElement.C_CLASS );
|
||||
assertNotNull(myElementClass);
|
||||
assertTrue(myElementClass.getElementType() == ICElement.C_CLASS);
|
||||
IStructure myStructClass = (IStructure) myElementClass;
|
||||
assertNotNull( myStructClass );
|
||||
assertTrue( myStructClass.isClass() );
|
||||
assertNotNull(myStructClass);
|
||||
assertTrue(myStructClass.isClass());
|
||||
|
||||
assertNotNull( myElementNonClass );
|
||||
assertTrue( myElementNonClass.getElementType()!=ICElement.C_CLASS );
|
||||
assertNotNull(myElementNonClass);
|
||||
assertTrue(myElementNonClass.getElementType() != ICElement.C_CLASS);
|
||||
IStructure myStructNonClass = (IStructure) myElementNonClass;
|
||||
assertNotNull( myStructNonClass );
|
||||
assertFalse( myStructNonClass.isClass() );
|
||||
assertNotNull(myStructNonClass);
|
||||
assertFalse(myStructNonClass.isClass());
|
||||
}
|
||||
|
||||
public void testIsAbstract() throws CModelException {
|
||||
|
@ -303,22 +297,20 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
try {
|
||||
myElementAbstract = tu.getElement("testClass4Abstract");
|
||||
myElementNonAbstract = tu.getElement("testClass1");
|
||||
} catch (CModelException e) {
|
||||
assertNotNull("CModelException thrown", e);
|
||||
}
|
||||
catch( CModelException c )
|
||||
{
|
||||
assertNotNull("CModelException thrown",c);
|
||||
}
|
||||
assertNotNull( myElementAbstract );
|
||||
assertTrue( myElementAbstract.getElementType()==ICElement.C_CLASS );
|
||||
assertNotNull(myElementAbstract);
|
||||
assertTrue(myElementAbstract.getElementType() == ICElement.C_CLASS);
|
||||
IStructure myStructAbstract = (IStructure) myElementAbstract;
|
||||
assertNotNull( myStructAbstract );
|
||||
assertTrue( myStructAbstract.isAbstract() );
|
||||
assertNotNull(myStructAbstract);
|
||||
assertTrue(myStructAbstract.isAbstract());
|
||||
|
||||
assertNotNull( myElementNonAbstract );
|
||||
assertTrue( myElementNonAbstract.getElementType() == ICElement.C_CLASS );
|
||||
assertNotNull(myElementNonAbstract);
|
||||
assertTrue(myElementNonAbstract.getElementType() == ICElement.C_CLASS);
|
||||
IStructure myStructNonAbstract = (IStructure) myElementNonAbstract;
|
||||
assertNotNull( myStructNonAbstract );
|
||||
assertFalse( myStructNonAbstract.isAbstract() );
|
||||
assertNotNull(myStructNonAbstract);
|
||||
assertFalse(myStructNonAbstract.isAbstract());
|
||||
}
|
||||
|
||||
// IInheritance
|
||||
|
@ -328,23 +320,21 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
String[] myBaseTypes = null;
|
||||
try {
|
||||
myElementDerived = tu.getElement("testClass5"); // throws
|
||||
assertNotNull( myElementDerived );
|
||||
assertTrue( myElementDerived.getElementType()==ICElement.C_CLASS );
|
||||
assertNotNull(myElementDerived);
|
||||
assertTrue(myElementDerived.getElementType() == ICElement.C_CLASS);
|
||||
IStructure myStructDerived = (IStructure) myElementDerived;
|
||||
assertNotNull( myStructDerived );
|
||||
assertNotNull(myStructDerived);
|
||||
myBaseTypes = myStructDerived.getSuperClassesNames();
|
||||
}
|
||||
catch( CModelException c )
|
||||
{
|
||||
assertNotNull("CModelException thrown",c);
|
||||
} catch (CModelException e) {
|
||||
assertNotNull("CModelException thrown", e);
|
||||
}
|
||||
|
||||
String[] myExpectedBaseTypes = {
|
||||
"testClass1","testClass3","testClass4Abstract"
|
||||
"testClass1", "testClass3","testClass4Abstract"
|
||||
};
|
||||
assertEquals( myExpectedBaseTypes.length, myBaseTypes.length );
|
||||
for(int i=0; i<myBaseTypes.length; i++) {
|
||||
assertEquals( "Failed on "+i, myExpectedBaseTypes[i], myBaseTypes[i] );
|
||||
assertEquals(myExpectedBaseTypes.length, myBaseTypes.length);
|
||||
for (int i= 0; i < myBaseTypes.length; i++) {
|
||||
assertEquals("Failed on " + i, myExpectedBaseTypes[i], myBaseTypes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,10 +345,10 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
String[] myBaseTypes = null;
|
||||
try {
|
||||
myElementDerived = tu.getElement("testClass5"); // throws
|
||||
assertNotNull( myElementDerived );
|
||||
assertTrue( myElementDerived.getElementType()==ICElement.C_CLASS );
|
||||
assertNotNull(myElementDerived);
|
||||
assertTrue(myElementDerived.getElementType() == ICElement.C_CLASS);
|
||||
IStructure myStructDerived = (IStructure) myElementDerived;
|
||||
assertNotNull( myStructDerived );
|
||||
assertNotNull(myStructDerived);
|
||||
myBaseTypes = myStructDerived.getSuperClassesNames();
|
||||
|
||||
ASTAccessVisibility[] myExpectedAccessControl = {
|
||||
|
@ -367,15 +357,13 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
ASTAccessVisibility.PROTECTED,
|
||||
ASTAccessVisibility.PRIVATE
|
||||
};
|
||||
assertEquals( myExpectedAccessControl.length, myBaseTypes.length );
|
||||
for(int i=0; i<myBaseTypes.length; i++) {
|
||||
assertEquals(myExpectedAccessControl.length, myBaseTypes.length);
|
||||
for (int i= 0; i < myBaseTypes.length; i++) {
|
||||
ASTAccessVisibility myAccessControl = myStructDerived.getSuperClassAccess(myBaseTypes[i]);
|
||||
assertEquals( "Failed on "+i, myExpectedAccessControl[i], myAccessControl );
|
||||
assertEquals("Failed on " + i, myExpectedAccessControl[i], myAccessControl);
|
||||
}
|
||||
}
|
||||
catch( CModelException c )
|
||||
{
|
||||
assertNotNull("CModelException thrown",c);
|
||||
} catch (CModelException e) {
|
||||
assertNotNull("CModelException thrown", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -399,13 +387,11 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
ICElement myElement = null;
|
||||
try {
|
||||
myElement = tu.getElement("testAnonymousStructObject1");
|
||||
} catch (CModelException e) {
|
||||
assertNotNull("CModelException thrown", e);
|
||||
}
|
||||
catch( CModelException c )
|
||||
{
|
||||
assertNotNull("CModelException thrown",c);
|
||||
}
|
||||
assertNotNull( myElement );
|
||||
assertEquals( ICElement.C_VARIABLE, myElement.getElementType() );
|
||||
assertNotNull(myElement);
|
||||
assertEquals(ICElement.C_VARIABLE, myElement.getElementType());
|
||||
}
|
||||
|
||||
public void testInnerStruct() throws CModelException {
|
||||
|
@ -413,24 +399,22 @@ public class IStructureTests extends IntegratedCModelTest {
|
|||
ICElement myElement = null;
|
||||
try {
|
||||
myElement = tu.getElement("testStruct8");
|
||||
} catch (CModelException e) {
|
||||
assertNotNull("CModelException thrown", e);
|
||||
}
|
||||
catch( CModelException c )
|
||||
{
|
||||
assertNotNull("CModelException thrown",c);
|
||||
}
|
||||
assertNotNull( myElement );
|
||||
assertNotNull(myElement);
|
||||
IStructure myIStruct = (IStructure) myElement;
|
||||
assertNotNull( myIStruct );
|
||||
assertNotNull(myIStruct);
|
||||
|
||||
String[] myExpectedInnerStructs = {
|
||||
"testStruct9Inner", "testStruct10Inner"
|
||||
};
|
||||
List myInnerStructs = myIStruct.getChildrenOfType(ICElement.C_STRUCT);
|
||||
assertEquals( myExpectedInnerStructs.length, myInnerStructs.size() );
|
||||
for(int i=0; i<myExpectedInnerStructs.length; i++) {
|
||||
assertEquals(myExpectedInnerStructs.length, myInnerStructs.size());
|
||||
for (int i= 0; i < myExpectedInnerStructs.length; i++) {
|
||||
IStructure myInnerStruct = (IStructure) myInnerStructs.get(i);
|
||||
assertNotNull( "Failed on "+i, myInnerStruct );
|
||||
assertEquals( "Failed on "+i, myExpectedInnerStructs[i], myInnerStruct.getElementName() );
|
||||
assertNotNull("Failed on " + i, myInnerStruct);
|
||||
assertEquals("Failed on " + i, myExpectedInnerStructs[i], myInnerStruct.getElementName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* Created on Jun 3, 2003
|
||||
* by bnicolle
|
||||
*/
|
||||
package org.eclipse.cdt.core.model.tests;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
|
@ -33,18 +29,13 @@ import org.eclipse.core.runtime.Path;
|
|||
|
||||
/**
|
||||
* @author bnicolle
|
||||
*
|
||||
*/
|
||||
public abstract class IntegratedCModelTest extends BaseTestCase {
|
||||
|
||||
private ICProject fCProject;
|
||||
private IFile sourceFile;
|
||||
private NullProgressMonitor monitor;
|
||||
private boolean structuralParse = false;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public IntegratedCModelTest() {
|
||||
super();
|
||||
}
|
||||
|
@ -113,5 +104,4 @@ public abstract class IntegratedCModelTest extends BaseTestCase {
|
|||
public void setStructuralParse(boolean structuralParse) {
|
||||
this.structuralParse = structuralParse;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.index.tests;
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
public static class ProjectWithDepProj extends IndexCPPTemplateResolutionTest {
|
||||
public ProjectWithDepProj() {setStrategy(new ReferencedProject(true));}
|
||||
public static TestSuite suite() {return suite(ProjectWithDepProj.class);}
|
||||
|
||||
|
||||
@Override
|
||||
public void testDefaultTemplateArgInHeader_264988() throws Exception {
|
||||
// Not supported across projects (the composite index does not merge
|
||||
|
@ -86,7 +86,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
}
|
||||
}
|
||||
|
||||
public static void addTests(TestSuite suite) {
|
||||
public static void addTests(TestSuite suite) {
|
||||
suite.addTest(SingleProject.suite());
|
||||
suite.addTest(ProjectWithDepProj.suite());
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
IBinding b0= getBindingFromASTName("C1<char> c1", 8);
|
||||
IBinding b1= getBindingFromASTName("m1(\"aaa\")", 2);
|
||||
IBinding b2= getBindingFromASTName("m2(\"aaa\")", 2);
|
||||
|
||||
|
||||
assertEquals(1, getIndex().findNames(b1, IIndex.FIND_REFERENCES).length);
|
||||
assertEquals(1, getIndex().findNames(b2, IIndex.FIND_REFERENCES).length);
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
public void testUnindexedConstructorInstanceImplicitReference() throws Exception {
|
||||
IBinding b0= getBindingFromASTName("m1(\"aaa\")", 2);
|
||||
IBinding b1= getBindingFromASTName("m2(\"aaa\")", 2);
|
||||
|
||||
|
||||
assertEquals(1, getIndex().findNames(b0, IIndex.FIND_REFERENCES).length);
|
||||
assertEquals(1, getIndex().findNames(b1, IIndex.FIND_REFERENCES).length);
|
||||
}
|
||||
|
@ -397,29 +397,29 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
public void testCPPConstructorTemplateSpecialization() throws Exception {
|
||||
IBinding b0= getBindingFromASTName("D<int> *var", 1);
|
||||
IBinding b1= getBindingFromASTName("D<int> *var", 6);
|
||||
|
||||
|
||||
assertInstance(b0, ICPPClassTemplate.class);
|
||||
assertInstance(b0, ICPPClassType.class);
|
||||
assertInstance(b1, ICPPTemplateInstance.class);
|
||||
assertInstance(b1, ICPPClassType.class);
|
||||
|
||||
|
||||
// ICPPClassType _ct= (ICPPClassType) b1;
|
||||
// ICPPConstructor[] _ctcs= _ct.getConstructors();
|
||||
// assertEquals(3, _ctcs.length); // two implicit plus the constructor template
|
||||
|
||||
|
||||
IBinding b2= getBindingFromASTName("D<int>(", 1);
|
||||
IBinding b3= getBindingFromASTName("D<int>(", 6);
|
||||
|
||||
|
||||
assertInstance(b2, ICPPClassTemplate.class); // *D*<int>(5, 6)
|
||||
assertInstance(b2, ICPPClassType.class); // *D*<int>(5, 6)
|
||||
assertInstance(b3, ICPPTemplateInstance.class); // *D<int>*(5, 6)
|
||||
assertInstance(b3, ICPPConstructor.class); // *D<int>*(5, 6)
|
||||
|
||||
|
||||
//
|
||||
// ICPPClassType ct= (ICPPClassType) b2;
|
||||
// ICPPConstructor[] ctcs= ct.getConstructors();
|
||||
// assertEquals(3, ctcs.length); // two implicit plus the constructor template
|
||||
|
||||
|
||||
IBinding tidSpc= ((ICPPTemplateInstance)b3).getSpecializedBinding();
|
||||
assertInstance(tidSpc, ICPPConstructor.class);
|
||||
assertInstance(tidSpc, ICPPSpecialization.class);
|
||||
|
@ -470,22 +470,22 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
IBinding b2= getBindingFromASTName("f.s.foo", 1);
|
||||
IBinding b3= getBindingFromASTName("s.foo", 1);
|
||||
IBinding b4= getBindingFromASTName("foo(*", 3);
|
||||
|
||||
|
||||
assertInstance(b0, ICPPClassTemplate.class);
|
||||
assertInstance(b0, ICPPClassType.class);
|
||||
ICPPTemplateParameter[] ps= ((ICPPClassTemplate)b0).getTemplateParameters();
|
||||
assertEquals(2, ps.length);
|
||||
assertInstance(ps[0], ICPPTemplateTypeParameter.class);
|
||||
assertInstance(ps[1], ICPPTemplateTemplateParameter.class);
|
||||
|
||||
|
||||
assertInstance(b1, ICPPTemplateInstance.class);
|
||||
assertInstance(b1, ICPPClassType.class);
|
||||
|
||||
|
||||
IType[] type= ((ICPPTemplateInstance)b1).getArguments();
|
||||
assertInstance(type[0], ICPPClassType.class);
|
||||
assertInstance(type[1], ICPPClassTemplate.class);
|
||||
assertInstance(type[1], ICPPClassType.class);
|
||||
|
||||
|
||||
ObjectMap om= ((ICPPTemplateInstance)b1).getArgumentMap();
|
||||
assertEquals(2, om.size());
|
||||
assertInstance(om.keyAt(0), ICPPTemplateTypeParameter.class);
|
||||
|
@ -493,7 +493,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
assertInstance(om.keyAt(1), ICPPTemplateTemplateParameter.class);
|
||||
assertInstance(om.getAt(1), ICPPClassType.class);
|
||||
assertInstance(om.getAt(1), ICPPClassTemplate.class);
|
||||
|
||||
|
||||
IBinding b1_spcd= ((ICPPTemplateInstance)b1).getSpecializedBinding();
|
||||
assertInstance(b1_spcd, ICPPClassTemplate.class);
|
||||
assertInstance(b1_spcd, ICPPClassType.class);
|
||||
|
@ -580,20 +580,20 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
IBinding b1= getBindingFromASTName("D<B, T3>", 8);
|
||||
IBinding b2= getBindingFromASTName("D<C, T3>", 8);
|
||||
IBinding b3= getBindingFromASTName("D<B", 1);
|
||||
|
||||
|
||||
List spBindings= new ArrayList();
|
||||
assertInstance(b0, ICPPSpecialization.class);
|
||||
assertInstance(b0, ICPPClassTemplate.class);
|
||||
spBindings.add(((ICPPSpecialization)b0).getSpecializedBinding());
|
||||
|
||||
|
||||
assertInstance(b1, ICPPSpecialization.class);
|
||||
assertInstance(b1, ICPPClassTemplate.class);
|
||||
spBindings.add(((ICPPSpecialization)b1).getSpecializedBinding());
|
||||
|
||||
|
||||
assertInstance(b2, ICPPSpecialization.class);
|
||||
assertInstance(b2, ICPPClassTemplate.class);
|
||||
spBindings.add(((ICPPSpecialization)b2).getSpecializedBinding());
|
||||
|
||||
|
||||
for(int i=0; i<spBindings.size(); i++) {
|
||||
for(int j=0; j<spBindings.size(); j++) {
|
||||
IType ty1= (IType) spBindings.get(i);
|
||||
|
@ -601,7 +601,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
assertTrue(ty1.isSameType(ty2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
assertInstance(b3, ICPPClassTemplate.class);
|
||||
ICPPClassTemplate ct= (ICPPClassTemplate) b3;
|
||||
assertEquals(3, ct.getPartialSpecializations().length);
|
||||
|
@ -668,7 +668,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
// B foo(B t) { B x= *new B(); return x; }
|
||||
// void bar(B t, int& x) { x++; }
|
||||
// };
|
||||
|
||||
|
||||
// A<B> ab;
|
||||
public void testClassSpecializationMethods() throws Exception {
|
||||
IBinding b0= getBindingFromASTName("A<B> ab", 4);
|
||||
|
@ -685,20 +685,20 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
|
||||
ICPPMethod foo= dms[0].getName().equals("foo") ? dms[0] : dms[1];
|
||||
ICPPMethod bar= dms[0].getName().equals("bar") ? dms[0] : dms[1];
|
||||
|
||||
|
||||
assertEquals(foo.getName(), "foo");
|
||||
assertEquals(bar.getName(), "bar");
|
||||
|
||||
|
||||
assertInstance(foo.getType().getReturnType(), ICPPClassType.class);
|
||||
assertEquals(((ICPPClassType)foo.getType().getReturnType()).getName(), "B");
|
||||
assertEquals(foo.getType().getParameterTypes().length, 1);
|
||||
assertInstance(foo.getType().getParameterTypes()[0], ICPPClassType.class);
|
||||
assertEquals(((ICPPClassType)foo.getType().getParameterTypes()[0]).getName(), "B");
|
||||
|
||||
|
||||
assertInstance(bar.getType().getReturnType(), ICPPBasicType.class);
|
||||
assertEquals(((ICPPBasicType)bar.getType().getReturnType()).getType(), IBasicType.t_void);
|
||||
}
|
||||
|
||||
|
||||
// template<typename T> class A {
|
||||
// public:
|
||||
// typedef T TD;
|
||||
|
@ -807,25 +807,25 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
assertInstance(b0_ptypes[1], ICPPClassType.class);
|
||||
assertEquals("A", ((ICPPClassType)b0_ptypes[0]).getName());
|
||||
assertEquals("B", ((ICPPClassType)b0_ptypes[1]).getName());
|
||||
|
||||
|
||||
IParameter[] b0_pms= ((ICPPFunction)b0).getParameters();
|
||||
assertEquals(2, b0_pms.length);
|
||||
assertInstance(b0_pms[0].getType(), ICPPClassType.class);
|
||||
assertInstance(b0_pms[1].getType(), ICPPClassType.class);
|
||||
assertEquals("A", ((ICPPClassType)b0_pms[0].getType()).getName());
|
||||
assertEquals("B", ((ICPPClassType)b0_pms[1].getType()).getName());
|
||||
|
||||
|
||||
IBinding b0_spcd= ((ICPPTemplateInstance)b0).getSpecializedBinding();
|
||||
assertInstance(b0_spcd, ICPPFunction.class);
|
||||
assertInstance(b0_spcd, ICPPTemplateDefinition.class);
|
||||
|
||||
|
||||
IParameter[] b0_spcd_pms= ((ICPPFunction)b0_spcd).getParameters();
|
||||
assertEquals(2, b0_spcd_pms.length);
|
||||
assertInstance(b0_spcd_pms[0].getType(), ICPPTemplateTypeParameter.class);
|
||||
assertInstance(b0_spcd_pms[1].getType(), ICPPTemplateTypeParameter.class);
|
||||
assertEquals("T1", ((ICPPTemplateTypeParameter)b0_spcd_pms[0].getType()).getName());
|
||||
assertEquals("T2", ((ICPPTemplateTypeParameter)b0_spcd_pms[1].getType()).getName());
|
||||
|
||||
|
||||
ObjectMap b0_am= ((ICPPSpecialization)b0).getArgumentMap();
|
||||
assertEquals(2, b0_am.size());
|
||||
assertInstance(b0_am.getAt(0), ICPPClassType.class);
|
||||
|
@ -836,7 +836,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
assertEquals("T2", ((ICPPTemplateTypeParameter)b0_am.keyAt(1)).getName());
|
||||
assertEquals("A", ((ICPPClassType)b0_am.getAt(0)).getName());
|
||||
assertEquals("B", ((ICPPClassType)b0_am.getAt(1)).getName());
|
||||
|
||||
|
||||
ICPPFunctionType b0_spcd_type= ((ICPPFunction)b0_spcd).getType();
|
||||
assertInstance(b0_spcd_type.getReturnType(), ICPPBasicType.class);
|
||||
IType[] b0_spcd_ptypes= b0_spcd_type.getParameterTypes();
|
||||
|
@ -845,7 +845,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
assertInstance(b0_spcd_ptypes[1], ICPPTemplateTypeParameter.class);
|
||||
assertEquals("T1", ((ICPPTemplateTypeParameter)b0_spcd_ptypes[0]).getName());
|
||||
assertEquals("T2", ((ICPPTemplateTypeParameter)b0_spcd_ptypes[1]).getName());
|
||||
|
||||
|
||||
IBinding b1= getBindingFromASTName("foo(c,a)", 3);
|
||||
assertInstance(b1, ICPPFunction.class);
|
||||
ICPPFunctionType b1type= ((ICPPFunction)b1).getType();
|
||||
|
@ -856,20 +856,20 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
assertInstance(b1_ptypes[1], ICPPClassType.class);
|
||||
assertEquals("C", ((ICPPClassType)b1_ptypes[0]).getName());
|
||||
assertEquals("A", ((ICPPClassType)b1_ptypes[1]).getName());
|
||||
|
||||
|
||||
IParameter[] b1_pms= ((ICPPFunction)b1).getParameters();
|
||||
assertEquals(2, b1_pms.length);
|
||||
assertInstance(b1_pms[0].getType(), ICPPClassType.class);
|
||||
assertInstance(b1_pms[1].getType(), ICPPClassType.class);
|
||||
assertEquals("C", ((ICPPClassType)b1_pms[0].getType()).getName());
|
||||
assertEquals("A", ((ICPPClassType)b1_pms[1].getType()).getName());
|
||||
|
||||
|
||||
assertInstance(b1, ICPPSpecialization.class);
|
||||
ICPPSpecialization b1s= (ICPPSpecialization) b1;
|
||||
IBinding b1_spcd= b1s.getSpecializedBinding();
|
||||
assertInstance(b1_spcd, ICPPFunction.class);
|
||||
assertInstance(b1_spcd, ICPPTemplateDefinition.class);
|
||||
|
||||
|
||||
ICPPFunctionType b1_spcd_type= ((ICPPFunction)b1_spcd).getType();
|
||||
assertInstance(b1_spcd_type.getReturnType(), ICPPBasicType.class);
|
||||
IType[] b1_spcd_ptypes= b1_spcd_type.getParameterTypes();
|
||||
|
@ -878,14 +878,14 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
assertInstance(b1_spcd_ptypes[1], ICPPTemplateTypeParameter.class);
|
||||
assertEquals("T1", ((ICPPTemplateTypeParameter)b1_spcd_ptypes[0]).getName());
|
||||
assertEquals("T2", ((ICPPTemplateTypeParameter)b1_spcd_ptypes[1]).getName());
|
||||
|
||||
|
||||
IParameter[] b1_spcd_pms= ((ICPPFunction)b1_spcd).getParameters();
|
||||
assertEquals(2, b1_spcd_pms.length);
|
||||
assertInstance(b1_spcd_pms[0].getType(), ICPPTemplateTypeParameter.class);
|
||||
assertInstance(b1_spcd_pms[1].getType(), ICPPTemplateTypeParameter.class);
|
||||
assertEquals("T1", ((ICPPTemplateTypeParameter)b1_spcd_pms[0].getType()).getName());
|
||||
assertEquals("T2", ((ICPPTemplateTypeParameter)b1_spcd_pms[1].getType()).getName());
|
||||
|
||||
|
||||
ObjectMap b1_am= b1s.getArgumentMap();
|
||||
assertEquals(2, b1_am.size());
|
||||
assertInstance(b1_am.keyAt(0), ICPPTemplateTypeParameter.class);
|
||||
|
@ -911,17 +911,17 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
IBinding b0= getBindingFromASTName("foo(a)", 3);
|
||||
assertInstance(b0, ICPPTemplateInstance.class);
|
||||
assertInstance(b0, ICPPFunction.class);
|
||||
|
||||
|
||||
ICPPFunction f= (ICPPFunction) b0;
|
||||
ICPPFunctionType type= f.getType();
|
||||
IType rt= type.getReturnType();
|
||||
IType[] pts= type.getParameterTypes();
|
||||
|
||||
|
||||
IParameter[] ps= f.getParameters();
|
||||
assertEquals(1, ps.length);
|
||||
ICPPParameter param= (ICPPParameter) ps[0];
|
||||
assertInstance(param, ICPPSpecialization.class);
|
||||
|
||||
|
||||
IType paramType= param.getType();
|
||||
assertInstance(paramType, ICPPClassType.class);
|
||||
ICPPParameter paramSpec= (ICPPParameter) ((ICPPSpecialization) param).getSpecializedBinding();
|
||||
|
@ -929,7 +929,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
ICPPTemplateTypeParameter ttp= (ICPPTemplateTypeParameter) paramSpec.getType();
|
||||
assertEquals("T", ttp.getName());
|
||||
assertNull(ttp.getDefault());
|
||||
|
||||
|
||||
ICPPTemplateInstance inst= (ICPPTemplateInstance) b0;
|
||||
IBinding sp= inst.getSpecializedBinding();
|
||||
assertInstance(sp, ICPPFunction.class);
|
||||
|
@ -994,10 +994,10 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
public void testClassSpecializations_180738() {
|
||||
IBinding b1a = getBindingFromASTName("Foo<B> b1;", 3);
|
||||
IBinding b1b = getBindingFromASTName("Foo<B> b1;", 6);
|
||||
|
||||
|
||||
assertInstance(b1a, ICPPClassType.class);
|
||||
assertInstance(b1a, ICPPClassTemplate.class);
|
||||
|
||||
|
||||
assertInstance(b1b, ICPPClassType.class);
|
||||
assertInstance(b1b, ICPPSpecialization.class);
|
||||
ICPPSpecialization b1spc= (ICPPSpecialization) b1b;
|
||||
|
@ -1006,13 +1006,13 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
assertInstance(b1om.getAt(0), ICPPClassType.class);
|
||||
ICPPClassType b1pct= (ICPPClassType) b1om.getAt(0);
|
||||
assertEquals("B", b1pct.getName());
|
||||
|
||||
|
||||
IBinding b2a = getBindingFromASTName("Foo<B> b2;", 3);
|
||||
IBinding b2b = getBindingFromASTName("Foo<B> b2;", 6);
|
||||
|
||||
|
||||
assertInstance(b2a, ICPPClassType.class);
|
||||
assertInstance(b2a, ICPPClassTemplate.class);
|
||||
|
||||
|
||||
assertInstance(b2b, ICPPClassType.class);
|
||||
assertInstance(b2b, ICPPSpecialization.class);
|
||||
ICPPSpecialization b2spc= (ICPPSpecialization) b2b;
|
||||
|
@ -1122,21 +1122,21 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
IBinding ca= getBindingFromASTName("C<A>", 4);
|
||||
assertInstance(ca, ICPPClassType.class);
|
||||
assertInstance(ca, ICPPTemplateInstance.class);
|
||||
|
||||
|
||||
IBinding foo1= getBindingFromASTName("foo(c)", 3);
|
||||
|
||||
|
||||
IBinding da= getBindingFromASTName("D<A>", 4);
|
||||
assertInstance(da, ICPPClassType.class);
|
||||
assertInstance(da, ICPPTemplateInstance.class);
|
||||
|
||||
|
||||
IBinding foo2= getBindingFromASTName("foo(d)", 3);
|
||||
IBinding foo3= getBindingFromASTName("foo(e)", 3);
|
||||
IBinding foo4= getBindingFromASTName("foo(cx)", 3);
|
||||
|
||||
|
||||
assertEquals(foo1, foo2); assertEquals(foo2, foo3);
|
||||
assertEquals(foo3, foo4);
|
||||
}
|
||||
|
||||
|
||||
// template<typename T>
|
||||
// class A {};
|
||||
//
|
||||
|
@ -1144,7 +1144,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
//
|
||||
// template<>
|
||||
// class A<B> {};
|
||||
|
||||
|
||||
// class C {};
|
||||
//
|
||||
// A<B> ab;
|
||||
|
@ -1152,15 +1152,15 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
public void testEnclosingScopes_a() throws Exception {
|
||||
ICPPSpecialization b0= getBindingFromASTName("A<B>", 4, ICPPSpecialization.class, ICPPClassType.class);
|
||||
ICPPTemplateInstance b1= getBindingFromASTName("A<C>", 4, ICPPTemplateInstance.class, ICPPClassType.class);
|
||||
|
||||
|
||||
ICPPClassType sc0= assertInstance(b0.getSpecializedBinding(), ICPPClassType.class);
|
||||
ICPPClassType sc1= assertInstance(b1.getSpecializedBinding(), ICPPClassType.class);
|
||||
assertTrue(sc0.isSameType(sc1));
|
||||
|
||||
|
||||
assertNull(sc0.getScope());
|
||||
assertNull(b0.getScope());
|
||||
}
|
||||
|
||||
|
||||
// template<typename T>
|
||||
// class A {
|
||||
// public:
|
||||
|
@ -1174,7 +1174,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
// public:
|
||||
// class B {};
|
||||
// };
|
||||
|
||||
|
||||
// #include "header.h"
|
||||
// void refs() {
|
||||
// A<C>::B acb;
|
||||
|
@ -1184,7 +1184,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
ICPPClassType b0= getBindingFromASTName("B acb", 1, ICPPClassType.class);
|
||||
ICPPClassType b1= getBindingFromASTName("B adb", 1, ICPPClassType.class, ICPPSpecialization.class);
|
||||
ICPPClassType b2= getBindingFromASTName("A<C>", 4, ICPPClassType.class, ICPPSpecialization.class);
|
||||
|
||||
|
||||
IIndexBinding[] sr = getIndex().findBindings("A".toCharArray(), new IndexFilter() {
|
||||
@Override
|
||||
public boolean acceptBinding(IBinding binding) throws CoreException {
|
||||
|
@ -1193,7 +1193,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
}, npm());
|
||||
assertTrue(sr.length == 1);
|
||||
ICPPClassType b3= (ICPPClassType) sr[0];
|
||||
|
||||
|
||||
sr = getIndex().findBindings(new char[][] {"A".toCharArray(), "B".toCharArray()}, new IndexFilter() {
|
||||
@Override
|
||||
public boolean acceptBinding(IBinding binding) throws CoreException {
|
||||
|
@ -1202,19 +1202,19 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
}, npm());
|
||||
assertTrue(sr.length == 1);
|
||||
ICPPClassType b4= (ICPPClassType) sr[0];
|
||||
|
||||
|
||||
assertFalse(b0 instanceof ICPPSpecialization);
|
||||
|
||||
|
||||
IIndexScope s0= (IIndexScope) b0.getScope(), s4= (IIndexScope) b4.getScope();
|
||||
IScope s1= b1.getScope();
|
||||
|
||||
|
||||
assertTrue(((IType)s0.getScopeBinding()).isSameType((IType)((IIndexScope)b2.getCompositeScope()).getScopeBinding()));
|
||||
ICPPClassScope cs1= assertInstance(s1, ICPPClassScope.class);
|
||||
assertInstance(cs1.getClassType(), ICPPClassType.class);
|
||||
assertInstance(cs1.getClassType(), ICPPTemplateInstance.class);
|
||||
assertTrue(((IType)((ICPPClassSpecialization) s4.getScopeBinding()).getSpecializedBinding()).isSameType( (IType) ((IIndexScope)b3.getCompositeScope()).getScopeBinding() ));
|
||||
}
|
||||
|
||||
|
||||
// class A {};
|
||||
//
|
||||
// template<typename T>
|
||||
|
@ -1230,18 +1230,18 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
public void testEnclosingScopes_c() throws Exception {
|
||||
ICPPClassType b0= getBindingFromASTName("Y::Z x", 1, ICPPClassType.class);
|
||||
ICPPClassType b1= getBindingFromASTName("Z xayz", 1, ICPPClassType.class);
|
||||
|
||||
|
||||
IScope s0= b0.getScope(), s1= b1.getScope();
|
||||
|
||||
|
||||
ICPPClassScope cs0= assertInstance(s0, ICPPClassScope.class);
|
||||
assertInstance(cs0.getClassType(), ICPPClassType.class);
|
||||
assertInstance(cs0.getClassType(), ICPPSpecialization.class);
|
||||
|
||||
|
||||
ICPPClassScope cs1= assertInstance(s1, ICPPClassScope.class);
|
||||
assertInstance(cs1.getClassType(), ICPPClassType.class);
|
||||
assertInstance(cs1.getClassType(), ICPPSpecialization.class);
|
||||
assertInstance(cs1.getClassType(), ICPPSpecialization.class);
|
||||
}
|
||||
|
||||
|
||||
// class A {}; class B {};
|
||||
//
|
||||
// template<typename T1, typename T2>
|
||||
|
@ -1252,21 +1252,21 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
// public:
|
||||
// class N {};
|
||||
// };
|
||||
|
||||
|
||||
// X<B,A>::N n;
|
||||
public void testEnclosingScopes_d() throws Exception {
|
||||
ICPPClassType b0= getBindingFromASTName("N n", 1, ICPPClassType.class, ICPPSpecialization.class);
|
||||
ICPPClassType b1= assertInstance(((ICPPSpecialization) b0).getSpecializedBinding(), ICPPClassType.class);
|
||||
|
||||
|
||||
ICPPClassScope s0= assertInstance(b0.getScope(), ICPPClassScope.class);
|
||||
assertInstance(s0.getClassType(), ICPPTemplateInstance.class);
|
||||
|
||||
|
||||
ICPPClassScope s1= assertInstance(b1.getScope(), ICPPClassScope.class);
|
||||
assertInstance(s1.getClassType(), ICPPTemplateDefinition.class);
|
||||
|
||||
|
||||
assertNull(s1.getClassType().getScope());
|
||||
}
|
||||
|
||||
|
||||
// typedef signed int SI;
|
||||
//
|
||||
// template <SI x>
|
||||
|
@ -1282,16 +1282,16 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
assertInstance(args.keyAt(0), ICPPTemplateNonTypeParameter.class);
|
||||
assertEquals(1, args.size());
|
||||
}
|
||||
|
||||
// template <class T> class A {
|
||||
// class B { T t; };
|
||||
// B b;
|
||||
// };
|
||||
|
||||
// void f() {
|
||||
// A<int> a;
|
||||
// a.b.t;
|
||||
// }
|
||||
|
||||
// template <class T> class A {
|
||||
// class B { T t; };
|
||||
// B b;
|
||||
// };
|
||||
|
||||
// void f() {
|
||||
// A<int> a;
|
||||
// a.b.t;
|
||||
// }
|
||||
public void testNestedClassTypeSpecializations() throws Exception {
|
||||
ICPPField t2 = getBindingFromASTName("t;", 1, ICPPField.class);
|
||||
|
||||
|
@ -1312,7 +1312,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
// template<typename _Iterator, typename _Container> class normal_iterator {
|
||||
// protected:
|
||||
// _Iterator _M_current;
|
||||
//
|
||||
//
|
||||
// public:
|
||||
// typedef typename iterator_traits<_Iterator>::pointer pointer;
|
||||
// normal_iterator() : _M_current(_Iterator()) { }
|
||||
|
@ -1349,7 +1349,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
ICPPField t2 = getBindingFromASTName("member; // it->member", 6, ICPPField.class);
|
||||
ICPPClassType ct= t2.getClassOwner();
|
||||
assertEquals("MyStruct", ct.getName());
|
||||
|
||||
|
||||
final IType type = t2.getType();
|
||||
assertTrue(type instanceof IBasicType);
|
||||
assertEquals(((IBasicType)type).getType(), IBasicType.t_int);
|
||||
|
@ -1382,7 +1382,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
ICPPTemplateArgument arg = paramMap.getArgument(0);
|
||||
assertEquals(Long.valueOf(256), arg.getNonTypeValue().numericalValue());
|
||||
assertInstance(arg.getTypeOfNonTypeValue(), ICPPBasicType.class);
|
||||
|
||||
|
||||
ICPPFunction foo = getBindingFromASTName("foo(t)", 3, ICPPFunction.class);
|
||||
ICPPFunction bar = getBindingFromASTName("bar(t)", 3, ICPPFunction.class);
|
||||
}
|
||||
|
@ -1400,15 +1400,15 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
ICPPClassType b2= getBindingFromASTName("A<B, 'x'>", 9, ICPPClassType.class, ICPPTemplateInstance.class);
|
||||
ICPPClassType b3= getBindingFromASTName("A<B, 'y'>", 9, ICPPClassType.class, ICPPTemplateInstance.class);
|
||||
ICPPClassType b4= getBindingFromASTName("A<B, 'z'>", 9, ICPPClassType.class, ICPPTemplateInstance.class);
|
||||
|
||||
|
||||
assertTrue(!b2.isSameType(b3));
|
||||
assertTrue(!b3.isSameType(b4));
|
||||
assertTrue(!b4.isSameType(b2));
|
||||
|
||||
|
||||
ICPPClassType X= getBindingFromASTName("X x", 1, ICPPClassType.class);
|
||||
ICPPClassType Y= getBindingFromASTName("Y y", 1, ICPPClassType.class);
|
||||
ICPPClassType Z= getBindingFromASTName("Z z", 1, ICPPClassType.class);
|
||||
|
||||
|
||||
assertTrue(!X.isSameType(Y));
|
||||
assertTrue(!Y.isSameType(Z));
|
||||
assertTrue(!Z.isSameType(X));
|
||||
|
@ -1429,7 +1429,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
ICPPClassType Y= getBindingFromASTName("Y y; //2", 1, ICPPClassType.class);
|
||||
getProblemFromASTName("X x; //3", 1);
|
||||
getProblemFromASTName("Y y; //4", 1);
|
||||
|
||||
|
||||
assertTrue(!X.isSameType(Y));
|
||||
}
|
||||
|
||||
|
@ -1453,12 +1453,12 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
ICPPClassType a5c= getBindingFromASTName("A<FUNF>", 7, ICPPClassType.class, ICPPSpecialization.class);
|
||||
ICPPClassType a5d= getBindingFromASTName("A<5>", 4, ICPPClassType.class, ICPPSpecialization.class);
|
||||
ICPPClassType a1= getBindingFromASTName("A<1>", 4, ICPPClassType.class, ICPPTemplateInstance.class);
|
||||
|
||||
|
||||
assertTrue(a5a.isSameType(a5b));
|
||||
assertTrue(a5b.isSameType(a5c));
|
||||
assertTrue(a5c.isSameType(a5d));
|
||||
assertTrue(a5d.isSameType(a5a));
|
||||
|
||||
|
||||
assertTrue(!a1.isSameType(a5a));
|
||||
assertTrue(!a1.isSameType(a5b));
|
||||
assertTrue(!a1.isSameType(a5c));
|
||||
|
@ -1489,7 +1489,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
ICPPConstructor th1sCtor= ba.assertNonProblem("This() :", 4, ICPPConstructor.class);
|
||||
assertFalse(th1sCtor instanceof ICPPSpecialization);ICPPTemplateNonTypeParameter np= ba.assertNonProblem("I)", 1, ICPPTemplateNonTypeParameter.class);
|
||||
*/
|
||||
|
||||
|
||||
ICPPTemplateNonTypeParameter np= getBindingFromASTName("I>(I)", 1, ICPPTemplateNonTypeParameter.class);
|
||||
ICPPConstructor clazz= getBindingFromASTName("That<I>(I)", 4, ICPPConstructor.class);
|
||||
ICPPConstructor ctor= getBindingFromASTName("That<I>(I)", 7, ICPPConstructor.class);
|
||||
|
@ -1515,7 +1515,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
assertFalse(tid instanceof ICPPSpecialization);
|
||||
ICPPConstructor th1sCtor= getBindingFromASTName("This() :", 4, ICPPConstructor.class);
|
||||
assertFalse(th1sCtor instanceof ICPPSpecialization);
|
||||
|
||||
|
||||
ICPPTemplateTypeParameter np= getBindingFromASTName("I>()", 1, ICPPTemplateTypeParameter.class);
|
||||
ICPPConstructor clazz= getBindingFromASTName("That<I>()", 4, ICPPConstructor.class);
|
||||
ICPPConstructor ctor= getBindingFromASTName("That<I>()", 7, ICPPConstructor.class);
|
||||
|
@ -1530,14 +1530,14 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
public void testUniqueSpecializations_Bug241641() throws Exception {
|
||||
ICPPVariable v1= getBindingFromASTName("v1", 2, ICPPVariable.class);
|
||||
ICPPVariable v2= getBindingFromASTName("v1", 2, ICPPVariable.class);
|
||||
|
||||
|
||||
IType t1= v1.getType();
|
||||
assertInstance(t1, ICPPClassType.class);
|
||||
|
||||
|
||||
ICPPClassType ct= (ICPPClassType) t1;
|
||||
IBinding f1= ct.getCompositeScope().find("field")[0];
|
||||
IBinding f2= ct.getCompositeScope().find("field")[0];
|
||||
|
||||
|
||||
assertSame(f1, f2);
|
||||
}
|
||||
|
||||
|
@ -1549,15 +1549,15 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
public void testUniqueInstance_Bug241641() throws Exception {
|
||||
IASTName name= findName("v1", 2);
|
||||
ICPPVariable v1= getBindingFromASTName("v1", 2, ICPPVariable.class);
|
||||
|
||||
|
||||
IType t1= v1.getType();
|
||||
assertInstance(t1, ICPPTemplateInstance.class);
|
||||
|
||||
|
||||
ICPPTemplateInstance inst= (ICPPTemplateInstance) t1;
|
||||
final ICPPClassTemplate tmplDef = (ICPPClassTemplate) inst.getTemplateDefinition();
|
||||
IBinding inst2= CPPTemplates.instantiate(tmplDef, inst.getTemplateArguments(), name);
|
||||
assertSame(inst, inst2);
|
||||
|
||||
|
||||
IBinding charInst1= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateTypeArgument(new CPPBasicType(Kind.eChar, 0))}, name);
|
||||
IBinding charInst2= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateTypeArgument(new CPPBasicType(Kind.eChar, 0))}, name);
|
||||
assertSame(charInst1, charInst2);
|
||||
|
@ -1582,9 +1582,9 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
}
|
||||
|
||||
// template<class T, class U> class A {};
|
||||
// template<class T> class A<T, int> {
|
||||
// void foo(T t);
|
||||
// };
|
||||
// template<class T> class A<T, int> {
|
||||
// void foo(T t);
|
||||
// };
|
||||
|
||||
// template<class T> void A<T, int>::foo(T t) {}
|
||||
public void testBug177418() throws Exception {
|
||||
|
@ -1592,8 +1592,8 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
ICPPClassType owner= m.getClassOwner();
|
||||
assertInstance(owner, ICPPClassTemplatePartialSpecialization.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// template<typename T> class XT {
|
||||
// int f;
|
||||
// void m();
|
||||
|
@ -1610,13 +1610,13 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
assertFalse(m instanceof ICPPUnknownBinding);
|
||||
m= getBindingFromASTName("m(); // 2", 1, ICPPMethod.class);
|
||||
assertFalse(m instanceof ICPPUnknownBinding);
|
||||
|
||||
|
||||
ICPPField f= getBindingFromASTName("f; // 1", 1, ICPPField.class);
|
||||
assertFalse(f instanceof ICPPUnknownBinding);
|
||||
f= getBindingFromASTName("f; // 2", 1, ICPPField.class);
|
||||
assertFalse(f instanceof ICPPUnknownBinding);
|
||||
}
|
||||
|
||||
|
||||
// template <typename T= int> class XT;
|
||||
|
||||
// #include "header.h"
|
||||
|
@ -1769,7 +1769,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
assertFalse(inst.isExplicitSpecialization());
|
||||
inst = getBindingFromASTName("Y<int>", 0);
|
||||
assertTrue(inst.isExplicitSpecialization());
|
||||
|
||||
|
||||
inst = getBindingFromASTName("f(1)", 1);
|
||||
assertFalse(inst.isExplicitSpecialization());
|
||||
inst = getBindingFromASTName("g(1)", 1);
|
||||
|
@ -1819,7 +1819,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
// };
|
||||
// int main() {
|
||||
// A<float, int> a;
|
||||
// a.f(0);
|
||||
// a.f(0);
|
||||
// return 0;
|
||||
// }
|
||||
public void testPartialSpecializationsOfClassTemplateSpecializations_332884() throws Exception {
|
||||
|
@ -1844,16 +1844,16 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
ICPPClassType ct= getBindingFromASTName("TXT", 0, ICPPClassType.class);
|
||||
ICPPMethod[] methods = ct.getAllDeclaredMethods();
|
||||
assertEquals(2, methods.length);
|
||||
|
||||
|
||||
methods= ct.getConstructors();
|
||||
assertEquals(2, methods.length);
|
||||
|
||||
methods= ct.getMethods();
|
||||
assertEquals(14, methods.length);
|
||||
|
||||
|
||||
ICPPBase[] bases = ClassTypeHelper.getBases(ct, null);
|
||||
assertEquals(1, bases.length);
|
||||
|
||||
|
||||
IField field = ct.findField("bfield");
|
||||
assertNotNull(field);
|
||||
|
||||
|
@ -2034,12 +2034,12 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
public void testSFINAE_b() throws Exception {
|
||||
checkBindings();
|
||||
}
|
||||
|
||||
|
||||
// struct CString {
|
||||
// template<template<class,class> class ListT, class UType, class Alloc, typename StringT>
|
||||
// void split(ListT<UType,Alloc>& out, const StringT& sep, bool keepEmptyElements = false, bool trimElements = true, bool emptyBefore = true) const;
|
||||
// };
|
||||
|
||||
|
||||
// template<template<class,class> class ListT, class UType, class Alloc, class StringT>
|
||||
// void CString::split(ListT<UType,Alloc>& out, const StringT& sep, bool keepEmptyElements, bool trimElements, bool emptyBefore) const {
|
||||
// }
|
||||
|
|
|
@ -160,7 +160,7 @@ public class BaseTestCase extends TestCase {
|
|||
try {
|
||||
super.runBare();
|
||||
} catch (Throwable e) {
|
||||
testThrowable=e;
|
||||
testThrowable= e;
|
||||
}
|
||||
|
||||
if (statusLog.size() != fExpectedLoggedNonOK) {
|
||||
|
@ -168,7 +168,7 @@ public class BaseTestCase extends TestCase {
|
|||
msg.append("non-OK status objects in log differs from actual (" + statusLog.size() + ").\n");
|
||||
Throwable cause= null;
|
||||
if (!statusLog.isEmpty()) {
|
||||
synchronized(statusLog) {
|
||||
synchronized (statusLog) {
|
||||
for (IStatus status : statusLog) {
|
||||
IStatus[] ss= {status};
|
||||
ss= status instanceof MultiStatus ? ((MultiStatus) status).getChildren() : ss;
|
||||
|
|
|
@ -20,7 +20,7 @@ public interface IASTBinaryTypeIdExpression extends IASTExpression {
|
|||
public static final ASTNodeProperty OPERAND2 = new ASTNodeProperty("IASTBinaryTypeIdExpression.OPERAND2 [IASTTypeId]"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Built-in type trait of g++.
|
||||
* Built-in type trait of g++.
|
||||
*/
|
||||
public static enum Operator {__is_base_of}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* 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:
|
||||
* Andrew Niefer (IBM Corporation) - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
|
@ -16,57 +16,57 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
|||
|
||||
/**
|
||||
* Binding for c++ functions.
|
||||
*
|
||||
*
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
* @noextend This interface is not intended to be extended by clients.
|
||||
*/
|
||||
public interface ICPPFunction extends IFunction, ICPPBinding {
|
||||
/**
|
||||
* Does this function have the mutable storage class specifier
|
||||
*/
|
||||
public boolean isMutable();
|
||||
|
||||
/**
|
||||
* Is this an inline function
|
||||
*/
|
||||
@Override
|
||||
* Does this function have the mutable storage class specifier
|
||||
*/
|
||||
public boolean isMutable();
|
||||
|
||||
/**
|
||||
* Is this an inline function
|
||||
*/
|
||||
@Override
|
||||
public boolean isInline();
|
||||
|
||||
/**
|
||||
* Returns whether this function is declared as extern "C".
|
||||
* @since 5.0
|
||||
*/
|
||||
public boolean isExternC();
|
||||
|
||||
/**
|
||||
* Returns the exception specification for this function or <code>null</code> if there
|
||||
* is no exception specification.
|
||||
* @since 5.1
|
||||
*/
|
||||
public IType[] getExceptionSpecification();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
||||
/**
|
||||
* Returns whether this function is declared as extern "C".
|
||||
* @since 5.0
|
||||
*/
|
||||
public boolean isExternC();
|
||||
|
||||
/**
|
||||
* Returns the exception specification for this function or <code>null</code> if there
|
||||
* is no exception specification.
|
||||
* @since 5.1
|
||||
*/
|
||||
@Override
|
||||
public IType[] getExceptionSpecification();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @since 5.1
|
||||
*/
|
||||
@Override
|
||||
public ICPPFunctionType getType();
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* @since 5.2
|
||||
*/
|
||||
@Override
|
||||
@Override
|
||||
public ICPPParameter[] getParameters();
|
||||
|
||||
/**
|
||||
* @since 5.2
|
||||
*/
|
||||
public int getRequiredArgumentCount();
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* @since 5.2
|
||||
*/
|
||||
public boolean hasParameterPack();
|
||||
public int getRequiredArgumentCount();
|
||||
|
||||
/**
|
||||
* @since 5.2
|
||||
*/
|
||||
public boolean hasParameterPack();
|
||||
|
||||
/**
|
||||
* Returns whether this is a function with a deleted function definition.
|
||||
|
|
|
@ -6,10 +6,11 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
||||
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
@ -42,9 +43,7 @@ public class ObjectMap extends ObjectTable<Object> {
|
|||
@Override
|
||||
final public void clear() {
|
||||
super.clear();
|
||||
for(int i = 0; i < valueTable.length; i++) {
|
||||
valueTable[i] = null;
|
||||
}
|
||||
Arrays.fill(valueTable, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -417,8 +417,9 @@ public abstract class ASTTranslationUnit extends ASTNode implements IASTTranslat
|
|||
copy.fForContentAssist = fForContentAssist;
|
||||
copy.fOriginatingTranslationUnit = fOriginatingTranslationUnit;
|
||||
|
||||
for (IASTDeclaration declaration : getDeclarations())
|
||||
for (IASTDeclaration declaration : getDeclarations()) {
|
||||
copy.addDeclaration(declaration == null ? null : declaration.copy(style));
|
||||
}
|
||||
|
||||
copy.setOffsetAndLength(this);
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ public class Value implements IValue {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a value object representing the given boolean value.
|
||||
* Creates a value object representing the given boolean value.
|
||||
*/
|
||||
public static IValue create(boolean value) {
|
||||
return create(value ? 1 : 0);
|
||||
|
@ -357,7 +357,7 @@ public class Value implements IValue {
|
|||
}
|
||||
/**
|
||||
* Tests whether the value is a template parameter (or a parameter pack).
|
||||
*
|
||||
*
|
||||
* @return the parameter id of the parameter, or <code>-1</code> if it is not a template
|
||||
* parameter.
|
||||
*/
|
||||
|
|
|
@ -263,7 +263,7 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
|
|||
if (image.length > 1 && image[0] == 'L')
|
||||
return Value.create(ExpressionEvaluator.getChar(image, 2));
|
||||
return Value.create(ExpressionEvaluator.getChar(image, 1));
|
||||
} catch (EvalException e1) {
|
||||
} catch (EvalException e) {
|
||||
return Value.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
|
|||
private IValue createIntValue() {
|
||||
try {
|
||||
return Value.create(ExpressionEvaluator.getNumber(getValue()));
|
||||
} catch (EvalException e1) {
|
||||
} catch (EvalException e) {
|
||||
return Value.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,5 +19,4 @@ public class CPPConstructor extends CPPMethod implements ICPPConstructor {
|
|||
public CPPConstructor(ICPPASTFunctionDeclarator declarator) {
|
||||
super(declarator);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Niefer (IBM) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Niefer (IBM) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
|
@ -28,7 +28,8 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
|||
public class CPPFunctionInstance extends CPPFunctionSpecialization implements ICPPTemplateInstance {
|
||||
private final ICPPTemplateArgument[] fArguments;
|
||||
|
||||
public CPPFunctionInstance(ICPPFunction orig, IBinding owner, CPPTemplateParameterMap argMap, ICPPTemplateArgument[] args, ICPPFunctionType type, IType[] exceptionSpecs) {
|
||||
public CPPFunctionInstance(ICPPFunction orig, IBinding owner, CPPTemplateParameterMap argMap,
|
||||
ICPPTemplateArgument[] args, ICPPFunctionType type, IType[] exceptionSpecs) {
|
||||
super(orig, owner, argMap, type, exceptionSpecs);
|
||||
fArguments = args;
|
||||
}
|
||||
|
@ -73,11 +74,11 @@ public class CPPFunctionInstance extends CPPFunctionSpecialization implements IC
|
|||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if( (obj instanceof ICPPTemplateInstance) && (obj instanceof ICPPFunction)){
|
||||
final ICPPTemplateInstance inst = (ICPPTemplateInstance)obj;
|
||||
ICPPFunctionType ct1= ((ICPPFunction)getSpecializedBinding()).getType();
|
||||
ICPPFunctionType ct2= ((ICPPFunction)inst.getTemplateDefinition()).getType();
|
||||
if(!ct1.isSameType(ct2))
|
||||
if ((obj instanceof ICPPTemplateInstance) && (obj instanceof ICPPFunction)) {
|
||||
final ICPPTemplateInstance inst = (ICPPTemplateInstance) obj;
|
||||
ICPPFunctionType ct1= ((ICPPFunction) getSpecializedBinding()).getType();
|
||||
ICPPFunctionType ct2= ((ICPPFunction) inst.getTemplateDefinition()).getType();
|
||||
if (!ct1.isSameType(ct2))
|
||||
return false;
|
||||
|
||||
return CPPTemplates.haveSameArguments(this, inst);
|
||||
|
|
|
@ -183,10 +183,10 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
|||
|
||||
protected ICPPASTDeclSpecifier getDeclSpecifier(IASTDeclaration decl) {
|
||||
if (decl instanceof IASTSimpleDeclaration) {
|
||||
return (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration)decl).getDeclSpecifier();
|
||||
return (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration) decl).getDeclSpecifier();
|
||||
}
|
||||
if (decl instanceof IASTFunctionDefinition) {
|
||||
return (ICPPASTDeclSpecifier) ((IASTFunctionDefinition)decl).getDeclSpecifier();
|
||||
return (ICPPASTDeclSpecifier) ((IASTFunctionDefinition) decl).getDeclSpecifier();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Niefer (IBM) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Niefer (IBM) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
|
@ -29,8 +29,7 @@ import org.eclipse.cdt.core.parser.util.ObjectMap;
|
|||
*/
|
||||
public class CPPFunctionTemplateSpecialization extends CPPFunctionSpecialization
|
||||
implements ICPPFunctionTemplate, ICPPInternalTemplate {
|
||||
|
||||
private ObjectMap instances = null;
|
||||
private ObjectMap instances;
|
||||
|
||||
public CPPFunctionTemplateSpecialization(ICPPFunction original, ICPPClassType owner, ICPPTemplateParameterMap argumentMap, ICPPFunctionType type, IType[] exceptionSpecs) {
|
||||
super(original, owner, argumentMap, type, exceptionSpecs);
|
||||
|
|
|
@ -23,16 +23,14 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
|||
*/
|
||||
public class CPPMethodInstance extends CPPFunctionInstance implements ICPPMethod {
|
||||
|
||||
public CPPMethodInstance(ICPPMethod orig, ICPPClassType owner, CPPTemplateParameterMap tpmap, ICPPTemplateArgument[] args, ICPPFunctionType type, IType[] exceptionSpecs) {
|
||||
public CPPMethodInstance(ICPPMethod orig, ICPPClassType owner, CPPTemplateParameterMap tpmap,
|
||||
ICPPTemplateArgument[] args, ICPPFunctionType type, IType[] exceptionSpecs) {
|
||||
super(orig, owner, tpmap, args, type, exceptionSpecs);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMember#getVisibility()
|
||||
*/
|
||||
@Override
|
||||
public int getVisibility() {
|
||||
return ((ICPPMethod)getTemplateDefinition()).getVisibility();
|
||||
return ((ICPPMethod) getTemplateDefinition()).getVisibility();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,20 +38,14 @@ public class CPPMethodInstance extends CPPFunctionInstance implements ICPPMethod
|
|||
return (ICPPClassType) getOwner();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual()
|
||||
*/
|
||||
@Override
|
||||
public boolean isVirtual() {
|
||||
return ((ICPPMethod)getTemplateDefinition()).isVirtual();
|
||||
return ((ICPPMethod) getTemplateDefinition()).isVirtual();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isPureVirtual()
|
||||
*/
|
||||
@Override
|
||||
public boolean isPureVirtual() {
|
||||
return ((ICPPMethod)getTemplateDefinition()).isPureVirtual();
|
||||
return ((ICPPMethod) getTemplateDefinition()).isPureVirtual();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -61,9 +53,6 @@ public class CPPMethodInstance extends CPPFunctionInstance implements ICPPMethod
|
|||
return ((ICPPMethod) getTemplateDefinition()).isExplicit();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
|
||||
*/
|
||||
@Override
|
||||
public boolean isDestructor() {
|
||||
char[] name = getNameCharArray();
|
||||
|
@ -80,11 +69,11 @@ public class CPPMethodInstance extends CPPFunctionInstance implements ICPPMethod
|
|||
|
||||
@Override
|
||||
public boolean isOverride() {
|
||||
return ((ICPPMethod)getTemplateDefinition()).isOverride();
|
||||
return ((ICPPMethod) getTemplateDefinition()).isOverride();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinal() {
|
||||
return ((ICPPMethod)getTemplateDefinition()).isFinal();
|
||||
return ((ICPPMethod) getTemplateDefinition()).isFinal();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
|
|
|
@ -3041,8 +3041,10 @@ public class CPPSemantics {
|
|||
if (type == null)
|
||||
return null;
|
||||
|
||||
ICPPEvaluation[] args = {new EvalFixed(type, LVALUE, Value.UNKNOWN),
|
||||
((ICPPASTExpression) expr.getOperand()).getEvaluation()};
|
||||
ICPPEvaluation[] args = {
|
||||
new EvalFixed(type, LVALUE, Value.UNKNOWN),
|
||||
((ICPPASTExpression) expr.getOperand()).getEvaluation()
|
||||
};
|
||||
return findOverloadedOperator(expr, args, type, op, LookupMode.GLOBALS_IF_NO_MEMBERS);
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ public class EvalFunctionCall extends CPPEvaluation {
|
|||
if (isTypeDependent())
|
||||
return null;
|
||||
|
||||
IType t= SemanticUtil.getNestedType(fArguments[0].getTypeOrFunctionSet(point), TDEF|REF|CVTYPE);
|
||||
IType t= SemanticUtil.getNestedType(fArguments[0].getTypeOrFunctionSet(point), TDEF | REF | CVTYPE);
|
||||
if (t instanceof ICPPClassType) {
|
||||
return CPPSemantics.findOverloadedOperator(point, fArguments, t, OverloadableOperator.PAREN, LookupMode.NO_GLOBALS);
|
||||
}
|
||||
|
@ -118,9 +118,8 @@ public class EvalFunctionCall extends CPPEvaluation {
|
|||
if (overload != null)
|
||||
return ExpressionTypes.typeFromFunctionCall(overload);
|
||||
|
||||
|
||||
final ICPPEvaluation arg0 = fArguments[0];
|
||||
IType t= SemanticUtil.getNestedType(arg0.getTypeOrFunctionSet(point), TDEF|REF|CVTYPE);
|
||||
IType t= SemanticUtil.getNestedType(arg0.getTypeOrFunctionSet(point), TDEF | REF | CVTYPE);
|
||||
if (t instanceof ICPPClassType) {
|
||||
return ProblemType.UNKNOWN_FOR_EXPRESSION;
|
||||
}
|
||||
|
|
|
@ -175,8 +175,9 @@ public class EvalMemberAccess extends CPPEvaluation {
|
|||
* examine for type information.
|
||||
*/
|
||||
|
||||
ICPPEvaluation[] args= {new EvalFixed(type, LVALUE, Value.UNKNOWN)};
|
||||
ICPPFunction op= CPPSemantics.findOverloadedOperator(point, args, classType, OverloadableOperator.ARROW, LookupMode.NO_GLOBALS);
|
||||
ICPPEvaluation[] args= { new EvalFixed(type, LVALUE, Value.UNKNOWN) };
|
||||
ICPPFunction op= CPPSemantics.findOverloadedOperator(point, args, classType,
|
||||
OverloadableOperator.ARROW, LookupMode.NO_GLOBALS);
|
||||
if (op == null)
|
||||
break;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.c;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.c;
|
||||
|
||||
|
@ -24,28 +24,28 @@ class CompositeCParameter extends CompositeCBinding implements IParameter {
|
|||
|
||||
@Override
|
||||
public IType getType() {
|
||||
IType rtype = ((IParameter)rbinding).getType();
|
||||
IType rtype = ((IParameter) rbinding).getType();
|
||||
return cf.getCompositeType(rtype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAuto() {
|
||||
return ((IParameter)rbinding).isAuto();
|
||||
return ((IParameter) rbinding).isAuto();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExtern() {
|
||||
return ((IParameter)rbinding).isExtern();
|
||||
return ((IParameter) rbinding).isExtern();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRegister() {
|
||||
return ((IParameter)rbinding).isRegister();
|
||||
return ((IParameter) rbinding).isRegister();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStatic() {
|
||||
return ((IParameter)rbinding).isStatic();
|
||||
return ((IParameter) rbinding).isStatic();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.c;
|
||||
|
||||
|
@ -24,18 +24,18 @@ class CompositeCVariable extends CompositeCBinding implements IVariable {
|
|||
|
||||
@Override
|
||||
public IType getType() {
|
||||
IType rtype = ((IVariable)rbinding).getType();
|
||||
IType rtype = ((IVariable) rbinding).getType();
|
||||
return cf.getCompositeType(rtype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAuto() {
|
||||
return ((IVariable)rbinding).isAuto();
|
||||
return ((IVariable) rbinding).isAuto();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExtern() {
|
||||
return ((IVariable)rbinding).isExtern();
|
||||
return ((IVariable) rbinding).isExtern();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,11 +45,11 @@ class CompositeCVariable extends CompositeCBinding implements IVariable {
|
|||
|
||||
@Override
|
||||
public boolean isStatic() {
|
||||
return ((IVariable)rbinding).isStatic();
|
||||
return ((IVariable) rbinding).isStatic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IValue getInitialValue() {
|
||||
return ((IVariable)rbinding).getInitialValue();
|
||||
return ((IVariable) rbinding).getInitialValue();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
|
@ -25,42 +25,42 @@ class CompositeCPPVariable extends CompositeCPPBinding implements ICPPVariable {
|
|||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return ((ICPPVariable)rbinding).isMutable();
|
||||
return ((ICPPVariable) rbinding).isMutable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExternC() {
|
||||
return ((ICPPVariable)rbinding).isExternC();
|
||||
return ((ICPPVariable) rbinding).isExternC();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IType getType() {
|
||||
IType rtype = ((ICPPVariable)rbinding).getType();
|
||||
IType rtype = ((ICPPVariable) rbinding).getType();
|
||||
return cf.getCompositeType(rtype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAuto() {
|
||||
return ((ICPPVariable)rbinding).isAuto();
|
||||
return ((ICPPVariable) rbinding).isAuto();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExtern() {
|
||||
return ((ICPPVariable)rbinding).isExtern();
|
||||
return ((ICPPVariable) rbinding).isExtern();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRegister() {
|
||||
return ((ICPPVariable)rbinding).isRegister();
|
||||
return ((ICPPVariable) rbinding).isRegister();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStatic() {
|
||||
return ((ICPPVariable)rbinding).isStatic();
|
||||
return ((ICPPVariable) rbinding).isStatic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IValue getInitialValue() {
|
||||
return ((ICPPVariable)rbinding).getInitialValue();
|
||||
return ((ICPPVariable) rbinding).getInitialValue();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*******************************************************************************
|
||||
* 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
|
||||
* 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:
|
||||
* Contributors:
|
||||
* IBM Corporation - initial implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Bryan Wilkinson (QNX) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
|
||||
|
@ -73,9 +73,9 @@ public class ExpressionEvaluator {
|
|||
if (LA() == IToken.tQUESTION) {
|
||||
consume();
|
||||
long r2 = expression();
|
||||
if (LA() == IToken.tCOLON)
|
||||
if (LA() == IToken.tCOLON) {
|
||||
consume();
|
||||
else {
|
||||
} else {
|
||||
throw new EvalException(IProblem.SCANNER_BAD_CONDITIONAL_EXPRESSION, null);
|
||||
}
|
||||
long r3 = conditionalExpression();
|
||||
|
@ -139,11 +139,12 @@ public class ExpressionEvaluator {
|
|||
for (int t = LA(); t == IToken.tEQUAL || t == IToken.tNOTEQUAL; t = LA()) {
|
||||
consume();
|
||||
long r2 = relationalExpression();
|
||||
if (t == IToken.tEQUAL)
|
||||
if (t == IToken.tEQUAL) {
|
||||
r1 = (r1 == r2) ? 1 : 0;
|
||||
else
|
||||
} else {
|
||||
// t == tNOTEQUAL
|
||||
r1 = (r1 != r2) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
return r1;
|
||||
}
|
||||
|
@ -179,11 +180,12 @@ public class ExpressionEvaluator {
|
|||
for (int t = LA(); t == IToken.tSHIFTL || t == IToken.tSHIFTR; t = LA()) {
|
||||
consume();
|
||||
long r2 = additiveExpression();
|
||||
if (t == IToken.tSHIFTL)
|
||||
if (t == IToken.tSHIFTL) {
|
||||
r1 = r1 << r2;
|
||||
else
|
||||
} else {
|
||||
// t == tSHIFTR
|
||||
r1 = r1 >> r2;
|
||||
}
|
||||
}
|
||||
return r1;
|
||||
}
|
||||
|
@ -193,11 +195,12 @@ public class ExpressionEvaluator {
|
|||
for (int t = LA(); t == IToken.tPLUS || t == IToken.tMINUS; t = LA()) {
|
||||
consume();
|
||||
long r2 = multiplicativeExpression();
|
||||
if (t == IToken.tPLUS)
|
||||
if (t == IToken.tPLUS) {
|
||||
r1 = r1 + r2;
|
||||
else
|
||||
} else {
|
||||
// t == tMINUS
|
||||
r1 = r1 - r2;
|
||||
}
|
||||
}
|
||||
return r1;
|
||||
}
|
||||
|
@ -207,13 +210,14 @@ public class ExpressionEvaluator {
|
|||
for (int t = LA(); t == IToken.tSTAR || t == IToken.tDIV || t == IToken.tMOD; t = LA()) {
|
||||
consume();
|
||||
long r2 = unaryExpression();
|
||||
if (t == IToken.tSTAR)
|
||||
if (t == IToken.tSTAR) {
|
||||
r1 = r1 * r2;
|
||||
else if (r2 != 0) {
|
||||
if (t == IToken.tDIV)
|
||||
} else if (r2 != 0) {
|
||||
if (t == IToken.tDIV) {
|
||||
r1 = r1 / r2;
|
||||
else
|
||||
} else {
|
||||
r1 = r1 % r2; //tMOD
|
||||
}
|
||||
} else {
|
||||
throw new EvalException(IProblem.SCANNER_DIVIDE_BY_ZERO, null);
|
||||
}
|
||||
|
@ -328,7 +332,7 @@ public class ExpressionEvaluator {
|
|||
}
|
||||
|
||||
long getValue(Token t) throws EvalException {
|
||||
switch(t.getType()) {
|
||||
switch (t.getType()) {
|
||||
case IToken.tCHAR:
|
||||
return getChar(t.getCharImage(), 1);
|
||||
case IToken.tLCHAR:
|
||||
|
@ -386,7 +390,7 @@ public class ExpressionEvaluator {
|
|||
}
|
||||
|
||||
public static long getChar(char[] tokenImage, int i) throws EvalException {
|
||||
if (i>=tokenImage.length) {
|
||||
if (i >= tokenImage.length) {
|
||||
throw new EvalException(IProblem.SCANNER_BAD_CHARACTER, tokenImage);
|
||||
}
|
||||
final char c= tokenImage[i];
|
||||
|
@ -398,7 +402,7 @@ public class ExpressionEvaluator {
|
|||
throw new EvalException(IProblem.SCANNER_BAD_CHARACTER, tokenImage);
|
||||
}
|
||||
final char d= tokenImage[i];
|
||||
switch(d) {
|
||||
switch (d) {
|
||||
case '\\': case '"': case '\'':
|
||||
return d;
|
||||
case 'a': return 7;
|
||||
|
@ -433,7 +437,7 @@ public class ExpressionEvaluator {
|
|||
result= result*base + digit;
|
||||
}
|
||||
for (; i < to; i++) {
|
||||
switch(tokenImage[i]) {
|
||||
switch (tokenImage[i]) {
|
||||
case 'u' : case 'l': case 'U': case 'L':
|
||||
break;
|
||||
default:
|
||||
|
@ -444,13 +448,13 @@ public class ExpressionEvaluator {
|
|||
}
|
||||
|
||||
private static int getDigit(char c) {
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
|
||||
return c-'0';
|
||||
return c - '0';
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
||||
return c-'a' + 10;
|
||||
return c - 'a' + 10;
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||
return c-'A'+10;
|
||||
return c - 'A' + 10;
|
||||
}
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import org.eclipse.cdt.internal.core.index.IWritableIndex;
|
|||
|
||||
/**
|
||||
* Write lock on the index that can be yielded temporarily to unblock threads that need
|
||||
* read access to the index.
|
||||
* read access to the index.
|
||||
* @since 5.2
|
||||
*/
|
||||
public class YieldableIndexLock {
|
||||
|
@ -30,7 +30,7 @@ public class YieldableIndexLock {
|
|||
|
||||
/**
|
||||
* Acquires the lock.
|
||||
*
|
||||
*
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void acquire() throws InterruptedException {
|
||||
|
@ -51,7 +51,7 @@ public class YieldableIndexLock {
|
|||
|
||||
/**
|
||||
* Yields the lock temporarily if it was held for YIELD_INTERVAL or more, and somebody is waiting
|
||||
* for a read lock.
|
||||
* for a read lock.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void yield() throws InterruptedException {
|
||||
|
@ -64,7 +64,7 @@ public class YieldableIndexLock {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return Total time the lock was held in milliseconds.
|
||||
* @return Total time the lock was held in milliseconds.
|
||||
*/
|
||||
public long getCumulativeLockTime() {
|
||||
return cumulativeLockTime;
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Doug Schaefer (QNX) - Initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Doug Schaefer (QNX) - Initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
||||
|
||||
|
@ -31,15 +31,14 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* Binding for a function parameter in the index.
|
||||
*/
|
||||
final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBinding {
|
||||
|
||||
private static final int NEXT_PARAM = PDOMNamedNode.RECORD_SIZE;
|
||||
private static final int FLAG_OFFSET = NEXT_PARAM + Database.PTR_SIZE;
|
||||
private static final int FLAG_OFFSET = NEXT_PARAM + Database.PTR_SIZE;
|
||||
@SuppressWarnings("hiding")
|
||||
public static final int RECORD_SIZE = FLAG_OFFSET + 1;
|
||||
static {
|
||||
assert RECORD_SIZE <= 22; // 23 would yield a 32-byte block
|
||||
}
|
||||
|
||||
|
||||
private final IType fType;
|
||||
public PDOMCParameter(PDOMLinkage linkage, long record, IType type) {
|
||||
super(linkage, record);
|
||||
|
@ -50,7 +49,7 @@ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBin
|
|||
throws CoreException {
|
||||
super(linkage, parent, param.getNameCharArray());
|
||||
fType= null; // this constructor is used for adding parameters to the database, only.
|
||||
|
||||
|
||||
Database db = getDB();
|
||||
|
||||
db.putRecPtr(record + NEXT_PARAM, 0);
|
||||
|
@ -67,7 +66,7 @@ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBin
|
|||
public int getNodeType() {
|
||||
return IIndexCBindingConstants.CPARAMETER;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IType getType() {
|
||||
return fType;
|
||||
|
@ -75,13 +74,13 @@ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBin
|
|||
|
||||
@Override
|
||||
public boolean isAuto() {
|
||||
byte flag = 1<<PDOMCAnnotation.AUTO_OFFSET;
|
||||
byte flag = 1 << PDOMCAnnotation.AUTO_OFFSET;
|
||||
return hasFlag(flag, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRegister() {
|
||||
byte flag = 1<<PDOMCAnnotation.REGISTER_OFFSET;
|
||||
byte flag = 1 << PDOMCAnnotation.REGISTER_OFFSET;
|
||||
return hasFlag(flag, false);
|
||||
}
|
||||
|
||||
|
@ -137,15 +136,14 @@ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBin
|
|||
public int getBindingConstant() {
|
||||
return getNodeType();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void delete(PDOMLinkage linkage) throws CoreException {
|
||||
PDOMCParameter p= this;
|
||||
for (;;) {
|
||||
long rec = p.getNextPtr();
|
||||
p.flatDelete(linkage);
|
||||
if (rec == 0)
|
||||
if (rec == 0)
|
||||
return;
|
||||
p= new PDOMCParameter(linkage, rec, null);
|
||||
}
|
||||
|
@ -153,8 +151,8 @@ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBin
|
|||
|
||||
private void flatDelete(PDOMLinkage linkage) throws CoreException {
|
||||
super.delete(linkage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public long getNextPtr() throws CoreException {
|
||||
long rec = getDB().getRecPtr(record + NEXT_PARAM);
|
||||
return rec;
|
||||
|
@ -164,7 +162,7 @@ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBin
|
|||
public boolean isFileLocal() throws CoreException {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIndexFile getLocalToFile() throws CoreException {
|
||||
return null;
|
||||
|
@ -192,8 +190,7 @@ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBin
|
|||
}
|
||||
return defValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isExtern() {
|
||||
return false;
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
|
@ -32,7 +32,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* Result of instantiating a class template.
|
||||
*/
|
||||
class PDOMCPPClassInstance extends PDOMCPPClassSpecialization implements ICPPTemplateInstance {
|
||||
|
||||
private static final int ARGUMENTS = PDOMCPPClassSpecialization.RECORD_SIZE + 0;
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,38 +42,36 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
private static final short ANNOT_IS_DELETED = 9;
|
||||
|
||||
/**
|
||||
* Offset of total number of function parameters (relative to the
|
||||
* beginning of the record).
|
||||
* Offset of total number of function parameters (relative to the beginning of the record).
|
||||
*/
|
||||
private static final int NUM_PARAMS = PDOMCPPBinding.RECORD_SIZE;
|
||||
|
||||
/**
|
||||
* Offset of pointer to the first parameter of this function (relative to
|
||||
* the beginning of the record).
|
||||
* Offset of pointer to the first parameter of this function (relative to the beginning of the record).
|
||||
*/
|
||||
private static final int FIRST_PARAM = NUM_PARAMS + 4;
|
||||
|
||||
|
||||
/**
|
||||
* Offset of pointer to the function type record of this function (relative to
|
||||
* the beginning of the record).
|
||||
* Offset of pointer to the function type record of this function (relative to the beginning of the
|
||||
* record).
|
||||
*/
|
||||
protected static final int FUNCTION_TYPE= FIRST_PARAM + Database.PTR_SIZE;
|
||||
|
||||
protected static final int FUNCTION_TYPE = FIRST_PARAM + Database.PTR_SIZE;
|
||||
|
||||
/**
|
||||
* Offset of hash of parameter information to allow fast comparison
|
||||
*/
|
||||
private static final int SIGNATURE_HASH = FUNCTION_TYPE + Database.TYPE_SIZE;
|
||||
|
||||
|
||||
/**
|
||||
* Offset of start of exception specifications
|
||||
*/
|
||||
protected static final int EXCEPTION_SPEC = SIGNATURE_HASH + 4; // int
|
||||
|
||||
|
||||
/**
|
||||
* Offset of annotation information (relative to the beginning of the record).
|
||||
*/
|
||||
private static final int ANNOTATION = EXCEPTION_SPEC + Database.PTR_SIZE; // short
|
||||
|
||||
|
||||
private static final int REQUIRED_ARG_COUNT = ANNOTATION + 2;
|
||||
|
||||
/**
|
||||
|
@ -82,13 +80,14 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
@SuppressWarnings("hiding")
|
||||
protected static final int RECORD_SIZE = REQUIRED_ARG_COUNT + 4;
|
||||
|
||||
private short fAnnotation= -1;
|
||||
private int fRequiredArgCount= -1;
|
||||
private short fAnnotation = -1;
|
||||
private int fRequiredArgCount = -1;
|
||||
private ICPPFunctionType fType; // No need for volatile, all fields of ICPPFunctionTypes are final.
|
||||
|
||||
public PDOMCPPFunction(PDOMLinkage linkage, PDOMNode parent, ICPPFunction function, boolean setTypes) throws CoreException, DOMException {
|
||||
|
||||
public PDOMCPPFunction(PDOMLinkage linkage, PDOMNode parent, ICPPFunction function,
|
||||
boolean setTypes) throws CoreException, DOMException {
|
||||
super(linkage, parent, function.getNameCharArray());
|
||||
Database db = getDB();
|
||||
Database db = getDB();
|
||||
Integer sigHash = IndexCPPSignatureUtil.getSignatureHash(function);
|
||||
getDB().putInt(record + SIGNATURE_HASH, sigHash != null ? sigHash.intValue() : 0);
|
||||
db.putShort(record + ANNOTATION, getAnnotation(function));
|
||||
|
@ -99,7 +98,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
}
|
||||
|
||||
private short getAnnotation(ICPPFunction function) {
|
||||
int annot= PDOMCPPAnnotation.encodeAnnotation(function) & 0xff;
|
||||
int annot = PDOMCPPAnnotation.encodeAnnotation(function) & 0xff;
|
||||
if (function.hasParameterPack()) {
|
||||
annot |= (1 << ANNOT_PARAMETER_PACK);
|
||||
}
|
||||
|
@ -122,39 +121,39 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
@Override
|
||||
public void update(final PDOMLinkage linkage, IBinding newBinding) throws CoreException {
|
||||
if (newBinding instanceof ICPPFunction) {
|
||||
ICPPFunction func= (ICPPFunction) newBinding;
|
||||
ICPPFunction func = (ICPPFunction) newBinding;
|
||||
ICPPFunctionType newType;
|
||||
ICPPParameter[] newParams;
|
||||
short newAnnotation;
|
||||
int newBindingRequiredArgCount;
|
||||
newType= func.getType();
|
||||
newType = func.getType();
|
||||
newParams = func.getParameters();
|
||||
newAnnotation = getAnnotation(func);
|
||||
newBindingRequiredArgCount= func.getRequiredArgumentCount();
|
||||
|
||||
fType= null;
|
||||
newBindingRequiredArgCount = func.getRequiredArgumentCount();
|
||||
|
||||
fType = null;
|
||||
linkage.storeType(record + FUNCTION_TYPE, newType);
|
||||
|
||||
PDOMCPPParameter oldParams= getFirstParameter(null);
|
||||
PDOMCPPParameter oldParams = getFirstParameter(null);
|
||||
int requiredCount;
|
||||
if (oldParams != null && hasDeclaration()) {
|
||||
int parCount= 0;
|
||||
requiredCount= 0;
|
||||
int parCount = 0;
|
||||
requiredCount = 0;
|
||||
for (ICPPParameter newPar : newParams) {
|
||||
parCount++;
|
||||
if (parCount <= newBindingRequiredArgCount && !oldParams.hasDefaultValue())
|
||||
requiredCount= parCount;
|
||||
requiredCount = parCount;
|
||||
oldParams.update(newPar);
|
||||
long next= oldParams.getNextPtr();
|
||||
long next = oldParams.getNextPtr();
|
||||
if (next == 0)
|
||||
break;
|
||||
oldParams= new PDOMCPPParameter(linkage, next, null);
|
||||
oldParams = new PDOMCPPParameter(linkage, next, null);
|
||||
}
|
||||
if (parCount < newBindingRequiredArgCount) {
|
||||
requiredCount= newBindingRequiredArgCount;
|
||||
requiredCount = newBindingRequiredArgCount;
|
||||
}
|
||||
} else {
|
||||
requiredCount= newBindingRequiredArgCount;
|
||||
requiredCount = newBindingRequiredArgCount;
|
||||
setParameters(newParams);
|
||||
if (oldParams != null) {
|
||||
oldParams.delete(linkage);
|
||||
|
@ -162,10 +161,10 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
}
|
||||
final Database db = getDB();
|
||||
db.putShort(record + ANNOTATION, newAnnotation);
|
||||
fAnnotation= newAnnotation;
|
||||
fAnnotation = newAnnotation;
|
||||
db.putInt(record + REQUIRED_ARG_COUNT, requiredCount);
|
||||
fRequiredArgCount= requiredCount;
|
||||
|
||||
fRequiredArgCount = requiredCount;
|
||||
|
||||
long oldRec = db.getRecPtr(record + EXCEPTION_SPEC);
|
||||
storeExceptionSpec(extractExceptionSpec(func));
|
||||
if (oldRec != 0) {
|
||||
|
@ -175,7 +174,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
}
|
||||
|
||||
private void storeExceptionSpec(IType[] exceptionSpec) throws CoreException {
|
||||
long typelist= PDOMCPPTypeList.putTypes(this, exceptionSpec);
|
||||
long typelist = PDOMCPPTypeList.putTypes(this, exceptionSpec);
|
||||
getDB().putRecPtr(record + EXCEPTION_SPEC, typelist);
|
||||
}
|
||||
|
||||
|
@ -183,43 +182,43 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
IType[] exceptionSpec;
|
||||
if (binding instanceof ICPPMethod && ((ICPPMethod) binding).isImplicit()) {
|
||||
// Don't store the exception specification, compute it on demand.
|
||||
exceptionSpec= null;
|
||||
exceptionSpec = null;
|
||||
} else {
|
||||
exceptionSpec= binding.getExceptionSpecification();
|
||||
exceptionSpec = binding.getExceptionSpecification();
|
||||
}
|
||||
return exceptionSpec;
|
||||
}
|
||||
|
||||
private void setParameters(ICPPParameter[] params) throws CoreException {
|
||||
final PDOMLinkage linkage = getLinkage();
|
||||
final Database db= getDB();
|
||||
final Database db = getDB();
|
||||
db.putInt(record + NUM_PARAMS, params.length);
|
||||
db.putRecPtr(record + FIRST_PARAM, 0);
|
||||
PDOMCPPParameter next= null;
|
||||
for (int i= params.length; --i >= 0;) {
|
||||
next= new PDOMCPPParameter(linkage, this, params[i], next);
|
||||
PDOMCPPParameter next = null;
|
||||
for (int i = params.length; --i >= 0;) {
|
||||
next = new PDOMCPPParameter(linkage, this, params[i], next);
|
||||
}
|
||||
db.putRecPtr(record + FIRST_PARAM, next == null ? 0 : next.getRecord());
|
||||
}
|
||||
|
||||
private void setType(ICPPFunctionType ft) throws CoreException {
|
||||
fType= null;
|
||||
fType = null;
|
||||
getLinkage().storeType(record + FUNCTION_TYPE, ft);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getSignatureHash() throws CoreException {
|
||||
return getDB().getInt(record + SIGNATURE_HASH);
|
||||
}
|
||||
|
||||
|
||||
public static int getSignatureHash(PDOMLinkage linkage, long record) throws CoreException {
|
||||
return linkage.getDB().getInt(record + SIGNATURE_HASH);
|
||||
}
|
||||
|
||||
|
||||
public PDOMCPPFunction(PDOMLinkage linkage, long bindingRecord) {
|
||||
super(linkage, bindingRecord);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getRecordSize() {
|
||||
return RECORD_SIZE;
|
||||
|
@ -229,12 +228,12 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
public int getNodeType() {
|
||||
return IIndexCPPBindingConstants.CPPFUNCTION;
|
||||
}
|
||||
|
||||
|
||||
private PDOMCPPParameter getFirstParameter(IType type) throws CoreException {
|
||||
long rec = getDB().getRecPtr(record + FIRST_PARAM);
|
||||
return rec != 0 ? new PDOMCPPParameter(getLinkage(), rec, type) : null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isInline() {
|
||||
return getBit(getAnnotation(), PDOMCAnnotation.INLINE_OFFSET);
|
||||
|
@ -244,9 +243,9 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
public int getRequiredArgumentCount() {
|
||||
if (fRequiredArgCount == -1) {
|
||||
try {
|
||||
fRequiredArgCount= getDB().getInt(record + REQUIRED_ARG_COUNT);
|
||||
fRequiredArgCount = getDB().getInt(record + REQUIRED_ARG_COUNT);
|
||||
} catch (CoreException e) {
|
||||
fRequiredArgCount= 0;
|
||||
fRequiredArgCount = 0;
|
||||
}
|
||||
}
|
||||
return fRequiredArgCount;
|
||||
|
@ -255,9 +254,9 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
final protected short getAnnotation() {
|
||||
if (fAnnotation == -1) {
|
||||
try {
|
||||
fAnnotation= getDB().getShort(record + ANNOTATION);
|
||||
fAnnotation = getDB().getShort(record + ANNOTATION);
|
||||
} catch (CoreException e) {
|
||||
fAnnotation= 0;
|
||||
fAnnotation = 0;
|
||||
}
|
||||
}
|
||||
return fAnnotation;
|
||||
|
@ -281,20 +280,20 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
@Override
|
||||
public ICPPParameter[] getParameters() {
|
||||
try {
|
||||
PDOMLinkage linkage= getLinkage();
|
||||
Database db= getDB();
|
||||
PDOMLinkage linkage = getLinkage();
|
||||
Database db = getDB();
|
||||
ICPPFunctionType ft = getType();
|
||||
IType[] ptypes= ft == null ? IType.EMPTY_TYPE_ARRAY : ft.getParameterTypes();
|
||||
|
||||
IType[] ptypes = ft == null ? IType.EMPTY_TYPE_ARRAY : ft.getParameterTypes();
|
||||
|
||||
int n = db.getInt(record + NUM_PARAMS);
|
||||
ICPPParameter[] result = new ICPPParameter[n];
|
||||
|
||||
|
||||
long next = db.getRecPtr(record + FIRST_PARAM);
|
||||
for (int i = 0; i < n && next != 0; i++) {
|
||||
IType type= i<ptypes.length ? ptypes[i] : null;
|
||||
for (int i = 0; i < n && next != 0; i++) {
|
||||
IType type = i < ptypes.length ? ptypes[i] : null;
|
||||
final PDOMCPPParameter par = new PDOMCPPParameter(linkage, next, type);
|
||||
next= par.getNextPtr();
|
||||
result[i]= par;
|
||||
next = par.getNextPtr();
|
||||
result[i] = par;
|
||||
}
|
||||
return result;
|
||||
} catch (CoreException e) {
|
||||
|
@ -304,29 +303,29 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
}
|
||||
|
||||
@Override
|
||||
public final ICPPFunctionType getType() {
|
||||
public final ICPPFunctionType getType() {
|
||||
if (fType == null) {
|
||||
try {
|
||||
fType= (ICPPFunctionType) getLinkage().loadType(record + FUNCTION_TYPE);
|
||||
fType = (ICPPFunctionType) getLinkage().loadType(record + FUNCTION_TYPE);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
fType= new ProblemFunctionType(ISemanticProblem.TYPE_NOT_PERSISTED);
|
||||
fType = new ProblemFunctionType(ISemanticProblem.TYPE_NOT_PERSISTED);
|
||||
}
|
||||
}
|
||||
return fType;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isAuto() {
|
||||
// ISO/IEC 14882:2003 7.1.1.2
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeleted() {
|
||||
return getBit(getAnnotation(), ANNOT_IS_DELETED);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isExtern() {
|
||||
return getBit(getAnnotation(), PDOMCAnnotation.EXTERN_OFFSET);
|
||||
|
@ -335,7 +334,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
@Override
|
||||
public boolean isRegister() {
|
||||
// ISO/IEC 14882:2003 7.1.1.2
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -360,24 +359,24 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
|
||||
@Override
|
||||
public Object clone() {
|
||||
throw new UnsupportedOperationException();
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int pdomCompareTo(PDOMBinding other) {
|
||||
int cmp = super.pdomCompareTo(other);
|
||||
return cmp == 0 ? compareSignatures(this, other) : cmp;
|
||||
}
|
||||
|
||||
|
||||
protected static int compareSignatures(IPDOMOverloader a, Object b) {
|
||||
if (b instanceof IPDOMOverloader) {
|
||||
IPDOMOverloader bb= (IPDOMOverloader) b;
|
||||
IPDOMOverloader bb = (IPDOMOverloader) b;
|
||||
try {
|
||||
int mySM = a.getSignatureHash();
|
||||
int otherSM = bb.getSignatureHash();
|
||||
return mySM == otherSM ? 0 : mySM < otherSM ? -1 : 1;
|
||||
} catch(CoreException ce) {
|
||||
CCorePlugin.log(ce);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
} else {
|
||||
assert false;
|
||||
|
|
|
@ -86,7 +86,7 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP
|
|||
getLinkage().storeType(record + FUNCTION_TYPE, astFt);
|
||||
}
|
||||
|
||||
ICPPFunction origAstFunc= (ICPPFunction) ((ICPPSpecialization)astFunction).getSpecializedBinding();
|
||||
ICPPFunction origAstFunc= (ICPPFunction) ((ICPPSpecialization) astFunction).getSpecializedBinding();
|
||||
ICPPParameter[] origAstParams= origAstFunc.getParameters();
|
||||
if (origAstParams.length == 0) {
|
||||
db.putInt(record + NUM_PARAMS, 0);
|
||||
|
@ -98,14 +98,14 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP
|
|||
db.putRecPtr(record + FIRST_PARAM, 0);
|
||||
PDOMCPPParameter origPar= null;
|
||||
PDOMCPPParameterSpecialization next= null;
|
||||
for (int i= length-1; i >= 0; --i) {
|
||||
for (int i= length; --i >= 0;) {
|
||||
// There may be fewer or less original parameters, because of parameter packs.
|
||||
if (i < origAstParams.length - 1) {
|
||||
// Normal case
|
||||
origPar= new PDOMCPPParameter(linkage, specialized, origAstParams[i], null);
|
||||
} else if (origPar == null) {
|
||||
// Use last parameter
|
||||
origPar= new PDOMCPPParameter(linkage, specialized, origAstParams[origAstParams.length-1], null);
|
||||
origPar= new PDOMCPPParameter(linkage, specialized, origAstParams[origAstParams.length - 1], null);
|
||||
}
|
||||
next= new PDOMCPPParameterSpecialization(linkage, this, astParams[i], origPar, next);
|
||||
}
|
||||
|
@ -205,8 +205,8 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP
|
|||
if (fType == null) {
|
||||
try {
|
||||
fType= (ICPPFunctionType) getLinkage().loadType(record + FUNCTION_TYPE);
|
||||
} catch(CoreException ce) {
|
||||
CCorePlugin.log(ce);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
fType= new ProblemFunctionType(ISemanticProblem.TYPE_NOT_PERSISTED);
|
||||
}
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP
|
|||
@Override
|
||||
public int pdomCompareTo(PDOMBinding other) {
|
||||
int cmp= super.pdomCompareTo(other);
|
||||
return cmp==0 ? PDOMCPPFunction.compareSignatures(this, other) : cmp;
|
||||
return cmp == 0 ? PDOMCPPFunction.compareSignatures(this, other) : cmp;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Doug Schaefer (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* IBM Corporation
|
||||
* Doug Schaefer (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* IBM Corporation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
|
@ -35,7 +35,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* Binding for a parameter of a c++ function in the index.
|
||||
*/
|
||||
class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBinding {
|
||||
|
||||
private static final int NEXT_PARAM = PDOMNamedNode.RECORD_SIZE;
|
||||
private static final int ANNOTATIONS = NEXT_PARAM + Database.PTR_SIZE;
|
||||
private static final int FLAGS = ANNOTATIONS + 1;
|
||||
|
@ -44,10 +43,11 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind
|
|||
static {
|
||||
assert RECORD_SIZE <= 22; // 23 would yield a 32-byte block
|
||||
}
|
||||
|
||||
|
||||
private static final byte FLAG_DEFAULT_VALUE = 0x1;
|
||||
|
||||
private final IType fType;
|
||||
|
||||
public PDOMCPPParameter(PDOMLinkage linkage, long record, IType type) {
|
||||
super(linkage, record);
|
||||
fType= type;
|
||||
|
@ -57,7 +57,7 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind
|
|||
throws CoreException {
|
||||
super(linkage, parent, param.getNameCharArray());
|
||||
fType= null; // this constructor is used for adding parameters to the database, only.
|
||||
|
||||
|
||||
Database db = getDB();
|
||||
db.putByte(record + FLAGS, param.hasDefaultValue() ? FLAG_DEFAULT_VALUE : 0);
|
||||
db.putRecPtr(record + NEXT_PARAM, next == null ? 0 : next.getRecord());
|
||||
|
@ -77,9 +77,9 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind
|
|||
db.putByte(record + FLAGS, FLAG_DEFAULT_VALUE);
|
||||
} else if (newPar.isParameterPack()) {
|
||||
db.putByte(record + FLAGS, (byte) 0);
|
||||
}
|
||||
}
|
||||
storeAnnotations(db, newPar);
|
||||
|
||||
|
||||
final char[] newName = newPar.getNameCharArray();
|
||||
if (!CharArrayUtils.equals(newName, getNameCharArray())) {
|
||||
updateName(newName);
|
||||
|
@ -95,7 +95,7 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind
|
|||
public int getNodeType() {
|
||||
return IIndexCPPBindingConstants.CPPPARAMETER;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String[] getQualifiedName() {
|
||||
return new String[] {getName()};
|
||||
|
@ -114,7 +114,7 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind
|
|||
@Override
|
||||
public boolean isMutable() {
|
||||
// ISO/IEC 14882:2003 7.1.1.8
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -125,14 +125,14 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind
|
|||
@Override
|
||||
public boolean isAuto() {
|
||||
// ISO/IEC 14882:2003 7.1.1.2
|
||||
byte flag = 1<<PDOMCAnnotation.AUTO_OFFSET;
|
||||
byte flag = 1 << PDOMCAnnotation.AUTO_OFFSET;
|
||||
return hasFlag(flag, true, ANNOTATIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExtern() {
|
||||
// ISO/IEC 14882:2003 7.1.1.5
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -143,14 +143,14 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind
|
|||
@Override
|
||||
public boolean isRegister() {
|
||||
// ISO/IEC 14882:2003 7.1.1.2
|
||||
byte flag = 1<<PDOMCAnnotation.REGISTER_OFFSET;
|
||||
byte flag = 1 << PDOMCAnnotation.REGISTER_OFFSET;
|
||||
return hasFlag(flag, true, ANNOTATIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStatic() {
|
||||
// ISO/IEC 14882:2003 7.1.1.4
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -198,12 +198,12 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind
|
|||
}
|
||||
return defValue;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIndexFragment getFragment() {
|
||||
return getPDOM();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasDefinition() throws CoreException {
|
||||
// parameter bindings do not span index fragments
|
||||
|
@ -215,7 +215,7 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind
|
|||
// parameter bindings do not span index fragments
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getBindingConstant() {
|
||||
return getNodeType();
|
||||
|
@ -227,7 +227,7 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind
|
|||
for (;;) {
|
||||
long rec = p.getNextPtr();
|
||||
p.flatDelete(linkage);
|
||||
if (rec == 0)
|
||||
if (rec == 0)
|
||||
return;
|
||||
p= new PDOMCPPParameter(linkage, rec, null);
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind
|
|||
public boolean isFileLocal() throws CoreException {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIndexFile getLocalToFile() throws CoreException {
|
||||
return null;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
|
@ -44,7 +44,7 @@ class PDOMCPPParameterSpecialization extends PDOMCPPSpecialization implements IC
|
|||
public PDOMCPPParameterSpecialization(PDOMLinkage linkage, PDOMCPPFunctionSpecialization parent, ICPPParameter astParam,
|
||||
PDOMCPPParameter original, PDOMCPPParameterSpecialization next) throws CoreException {
|
||||
super(linkage, parent, (ICPPSpecialization) astParam, original);
|
||||
fType= null; // this constructor is used for adding parameters to the database, only.
|
||||
fType= null; // This constructor is used for adding parameters to the database, only.
|
||||
|
||||
Database db = getDB();
|
||||
db.putRecPtr(record + NEXT_PARAM, next == null ? 0 : next.getRecord());
|
||||
|
@ -79,7 +79,7 @@ class PDOMCPPParameterSpecialization extends PDOMCPPSpecialization implements IC
|
|||
if (parent instanceof ICPPSpecialization && parent instanceof ICPPFunction) {
|
||||
IParameter[] pars= ((ICPPFunction) parent).getParameters();
|
||||
int parPos= -1;
|
||||
for (parPos= 0; parPos<pars.length; parPos++) {
|
||||
for (parPos= 0; parPos < pars.length; parPos++) {
|
||||
IParameter par= pars[parPos];
|
||||
if (equals(par)) {
|
||||
break;
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Doug Schaefer (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* IBM Corporation
|
||||
* Doug Schaefer (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* IBM Corporation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
|
@ -32,7 +32,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* Binding for a c++ variable in the index, serves as a base class for fields.
|
||||
*/
|
||||
class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable {
|
||||
|
||||
private static final int TYPE_OFFSET = PDOMCPPBinding.RECORD_SIZE;
|
||||
private static final int VALUE_OFFSET = TYPE_OFFSET + Database.TYPE_SIZE;
|
||||
protected static final int ANNOTATIONS = VALUE_OFFSET + Database.VALUE_SIZE; // byte
|
||||
|
|
Loading…
Add table
Reference in a new issue