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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -22,51 +22,51 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
|||
*/
|
||||
public interface ICPPFunction extends IFunction, ICPPBinding {
|
||||
/**
|
||||
* Does this function have the mutable storage class specifier
|
||||
*/
|
||||
public boolean isMutable();
|
||||
* Does this function have the mutable storage class specifier
|
||||
*/
|
||||
public boolean isMutable();
|
||||
|
||||
/**
|
||||
* Is this an inline function
|
||||
*/
|
||||
@Override
|
||||
/**
|
||||
* 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 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 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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,7 +31,6 @@ 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;
|
||||
@SuppressWarnings("hiding")
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -138,7 +137,6 @@ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBin
|
|||
return getNodeType();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void delete(PDOMLinkage linkage) throws CoreException {
|
||||
PDOMCParameter p= this;
|
||||
|
@ -193,7 +191,6 @@ 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,22 +42,20 @@ 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
|
||||
|
@ -82,11 +80,12 @@ 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();
|
||||
Integer sigHash = IndexCPPSignatureUtil.getSignatureHash(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();
|
||||
newBindingRequiredArgCount = func.getRequiredArgumentCount();
|
||||
|
||||
fType= null;
|
||||
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,9 +161,9 @@ 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));
|
||||
|
@ -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,27 +182,27 @@ 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);
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -307,10 +306,10 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
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;
|
||||
|
@ -371,13 +370,13 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
|||
|
||||
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;
|
||||
|
@ -48,6 +47,7 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind
|
|||
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;
|
||||
|
@ -125,7 +125,7 @@ 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);
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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