mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 17:25:38 +02:00
181936: fix for support for function types
This commit is contained in:
parent
16626ae5e1
commit
81eedf4bf3
46 changed files with 1265 additions and 605 deletions
|
@ -18,6 +18,8 @@ import org.eclipse.cdt.core.dom.ast.IBasicType;
|
|||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||
|
@ -48,6 +50,33 @@ public class IndexCBindingResolutionTest extends IndexBindingResolutionTestBase
|
|||
setStrategy(new SinglePDOMTestStrategy(false));
|
||||
}
|
||||
|
||||
// int (*f)(int);
|
||||
// int g(int n){return n;}
|
||||
|
||||
// void foo() {
|
||||
// f= g;
|
||||
// }
|
||||
public void testPointerToFunction() throws Exception {
|
||||
IBinding b0 = getBindingFromASTName("f= g;", 1);
|
||||
IBinding b1 = getBindingFromASTName("g;", 1);
|
||||
|
||||
assertInstance(b0, IVariable.class);
|
||||
IVariable v0= (IVariable) b0;
|
||||
assertInstance(v0.getType(), IPointerType.class);
|
||||
IPointerType p0= (IPointerType) v0.getType();
|
||||
assertInstance(p0.getType(), IFunctionType.class);
|
||||
IFunctionType f0= (IFunctionType) p0.getType();
|
||||
assertInstance(f0.getReturnType(), IBasicType.class);
|
||||
assertEquals(1, f0.getParameterTypes().length);
|
||||
assertInstance(f0.getParameterTypes()[0], IBasicType.class);
|
||||
|
||||
assertInstance(b1, IFunction.class);
|
||||
IFunctionType f1= ((IFunction)b1).getType();
|
||||
assertInstance(f1.getReturnType(), IBasicType.class);
|
||||
assertEquals(1, f1.getParameterTypes().length);
|
||||
assertInstance(f1.getParameterTypes()[0], IBasicType.class);
|
||||
}
|
||||
|
||||
// // header file
|
||||
// struct S {int x;};
|
||||
// union U {int x;};
|
||||
|
|
|
@ -27,16 +27,15 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||
import org.eclipse.cdt.core.index.IIndex;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
|
@ -61,70 +60,32 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
|||
suite.addTest(suite(ProjectWithDepProj.class));
|
||||
}
|
||||
|
||||
// // header file
|
||||
// template <class T>
|
||||
// T left(T a, T b) {
|
||||
// return a;
|
||||
// }
|
||||
// void sanity() {}
|
||||
// int (*f)(int);
|
||||
// int g(int n){return n;}
|
||||
// int g(int n, int m){ return n+m; }
|
||||
|
||||
// void foo() { sanity(); }
|
||||
// class Int {};
|
||||
// Int a,b;
|
||||
// Int c= left(a,b);
|
||||
public void testSimpleFunctionTemplate() {
|
||||
IBinding b0 = getBindingFromASTName("sanity();", 6);
|
||||
IBinding b1 = getBindingFromASTName("left(a,b)", 4);
|
||||
}
|
||||
|
||||
// //header file
|
||||
//
|
||||
// template<typename T>
|
||||
// class Foo {};
|
||||
//
|
||||
// class B {};
|
||||
//
|
||||
// template<>
|
||||
// class Foo<B> {};
|
||||
|
||||
// Foo<B> b1;
|
||||
//
|
||||
// class A {};
|
||||
//
|
||||
// template<>
|
||||
// class Foo<A> {};
|
||||
//
|
||||
// Foo<B> b2;
|
||||
public void _testClassSpecializationInHeader() {
|
||||
IBinding b1a = getBindingFromASTName("Foo<B> b1;", 3);
|
||||
IBinding b1b = getBindingFromASTNameWithRawSignature("Foo<B> b1;", "Foo<B>");
|
||||
// void foo() {
|
||||
// f= g;
|
||||
// }
|
||||
public void testPointerToFunction() throws Exception {
|
||||
IBinding b0 = getBindingFromASTName("f= g;", 1);
|
||||
IBinding b1 = getBindingFromASTName("g;", 1);
|
||||
|
||||
assertInstance(b1a, ICPPClassType.class);
|
||||
assertInstance(b1a, ICPPClassTemplate.class);
|
||||
assertInstance(b0, ICPPVariable.class);
|
||||
ICPPVariable v0= (ICPPVariable) b0;
|
||||
assertInstance(v0.getType(), IPointerType.class);
|
||||
IPointerType p0= (IPointerType) v0.getType();
|
||||
assertInstance(p0.getType(), ICPPFunctionType.class);
|
||||
ICPPFunctionType f0= (ICPPFunctionType) p0.getType();
|
||||
assertInstance(f0.getReturnType(), ICPPBasicType.class);
|
||||
assertEquals(1, f0.getParameterTypes().length);
|
||||
assertInstance(f0.getParameterTypes()[0], ICPPBasicType.class);
|
||||
|
||||
assertInstance(b1b, ICPPClassType.class);
|
||||
assertInstance(b1b, ICPPSpecialization.class);
|
||||
ICPPSpecialization b1spc= (ICPPSpecialization) b1b;
|
||||
ObjectMap b1om= b1spc.getArgumentMap();
|
||||
assertEquals(1, b1om.keyArray().length);
|
||||
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 = getBindingFromASTNameWithRawSignature("Foo<B> b2;", "Foo<B>");
|
||||
|
||||
assertInstance(b2a, ICPPClassType.class);
|
||||
assertInstance(b2a, ICPPClassTemplate.class);
|
||||
|
||||
assertInstance(b2b, ICPPClassType.class);
|
||||
assertInstance(b2b, ICPPSpecialization.class);
|
||||
ICPPSpecialization b2spc= (ICPPSpecialization) b2b;
|
||||
ObjectMap b2om= b2spc.getArgumentMap();
|
||||
assertEquals(1, b2om.keyArray().length);
|
||||
assertInstance(b2om.getAt(0), ICPPClassType.class);
|
||||
ICPPClassType b2pct= (ICPPClassType) b2om.getAt(0);
|
||||
assertEquals("B", b2pct.getName());
|
||||
assertInstance(b1, ICPPFunction.class);
|
||||
ICPPFunctionType f1= (ICPPFunctionType) ((ICPPFunction)b1).getType();
|
||||
assertInstance(f1.getReturnType(), ICPPBasicType.class);
|
||||
assertEquals(1, f1.getParameterTypes().length);
|
||||
assertInstance(f1.getParameterTypes()[0], ICPPBasicType.class);
|
||||
}
|
||||
|
||||
// // header file
|
||||
|
|
|
@ -0,0 +1,300 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.index.tests;
|
||||
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
|
||||
/**
|
||||
* Tests for exercising resolution of template bindings against IIndex
|
||||
*/
|
||||
public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBase {
|
||||
public static class SingleProject extends IndexCPPTemplateResolutionTest {
|
||||
public SingleProject() {setStrategy(new SinglePDOMTestStrategy(true));}
|
||||
}
|
||||
public static class ProjectWithDepProj extends IndexCPPTemplateResolutionTest {
|
||||
public ProjectWithDepProj() {setStrategy(new ReferencedProject(true));}
|
||||
}
|
||||
|
||||
public static void addTests(TestSuite suite) {
|
||||
suite.addTest(suite(SingleProject.class));
|
||||
suite.addTest(suite(ProjectWithDepProj.class));
|
||||
}
|
||||
|
||||
|
||||
// template<typename X>
|
||||
// void foo(X x) {}
|
||||
//
|
||||
// template<typename A, typename B>
|
||||
// void foo(A a, B b) {}
|
||||
//
|
||||
// class C1 {}; class C2 {}; class C3 {};
|
||||
|
||||
// void bar() {
|
||||
// foo<C1>(*new C1());
|
||||
// foo<C2>(*new C2());
|
||||
// foo<C3>(*new C3());
|
||||
// foo<C1,C2>(*new C1(), *new C2());
|
||||
// foo<C2,C3>(*new C2(), *new C3());
|
||||
// foo<C3,C1>(*new C3(), *new C1());
|
||||
// foo<C2,C1>(*new C2(), *new C1());
|
||||
// foo<C3,C2>(*new C3(), *new C2());
|
||||
// foo<C1,C3>(*new C1(), *new C3());
|
||||
// }
|
||||
public void testFunctionTemplateSpecializations() throws Exception {
|
||||
IBinding b0= getBindingFromASTName("foo<C1>(", 3);
|
||||
IBinding b1= getBindingFromASTName("foo<C2>(", 3);
|
||||
IBinding b2= getBindingFromASTName("foo<C3>(", 3);
|
||||
IBinding b3= getBindingFromASTName("foo<C1,C2>(", 3);
|
||||
IBinding b4= getBindingFromASTName("foo<C2,C3>(", 3);
|
||||
IBinding b5= getBindingFromASTName("foo<C3,C1>(", 3);
|
||||
IBinding b6= getBindingFromASTName("foo<C2,C1>(", 3);
|
||||
IBinding b7= getBindingFromASTName("foo<C3,C2>(", 3);
|
||||
IBinding b8= getBindingFromASTName("foo<C1,C3>(", 3);
|
||||
}
|
||||
|
||||
// class A {}; class B{}; class C {};
|
||||
//
|
||||
// template<typename T1, typename T2>
|
||||
// void foo(T1 t1, T2 t2) {} // (0)
|
||||
//
|
||||
// template<>
|
||||
// void foo(C c, A a) {} // (1)
|
||||
|
||||
// void bar() {
|
||||
// A a;
|
||||
// B b;
|
||||
// C c;
|
||||
// foo(a,b); // function instance of function template (0)
|
||||
// foo(c,a); // function specialization (1)
|
||||
// }
|
||||
public void testFunctionInstanceSpecializationsParameters() throws Exception {
|
||||
IBinding b0= getBindingFromASTName("foo(a,b)", 3);
|
||||
assertInstance(b0, ICPPFunction.class);
|
||||
assertInstance(b0, ICPPTemplateInstance.class);
|
||||
ICPPFunctionType b0type= (ICPPFunctionType) ((ICPPFunction)b0).getType();
|
||||
assertInstance(b0type.getReturnType(), ICPPBasicType.class);
|
||||
IType[] b0_ptypes= b0type.getParameterTypes();
|
||||
assertEquals(2, b0_ptypes.length);
|
||||
assertInstance(b0_ptypes[0], ICPPClassType.class);
|
||||
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);
|
||||
assertInstance(b0_am.getAt(1), ICPPClassType.class);
|
||||
assertInstance(b0_am.keyAt(0), ICPPTemplateTypeParameter.class);
|
||||
assertInstance(b0_am.keyAt(1), ICPPTemplateTypeParameter.class);
|
||||
assertEquals("T1", ((ICPPTemplateTypeParameter)b0_am.keyAt(0)).getName());
|
||||
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= (ICPPFunctionType) ((ICPPFunction)b0_spcd).getType();
|
||||
assertInstance(b0_spcd_type.getReturnType(), ICPPBasicType.class);
|
||||
IType[] b0_spcd_ptypes= b0_spcd_type.getParameterTypes();
|
||||
assertEquals(2, b0_spcd_ptypes.length);
|
||||
assertInstance(b0_spcd_ptypes[0], ICPPTemplateTypeParameter.class);
|
||||
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= (ICPPFunctionType) ((ICPPFunction)b1).getType();
|
||||
assertInstance(b1type.getReturnType(), ICPPBasicType.class);
|
||||
IType[] b1_ptypes= b1type.getParameterTypes();
|
||||
assertEquals(2, b1_ptypes.length);
|
||||
assertInstance(b1_ptypes[0], ICPPClassType.class);
|
||||
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= (ICPPFunctionType) ((ICPPFunction)b1_spcd).getType();
|
||||
assertInstance(b1_spcd_type.getReturnType(), ICPPBasicType.class);
|
||||
IType[] b1_spcd_ptypes= b1_spcd_type.getParameterTypes();
|
||||
assertEquals(2, b1_spcd_ptypes.length);
|
||||
assertInstance(b1_spcd_ptypes[0], ICPPTemplateTypeParameter.class);
|
||||
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);
|
||||
assertInstance(b1_am.keyAt(1), ICPPTemplateTypeParameter.class);
|
||||
assertInstance(b1_am.getAt(0), ICPPClassType.class);
|
||||
assertInstance(b1_am.getAt(1), ICPPClassType.class);
|
||||
assertEquals("T1", ((ICPPTemplateTypeParameter)b1_am.keyAt(0)).getName());
|
||||
assertEquals("T2", ((ICPPTemplateTypeParameter)b1_am.keyAt(1)).getName());
|
||||
assertEquals("C", ((ICPPClassType)b1_am.getAt(0)).getName());
|
||||
assertEquals("A", ((ICPPClassType)b1_am.getAt(1)).getName());
|
||||
}
|
||||
|
||||
// class A {};
|
||||
//
|
||||
// template<typename T>
|
||||
// void foo(T t) {}
|
||||
|
||||
// void bar() {
|
||||
// A a;
|
||||
// foo(a);
|
||||
// }
|
||||
public void testFunctionInstanceParameters() throws Exception {
|
||||
IBinding b0= getBindingFromASTName("foo(a)", 3);
|
||||
assertInstance(b0, ICPPTemplateInstance.class);
|
||||
assertInstance(b0, ICPPFunction.class);
|
||||
|
||||
ICPPFunction f= (ICPPFunction) b0;
|
||||
ICPPFunctionType type= (ICPPFunctionType) 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();
|
||||
assertInstance(paramSpec.getType(), ICPPTemplateTypeParameter.class);
|
||||
ICPPTemplateTypeParameter ttp= (ICPPTemplateTypeParameter) paramSpec.getType();
|
||||
assertEquals("T", ttp.getName());
|
||||
assertNull(ttp.getDefault());
|
||||
|
||||
ICPPTemplateInstance inst= (ICPPTemplateInstance) b0;
|
||||
IBinding sp= inst.getSpecializedBinding();
|
||||
assertInstance(sp, ICPPFunction.class);
|
||||
assertInstance(sp, ICPPTemplateDefinition.class);
|
||||
}
|
||||
|
||||
// //header file
|
||||
//
|
||||
// template<typename T>
|
||||
// class Foo {};
|
||||
//
|
||||
// class B {};
|
||||
//
|
||||
// template<>
|
||||
// class Foo<B> {};
|
||||
|
||||
// Foo<B> b1;
|
||||
//
|
||||
// class A {};
|
||||
//
|
||||
// template<>
|
||||
// class Foo<A> {};
|
||||
//
|
||||
// Foo<B> b2;
|
||||
public void _testClassSpecializationInHeader() {
|
||||
IBinding b1a = getBindingFromASTName("Foo<B> b1;", 3);
|
||||
IBinding b1b = getBindingFromASTNameWithRawSignature("Foo<B> b1;", "Foo<B>");
|
||||
|
||||
assertInstance(b1a, ICPPClassType.class);
|
||||
assertInstance(b1a, ICPPClassTemplate.class);
|
||||
|
||||
assertInstance(b1b, ICPPClassType.class);
|
||||
assertInstance(b1b, ICPPSpecialization.class);
|
||||
ICPPSpecialization b1spc= (ICPPSpecialization) b1b;
|
||||
ObjectMap b1om= b1spc.getArgumentMap();
|
||||
assertEquals(1, b1om.keyArray().length);
|
||||
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 = getBindingFromASTNameWithRawSignature("Foo<B> b2;", "Foo<B>");
|
||||
|
||||
assertInstance(b2a, ICPPClassType.class);
|
||||
assertInstance(b2a, ICPPClassTemplate.class);
|
||||
|
||||
assertInstance(b2b, ICPPClassType.class);
|
||||
assertInstance(b2b, ICPPSpecialization.class);
|
||||
ICPPSpecialization b2spc= (ICPPSpecialization) b2b;
|
||||
ObjectMap b2om= b2spc.getArgumentMap();
|
||||
assertEquals(1, b2om.keyArray().length);
|
||||
assertInstance(b2om.getAt(0), ICPPClassType.class);
|
||||
ICPPClassType b2pct= (ICPPClassType) b2om.getAt(0);
|
||||
assertEquals("B", b2pct.getName());
|
||||
}
|
||||
|
||||
// // header file
|
||||
// template <class T>
|
||||
// T left(T a, T b) {
|
||||
// return a;
|
||||
// }
|
||||
// void sanity() {}
|
||||
|
||||
// void foo() { sanity(); }
|
||||
// class Int {};
|
||||
// Int a,b;
|
||||
// Int c= left(a,b);
|
||||
public void testSimpleFunctionTemplate() {
|
||||
IBinding b0 = getBindingFromASTName("sanity();", 6);
|
||||
IBinding b1 = getBindingFromASTName("a,b;", 1);
|
||||
IBinding b2 = getBindingFromASTName("left(a,b)", 4);
|
||||
}
|
||||
}
|
|
@ -17,7 +17,6 @@ import junit.framework.TestSuite;
|
|||
* Test suite for the indexer tests
|
||||
*/
|
||||
public class IndexTests extends TestSuite {
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new IndexTests();
|
||||
|
||||
|
@ -32,11 +31,11 @@ public class IndexTests extends TestSuite {
|
|||
suite.addTest(IndexProviderManagerTest.suite());
|
||||
|
||||
IndexCBindingResolutionTest.addTests(suite);
|
||||
IndexCPPTemplateResolutionTest.addTests(suite);
|
||||
IndexCPPBindingResolutionTest.addTests(suite);
|
||||
IndexCBindingResolutionBugs.addTests(suite);
|
||||
IndexBindingResolutionBugs.addTests(suite);
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,9 @@ import junit.framework.Test;
|
|||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
|
@ -50,10 +53,11 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
}
|
||||
|
||||
public void setUp() throws Exception {
|
||||
cproject= CProjectHelper.createCCProject("classTemplateTests"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
cproject= CProjectHelper.createCCProject("classTemplateTests"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
setUpSections(1);
|
||||
}
|
||||
|
||||
protected void setUpSpecifics(int sections) throws Exception {
|
||||
protected void setUpSections(int sections) throws Exception {
|
||||
StringBuffer[] contents= TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
||||
for(int i=0; i<contents.length; i++) {
|
||||
|
@ -77,13 +81,56 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
|
||||
/*************************************************************************/
|
||||
|
||||
// template<typename T>
|
||||
// class Foo {};
|
||||
//
|
||||
// class A{}; class B{};
|
||||
//
|
||||
// template<>
|
||||
// class Foo<A> {};
|
||||
//
|
||||
// Foo<A> a;
|
||||
// Foo<B> b;
|
||||
public void testSpecializations() throws Exception {
|
||||
IBinding[] as= pdom.findBindings(new char[][]{{'a'}}, IndexFilter.ALL, NPM);
|
||||
IBinding[] bs= pdom.findBindings(new char[][]{{'b'}}, IndexFilter.ALL, NPM);
|
||||
|
||||
assertEquals(1, as.length);
|
||||
assertEquals(1, bs.length);
|
||||
assertInstance(as[0], ICPPVariable.class);
|
||||
assertInstance(bs[0], ICPPVariable.class);
|
||||
|
||||
ICPPVariable a= (ICPPVariable) as[0];
|
||||
ICPPVariable b= (ICPPVariable) bs[0];
|
||||
|
||||
assertInstance(a.getType(), ICPPSpecialization.class);
|
||||
assertInstance(b.getType(), ICPPSpecialization.class);
|
||||
|
||||
ICPPSpecialization asp= (ICPPSpecialization) a.getType();
|
||||
ICPPSpecialization bsp= (ICPPSpecialization) b.getType();
|
||||
|
||||
assertEquals(1, asp.getArgumentMap().size());
|
||||
assertEquals(1, bsp.getArgumentMap().size());
|
||||
|
||||
assertInstance(asp.getArgumentMap().keyAt(0), ICPPTemplateParameter.class);
|
||||
assertInstance(bsp.getArgumentMap().keyAt(0), ICPPTemplateParameter.class);
|
||||
|
||||
assertInstance(asp.getArgumentMap().getAt(0), ICPPClassType.class);
|
||||
assertInstance(bsp.getArgumentMap().getAt(0), ICPPClassType.class);
|
||||
|
||||
assertEquals("A", ((ICPPClassType) asp.getArgumentMap().getAt(0)).getName());
|
||||
assertEquals("B", ((ICPPClassType) bsp.getArgumentMap().getAt(0)).getName());
|
||||
|
||||
assertDeclarationCount(pdom, "a", 1);
|
||||
assertDeclarationCount(pdom, "b", 1);
|
||||
}
|
||||
|
||||
// template<typename C>
|
||||
// class D {
|
||||
// public:
|
||||
// int foo(C c) {return 1};
|
||||
// };
|
||||
public void testSimpleDefinition() throws Exception {
|
||||
setUpSpecifics(1);
|
||||
assertDeclarationCount(pdom, "D", 1);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {{'D'}}, IndexFilter.ALL, NPM);
|
||||
assertEquals(1, b.length);
|
||||
|
@ -103,7 +150,6 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
// int foo(C c) {return 1};
|
||||
// };
|
||||
public void testDefinition() throws Exception {
|
||||
setUpSpecifics(1);
|
||||
assertDeclarationCount(pdom, "D", 1);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {{'D'}}, IndexFilter.ALL, NPM);
|
||||
assertEquals(1, b.length);
|
||||
|
@ -130,7 +176,6 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
// int foo(C c, B b, A a) {return 1};
|
||||
// };
|
||||
public void testDefinition2() throws Exception {
|
||||
setUpSpecifics(1);
|
||||
assertDeclarationCount(pdom, "E", 1);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {{'E'}}, IndexFilter.ALL, NPM);
|
||||
assertEquals(1, b.length);
|
||||
|
@ -170,6 +215,33 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
assertEquals(0, ct.getPartialSpecializations().length);
|
||||
}
|
||||
|
||||
// template<typename T>
|
||||
// class Foo {
|
||||
// public:
|
||||
// T (*f)(T);
|
||||
// };
|
||||
//
|
||||
// class A {};
|
||||
// Foo<A> foo = *new Foo<A>();
|
||||
// void bar() {
|
||||
// foo->f(*new A());
|
||||
// }
|
||||
public void _testFunctionPointer() throws Exception {
|
||||
IIndexFragmentBinding[] bs= pdom.findBindings(new char[][] {"foo".toCharArray()}, IndexFilter.ALL, NPM);
|
||||
assertEquals(1, bs.length);
|
||||
assertInstance(bs[0], ICPPVariable.class);
|
||||
ICPPVariable var= (ICPPVariable) bs[0];
|
||||
assertInstance(var.getType(), ICPPClassType.class);
|
||||
ICPPClassType ct= (ICPPClassType) var.getType();
|
||||
assertEquals(1, ct.getFields().length);
|
||||
assertInstance(ct.getFields()[0].getType(), IPointerType.class);
|
||||
IPointerType pt= (IPointerType) ct.getFields()[0].getType();
|
||||
assertInstance(pt.getType(), IFunctionType.class);
|
||||
IFunctionType ft= (IFunctionType) pt.getType();
|
||||
assertInstance(ft.getReturnType(), ICPPClassType.class);
|
||||
assertEquals(1, ft.getParameterTypes().length);
|
||||
assertInstance(ft.getParameterTypes()[0], ICPPClassType.class);
|
||||
}
|
||||
|
||||
// template<typename C>
|
||||
// class D {
|
||||
|
@ -188,7 +260,6 @@ public class CPPClassTemplateTests extends PDOMTestBase {
|
|||
// D<N> dn;
|
||||
// D<int> dint;
|
||||
public void testExplicitInstantiation() throws Exception {
|
||||
setUpSpecifics(1);
|
||||
|
||||
{
|
||||
// template
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX - Initial implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.pdom.tests;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
|
||||
import org.eclipse.cdt.core.index.IndexFilter;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
||||
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
|
||||
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragment;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
public class CPPFunctionTemplateTests extends PDOMTestBase {
|
||||
protected PDOM pdom;
|
||||
protected ICProject cproject;
|
||||
|
||||
public static Test suite() {
|
||||
return suite(CPPFunctionTemplateTests.class);
|
||||
}
|
||||
|
||||
public void setUp() throws Exception {
|
||||
cproject= CProjectHelper.createCCProject("functionTemplateTests"+System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
|
||||
}
|
||||
|
||||
protected void setUpSections(int sections) throws Exception {
|
||||
StringBuffer[] contents= TestSourceReader.getContentsForTest(
|
||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), sections);
|
||||
for(int i=0; i<contents.length; i++) {
|
||||
IFile file= TestSourceReader.createFile(cproject.getProject(), new Path("refs.cpp"), contents[i].toString());
|
||||
}
|
||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, "true");
|
||||
IndexerPreferences.set(cproject.getProject(), IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_FAST_INDEXER);
|
||||
CCorePlugin.getIndexManager().reindex(cproject);
|
||||
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
|
||||
pdom= (PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject);
|
||||
pdom.acquireReadLock();
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
if(pdom!=null) {
|
||||
pdom.releaseReadLock();
|
||||
}
|
||||
pdom= null;
|
||||
cproject.getProject().delete(true, NPM);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
// template<typename X>
|
||||
// void foo(X x) {}
|
||||
//
|
||||
// template<typename A, typename B>
|
||||
// void foo(A a, B b) {}
|
||||
//
|
||||
// class C1 {}; class C2 {}; class C3 {};
|
||||
//
|
||||
// void bar() {
|
||||
// foo<C1>(*new C1());
|
||||
// foo<C2>(*new C2());
|
||||
// foo<C3>(*new C3());
|
||||
// foo<C1,C2>(*new C1(), *new C2());
|
||||
// foo<C2,C3>(*new C2(), *new C3());
|
||||
// foo<C3,C1>(*new C3(), *new C1());
|
||||
// foo<C2,C1>(*new C2(), *new C1());
|
||||
// foo<C3,C2>(*new C3(), *new C2());
|
||||
// foo<C1,C3>(*new C1(), *new C3());
|
||||
// }
|
||||
public void testSimpleInstantiation() throws Exception {
|
||||
setUpSections(1);
|
||||
IBinding[] bs= pdom.findBindings(new char[][]{"foo".toCharArray()}, IndexFilter.ALL, NPM);
|
||||
assertEquals(2, bs.length);
|
||||
assertInstance(bs[0], ICPPFunctionTemplate.class);
|
||||
assertInstance(bs[1], ICPPFunctionTemplate.class);
|
||||
|
||||
boolean b= ((ICPPFunctionTemplate)bs[0]).getTemplateParameters().length==1;
|
||||
ICPPFunctionTemplate fooX= (ICPPFunctionTemplate) bs[b ? 0 : 1];
|
||||
ICPPFunctionTemplate fooAB= (ICPPFunctionTemplate) bs[b ? 1 : 0];
|
||||
|
||||
assertNameCount(pdom, fooX, IIndexFragment.FIND_REFERENCES, 3);
|
||||
assertNameCount(pdom, fooAB, IIndexFragment.FIND_REFERENCES, 6);
|
||||
}
|
||||
}
|
|
@ -19,11 +19,15 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
|||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||
import org.eclipse.cdt.core.index.IIndex;
|
||||
import org.eclipse.cdt.core.index.IndexFilter;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -56,6 +60,21 @@ public class CPPFunctionTests extends PDOMTestBase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testPointerToFunctionType() throws Exception {
|
||||
assertDeclarationCount(pdom, "int2intPtr", 1);
|
||||
IIndexFragmentBinding[] b= pdom.findBindings(new char[][] {"int2intPtr".toCharArray()}, IndexFilter.ALL, NPM);
|
||||
assertEquals(1, b.length);
|
||||
assertInstance(b[0], ICPPVariable.class);
|
||||
ICPPVariable v= (ICPPVariable) b[0];
|
||||
assertInstance(v.getType(), IPointerType.class);
|
||||
IPointerType pt= (IPointerType) v.getType();
|
||||
assertInstance(pt.getType(), IFunctionType.class);
|
||||
IFunctionType ft= (IFunctionType) pt.getType();
|
||||
assertInstance(ft.getReturnType(), ICPPBasicType.class);
|
||||
assertEquals(1, ft.getParameterTypes().length);
|
||||
assertInstance(ft.getParameterTypes()[0], ICPPBasicType.class);
|
||||
}
|
||||
|
||||
public void testFunctionType() throws Exception {
|
||||
assertType(pdom, "normalDeclaration1", ICPPFunction.class);
|
||||
assertType(pdom, "normalDeclaration2", ICPPFunction.class);
|
||||
|
|
|
@ -153,7 +153,11 @@ public class PDOMTestBase extends BaseTestCase {
|
|||
} else {
|
||||
assertEquals(0, count);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void assertNameCount(PDOM pdom, IBinding binding, int options, int count) throws CoreException {
|
||||
IName[] names = pdom.findNames(binding, options);
|
||||
assertUniqueNameCount(names, count);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -215,7 +219,11 @@ public class PDOMTestBase extends BaseTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected void assertInstance(Object o, Class c) {
|
||||
assertNotNull(o);
|
||||
assertTrue("Expected "+c.getName()+" but got "+o.getClass().getName(), c.isInstance(o));
|
||||
}
|
||||
|
||||
public static Pattern[] makePatternArray(String[] args) {
|
||||
List preresult = new ArrayList();
|
||||
for(int i=0; i<args.length; i++) {
|
||||
|
|
|
@ -45,6 +45,7 @@ public class PDOMTests extends TestSuite {
|
|||
suite.addTest(CPPFunctionTests.suite());
|
||||
suite.addTest(CPPVariableTests.suite());
|
||||
suite.addTest(CPPClassTemplateTests.suite());
|
||||
suite.addTest(CPPFunctionTemplateTests.suite());
|
||||
suite.addTest(MethodTests.suite());
|
||||
suite.addTest(NamespaceTests.suite());
|
||||
|
||||
|
|
|
@ -12,6 +12,13 @@ int main() {
|
|||
b.f();
|
||||
}
|
||||
|
||||
class Z {
|
||||
public:
|
||||
Z (*f)(Z);
|
||||
};
|
||||
|
||||
Z zzz= *new Z();
|
||||
|
||||
class C {
|
||||
public:
|
||||
C(int a) {}
|
||||
|
|
|
@ -18,4 +18,7 @@ void spin() {
|
|||
normalDeclaration2();
|
||||
forwardDeclaration();
|
||||
}
|
||||
|
||||
int (*int2intPtr)(int);
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
|
@ -173,13 +174,15 @@ public class CPPClassInstance extends CPPInstance implements ICPPClassType, ICPP
|
|||
public boolean isSameType( IType type ) {
|
||||
if( type == this )
|
||||
return true;
|
||||
if( type instanceof ITypedef )
|
||||
return ((ITypedef)type).isSameType( this );
|
||||
if( type instanceof ITypedef || type instanceof IIndexType )
|
||||
return type.isSameType( this );
|
||||
if( type instanceof ICPPDeferredTemplateInstance && type instanceof ICPPClassType )
|
||||
return type.isSameType( this ); //the CPPDeferredClassInstance has some fuzziness
|
||||
|
||||
if( type instanceof ICPPTemplateInstance ){
|
||||
if( getSpecializedBinding() != ((ICPPTemplateInstance)type).getTemplateDefinition() )
|
||||
ICPPClassType ct1= (ICPPClassType) getSpecializedBinding();
|
||||
ICPPClassType ct2= (ICPPClassType) ((ICPPTemplateInstance)type).getTemplateDefinition();
|
||||
if(!ct1.isSameType(ct2))
|
||||
return false;
|
||||
|
||||
ObjectMap m1 = getArgumentMap(), m2 = ((ICPPTemplateInstance)type).getArgumentMap();
|
||||
|
@ -200,4 +203,8 @@ public class CPPClassInstance extends CPPInstance implements ICPPClassType, ICPP
|
|||
public ICPPClassType[] getNestedClasses() throws DOMException {
|
||||
return ICPPClassType.EMPTY_CLASS_ARRAY;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof ICPPClassType ? isSameType((ICPPClassType)obj) : false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
*/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||
|
@ -23,8 +24,10 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
|||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
|
||||
/**
|
||||
|
@ -155,4 +158,30 @@ public class CPPFunctionInstance extends CPPInstance implements ICPPFunction, IC
|
|||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if( (obj instanceof ICPPTemplateInstance) && (obj instanceof ICPPFunction)){
|
||||
try {
|
||||
ICPPFunctionType ct1= (ICPPFunctionType) ((ICPPFunction)getSpecializedBinding()).getType();
|
||||
ICPPFunctionType ct2= (ICPPFunctionType) ((ICPPFunction)((ICPPTemplateInstance)obj).getTemplateDefinition()).getType();
|
||||
if(!ct1.isSameType(ct2))
|
||||
return false;
|
||||
|
||||
ObjectMap m1 = getArgumentMap(), m2 = ((ICPPTemplateInstance)obj).getArgumentMap();
|
||||
if( m1 == null || m2 == null || m1.size() != m2.size())
|
||||
return false;
|
||||
for( int i = 0; i < m1.size(); i++ ){
|
||||
IType t1 = (IType) m1.getAt( i );
|
||||
IType t2 = (IType) m2.getAt( i );
|
||||
if( t1 == null || ! t1.isSameType( t2 ) )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} catch(DOMException de) {
|
||||
CCorePlugin.log(de);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
|||
import org.eclipse.cdt.core.dom.ast.IArrayType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
|
||||
public class CompositeArrayType extends CompositeType implements IArrayType, ITypeContainer {
|
||||
public class CompositeArrayType extends CompositeTypeContainer implements IArrayType, ITypeContainer {
|
||||
public CompositeArrayType(IArrayType arrayType, ICompositesFactory cf) {
|
||||
super((ITypeContainer) arrayType, cf);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
|
||||
public class CompositeFunctionType extends CompositeType implements IFunctionType, IIndexType {
|
||||
|
||||
public CompositeFunctionType(IFunctionType rtype, ICompositesFactory cf) {
|
||||
super(rtype, cf);
|
||||
}
|
||||
|
||||
public IType[] getParameterTypes() throws DOMException {
|
||||
IType[] result = ((IFunctionType)type).getParameterTypes();
|
||||
for(int i=0; i<result.length; i++) {
|
||||
result[i] = cf.getCompositeType((IIndexType)result[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public IType getReturnType() throws DOMException {
|
||||
return cf.getCompositeType((IIndexType)((IFunctionType)type).getReturnType());
|
||||
}
|
||||
|
||||
public boolean isSameType(IType other) {
|
||||
return type.isSameType(other);
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,7 @@ import org.eclipse.cdt.core.dom.ast.IPointerType;
|
|||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
|
||||
public class CompositePointerType extends CompositeType implements IPointerType, ITypeContainer {
|
||||
public class CompositePointerType extends CompositeTypeContainer implements IPointerType, ITypeContainer {
|
||||
public CompositePointerType(IPointerType pointerType, ICompositesFactory cf) throws DOMException {
|
||||
super((ITypeContainer) pointerType, cf);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.eclipse.cdt.core.dom.ast.IQualifierType;
|
|||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
|
||||
public class CompositeQualifierType extends CompositeType implements IQualifierType, ITypeContainer {
|
||||
public class CompositeQualifierType extends CompositeTypeContainer implements IQualifierType, ITypeContainer {
|
||||
public CompositeQualifierType(IQualifierType qualifierType, ICompositesFactory cf) throws DOMException {
|
||||
super((ITypeContainer) qualifierType, cf);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.cdt.core.dom.IName;
|
|||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPCompositeBinding;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
|
@ -80,6 +81,8 @@ public abstract class CompositeScope implements IIndexScope {
|
|||
);
|
||||
} else if(binding == null) {
|
||||
return null;
|
||||
} else if(binding instanceof ICPPSpecialization) {
|
||||
return binding;
|
||||
}
|
||||
CCorePlugin.log("CompositeFactory unsure how to process: "+binding.getClass().getName()); //$NON-NLS-1$
|
||||
return binding;
|
||||
|
|
|
@ -10,19 +10,17 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
|
||||
/**
|
||||
* Represents an index-contexting carrying type
|
||||
*/
|
||||
public abstract class CompositeType implements IType, IIndexType, ITypeContainer {
|
||||
protected final ITypeContainer type;
|
||||
public abstract class CompositeType implements IType, IIndexType {
|
||||
protected final IType type;
|
||||
protected final ICompositesFactory cf;
|
||||
|
||||
protected CompositeType(ITypeContainer rtype, ICompositesFactory cf) {
|
||||
protected CompositeType(IType rtype, ICompositesFactory cf) {
|
||||
this.type = rtype;
|
||||
this.cf = cf;
|
||||
}
|
||||
|
@ -38,11 +36,7 @@ public abstract class CompositeType implements IType, IIndexType, ITypeContainer
|
|||
public final void setType(IType type) {
|
||||
fail();
|
||||
}
|
||||
|
||||
public final IType getType() throws DOMException {
|
||||
return cf.getCompositeType((IIndexType)type.getType());
|
||||
}
|
||||
|
||||
|
||||
protected void fail() {
|
||||
throw new CompositingNotImplementedError("Compositing feature (for IType) not implemented"); //$NON-NLS-1$
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.index.composite;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
|
||||
public class CompositeTypeContainer extends CompositeType implements ITypeContainer {
|
||||
|
||||
protected CompositeTypeContainer(ITypeContainer rtype, ICompositesFactory cf) {
|
||||
super(rtype, cf);
|
||||
}
|
||||
|
||||
public final IType getType() throws DOMException {
|
||||
return cf.getCompositeType((IIndexType)((ITypeContainer)type).getType());
|
||||
}
|
||||
|
||||
}
|
|
@ -19,6 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
|||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||
import org.eclipse.cdt.core.dom.ast.IField;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||
import org.eclipse.cdt.core.dom.ast.IQualifierType;
|
||||
|
@ -34,6 +35,7 @@ import org.eclipse.cdt.internal.core.index.IIndexScope;
|
|||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
import org.eclipse.cdt.internal.core.index.composite.AbstractCompositeFactory;
|
||||
import org.eclipse.cdt.internal.core.index.composite.CompositeArrayType;
|
||||
import org.eclipse.cdt.internal.core.index.composite.CompositeFunctionType;
|
||||
import org.eclipse.cdt.internal.core.index.composite.CompositePointerType;
|
||||
import org.eclipse.cdt.internal.core.index.composite.CompositeQualifierType;
|
||||
import org.eclipse.cdt.internal.core.index.composite.CompositingNotImplementedError;
|
||||
|
@ -71,6 +73,8 @@ public class CCompositesFactory extends AbstractCompositeFactory implements ICom
|
|||
|
||||
if(rtype==null) {
|
||||
result = null;
|
||||
} else if(rtype instanceof IFunctionType) {
|
||||
result = new CompositeFunctionType((IFunctionType)rtype, this);
|
||||
} else if(rtype instanceof ICompositeType) {
|
||||
result = (ICompositeType) getCompositeBinding((IIndexFragmentBinding) rtype);
|
||||
} else if (rtype instanceof IEnumeration) {
|
||||
|
|
|
@ -43,33 +43,8 @@ class CompositeCFunction extends CompositeCBinding implements IIndexBinding, IFu
|
|||
}
|
||||
|
||||
public IFunctionType getType() throws DOMException {
|
||||
/* @see PDOMCFunction.getType() */
|
||||
return new IFunctionType() {
|
||||
public IType[] getParameterTypes() throws DOMException {
|
||||
IType[] preresult = ((IFunctionType)rbinding).getParameterTypes();
|
||||
IType[] result = new IType[preresult.length];
|
||||
for(int i=0; i<preresult.length; i++) {
|
||||
assert preresult!=null;
|
||||
result[i] = cf.getCompositeType((IIndexType)preresult[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public IType getReturnType() throws DOMException {
|
||||
IType type = ((IFunction)rbinding).getType().getReturnType();
|
||||
return cf.getCompositeType((IIndexType)type);
|
||||
}
|
||||
|
||||
public boolean isSameType(IType type) {
|
||||
try {
|
||||
return ((IFunction)rbinding).getType().isSameType(type);
|
||||
} catch(DOMException de) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Object clone() {fail(); return null;}
|
||||
};
|
||||
IType rtype = ((IFunction)rbinding).getType();
|
||||
return (IFunctionType) cf.getCompositeType((IIndexType)rtype);
|
||||
}
|
||||
|
||||
public boolean isAuto() throws DOMException {
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPDeferredTemplateInstance;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
|
||||
|
@ -114,6 +115,8 @@ public class CPPCompositesFactory extends AbstractCompositeFactory implements IC
|
|||
result = new CompositeCPPTypedef(this, (ICPPBinding) rtype);
|
||||
} else if (rtype instanceof IEnumeration) {
|
||||
result = (IEnumeration) getCompositeBinding((IIndexFragmentBinding) rtype);
|
||||
} else if(rtype instanceof ICPPFunctionType) {
|
||||
result = new CompositeCPPFunctionType((ICPPFunctionType) rtype, this);
|
||||
} else if(rtype instanceof ICPPPointerToMemberType) {
|
||||
result = new CompositeCPPPointerToMemberType(this, (ICPPPointerToMemberType)rtype);
|
||||
} else if(rtype instanceof IPointerType) {
|
||||
|
|
|
@ -17,12 +17,11 @@ import org.eclipse.cdt.core.dom.ast.IParameter;
|
|||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction, ICPPFunctionType, IIndexType {
|
||||
class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction {
|
||||
|
||||
public CompositeCPPFunction(ICompositesFactory cf, ICPPFunction rbinding) {
|
||||
super(cf, rbinding);
|
||||
|
@ -49,7 +48,8 @@ class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction,
|
|||
}
|
||||
|
||||
public IFunctionType getType() throws DOMException {
|
||||
return this;
|
||||
IType rtype = ((ICPPFunction)rbinding).getType();
|
||||
return (IFunctionType) cf.getCompositeType((IIndexType)rtype);
|
||||
}
|
||||
|
||||
public boolean isAuto() throws DOMException {
|
||||
|
@ -72,30 +72,6 @@ class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction,
|
|||
return ((ICPPFunction)rbinding).takesVarArgs();
|
||||
}
|
||||
|
||||
public boolean isConst() {
|
||||
return ((ICPPFunctionType)rbinding).isConst();
|
||||
}
|
||||
|
||||
public boolean isVolatile() {
|
||||
return ((ICPPFunctionType)rbinding).isVolatile();
|
||||
}
|
||||
|
||||
public IType[] getParameterTypes() throws DOMException {
|
||||
IType[] result = ((ICPPFunctionType)rbinding).getParameterTypes();
|
||||
for(int i=0; i<result.length; i++) {
|
||||
result[i] = cf.getCompositeType((IIndexType)result[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public IType getReturnType() throws DOMException {
|
||||
return cf.getCompositeType((IIndexType)((ICPPFunctionType)rbinding).getReturnType());
|
||||
}
|
||||
|
||||
public boolean isSameType(IType type) {
|
||||
return ((ICPPFunctionType)rbinding).isSameType(type);
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
fail(); return null;
|
||||
}
|
||||
|
|
|
@ -16,11 +16,10 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPFunctionSpecialization extends CompositeCPPFunction
|
||||
implements IIndexType, ICPPFunction, ICPPSpecialization {
|
||||
implements ICPPFunction, ICPPSpecialization {
|
||||
|
||||
public CompositeCPPFunctionSpecialization(ICompositesFactory cf, ICPPFunction ft) {
|
||||
super(cf, (ICPPFunction) ft);
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||
import org.eclipse.cdt.internal.core.index.composite.CompositeFunctionType;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPFunctionType extends CompositeFunctionType implements ICPPFunctionType {
|
||||
|
||||
public CompositeCPPFunctionType(ICPPFunctionType rtype,
|
||||
ICompositesFactory cf) {
|
||||
super(rtype, cf);
|
||||
}
|
||||
|
||||
public boolean isConst() {
|
||||
return ((ICPPFunctionType)type).isConst();
|
||||
}
|
||||
|
||||
public boolean isVolatile() {
|
||||
return ((ICPPFunctionType)type).isVolatile();
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
fail(); return null;
|
||||
}
|
||||
}
|
|
@ -13,10 +13,10 @@ package org.eclipse.cdt.internal.core.index.composite.cpp;
|
|||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
import org.eclipse.cdt.internal.core.index.composite.CompositeType;
|
||||
import org.eclipse.cdt.internal.core.index.composite.CompositeTypeContainer;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
class CompositeCPPReferenceType extends CompositeType implements ICPPReferenceType {
|
||||
class CompositeCPPReferenceType extends CompositeTypeContainer implements ICPPReferenceType {
|
||||
public CompositeCPPReferenceType(ICPPReferenceType referenceType, ICompositesFactory cf) throws DOMException {
|
||||
super((ITypeContainer) referenceType, cf);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
package org.eclipse.cdt.internal.core.pdom;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -59,6 +58,7 @@ import org.eclipse.cdt.internal.core.index.IndexerStateEvent;
|
|||
import org.eclipse.cdt.internal.core.index.provider.IndexProviderManager;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM.IListener;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.ChunkCache;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMProjectIndexLocationConverter;
|
||||
import org.eclipse.cdt.internal.core.pdom.indexer.DeltaAnalyzer;
|
||||
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
||||
|
@ -1036,12 +1036,12 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
|||
PDOM pdom= (PDOM) getPDOM(cproject);
|
||||
pdom.acquireWriteLock();
|
||||
try {
|
||||
File db = pdom.getDB().getLocation();
|
||||
FileChannel from = new FileInputStream(db).getChannel();
|
||||
Database db= pdom.getDB();
|
||||
db.flushDirtyChunks();
|
||||
FileChannel from= db.getChannel();
|
||||
FileChannel to = new FileOutputStream(targetLocation).getChannel();
|
||||
from.transferTo(0, from.size(), to);
|
||||
to.close();
|
||||
from.close();
|
||||
} finally {
|
||||
pdom.releaseWriteLock();
|
||||
}
|
||||
|
|
|
@ -18,22 +18,35 @@ import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
* Represents a linked list
|
||||
* Represents a linked list of PDOMNode records
|
||||
* @author Doug Schaefer
|
||||
*
|
||||
*/
|
||||
public class PDOMNodeLinkedList {
|
||||
PDOM pdom;
|
||||
int offset;
|
||||
PDOMLinkage linkage;
|
||||
private PDOM pdom;
|
||||
private int offset;
|
||||
private PDOMLinkage linkage;
|
||||
private boolean allowsNull;
|
||||
|
||||
private static final int FIRST_MEMBER = 0;
|
||||
protected static final int RECORD_SIZE = 4;
|
||||
|
||||
public PDOMNodeLinkedList(PDOM pdom, int offset, PDOMLinkage linkage) {
|
||||
public PDOMNodeLinkedList(PDOM pdom, int offset, PDOMLinkage linkage, boolean allowsNulls) {
|
||||
this.pdom = pdom;
|
||||
this.offset = offset;
|
||||
this.linkage = linkage;
|
||||
this.allowsNull = allowsNulls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an object representing a linked list at the specified offset of the specified pdom.
|
||||
* The linked list created may not hold null items
|
||||
* @param pdom
|
||||
* @param offset
|
||||
* @param linkage
|
||||
*/
|
||||
public PDOMNodeLinkedList(PDOM pdom, int offset, PDOMLinkage linkage) {
|
||||
this(pdom, offset, linkage, false);
|
||||
}
|
||||
|
||||
protected int getRecordSize() {
|
||||
|
@ -47,8 +60,17 @@ public class PDOMNodeLinkedList {
|
|||
|
||||
ListItem item = firstItem;
|
||||
do {
|
||||
PDOMNode node = linkage.getNode(item.getItem());
|
||||
if (visitor.visit(node))
|
||||
PDOMNode node;
|
||||
int record= item.getItem();
|
||||
if(record==0) {
|
||||
if(!allowsNull) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
node= null;
|
||||
} else {
|
||||
node= linkage.getNode(item.getItem());
|
||||
}
|
||||
if (visitor.visit(node) && node!=null)
|
||||
node.accept(visitor);
|
||||
visitor.leave(node);
|
||||
item = item.getNext();
|
||||
|
@ -62,17 +84,21 @@ public class PDOMNodeLinkedList {
|
|||
}
|
||||
|
||||
public void addMember(PDOMNode member) throws CoreException {
|
||||
addMember(allowsNull && member==null ? 0 : member.getRecord());
|
||||
}
|
||||
|
||||
protected void addMember(int record) throws CoreException {
|
||||
Database db = pdom.getDB();
|
||||
ListItem firstMember = getFirstMemberItem();
|
||||
if (firstMember == null) {
|
||||
firstMember = new ListItem(db);
|
||||
firstMember.setItem(member.getRecord());
|
||||
firstMember.setItem(record);
|
||||
firstMember.setNext(firstMember);
|
||||
firstMember.setPrev(firstMember);
|
||||
db.putInt(offset + FIRST_MEMBER, firstMember.getRecord());
|
||||
} else {
|
||||
ListItem newMember = new ListItem(db);
|
||||
newMember.setItem(member.getRecord());
|
||||
newMember.setItem(record);
|
||||
ListItem prevMember = firstMember.getPrev();
|
||||
prevMember.setNext(newMember);
|
||||
firstMember.setPrev(newMember);
|
||||
|
|
|
@ -268,16 +268,35 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IIndexFragmen
|
|||
}
|
||||
|
||||
public int compareTo(Object other) {
|
||||
if(other instanceof PDOMBinding) {
|
||||
PDOMBinding otherBinding = (PDOMBinding) other;
|
||||
int cmp = comparePDOMBindingQNs(this, otherBinding);
|
||||
if(cmp==0) {
|
||||
int t1 = getNodeType();
|
||||
int t2 = otherBinding.getNodeType();
|
||||
return t1 < t2 ? -1 : (t1 > t2 ? 1 : 0);
|
||||
if(other==null)
|
||||
return 1;
|
||||
|
||||
if(other instanceof IBinding) {
|
||||
if(!(other instanceof PDOMBinding)) {
|
||||
try {
|
||||
other= getLinkageImpl().adaptBinding((IBinding)other);
|
||||
} catch(CoreException ce) {
|
||||
CCorePlugin.log(ce);
|
||||
}
|
||||
}
|
||||
return cmp;
|
||||
if(other instanceof PDOMBinding) {
|
||||
PDOMBinding otherBinding = (PDOMBinding) other;
|
||||
int cmp = comparePDOMBindingQNs(this, otherBinding);
|
||||
if(cmp==0) {
|
||||
int t1 = getNodeType();
|
||||
int t2 = otherBinding.getNodeType();
|
||||
return t1 < t2 ? -1 : (t1 > t2 ? 1 : 0);
|
||||
}
|
||||
return cmp;
|
||||
}
|
||||
if(other==null)
|
||||
return 1;
|
||||
throw new PDOMNotImplementedError(""+other); //$NON-NLS-1$
|
||||
}
|
||||
throw new PDOMNotImplementedError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return compareTo(o)==0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.IString;
|
||||
|
@ -67,30 +66,4 @@ public abstract class PDOMNamedNode extends PDOMNode {
|
|||
public boolean hasName(char[] name) throws CoreException {
|
||||
return getDBName().equals(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for fetching a byte from the database.
|
||||
* @param offset Location of the byte.
|
||||
* @return a byte from the database.
|
||||
*/
|
||||
protected byte getByte(int offset) {
|
||||
try {
|
||||
return pdom.getDB().getByte(offset);
|
||||
}
|
||||
catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bit at the specified offset in a bit vector.
|
||||
* @param bitVector Bits.
|
||||
* @param offset The position of the desired bit.
|
||||
* @return the bit at the specified offset.
|
||||
*/
|
||||
protected boolean getBit(int bitVector, int offset) {
|
||||
int mask = 1 << offset;
|
||||
return (bitVector & mask) == mask;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
import org.eclipse.cdt.core.dom.IPDOMNode;
|
||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||
|
@ -118,4 +119,39 @@ public abstract class PDOMNode implements IPDOMNode {
|
|||
// nothing here
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for fetching a byte from the database.
|
||||
* @param offset Location of the byte.
|
||||
* @return a byte from the database.
|
||||
*/
|
||||
protected byte getByte(int offset) {
|
||||
try {
|
||||
return pdom.getDB().getByte(offset);
|
||||
}
|
||||
catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected int getInt(int offset) {
|
||||
try {
|
||||
return pdom.getDB().getInt(offset);
|
||||
}
|
||||
catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bit at the specified offset in a bit vector.
|
||||
* @param bitVector Bits.
|
||||
* @param offset The position of the desired bit.
|
||||
* @return the bit at the specified offset.
|
||||
*/
|
||||
protected boolean getBit(int bitVector, int offset) {
|
||||
int mask = 1 << offset;
|
||||
return (bitVector & mask) == mask;
|
||||
}
|
||||
}
|
|
@ -19,7 +19,6 @@ import org.eclipse.cdt.core.dom.ast.IFunction;
|
|||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||
|
@ -44,10 +43,10 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
|||
public static final int FIRST_PARAM = PDOMBinding.RECORD_SIZE + 4;
|
||||
|
||||
/**
|
||||
* Offset for return type of this function (relative to
|
||||
* Offset for the type of this function (relative to
|
||||
* the beginning of the record).
|
||||
*/
|
||||
private static final int RETURN_TYPE = PDOMBinding.RECORD_SIZE + 8;
|
||||
private static final int FUNCTION_TYPE = PDOMBinding.RECORD_SIZE + 8;
|
||||
|
||||
/**
|
||||
* Offset of annotation information (relative to the beginning of the
|
||||
|
@ -65,11 +64,11 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
|||
|
||||
try {
|
||||
IFunctionType ft= function.getType();
|
||||
IType rt= ft.getReturnType();
|
||||
if (rt != null) {
|
||||
PDOMNode typeNode = getLinkageImpl().addType(this, rt);
|
||||
|
||||
if (ft != null) {
|
||||
PDOMNode typeNode = getLinkageImpl().addType(this, ft);
|
||||
if (typeNode != null) {
|
||||
pdom.getDB().putInt(record + RETURN_TYPE, typeNode.getRecord());
|
||||
pdom.getDB().putInt(record + FUNCTION_TYPE, typeNode.getRecord());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,18 +115,13 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
|||
* we can't use the convenient idea of having PDOMCFunction implement
|
||||
* both the IType and IBinding subinterfaces.
|
||||
*/
|
||||
return new IFunctionType() {
|
||||
public Object clone() { fail(); return null; }
|
||||
public IType[] getParameterTypes() throws DOMException {
|
||||
return PDOMCFunction.this.getParameterTypes();
|
||||
}
|
||||
public IType getReturnType() throws DOMException {
|
||||
return PDOMCFunction.this.getReturnType();
|
||||
}
|
||||
public boolean isSameType(IType type) {
|
||||
fail(); return false;
|
||||
}
|
||||
};
|
||||
try {
|
||||
int offset= pdom.getDB().getInt(record + FUNCTION_TYPE);
|
||||
return offset==0 ? null : new PDOMCFunctionType(pdom, offset);
|
||||
} catch(CoreException ce) {
|
||||
CCorePlugin.log(ce);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isStatic() throws DOMException {
|
||||
|
@ -154,22 +148,6 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
|||
}
|
||||
}
|
||||
|
||||
public IType[] getParameterTypes() throws DOMException {
|
||||
try {
|
||||
int n = pdom.getDB().getInt(record + NUM_PARAMS);
|
||||
IType[] types = new IType[n];
|
||||
PDOMCParameter param = getFirstParameter();
|
||||
while (param != null) {
|
||||
types[--n] = param.getType();
|
||||
param = param.getNextParameter();
|
||||
}
|
||||
return types;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return new IType[0];
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAuto() throws DOMException {
|
||||
// ISO/IEC 9899:TC1 6.9.1.4
|
||||
return false;
|
||||
|
@ -188,18 +166,6 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
|||
return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.VARARGS_OFFSET);
|
||||
}
|
||||
|
||||
public IType getReturnType() throws DOMException {
|
||||
try {
|
||||
PDOMNode node = getLinkageImpl().getNode(pdom.getDB().getInt(record + RETURN_TYPE));
|
||||
if (node instanceof IType) {
|
||||
return (IType) node;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IScope getFunctionScope() throws DOMException {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,168 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX - Initial implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IPDOMNode;
|
||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public class PDOMCFunctionType extends PDOMNode implements IIndexType, IFunctionType {
|
||||
/**
|
||||
* Offset for linked list of types of parameters of this function (relative to
|
||||
* the beginning of the record).
|
||||
*/
|
||||
private static final int TYPELIST = PDOMNode.RECORD_SIZE + 0;
|
||||
|
||||
/**
|
||||
* Offset for return type of this function (relative to
|
||||
* the beginning of the record).
|
||||
*/
|
||||
private static final int RETURN_TYPE= PDOMNode.RECORD_SIZE + 4;
|
||||
|
||||
/**
|
||||
* The size in bytes of a PDOMCFunctionType record in the database.
|
||||
*/
|
||||
protected static final int RECORD_SIZE= PDOMNode.RECORD_SIZE + 8;
|
||||
|
||||
public PDOMCFunctionType(PDOM pdom, int record) {
|
||||
super(pdom, record);
|
||||
}
|
||||
|
||||
public PDOMCFunctionType(PDOM pdom, PDOMNode parent, IFunctionType type) throws CoreException {
|
||||
super(pdom, parent);
|
||||
|
||||
try {
|
||||
PDOMLinkage linkage= parent.getLinkageImpl();
|
||||
PDOMNodeLinkedList list= new PDOMNodeLinkedList(pdom, record + TYPELIST, parent.getLinkageImpl(), true);
|
||||
setReturnType(type.getReturnType());
|
||||
IType[] pt= type.getParameterTypes();
|
||||
for(int i=0; i<pt.length; i++) {
|
||||
PDOMNode typeNode;
|
||||
if(pt[i]==null || pt[i] instanceof IProblemBinding) {
|
||||
typeNode= null;
|
||||
} else {
|
||||
typeNode= linkage.addType(this, pt[i]);
|
||||
}
|
||||
list.addMember(typeNode);
|
||||
}
|
||||
} catch(DOMException de) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int getNodeType() {
|
||||
return PDOMCLinkage.CFUNCTIONTYPE;
|
||||
}
|
||||
|
||||
protected int getRecordSize() {
|
||||
return RECORD_SIZE;
|
||||
}
|
||||
|
||||
public boolean isSameType(IType type) {
|
||||
if (type instanceof ITypedef) {
|
||||
return type.isSameType(this);
|
||||
}
|
||||
|
||||
try {
|
||||
if (type instanceof IFunctionType) {
|
||||
IFunctionType ft = (IFunctionType) type;
|
||||
IType rt1= getReturnType();
|
||||
IType rt2= ft.getReturnType();
|
||||
if (rt1 != rt2) {
|
||||
if (rt1 == null || !rt1.isSameType(rt2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
IType[] params1= getParameterTypes();
|
||||
IType[] params2= ft.getParameterTypes();
|
||||
if( params1.length == 1 && params2.length == 0 ){
|
||||
if( !(params1[0] instanceof IBasicType) || ((IBasicType)params1[0]).getType() != IBasicType.t_void )
|
||||
return false;
|
||||
} else if( params2.length == 1 && params1.length == 0 ){
|
||||
if( !(params2[0] instanceof IBasicType) || ((IBasicType)params2[0]).getType() != IBasicType.t_void )
|
||||
return false;
|
||||
} else if( params1.length != params2.length ){
|
||||
return false;
|
||||
} else {
|
||||
for( int i = 0; i < params1.length; i++ ){
|
||||
if (params1[i] == null || ! params1[i].isSameType( params2[i] ) )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public IType[] getParameterTypes() throws DOMException {
|
||||
final List result= new ArrayList();
|
||||
try {
|
||||
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + TYPELIST, getLinkageImpl(), true);
|
||||
list.accept(new IPDOMVisitor(){
|
||||
public void leave(IPDOMNode node) throws CoreException {
|
||||
result.add(node);
|
||||
}
|
||||
public boolean visit(IPDOMNode node) throws CoreException {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} catch(CoreException ce) {
|
||||
CCorePlugin.log(ce);
|
||||
}
|
||||
return (IType[]) result.toArray(new IType[result.size()]);
|
||||
}
|
||||
|
||||
public IType getReturnType() throws DOMException {
|
||||
try {
|
||||
PDOMNode node = getLinkageImpl().getNode(pdom.getDB().getInt(record + RETURN_TYPE));
|
||||
if (node instanceof IType) {
|
||||
return (IType) node;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setReturnType(IType type) throws CoreException {
|
||||
PDOMNode typeNode = getLinkageImpl().addType(this, type);
|
||||
if (typeNode != null) {
|
||||
pdom.getDB().putInt(record + RETURN_TYPE, typeNode.getRecord());
|
||||
}
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
}
|
|
@ -22,6 +22,7 @@ import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
|||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||
import org.eclipse.cdt.core.dom.ast.IField;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
|
@ -69,6 +70,7 @@ class PDOMCLinkage extends PDOMLinkage {
|
|||
public static final int CTYPEDEF = PDOMLinkage.LAST_NODE_TYPE + 7;
|
||||
public static final int CPARAMETER = PDOMLinkage.LAST_NODE_TYPE + 8;
|
||||
public static final int CBASICTYPE = PDOMLinkage.LAST_NODE_TYPE + 9;
|
||||
public static final int CFUNCTIONTYPE = PDOMLinkage.LAST_NODE_TYPE + 10;
|
||||
|
||||
public PDOMBinding addBinding(IBinding binding) throws CoreException {
|
||||
PDOMBinding pdomBinding = adaptBinding(binding);
|
||||
|
@ -205,6 +207,8 @@ class PDOMCLinkage extends PDOMLinkage {
|
|||
return new PDOMCParameter(pdom, record);
|
||||
case CBASICTYPE:
|
||||
return new PDOMCBasicType(pdom, record);
|
||||
case CFUNCTIONTYPE:
|
||||
return new PDOMCFunctionType(pdom, record);
|
||||
}
|
||||
|
||||
return super.getNode(record);
|
||||
|
@ -216,6 +220,8 @@ class PDOMCLinkage extends PDOMLinkage {
|
|||
|
||||
if (type instanceof ICBasicType) {
|
||||
return new PDOMCBasicType(pdom, parent, (ICBasicType)type);
|
||||
} else if(type instanceof IFunctionType) {
|
||||
return new PDOMCFunctionType(pdom, parent, (IFunctionType)type);
|
||||
} else if (type instanceof IBinding) {
|
||||
return addBinding((IBinding)type);
|
||||
}
|
||||
|
|
|
@ -146,7 +146,9 @@ class PDOMCPPClassInstance extends PDOMCPPInstance implements
|
|||
return type.isSameType( this ); //the CPPDeferredClassInstance has some fuzziness
|
||||
|
||||
if( type instanceof ICPPTemplateInstance ){
|
||||
if( getSpecializedBinding() != ((ICPPTemplateInstance)type).getTemplateDefinition() )
|
||||
ICPPClassType ct1= (ICPPClassType) getSpecializedBinding();
|
||||
ICPPClassType ct2= (ICPPClassType) ((ICPPTemplateInstance)type).getTemplateDefinition();
|
||||
if(!ct1.isSameType(ct2))
|
||||
return false;
|
||||
|
||||
ObjectMap m1 = getArgumentMap(), m2 = ((ICPPTemplateInstance)type).getArgumentMap();
|
||||
|
|
|
@ -395,4 +395,12 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements
|
|||
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + MEMBERLIST, getLinkageImpl());
|
||||
list.accept(visitor);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String result= super.toString();
|
||||
ObjectMap map= getArgumentMap();
|
||||
for(int i=0; i<map.size(); i++)
|
||||
result+=" <"+map.keyAt(i)+"=>"+getArgumentMap().getAt(i)+">"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,17 +16,13 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
|||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMOverloader;
|
||||
|
@ -39,7 +35,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* @author Doug Schaefer
|
||||
*
|
||||
*/
|
||||
class PDOMCPPFunction extends PDOMCPPBinding implements IIndexType, ICPPFunction, ICPPFunctionType, IPDOMOverloader {
|
||||
class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverloader {
|
||||
|
||||
/**
|
||||
* Offset of total number of function parameters (relative to the
|
||||
|
@ -54,16 +50,16 @@ class PDOMCPPFunction extends PDOMCPPBinding implements IIndexType, ICPPFunction
|
|||
private static final int FIRST_PARAM = PDOMCPPBinding.RECORD_SIZE + 4;
|
||||
|
||||
/**
|
||||
* Offset of hash of parameter information to allow fast comparison
|
||||
*/
|
||||
private static final int SIGNATURE_MEMENTO = PDOMCPPBinding.RECORD_SIZE + 8;
|
||||
|
||||
/**
|
||||
* Offset for return type of this function (relative to
|
||||
* Offset of pointer to the function type record of this function (relative to
|
||||
* the beginning of the record).
|
||||
*/
|
||||
private static final int RETURN_TYPE = PDOMCPPBinding.RECORD_SIZE + 12;
|
||||
|
||||
protected static final int FUNCTION_TYPE= PDOMCPPBinding.RECORD_SIZE + 8;
|
||||
|
||||
/**
|
||||
* Offset of hash of parameter information to allow fast comparison
|
||||
*/
|
||||
private static final int SIGNATURE_MEMENTO = PDOMCPPBinding.RECORD_SIZE + 12;
|
||||
|
||||
/**
|
||||
* Offset of annotation information (relative to the beginning of the
|
||||
* record).
|
||||
|
@ -77,39 +73,37 @@ class PDOMCPPFunction extends PDOMCPPBinding implements IIndexType, ICPPFunction
|
|||
|
||||
public PDOMCPPFunction(PDOM pdom, PDOMNode parent, ICPPFunction function, boolean setTypes) throws CoreException {
|
||||
super(pdom, parent, function.getNameCharArray());
|
||||
|
||||
Database db = pdom.getDB();
|
||||
IBinding binding = function;
|
||||
Database db = pdom.getDB();
|
||||
try {
|
||||
IFunctionType ft= function.getType();
|
||||
IParameter[] params= function.getParameters();
|
||||
IType[] paramTypes= ft.getParameterTypes();
|
||||
db.putInt(record + NUM_PARAMS, params.length);
|
||||
|
||||
db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(binding));
|
||||
Integer memento = PDOMCPPOverloaderUtil.getSignatureMemento(binding);
|
||||
Integer memento = PDOMCPPOverloaderUtil.getSignatureMemento(function);
|
||||
pdom.getDB().putInt(record + SIGNATURE_MEMENTO, memento != null ? memento.intValue() : 0);
|
||||
|
||||
if (setTypes) {
|
||||
IType rt= ft.getReturnType();
|
||||
if (rt != null) {
|
||||
setReturnType(rt);
|
||||
}
|
||||
|
||||
for (int i=0; i<params.length; ++i) {
|
||||
IType pt= i<paramTypes.length ? paramTypes[i] : null;
|
||||
setFirstParameter(new PDOMCPPParameter(pdom, this, params[i], pt));
|
||||
}
|
||||
if(setTypes) {
|
||||
initData(function);
|
||||
}
|
||||
db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(function));
|
||||
} catch (DOMException e) {
|
||||
throw new CoreException(Util.createStatus(e));
|
||||
}
|
||||
}
|
||||
|
||||
public PDOMCPPFunction(PDOM pdom, int bindingRecord) {
|
||||
super(pdom, bindingRecord);
|
||||
public void initData(ICPPFunction function) throws CoreException, DOMException {
|
||||
Database db= pdom.getDB();
|
||||
|
||||
ICPPFunctionType ft= (ICPPFunctionType) function.getType();
|
||||
PDOMCPPFunctionType pft = (PDOMCPPFunctionType) getLinkageImpl().addType(this, ft);
|
||||
db.putInt(record + FUNCTION_TYPE, pft.getRecord());
|
||||
|
||||
IParameter[] params= function.getParameters();
|
||||
db.putInt(record + NUM_PARAMS, params.length);
|
||||
|
||||
IType[] paramTypes= pft.getParameterTypes();
|
||||
for (int i=0; i<params.length; ++i) {
|
||||
int ptRecord= i<paramTypes.length && paramTypes[i]!=null ? ((PDOMNode) paramTypes[i]).getRecord() : 0;
|
||||
setFirstParameter(new PDOMCPPParameter(pdom, this, params[i], ptRecord));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getSignatureMemento() throws CoreException {
|
||||
return pdom.getDB().getInt(record + SIGNATURE_MEMENTO);
|
||||
}
|
||||
|
@ -118,6 +112,10 @@ class PDOMCPPFunction extends PDOMCPPBinding implements IIndexType, ICPPFunction
|
|||
return pdom.getDB().getInt(record + SIGNATURE_MEMENTO);
|
||||
}
|
||||
|
||||
public PDOMCPPFunction(PDOM pdom, int bindingRecord) {
|
||||
super(pdom, bindingRecord);
|
||||
}
|
||||
|
||||
protected int getRecordSize() {
|
||||
return RECORD_SIZE;
|
||||
}
|
||||
|
@ -166,8 +164,14 @@ class PDOMCPPFunction extends PDOMCPPBinding implements IIndexType, ICPPFunction
|
|||
}
|
||||
}
|
||||
|
||||
public IFunctionType getType() throws DOMException {
|
||||
return this;
|
||||
public IFunctionType getType() throws DOMException {
|
||||
try {
|
||||
int offset= pdom.getDB().getInt(record + FUNCTION_TYPE);
|
||||
return offset==0 ? null : new PDOMCPPFunctionType(pdom, offset);
|
||||
} catch(CoreException ce) {
|
||||
CCorePlugin.log(ce);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAuto() throws DOMException {
|
||||
|
@ -192,118 +196,13 @@ class PDOMCPPFunction extends PDOMCPPBinding implements IIndexType, ICPPFunction
|
|||
return getBit(getByte(record + ANNOTATION), PDOMCAnnotation.VARARGS_OFFSET);
|
||||
}
|
||||
|
||||
public IType[] getParameterTypes() throws DOMException {
|
||||
try {
|
||||
int n = pdom.getDB().getInt(record + NUM_PARAMS);
|
||||
IType[] types = new IType[n];
|
||||
PDOMCPPParameter param = getFirstParameter();
|
||||
while (param != null) {
|
||||
types[--n] = param.getType();
|
||||
param = param.getNextParameter();
|
||||
}
|
||||
return types;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return new IType[0];
|
||||
}
|
||||
}
|
||||
|
||||
public IType getReturnType() throws DOMException {
|
||||
try {
|
||||
PDOMNode node = getLinkageImpl().getNode(pdom.getDB().getInt(record + RETURN_TYPE));
|
||||
if (node instanceof IType) {
|
||||
return (IType) node;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setReturnType(IType type) throws CoreException {
|
||||
PDOMNode typeNode = getLinkageImpl().addType(this, type);
|
||||
if (typeNode != null) {
|
||||
pdom.getDB().putInt(record + RETURN_TYPE, typeNode.getRecord());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isConst() {
|
||||
// ISO/IEC 14882:2003 9.3.1.3
|
||||
// Only applicable to member functions
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isVolatile() {
|
||||
// ISO/IEC 14882:2003 9.3.1.3
|
||||
// Only applicable to member functions
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSameType(IType type) {
|
||||
if (type instanceof ITypedef) {
|
||||
return type.isSameType(this);
|
||||
}
|
||||
|
||||
try {
|
||||
if (type instanceof ICPPFunctionType) {
|
||||
ICPPFunctionType ft = (ICPPFunctionType) type;
|
||||
IType rt1= getReturnType();
|
||||
IType rt2= ft.getReturnType();
|
||||
if (rt1 != rt2) {
|
||||
if (rt1 == null || !rt1.isSameType(rt2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
IType[] params1= getParameterTypes();
|
||||
IType[] params2= ft.getParameterTypes();
|
||||
if( params1.length == 1 && params2.length == 0 ){
|
||||
if( !(params1[0] instanceof IBasicType) || ((IBasicType)params1[0]).getType() != IBasicType.t_void )
|
||||
return false;
|
||||
} else if( params2.length == 1 && params1.length == 0 ){
|
||||
if( !(params2[0] instanceof IBasicType) || ((IBasicType)params2[0]).getType() != IBasicType.t_void )
|
||||
return false;
|
||||
} else if( params1.length != params2.length ){
|
||||
return false;
|
||||
} else {
|
||||
for( int i = 0; i < params1.length; i++ ){
|
||||
if (params1[i] == null || ! params1[i].isSameType( params2[i] ) )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if( isConst() != ft.isConst() || isVolatile() != ft.isVolatile() )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public int compareTo(Object other) {
|
||||
int cmp = super.compareTo(other);
|
||||
if(cmp==0) {
|
||||
if(other instanceof PDOMCPPFunction) {
|
||||
try {
|
||||
PDOMCPPFunction otherFunction = (PDOMCPPFunction) other;
|
||||
int mySM = getSignatureMemento();
|
||||
int otherSM = otherFunction.getSignatureMemento();
|
||||
return mySM == otherSM ? 0 : mySM < otherSM ? -1 : 1;
|
||||
} catch(CoreException ce) {
|
||||
CCorePlugin.log(ce);
|
||||
}
|
||||
} else {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
}
|
||||
return cmp;
|
||||
int cmp= super.compareTo(other);
|
||||
return cmp==0 ? PDOMCPPOverloaderUtil.compare(this, other) : cmp;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
|
|
@ -7,24 +7,21 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||
|
@ -35,9 +32,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* @author Bryan Wilkinson
|
||||
*
|
||||
*/
|
||||
class PDOMCPPFunctionInstance extends PDOMCPPInstance implements IIndexType,
|
||||
ICPPFunction, ICPPFunctionType {
|
||||
|
||||
class PDOMCPPFunctionInstance extends PDOMCPPInstance implements ICPPFunction {
|
||||
/**
|
||||
* Offset of total number of function parameters (relative to the
|
||||
* beginning of the record).
|
||||
|
@ -51,10 +46,10 @@ class PDOMCPPFunctionInstance extends PDOMCPPInstance implements IIndexType,
|
|||
private static final int FIRST_PARAM = PDOMCPPInstance.RECORD_SIZE + 4;
|
||||
|
||||
/**
|
||||
* Offset for return type of this function (relative to
|
||||
* Offset for type of this function (relative to
|
||||
* the beginning of the record).
|
||||
*/
|
||||
private static final int RETURN_TYPE = PDOMCPPInstance.RECORD_SIZE + 8;
|
||||
private static final int FUNCTION_TYPE = PDOMCPPInstance.RECORD_SIZE + 8;
|
||||
|
||||
/**
|
||||
* The size in bytes of a PDOMCPPFunctionInstance record in the database.
|
||||
|
@ -68,14 +63,14 @@ class PDOMCPPFunctionInstance extends PDOMCPPInstance implements IIndexType,
|
|||
Database db = pdom.getDB();
|
||||
try {
|
||||
IFunctionType ft= function.getType();
|
||||
IType rt= ft.getReturnType();
|
||||
if (rt != null) {
|
||||
PDOMNode typeNode = getLinkageImpl().addType(this, rt);
|
||||
if (ft != null) {
|
||||
PDOMNode typeNode = getLinkageImpl().addType(this, ft);
|
||||
if (typeNode != null) {
|
||||
db.putInt(record + RETURN_TYPE, typeNode.getRecord());
|
||||
db.putInt(record + FUNCTION_TYPE, typeNode.getRecord());
|
||||
}
|
||||
}
|
||||
|
||||
ft= getType();
|
||||
IParameter[] params= function.getParameters();
|
||||
IType[] paramTypes= ft.getParameterTypes();
|
||||
db.putInt(record + NUM_PARAMS, params.length);
|
||||
|
@ -85,10 +80,10 @@ class PDOMCPPFunctionInstance extends PDOMCPPInstance implements IIndexType,
|
|||
IType[] sParamTypes= sFunc.getType().getParameterTypes();
|
||||
|
||||
for (int i=0; i<params.length; ++i) {
|
||||
IType pt= i<paramTypes.length ? paramTypes[i] : null;
|
||||
int typeRecord= i<paramTypes.length && paramTypes[i]!=null ? ((PDOMNode)paramTypes[i]).getRecord() : 0;
|
||||
//TODO shouldn't need to make new parameter (find old one)
|
||||
PDOMCPPParameter sParam = new PDOMCPPParameter(pdom, this, sParams[i], sParamTypes[i]);
|
||||
setFirstParameter(new PDOMCPPParameterSpecialization(pdom, this, (ICPPParameter) params[i], sParam, pt));
|
||||
setFirstParameter(new PDOMCPPParameterSpecialization(pdom, this, (ICPPParameter) params[i], sParam, typeRecord));
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
throw new CoreException(Util.createStatus(e));
|
||||
|
@ -135,8 +130,14 @@ class PDOMCPPFunctionInstance extends PDOMCPPInstance implements IIndexType,
|
|||
}
|
||||
}
|
||||
|
||||
public IFunctionType getType() throws DOMException {
|
||||
return this;
|
||||
public IFunctionType getType() throws DOMException {
|
||||
try {
|
||||
int offset= pdom.getDB().getInt(record + FUNCTION_TYPE);
|
||||
return offset==0 ? null : new PDOMCPPFunctionType(pdom, offset);
|
||||
} catch(CoreException ce) {
|
||||
CCorePlugin.log(ce);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInline() throws DOMException {
|
||||
|
@ -169,50 +170,6 @@ class PDOMCPPFunctionInstance extends PDOMCPPInstance implements IIndexType,
|
|||
|
||||
public IScope getFunctionScope() throws DOMException { fail(); return null; }
|
||||
|
||||
public boolean isSameType(IType type) {
|
||||
if (type instanceof ITypedef) {
|
||||
return type.isSameType(this);
|
||||
}
|
||||
|
||||
try {
|
||||
if (type instanceof ICPPFunctionType) {
|
||||
ICPPFunctionType ft = (ICPPFunctionType) type;
|
||||
IType rt1= getReturnType();
|
||||
IType rt2= ft.getReturnType();
|
||||
if (rt1 != rt2) {
|
||||
if (rt1 == null || !rt1.isSameType(rt2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
IType[] params1= getParameterTypes();
|
||||
IType[] params2= ft.getParameterTypes();
|
||||
if( params1.length == 1 && params2.length == 0 ){
|
||||
if( !(params1[0] instanceof IBasicType) || ((IBasicType)params1[0]).getType() != IBasicType.t_void )
|
||||
return false;
|
||||
} else if( params2.length == 1 && params1.length == 0 ){
|
||||
if( !(params2[0] instanceof IBasicType) || ((IBasicType)params2[0]).getType() != IBasicType.t_void )
|
||||
return false;
|
||||
} else if( params1.length != params2.length ){
|
||||
return false;
|
||||
} else {
|
||||
for( int i = 0; i < params1.length; i++ ){
|
||||
if (params1[i] == null || ! params1[i].isSameType( params2[i] ) )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if( isConst() != ft.isConst() || isVolatile() != ft.isVolatile() )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isConst() {
|
||||
// ISO/IEC 14882:2003 9.3.1.3
|
||||
// Only applicable to member functions
|
||||
|
@ -224,34 +181,9 @@ class PDOMCPPFunctionInstance extends PDOMCPPInstance implements IIndexType,
|
|||
// Only applicable to member functions
|
||||
return false;
|
||||
}
|
||||
|
||||
public IType[] getParameterTypes() throws DOMException {
|
||||
try {
|
||||
int n = pdom.getDB().getInt(record + NUM_PARAMS);
|
||||
IType[] types = new IType[n];
|
||||
PDOMCPPParameterSpecialization param = getFirstParameter();
|
||||
while (param != null) {
|
||||
types[--n] = param.getType();
|
||||
param = param.getNextParameter();
|
||||
}
|
||||
return types;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return new IType[0];
|
||||
}
|
||||
}
|
||||
|
||||
public IType getReturnType() throws DOMException {
|
||||
try {
|
||||
PDOMNode node = getLinkageImpl().getNode(pdom.getDB().getInt(record + RETURN_TYPE));
|
||||
if (node instanceof IType) {
|
||||
return (IType) node;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object clone() {fail();return null;}
|
||||
public int compareTo(Object other) {
|
||||
int cmp= super.compareTo(other);
|
||||
return cmp==0 ? PDOMCPPOverloaderUtil.compare(this, other) : cmp;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,18 +12,14 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||
|
@ -36,9 +32,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* @author Bryan Wilkinson
|
||||
*
|
||||
*/
|
||||
class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization
|
||||
implements IIndexType, ICPPFunction, ICPPFunctionType {
|
||||
|
||||
class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICPPFunction {
|
||||
/**
|
||||
* Offset of total number of function parameters (relative to the
|
||||
* beginning of the record).
|
||||
|
@ -52,10 +46,10 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization
|
|||
private static final int FIRST_PARAM = PDOMCPPSpecialization.RECORD_SIZE + 4;
|
||||
|
||||
/**
|
||||
* Offset for return type of this function (relative to
|
||||
* Offset for type of this function (relative to
|
||||
* the beginning of the record).
|
||||
*/
|
||||
private static final int RETURN_TYPE = PDOMCPPSpecialization.RECORD_SIZE + 8;
|
||||
private static final int FUNCTION_TYPE = PDOMCPPSpecialization.RECORD_SIZE + 8;
|
||||
|
||||
/**
|
||||
* Offset of annotation information (relative to the beginning of the
|
||||
|
@ -77,14 +71,14 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization
|
|||
Database db = pdom.getDB();
|
||||
try {
|
||||
IFunctionType ft= function.getType();
|
||||
IType rt= ft.getReturnType();
|
||||
if (rt != null) {
|
||||
PDOMNode typeNode = getLinkageImpl().addType(this, rt);
|
||||
if (ft != null) {
|
||||
PDOMNode typeNode = getLinkageImpl().addType(this, ft);
|
||||
if (typeNode != null) {
|
||||
db.putInt(record + RETURN_TYPE, typeNode.getRecord());
|
||||
db.putInt(record + FUNCTION_TYPE, typeNode.getRecord());
|
||||
}
|
||||
}
|
||||
|
||||
ft= getType();
|
||||
IParameter[] params= function.getParameters();
|
||||
IType[] paramTypes= ft.getParameterTypes();
|
||||
db.putInt(record + NUM_PARAMS, params.length);
|
||||
|
@ -94,10 +88,10 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization
|
|||
IType[] sParamTypes= sFunc.getType().getParameterTypes();
|
||||
|
||||
for (int i=0; i<params.length; ++i) {
|
||||
IType pt= i<paramTypes.length ? paramTypes[i] : null;
|
||||
int typeRecord= i<paramTypes.length && paramTypes[i]!=null ? ((PDOMNode)paramTypes[i]).getRecord() : 0;
|
||||
//TODO shouldn't need to make new parameter (find old one)
|
||||
PDOMCPPParameter sParam = new PDOMCPPParameter(pdom, this, sParams[i], sParamTypes[i]);
|
||||
setFirstParameter(new PDOMCPPParameterSpecialization(pdom, this, (ICPPParameter) params[i], sParam, pt));
|
||||
setFirstParameter(new PDOMCPPParameterSpecialization(pdom, this, (ICPPParameter) params[i], sParam, typeRecord));
|
||||
}
|
||||
db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(function));
|
||||
} catch (DOMException e) {
|
||||
|
@ -157,8 +151,14 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization
|
|||
}
|
||||
}
|
||||
|
||||
public IFunctionType getType() throws DOMException {
|
||||
return this;
|
||||
public IFunctionType getType() throws DOMException {
|
||||
try {
|
||||
int offset= pdom.getDB().getInt(record + FUNCTION_TYPE);
|
||||
return offset==0 ? null : new PDOMCPPFunctionType(pdom, offset);
|
||||
} catch(CoreException ce) {
|
||||
CCorePlugin.log(ce);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAuto() throws DOMException {
|
||||
|
@ -183,50 +183,6 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization
|
|||
return getBit(getByte(record + ANNOTATION), PDOMCAnnotation.VARARGS_OFFSET);
|
||||
}
|
||||
|
||||
public boolean isSameType(IType type) {
|
||||
if (type instanceof ITypedef) {
|
||||
return type.isSameType(this);
|
||||
}
|
||||
|
||||
try {
|
||||
if (type instanceof ICPPFunctionType) {
|
||||
ICPPFunctionType ft = (ICPPFunctionType) type;
|
||||
IType rt1= getReturnType();
|
||||
IType rt2= ft.getReturnType();
|
||||
if (rt1 != rt2) {
|
||||
if (rt1 == null || !rt1.isSameType(rt2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
IType[] params1= getParameterTypes();
|
||||
IType[] params2= ft.getParameterTypes();
|
||||
if( params1.length == 1 && params2.length == 0 ){
|
||||
if( !(params1[0] instanceof IBasicType) || ((IBasicType)params1[0]).getType() != IBasicType.t_void )
|
||||
return false;
|
||||
} else if( params2.length == 1 && params1.length == 0 ){
|
||||
if( !(params2[0] instanceof IBasicType) || ((IBasicType)params2[0]).getType() != IBasicType.t_void )
|
||||
return false;
|
||||
} else if( params1.length != params2.length ){
|
||||
return false;
|
||||
} else {
|
||||
for( int i = 0; i < params1.length; i++ ){
|
||||
if (params1[i] == null || ! params1[i].isSameType( params2[i] ) )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if( isConst() != ft.isConst() || isVolatile() != ft.isVolatile() )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isConst() {
|
||||
// ISO/IEC 14882:2003 9.3.1.3
|
||||
// Only applicable to member functions
|
||||
|
@ -239,33 +195,8 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization
|
|||
return false;
|
||||
}
|
||||
|
||||
public IType[] getParameterTypes() throws DOMException {
|
||||
try {
|
||||
int n = pdom.getDB().getInt(record + NUM_PARAMS);
|
||||
IType[] types = new IType[n];
|
||||
PDOMCPPParameterSpecialization param = getFirstParameter();
|
||||
while (param != null) {
|
||||
types[--n] = param.getType();
|
||||
param = param.getNextParameter();
|
||||
}
|
||||
return types;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return new IType[0];
|
||||
}
|
||||
public int compareTo(Object other) {
|
||||
int cmp= super.compareTo(other);
|
||||
return cmp==0 ? PDOMCPPOverloaderUtil.compare(this, other) : cmp;
|
||||
}
|
||||
|
||||
public IType getReturnType() throws DOMException {
|
||||
try {
|
||||
PDOMNode node = getLinkageImpl().getNode(pdom.getDB().getInt(record + RETURN_TYPE));
|
||||
if (node instanceof IType) {
|
||||
return (IType) node;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object clone() {fail();return null;}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial Implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCAnnotation;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCFunctionType;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public class PDOMCPPFunctionType extends PDOMCFunctionType implements ICPPFunctionType {
|
||||
/**
|
||||
* Offset for return type of this function (relative to
|
||||
* the beginning of the record).
|
||||
*/
|
||||
private static final int FLAGS= PDOMCFunctionType.RECORD_SIZE;
|
||||
|
||||
/**
|
||||
* The size in bytes of a PDOMCFunctionType record in the database.
|
||||
*/
|
||||
private static final int RECORD_SIZE= PDOMCFunctionType.RECORD_SIZE+ 4;
|
||||
|
||||
protected PDOMCPPFunctionType(PDOM pdom, int offset) {
|
||||
super(pdom, offset);
|
||||
}
|
||||
|
||||
protected PDOMCPPFunctionType(PDOM pdom, PDOMNode parent, ICPPFunctionType type)
|
||||
throws CoreException {
|
||||
super(pdom, parent, type);
|
||||
int modifiers= PDOMCAnnotation.encodeCVQualifiers(type);
|
||||
pdom.getDB().putInt(getRecord()+FLAGS, modifiers);
|
||||
}
|
||||
|
||||
public boolean isConst() {
|
||||
return getBit(getInt(record + FLAGS), PDOMCAnnotation.CONST_OFFSET);
|
||||
}
|
||||
|
||||
public boolean isVolatile() {
|
||||
return getBit(getInt(record + FLAGS), PDOMCAnnotation.VOLATILE_OFFSET);
|
||||
}
|
||||
|
||||
protected int getRecordSize() {
|
||||
return RECORD_SIZE;
|
||||
}
|
||||
|
||||
public boolean isSameType(IType type) {
|
||||
if(type instanceof ICPPFunctionType) {
|
||||
if(super.isSameType(type)) {
|
||||
ICPPFunctionType ft= (ICPPFunctionType) type;
|
||||
if( isConst() != ft.isConst() || isVolatile() != ft.isVolatile() )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getNodeType() {
|
||||
return PDOMCPPLinkage.CPP_FUNCTION_TYPE;
|
||||
}
|
||||
}
|
|
@ -23,7 +23,6 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
|||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
|
@ -40,6 +39,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPDeferredTemplateInstance;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
|
||||
|
@ -131,6 +131,7 @@ class PDOMCPPLinkage extends PDOMLinkage {
|
|||
public static final int CPP_CONSTRUCTOR_TEMPLATE_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 37;
|
||||
public static final int CPP_CLASS_TEMPLATE_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 38;
|
||||
public static final int CPP_TYPEDEF_SPECIALIZATION= PDOMLinkage.LAST_NODE_TYPE + 39;
|
||||
public static final int CPP_FUNCTION_TYPE= PDOMLinkage.LAST_NODE_TYPE + 40;
|
||||
|
||||
private class ConfigureTemplate implements Runnable {
|
||||
ICPPTemplateDefinition template;
|
||||
|
@ -185,32 +186,23 @@ class PDOMCPPLinkage extends PDOMLinkage {
|
|||
|
||||
private class ConfigureFunctionTemplate implements Runnable {
|
||||
PDOMCPPFunctionTemplate template;
|
||||
ICPPFunction binding;
|
||||
ICPPFunction function;
|
||||
|
||||
public ConfigureFunctionTemplate(PDOMCPPFunctionTemplate template, ICPPFunction binding) {
|
||||
this.template = template;
|
||||
this.binding = binding;
|
||||
this.function = binding;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
IFunctionType ft = binding.getType();
|
||||
template.setReturnType(ft.getReturnType());
|
||||
|
||||
IParameter[] params= binding.getParameters();
|
||||
IType[] paramTypes= ft.getParameterTypes();
|
||||
|
||||
for (int i=0; i<params.length; ++i) {
|
||||
IType pt= i<paramTypes.length ? paramTypes[i] : null;
|
||||
template.setFirstParameter(new PDOMCPPParameter(pdom, PDOMCPPLinkage.this, params[i], pt));
|
||||
}
|
||||
template.initData(function);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
} catch (DOMException e) {
|
||||
CCorePlugin.log(e);
|
||||
} finally {
|
||||
template = null;
|
||||
binding = null;
|
||||
function = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -511,6 +503,8 @@ class PDOMCPPLinkage extends PDOMLinkage {
|
|||
else if (binding instanceof ICPPMethod)
|
||||
// this must be before functions
|
||||
return CPPMETHOD;
|
||||
else if (binding instanceof ICPPFunctionType)
|
||||
return CPP_FUNCTION_TYPE;
|
||||
else if (binding instanceof ICPPFunction)
|
||||
return CPPFUNCTION;
|
||||
else if (binding instanceof ICPPClassTemplate)
|
||||
|
@ -575,6 +569,9 @@ class PDOMCPPLinkage extends PDOMLinkage {
|
|||
if (type instanceof ICPPBasicType) {
|
||||
return new PDOMCPPBasicType(pdom, parent, (ICPPBasicType) type);
|
||||
}
|
||||
if (type instanceof ICPPFunctionType) {
|
||||
return new PDOMCPPFunctionType(pdom, parent, (ICPPFunctionType) type);
|
||||
}
|
||||
if (type instanceof ICPPClassType) {
|
||||
return addBinding((ICPPClassType) type);
|
||||
}
|
||||
|
@ -695,6 +692,8 @@ class PDOMCPPLinkage extends PDOMLinkage {
|
|||
return new PDOMCPPClassTemplateSpecialization(pdom, record);
|
||||
case CPP_TYPEDEF_SPECIALIZATION:
|
||||
return new PDOMCPPTypedefSpecialization(pdom, record);
|
||||
case CPP_FUNCTION_TYPE:
|
||||
return new PDOMCPPFunctionType(pdom, record);
|
||||
default:
|
||||
return super.getNode(record);
|
||||
}
|
||||
|
|
|
@ -16,14 +16,10 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||
|
@ -35,7 +31,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* @author Doug Schaefer
|
||||
*
|
||||
*/
|
||||
class PDOMCPPMethod extends PDOMCPPFunction implements IIndexType, ICPPMethod, ICPPFunctionType {
|
||||
class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod {
|
||||
|
||||
/**
|
||||
* Offset of remaining annotation information (relative to the beginning of
|
||||
|
@ -59,9 +55,7 @@ class PDOMCPPMethod extends PDOMCPPFunction implements IIndexType, ICPPMethod, I
|
|||
Database db = pdom.getDB();
|
||||
|
||||
try {
|
||||
ICPPFunctionType type = (ICPPFunctionType) method.getType();
|
||||
byte annotation = 0;
|
||||
annotation |= PDOMCAnnotation.encodeCVQualifiers(type) << CV_OFFSET;
|
||||
annotation |= PDOMCPPAnnotation.encodeExtraAnnotation(method);
|
||||
db.putByte(record + ANNOTATION1, annotation);
|
||||
} catch (DOMException e) {
|
||||
|
@ -101,10 +95,6 @@ class PDOMCPPMethod extends PDOMCPPFunction implements IIndexType, ICPPMethod, I
|
|||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IFunctionType getType() throws DOMException {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isExtern() throws DOMException {
|
||||
// ISO/IEC 14882:2003 9.2.6
|
||||
return false;
|
||||
|
@ -144,8 +134,4 @@ class PDOMCPPMethod extends PDOMCPPFunction implements IIndexType, ICPPMethod, I
|
|||
public boolean isVolatile() {
|
||||
return getBit(getByte(record + ANNOTATION1), PDOMCAnnotation.VOLATILE_OFFSET + CV_OFFSET);
|
||||
}
|
||||
|
||||
public boolean isSameType(IType type) {
|
||||
return super.isSameType(type);
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
|
@ -21,6 +22,7 @@ import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
|||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||
|
@ -28,6 +30,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
|||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexInternalTemplateParameter;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMOverloader;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
|
@ -163,4 +167,25 @@ class PDOMCPPOverloaderUtil {
|
|||
String sig = getSignature(binding);
|
||||
return sig.length() == 0 ? null : new Integer(sig.hashCode());
|
||||
}
|
||||
|
||||
public static Integer getSignatureMemento(ICPPFunctionType type) throws DOMException {
|
||||
String sig= getFunctionParameterString(type);
|
||||
return sig.length() == 0 ? null : new Integer(sig.hashCode());
|
||||
}
|
||||
|
||||
public static int compare(IPDOMOverloader a, Object b) {
|
||||
if(b instanceof IPDOMOverloader) {
|
||||
IPDOMOverloader bb= (IPDOMOverloader) b;
|
||||
try {
|
||||
int mySM = a.getSignatureMemento();
|
||||
int otherSM = bb.getSignatureMemento();
|
||||
return mySM == otherSM ? 0 : mySM < otherSM ? -1 : 1;
|
||||
} catch(CoreException ce) {
|
||||
CCorePlugin.log(ce);
|
||||
}
|
||||
} else {
|
||||
throw new PDOMNotImplementedError(b.getClass().toString());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,15 +67,15 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IIndexFra
|
|||
}
|
||||
|
||||
public PDOMCPPParameter(PDOM pdom, PDOMNode parent, IParameter param, IType type)
|
||||
throws CoreException {
|
||||
throws CoreException {
|
||||
super(pdom, parent, param.getNameCharArray());
|
||||
|
||||
|
||||
Database db = pdom.getDB();
|
||||
|
||||
db.putInt(record + NEXT_PARAM, 0);
|
||||
byte flags= encodeFlags(param);
|
||||
db.putByte(record + FLAGS, flags);
|
||||
|
||||
|
||||
try {
|
||||
if (type == null)
|
||||
type= param.getType();
|
||||
|
@ -87,6 +87,19 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IIndexFra
|
|||
throw new CoreException(Util.createStatus(e));
|
||||
}
|
||||
}
|
||||
|
||||
public PDOMCPPParameter(PDOM pdom, PDOMNode parent, IParameter param, int typeRecord)
|
||||
throws CoreException {
|
||||
super(pdom, parent, param.getNameCharArray());
|
||||
|
||||
Database db = pdom.getDB();
|
||||
|
||||
db.putInt(record + NEXT_PARAM, 0);
|
||||
byte flags= encodeFlags(param);
|
||||
db.putByte(record + FLAGS, flags);
|
||||
|
||||
db.putInt(record + TYPE, typeRecord);
|
||||
}
|
||||
|
||||
private byte encodeFlags(IParameter param) {
|
||||
byte flags= 0;
|
||||
|
|
|
@ -25,9 +25,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* @author Bryan Wilkinson
|
||||
*
|
||||
*/
|
||||
class PDOMCPPParameterSpecialization extends PDOMCPPSpecialization
|
||||
implements ICPPParameter {
|
||||
|
||||
class PDOMCPPParameterSpecialization extends PDOMCPPSpecialization implements ICPPParameter {
|
||||
/**
|
||||
* Offset of pointer to the next parameter (relative to the
|
||||
* beginning of the record).
|
||||
|
@ -45,6 +43,14 @@ class PDOMCPPParameterSpecialization extends PDOMCPPSpecialization
|
|||
*/
|
||||
protected static final int RECORD_SIZE = PDOMCPPSpecialization.RECORD_SIZE + 8;
|
||||
|
||||
public PDOMCPPParameterSpecialization(PDOM pdom, PDOMNode parent, ICPPParameter param, PDOMCPPParameter specialized, int typeRecord)
|
||||
throws CoreException {
|
||||
super(pdom, parent, (ICPPSpecialization) param, specialized);
|
||||
Database db = pdom.getDB();
|
||||
db.putInt(record + NEXT_PARAM, 0);
|
||||
db.putInt(record + TYPE, typeRecord);
|
||||
}
|
||||
|
||||
public PDOMCPPParameterSpecialization(PDOM pdom, PDOMNode parent, ICPPParameter param, PDOMCPPParameter specialized, IType type)
|
||||
throws CoreException {
|
||||
super(pdom, parent, (ICPPSpecialization) param, specialized);
|
||||
|
|
Loading…
Add table
Reference in a new issue