mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Updating class template definitions in the index, bug 256122.
This commit is contained in:
parent
317eef461a
commit
049e4b13f1
63 changed files with 1725 additions and 718 deletions
|
@ -4065,8 +4065,8 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
assertNotSame(d1, d2);
|
assertNotSame(d1, d2);
|
||||||
|
|
||||||
assertFalse(((ICPPFunctionType) d1.getType()).isConst());
|
assertFalse(d1.getType().isConst());
|
||||||
assertTrue(((ICPPFunctionType) d2.getType()).isConst());
|
assertTrue((d2.getType()).isConst());
|
||||||
|
|
||||||
ICPPFunction dr1 = (ICPPFunction) col.getName(5).resolveBinding();
|
ICPPFunction dr1 = (ICPPFunction) col.getName(5).resolveBinding();
|
||||||
ICPPFunction dr2 = (ICPPFunction) col.getName(8).resolveBinding();
|
ICPPFunction dr2 = (ICPPFunction) col.getName(8).resolveBinding();
|
||||||
|
@ -6248,4 +6248,22 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
public void testVoidParamInDefinition_257376() throws Exception {
|
public void testVoidParamInDefinition_257376() throws Exception {
|
||||||
parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
|
parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// namespace ns {
|
||||||
|
// struct C {
|
||||||
|
// C(C* c){}
|
||||||
|
// };
|
||||||
|
// int a;
|
||||||
|
// }
|
||||||
|
// struct C {
|
||||||
|
// C(ns::C*){}
|
||||||
|
// };
|
||||||
|
// void testbla() {
|
||||||
|
// ns::C* cptr= 0;
|
||||||
|
// C c= C(cptr);
|
||||||
|
// }
|
||||||
|
public void testNoKoenigForConstructors() throws Exception {
|
||||||
|
parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -849,10 +849,10 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
ICPPMethod bar_v= getBindingFromASTName("bar();/*2*/", 3, ICPPMethod.class);
|
ICPPMethod bar_v= getBindingFromASTName("bar();/*2*/", 3, ICPPMethod.class);
|
||||||
ICPPMethod bar_c= getBindingFromASTName("bar();/*3*/", 3, ICPPMethod.class);
|
ICPPMethod bar_c= getBindingFromASTName("bar();/*3*/", 3, ICPPMethod.class);
|
||||||
ICPPMethod bar= getBindingFromASTName("bar();/*4*/", 3, ICPPMethod.class);
|
ICPPMethod bar= getBindingFromASTName("bar();/*4*/", 3, ICPPMethod.class);
|
||||||
ICPPFunctionType bar_cv_ft= (ICPPFunctionType) bar_cv.getType();
|
ICPPFunctionType bar_cv_ft= bar_cv.getType();
|
||||||
ICPPFunctionType bar_v_ft= (ICPPFunctionType) bar_v.getType();
|
ICPPFunctionType bar_v_ft= bar_v.getType();
|
||||||
ICPPFunctionType bar_c_ft= (ICPPFunctionType) bar_c.getType();
|
ICPPFunctionType bar_c_ft= bar_c.getType();
|
||||||
ICPPFunctionType bar_ft= (ICPPFunctionType) bar.getType();
|
ICPPFunctionType bar_ft= bar.getType();
|
||||||
|
|
||||||
assertTrue(bar_cv_ft.isConst()); assertTrue(bar_cv_ft.isVolatile());
|
assertTrue(bar_cv_ft.isConst()); assertTrue(bar_cv_ft.isVolatile());
|
||||||
assertTrue(!bar_v_ft.isConst()); assertTrue(bar_v_ft.isVolatile());
|
assertTrue(!bar_v_ft.isConst()); assertTrue(bar_v_ft.isVolatile());
|
||||||
|
|
|
@ -247,7 +247,7 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
||||||
assertInstance(f0.getParameterTypes()[0], ICPPBasicType.class);
|
assertInstance(f0.getParameterTypes()[0], ICPPBasicType.class);
|
||||||
|
|
||||||
assertInstance(b1, ICPPFunction.class);
|
assertInstance(b1, ICPPFunction.class);
|
||||||
ICPPFunctionType f1= (ICPPFunctionType) ((ICPPFunction)b1).getType();
|
ICPPFunctionType f1= ((ICPPFunction)b1).getType();
|
||||||
assertInstance(f1.getReturnType(), ICPPBasicType.class);
|
assertInstance(f1.getReturnType(), ICPPBasicType.class);
|
||||||
assertEquals(1, f1.getParameterTypes().length);
|
assertEquals(1, f1.getParameterTypes().length);
|
||||||
assertInstance(f1.getParameterTypes()[0], ICPPBasicType.class);
|
assertInstance(f1.getParameterTypes()[0], ICPPBasicType.class);
|
||||||
|
|
|
@ -432,7 +432,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
||||||
// Foo<A,X> f;
|
// Foo<A,X> f;
|
||||||
// f.s.foo(*new A());
|
// f.s.foo(*new A());
|
||||||
// }
|
// }
|
||||||
public void _testTemplateTemplateParameter() throws Exception {
|
public void testTemplateTemplateParameter() throws Exception {
|
||||||
IBinding b0= getBindingFromASTName("Foo<A,X>", 3);
|
IBinding b0= getBindingFromASTName("Foo<A,X>", 3);
|
||||||
IBinding b1= getBindingFromASTName("Foo<A,X>", 8);
|
IBinding b1= getBindingFromASTName("Foo<A,X>", 8);
|
||||||
IBinding b2= getBindingFromASTName("f.s.foo", 1);
|
IBinding b2= getBindingFromASTName("f.s.foo", 1);
|
||||||
|
@ -768,7 +768,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
||||||
IBinding b0= getBindingFromASTName("foo(a,b)", 3);
|
IBinding b0= getBindingFromASTName("foo(a,b)", 3);
|
||||||
assertInstance(b0, ICPPFunction.class);
|
assertInstance(b0, ICPPFunction.class);
|
||||||
assertInstance(b0, ICPPTemplateInstance.class);
|
assertInstance(b0, ICPPTemplateInstance.class);
|
||||||
ICPPFunctionType b0type= (ICPPFunctionType) ((ICPPFunction)b0).getType();
|
ICPPFunctionType b0type= ((ICPPFunction)b0).getType();
|
||||||
assertInstance(b0type.getReturnType(), ICPPBasicType.class);
|
assertInstance(b0type.getReturnType(), ICPPBasicType.class);
|
||||||
IType[] b0_ptypes= b0type.getParameterTypes();
|
IType[] b0_ptypes= b0type.getParameterTypes();
|
||||||
assertEquals(2, b0_ptypes.length);
|
assertEquals(2, b0_ptypes.length);
|
||||||
|
@ -806,7 +806,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
||||||
assertEquals("A", ((ICPPClassType)b0_am.getAt(0)).getName());
|
assertEquals("A", ((ICPPClassType)b0_am.getAt(0)).getName());
|
||||||
assertEquals("B", ((ICPPClassType)b0_am.getAt(1)).getName());
|
assertEquals("B", ((ICPPClassType)b0_am.getAt(1)).getName());
|
||||||
|
|
||||||
ICPPFunctionType b0_spcd_type= (ICPPFunctionType) ((ICPPFunction)b0_spcd).getType();
|
ICPPFunctionType b0_spcd_type= ((ICPPFunction)b0_spcd).getType();
|
||||||
assertInstance(b0_spcd_type.getReturnType(), ICPPBasicType.class);
|
assertInstance(b0_spcd_type.getReturnType(), ICPPBasicType.class);
|
||||||
IType[] b0_spcd_ptypes= b0_spcd_type.getParameterTypes();
|
IType[] b0_spcd_ptypes= b0_spcd_type.getParameterTypes();
|
||||||
assertEquals(2, b0_spcd_ptypes.length);
|
assertEquals(2, b0_spcd_ptypes.length);
|
||||||
|
@ -817,7 +817,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
||||||
|
|
||||||
IBinding b1= getBindingFromASTName("foo(c,a)", 3);
|
IBinding b1= getBindingFromASTName("foo(c,a)", 3);
|
||||||
assertInstance(b1, ICPPFunction.class);
|
assertInstance(b1, ICPPFunction.class);
|
||||||
ICPPFunctionType b1type= (ICPPFunctionType) ((ICPPFunction)b1).getType();
|
ICPPFunctionType b1type= ((ICPPFunction)b1).getType();
|
||||||
assertInstance(b1type.getReturnType(), ICPPBasicType.class);
|
assertInstance(b1type.getReturnType(), ICPPBasicType.class);
|
||||||
IType[] b1_ptypes= b1type.getParameterTypes();
|
IType[] b1_ptypes= b1type.getParameterTypes();
|
||||||
assertEquals(2, b1_ptypes.length);
|
assertEquals(2, b1_ptypes.length);
|
||||||
|
@ -839,7 +839,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
||||||
assertInstance(b1_spcd, ICPPFunction.class);
|
assertInstance(b1_spcd, ICPPFunction.class);
|
||||||
assertInstance(b1_spcd, ICPPTemplateDefinition.class);
|
assertInstance(b1_spcd, ICPPTemplateDefinition.class);
|
||||||
|
|
||||||
ICPPFunctionType b1_spcd_type= (ICPPFunctionType) ((ICPPFunction)b1_spcd).getType();
|
ICPPFunctionType b1_spcd_type= ((ICPPFunction)b1_spcd).getType();
|
||||||
assertInstance(b1_spcd_type.getReturnType(), ICPPBasicType.class);
|
assertInstance(b1_spcd_type.getReturnType(), ICPPBasicType.class);
|
||||||
IType[] b1_spcd_ptypes= b1_spcd_type.getParameterTypes();
|
IType[] b1_spcd_ptypes= b1_spcd_type.getParameterTypes();
|
||||||
assertEquals(2, b1_spcd_ptypes.length);
|
assertEquals(2, b1_spcd_ptypes.length);
|
||||||
|
@ -882,7 +882,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
||||||
assertInstance(b0, ICPPFunction.class);
|
assertInstance(b0, ICPPFunction.class);
|
||||||
|
|
||||||
ICPPFunction f= (ICPPFunction) b0;
|
ICPPFunction f= (ICPPFunction) b0;
|
||||||
ICPPFunctionType type= (ICPPFunctionType) f.getType();
|
ICPPFunctionType type= f.getType();
|
||||||
IType rt= type.getReturnType();
|
IType rt= type.getReturnType();
|
||||||
IType[] pts= type.getParameterTypes();
|
IType[] pts= type.getParameterTypes();
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
|
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.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
|
@ -36,6 +37,10 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTemplateParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
|
@ -43,9 +48,11 @@ import org.eclipse.cdt.core.index.IndexFilter;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
|
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
|
||||||
public class IndexUpdateTests extends IndexTestBase {
|
public class IndexUpdateTests extends IndexTestBase {
|
||||||
|
|
||||||
|
@ -760,6 +767,140 @@ public class IndexUpdateTests extends IndexTestBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template<typename T> class CT {};
|
||||||
|
|
||||||
|
// template<typename T=int> class CT {};
|
||||||
|
|
||||||
|
// template<typename T=char> class CT {};
|
||||||
|
|
||||||
|
// template<int U, typename T> struct CT {};
|
||||||
|
|
||||||
|
// template<template<typename T> class V> class CT {};
|
||||||
|
|
||||||
|
// template<template<template<typename I> class T> class V> class CT {};
|
||||||
|
|
||||||
|
// template<typename U> class CT {};
|
||||||
|
public void testClassTemplates() throws Exception {
|
||||||
|
setupFile(7, true);
|
||||||
|
ICPPClassTemplate binding;
|
||||||
|
ICompositeType ct;
|
||||||
|
fIndex.acquireReadLock();
|
||||||
|
int pdomid;
|
||||||
|
try {
|
||||||
|
binding = (ICPPClassTemplate) findBinding("CT");
|
||||||
|
assertEquals(ICPPClassType.k_class , binding.getKey());
|
||||||
|
ICPPTemplateParameter[] tpars = binding.getTemplateParameters();
|
||||||
|
assertEquals(1, tpars.length);
|
||||||
|
assertTrue(tpars[0] instanceof ICPPTemplateTypeParameter);
|
||||||
|
assertEquals(0, tpars[0].getParameterID());
|
||||||
|
assertEquals("T", tpars[0].getName());
|
||||||
|
assertNull(tpars[0].getDefaultValue());
|
||||||
|
pdomid= ((PDOMNode)((IAdaptable) tpars[0]).getAdapter(PDOMNode.class)).getId();
|
||||||
|
} finally {
|
||||||
|
fIndex.releaseReadLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateFile();
|
||||||
|
fIndex.acquireReadLock();
|
||||||
|
try {
|
||||||
|
binding = (ICPPClassTemplate) findBinding("CT");
|
||||||
|
assertEquals(ICPPClassType.k_class , binding.getKey());
|
||||||
|
ICPPTemplateParameter[] tpars = binding.getTemplateParameters();
|
||||||
|
assertEquals(1, tpars.length);
|
||||||
|
assertTrue(tpars[0] instanceof ICPPTemplateTypeParameter);
|
||||||
|
assertEquals(0, tpars[0].getParameterID());
|
||||||
|
assertEquals("T", tpars[0].getName());
|
||||||
|
assertEquals("int", ASTTypeUtil.getType(tpars[0].getDefaultValue().getTypeValue()));
|
||||||
|
} finally {
|
||||||
|
fIndex.releaseReadLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateFile();
|
||||||
|
fIndex.acquireReadLock();
|
||||||
|
try {
|
||||||
|
binding = (ICPPClassTemplate) findBinding("CT");
|
||||||
|
assertEquals(ICPPClassType.k_class , binding.getKey());
|
||||||
|
ICPPTemplateParameter[] tpars = binding.getTemplateParameters();
|
||||||
|
assertEquals(1, tpars.length);
|
||||||
|
assertTrue(tpars[0] instanceof ICPPTemplateTypeParameter);
|
||||||
|
assertEquals(0, tpars[0].getParameterID());
|
||||||
|
assertEquals("T", tpars[0].getName());
|
||||||
|
assertEquals("char", ASTTypeUtil.getType(tpars[0].getDefaultValue().getTypeValue()));
|
||||||
|
} finally {
|
||||||
|
fIndex.releaseReadLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateFile();
|
||||||
|
fIndex.acquireReadLock();
|
||||||
|
try {
|
||||||
|
binding = (ICPPClassTemplate) findBinding("CT");
|
||||||
|
assertEquals(ICompositeType.k_struct , binding.getKey());
|
||||||
|
ICPPTemplateParameter[] tpars = binding.getTemplateParameters();
|
||||||
|
assertEquals(2, tpars.length);
|
||||||
|
assertTrue(tpars[0] instanceof ICPPTemplateNonTypeParameter);
|
||||||
|
assertEquals("U", tpars[0].getName());
|
||||||
|
assertEquals(0, tpars[0].getParameterID());
|
||||||
|
assertTrue(tpars[1] instanceof ICPPTemplateTypeParameter);
|
||||||
|
assertEquals("T", tpars[1].getName());
|
||||||
|
assertEquals(1, tpars[1].getParameterID());
|
||||||
|
} finally {
|
||||||
|
fIndex.releaseReadLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateFile();
|
||||||
|
fIndex.acquireReadLock();
|
||||||
|
try {
|
||||||
|
binding = (ICPPClassTemplate) findBinding("CT");
|
||||||
|
assertEquals(ICPPClassType.k_class , binding.getKey());
|
||||||
|
ICPPTemplateParameter[] tpars = binding.getTemplateParameters();
|
||||||
|
assertEquals(1, tpars.length);
|
||||||
|
assertTrue(tpars[0] instanceof ICPPTemplateTemplateParameter);
|
||||||
|
assertEquals("V", tpars[0].getName());
|
||||||
|
assertEquals(0, tpars[0].getParameterID());
|
||||||
|
tpars= ((ICPPTemplateTemplateParameter) tpars[0]).getTemplateParameters();
|
||||||
|
assertEquals(1, tpars.length);
|
||||||
|
assertTrue(tpars[0] instanceof ICPPTemplateTypeParameter);
|
||||||
|
assertEquals(0x10000, tpars[0].getParameterID());
|
||||||
|
assertEquals("T", tpars[0].getName());
|
||||||
|
} finally {
|
||||||
|
fIndex.releaseReadLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateFile();
|
||||||
|
fIndex.acquireReadLock();
|
||||||
|
try {
|
||||||
|
binding = (ICPPClassTemplate) findBinding("CT");
|
||||||
|
assertEquals(ICPPClassType.k_class , binding.getKey());
|
||||||
|
ICPPTemplateParameter[] tpars = binding.getTemplateParameters();
|
||||||
|
assertEquals(1, tpars.length);
|
||||||
|
assertTrue(tpars[0] instanceof ICPPTemplateTemplateParameter);
|
||||||
|
assertEquals("V", tpars[0].getName());
|
||||||
|
assertEquals(0, tpars[0].getParameterID());
|
||||||
|
tpars= ((ICPPTemplateTemplateParameter) tpars[0]).getTemplateParameters();
|
||||||
|
assertEquals(1, tpars.length);
|
||||||
|
assertTrue(tpars[0] instanceof ICPPTemplateTemplateParameter);
|
||||||
|
assertEquals(0x10000, tpars[0].getParameterID());
|
||||||
|
assertEquals("T", tpars[0].getName());
|
||||||
|
} finally {
|
||||||
|
fIndex.releaseReadLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateFile();
|
||||||
|
fIndex.acquireReadLock();
|
||||||
|
try {
|
||||||
|
binding = (ICPPClassTemplate) findBinding("CT");
|
||||||
|
assertEquals(ICPPClassType.k_class , binding.getKey());
|
||||||
|
ICPPTemplateParameter[] tpars = binding.getTemplateParameters();
|
||||||
|
assertEquals(1, tpars.length);
|
||||||
|
assertTrue(tpars[0] instanceof ICPPTemplateTypeParameter);
|
||||||
|
assertEquals(0, tpars[0].getParameterID());
|
||||||
|
assertEquals("U", tpars[0].getName());
|
||||||
|
assertEquals(pdomid, ((PDOMNode)((IAdaptable) tpars[0]).getAdapter(PDOMNode.class)).getId());
|
||||||
|
} finally {
|
||||||
|
fIndex.releaseReadLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// int globalVar;
|
// int globalVar;
|
||||||
|
|
||||||
// #include "header.h"
|
// #include "header.h"
|
||||||
|
|
|
@ -202,7 +202,7 @@ public class MethodTests extends PDOMTestBase {
|
||||||
IBinding[] bindings = findQualifiedName(pdom, "Class1::constMethod");
|
IBinding[] bindings = findQualifiedName(pdom, "Class1::constMethod");
|
||||||
assertEquals(1, bindings.length);
|
assertEquals(1, bindings.length);
|
||||||
ICPPMethod method = (ICPPMethod) bindings[0];
|
ICPPMethod method = (ICPPMethod) bindings[0];
|
||||||
ICPPFunctionType type = (ICPPFunctionType) method.getType();
|
ICPPFunctionType type = method.getType();
|
||||||
assertTrue(type.isConst());
|
assertTrue(type.isConst());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ public class MethodTests extends PDOMTestBase {
|
||||||
IBinding[] bindings = findQualifiedName(pdom, "Class1::volatileMethod");
|
IBinding[] bindings = findQualifiedName(pdom, "Class1::volatileMethod");
|
||||||
assertEquals(1, bindings.length);
|
assertEquals(1, bindings.length);
|
||||||
ICPPMethod method = (ICPPMethod) bindings[0];
|
ICPPMethod method = (ICPPMethod) bindings[0];
|
||||||
ICPPFunctionType type = (ICPPFunctionType) method.getType();
|
ICPPFunctionType type = method.getType();
|
||||||
assertTrue(type.isVolatile());
|
assertTrue(type.isVolatile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ public class MethodTests extends PDOMTestBase {
|
||||||
IBinding[] bindings = findQualifiedName(pdom, "Class1::constVolatileMethod");
|
IBinding[] bindings = findQualifiedName(pdom, "Class1::constVolatileMethod");
|
||||||
assertEquals(1, bindings.length);
|
assertEquals(1, bindings.length);
|
||||||
ICPPMethod method = (ICPPMethod) bindings[0];
|
ICPPMethod method = (ICPPMethod) bindings[0];
|
||||||
ICPPFunctionType type = (ICPPFunctionType) method.getType();
|
ICPPFunctionType type = method.getType();
|
||||||
assertTrue(type.isConst());
|
assertTrue(type.isConst());
|
||||||
assertTrue(type.isVolatile());
|
assertTrue(type.isVolatile());
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ public class MethodTests extends PDOMTestBase {
|
||||||
IBinding[] bindings = findQualifiedName(pdom, "Class1::notConstMethod");
|
IBinding[] bindings = findQualifiedName(pdom, "Class1::notConstMethod");
|
||||||
assertEquals(1, bindings.length);
|
assertEquals(1, bindings.length);
|
||||||
ICPPMethod method = (ICPPMethod) bindings[0];
|
ICPPMethod method = (ICPPMethod) bindings[0];
|
||||||
ICPPFunctionType type = (ICPPFunctionType) method.getType();
|
ICPPFunctionType type = method.getType();
|
||||||
assertFalse(type.isConst());
|
assertFalse(type.isConst());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ public class MethodTests extends PDOMTestBase {
|
||||||
IBinding[] bindings = findQualifiedName(pdom, "Class1::notVolatileMethod");
|
IBinding[] bindings = findQualifiedName(pdom, "Class1::notVolatileMethod");
|
||||||
assertEquals(1, bindings.length);
|
assertEquals(1, bindings.length);
|
||||||
ICPPMethod method = (ICPPMethod) bindings[0];
|
ICPPMethod method = (ICPPMethod) bindings[0];
|
||||||
ICPPFunctionType type = (ICPPFunctionType) method.getType();
|
ICPPFunctionType type = method.getType();
|
||||||
assertFalse(type.isVolatile());
|
assertFalse(type.isVolatile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ public class MethodTests extends PDOMTestBase {
|
||||||
IBinding[] bindings = findQualifiedName(pdom, "Class1::notConstVolatileMethod");
|
IBinding[] bindings = findQualifiedName(pdom, "Class1::notConstVolatileMethod");
|
||||||
assertEquals(1, bindings.length);
|
assertEquals(1, bindings.length);
|
||||||
ICPPMethod method = (ICPPMethod) bindings[0];
|
ICPPMethod method = (ICPPMethod) bindings[0];
|
||||||
ICPPFunctionType type = (ICPPFunctionType) method.getType();
|
ICPPFunctionType type = method.getType();
|
||||||
assertFalse(type.isConst());
|
assertFalse(type.isConst());
|
||||||
assertFalse(type.isVolatile());
|
assertFalse(type.isVolatile());
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,4 +45,10 @@ public interface ICPPFunction extends IFunction, ICPPBinding {
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
public IType[] getExceptionSpecification() throws DOMException;
|
public IType[] getExceptionSpecification() throws DOMException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
* @since 5.1
|
||||||
|
*/
|
||||||
|
public ICPPFunctionType getType() throws DOMException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,18 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005 IBM Corporation and others.
|
* Copyright (c) 2005, 2008 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* Andrew Niefer (IBM) - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
/*
|
|
||||||
* Created on Mar 31, 2005
|
|
||||||
*/
|
|
||||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author aniefer
|
* Interface for function templates
|
||||||
*/
|
*/
|
||||||
public interface ICPPFunctionTemplate extends ICPPTemplateDefinition {
|
public interface ICPPFunctionTemplate extends ICPPFunction, ICPPTemplateDefinition {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,11 @@
|
||||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Doug Schaefer
|
* Interface for template non type parameters.
|
||||||
*/
|
*/
|
||||||
public interface ICPPTemplateNonTypeParameter extends ICPPTemplateParameter, IVariable {
|
public interface ICPPTemplateNonTypeParameter extends ICPPTemplateParameter, ICPPVariable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated, use {@link ICPPTemplateParameter#getDefaultValue()}.
|
* @deprecated, use {@link ICPPTemplateParameter#getDefaultValue()}.
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
||||||
|
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.ICPPParameter;
|
||||||
import org.eclipse.cdt.core.dom.parser.IBuiltinBindingsProvider;
|
import org.eclipse.cdt.core.dom.parser.IBuiltinBindingsProvider;
|
||||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||||
|
@ -371,7 +372,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[0] = new CBuiltinParameter(parms[0]);
|
theParms[0] = new CBuiltinParameter(parms[0]);
|
||||||
temp = new CImplicitFunction(__BUILTIN_VA_START, scope, functionType, theParms, true);
|
temp = new CImplicitFunction(__BUILTIN_VA_START, scope, functionType, theParms, true);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_va_list;
|
parms[0] = cpp_va_list;
|
||||||
functionType = new CPPFunctionType(cpp_void_p, parms);
|
functionType = new CPPFunctionType(cpp_void_p, parms);
|
||||||
|
@ -394,7 +395,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[0] = new CBuiltinParameter(parms[0]);
|
theParms[0] = new CBuiltinParameter(parms[0]);
|
||||||
temp = new CImplicitFunction(__BUILTIN_VA_END, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_VA_END, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_va_list;
|
parms[0] = cpp_va_list;
|
||||||
functionType = new CPPFunctionType(cpp_void, parms);
|
functionType = new CPPFunctionType(cpp_void, parms);
|
||||||
|
@ -419,7 +420,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[1] = theParms[0];
|
theParms[1] = theParms[0];
|
||||||
temp = new CImplicitFunction(__BUILTIN_EXPECT, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_EXPECT, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_long_int;
|
parms[0] = cpp_long_int;
|
||||||
parms[1] = cpp_long_int;
|
parms[1] = cpp_long_int;
|
||||||
|
@ -444,7 +445,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[0] = new CBuiltinParameter(parms[0]);
|
theParms[0] = new CBuiltinParameter(parms[0]);
|
||||||
temp = new CImplicitFunction(__BUILTIN_PREFETCH, scope, functionType, theParms, true);
|
temp = new CImplicitFunction(__BUILTIN_PREFETCH, scope, functionType, theParms, true);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_const_void_p;
|
parms[0] = cpp_const_void_p;
|
||||||
functionType = new CPPFunctionType(cpp_void, parms);
|
functionType = new CPPFunctionType(cpp_void, parms);
|
||||||
|
@ -467,7 +468,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[0] = new CBuiltinParameter(parms[0]);
|
theParms[0] = new CBuiltinParameter(parms[0]);
|
||||||
temp = new CImplicitFunction(__BUILTIN_HUGE_VAL, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_HUGE_VAL, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_void;
|
parms[0] = cpp_void;
|
||||||
functionType = new CPPFunctionType(cpp_double, parms);
|
functionType = new CPPFunctionType(cpp_double, parms);
|
||||||
|
@ -488,7 +489,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[0] = new CBuiltinParameter(parms[0]);
|
theParms[0] = new CBuiltinParameter(parms[0]);
|
||||||
temp = new CImplicitFunction(__BUILTIN_HUGE_VALF, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_HUGE_VALF, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_void;
|
parms[0] = cpp_void;
|
||||||
functionType = new CPPFunctionType(cpp_float, parms);
|
functionType = new CPPFunctionType(cpp_float, parms);
|
||||||
|
@ -509,7 +510,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[0] = new CBuiltinParameter(parms[0]);
|
theParms[0] = new CBuiltinParameter(parms[0]);
|
||||||
temp = new CImplicitFunction(__BUILTIN_HUGE_VALL, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_HUGE_VALL, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_void;
|
parms[0] = cpp_void;
|
||||||
functionType = new CPPFunctionType(cpp_long_double, parms);
|
functionType = new CPPFunctionType(cpp_long_double, parms);
|
||||||
|
@ -533,7 +534,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[0] = new CBuiltinParameter(parms[0]);
|
theParms[0] = new CBuiltinParameter(parms[0]);
|
||||||
temp = new CImplicitFunction(__BUILTIN_INF, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_INF, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_void;
|
parms[0] = cpp_void;
|
||||||
functionType = new CPPFunctionType(cpp_double, parms);
|
functionType = new CPPFunctionType(cpp_double, parms);
|
||||||
|
@ -554,7 +555,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[0] = new CBuiltinParameter(parms[0]);
|
theParms[0] = new CBuiltinParameter(parms[0]);
|
||||||
temp = new CImplicitFunction(__BUILTIN_INFF, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_INFF, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_void;
|
parms[0] = cpp_void;
|
||||||
functionType = new CPPFunctionType(cpp_float, parms);
|
functionType = new CPPFunctionType(cpp_float, parms);
|
||||||
|
@ -575,7 +576,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[0] = new CBuiltinParameter(parms[0]);
|
theParms[0] = new CBuiltinParameter(parms[0]);
|
||||||
temp = new CImplicitFunction(__BUILTIN_INFL, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_INFL, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_void;
|
parms[0] = cpp_void;
|
||||||
functionType = new CPPFunctionType(cpp_long_double, parms);
|
functionType = new CPPFunctionType(cpp_long_double, parms);
|
||||||
|
@ -598,7 +599,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[0] = new CBuiltinParameter(parms[0]);
|
theParms[0] = new CBuiltinParameter(parms[0]);
|
||||||
temp = new CImplicitFunction(__BUILTIN_NAN, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_NAN, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_const_char_p;
|
parms[0] = cpp_const_char_p;
|
||||||
functionType = new CPPFunctionType(cpp_double, parms);
|
functionType = new CPPFunctionType(cpp_double, parms);
|
||||||
|
@ -619,7 +620,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[0] = new CBuiltinParameter(parms[0]);
|
theParms[0] = new CBuiltinParameter(parms[0]);
|
||||||
temp = new CImplicitFunction(__BUILTIN_NANF, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_NANF, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_const_char_p;
|
parms[0] = cpp_const_char_p;
|
||||||
functionType = new CPPFunctionType(cpp_float, parms);
|
functionType = new CPPFunctionType(cpp_float, parms);
|
||||||
|
@ -640,7 +641,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[0] = new CBuiltinParameter(parms[0]);
|
theParms[0] = new CBuiltinParameter(parms[0]);
|
||||||
temp = new CImplicitFunction(__BUILTIN_NANL, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_NANL, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_const_char_p;
|
parms[0] = cpp_const_char_p;
|
||||||
functionType = new CPPFunctionType(cpp_long_double, parms);
|
functionType = new CPPFunctionType(cpp_long_double, parms);
|
||||||
|
@ -661,7 +662,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[0] = new CBuiltinParameter(parms[0]);
|
theParms[0] = new CBuiltinParameter(parms[0]);
|
||||||
temp = new CImplicitFunction(__BUILTIN_NANS, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_NANS, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_const_char_p;
|
parms[0] = cpp_const_char_p;
|
||||||
functionType = new CPPFunctionType(cpp_double, parms);
|
functionType = new CPPFunctionType(cpp_double, parms);
|
||||||
|
@ -682,7 +683,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[0] = new CBuiltinParameter(parms[0]);
|
theParms[0] = new CBuiltinParameter(parms[0]);
|
||||||
temp = new CImplicitFunction(__BUILTIN_NANSF, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_NANSF, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_const_char_p;
|
parms[0] = cpp_const_char_p;
|
||||||
functionType = new CPPFunctionType(cpp_float, parms);
|
functionType = new CPPFunctionType(cpp_float, parms);
|
||||||
|
@ -703,7 +704,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[0] = new CBuiltinParameter(parms[0]);
|
theParms[0] = new CBuiltinParameter(parms[0]);
|
||||||
temp = new CImplicitFunction(__BUILTIN_NANSL, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_NANSL, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_const_char_p;
|
parms[0] = cpp_const_char_p;
|
||||||
functionType = new CPPFunctionType(cpp_long_double, parms);
|
functionType = new CPPFunctionType(cpp_long_double, parms);
|
||||||
|
@ -730,7 +731,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
parms[0] = cpp_unsigned_int;
|
parms[0] = cpp_unsigned_int;
|
||||||
functionType = new CPPFunctionType(cpp_int, parms);
|
functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_FFS, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_FFS, scope, (ICPPFunctionType) functionType, theParms, false);
|
||||||
}
|
}
|
||||||
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
||||||
|
|
||||||
|
@ -739,7 +740,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
if (lang == ParserLanguage.C) {
|
if (lang == ParserLanguage.C) {
|
||||||
temp = new CImplicitFunction(__BUILTIN_CLZ, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_CLZ, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_CLZ, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_CLZ, scope, (ICPPFunctionType) functionType, theParms, false);
|
||||||
}
|
}
|
||||||
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
||||||
|
|
||||||
|
@ -748,7 +749,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
if (lang == ParserLanguage.C) {
|
if (lang == ParserLanguage.C) {
|
||||||
temp = new CImplicitFunction(__BUILTIN_CTZ, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_CTZ, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_CTZ, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_CTZ, scope, (ICPPFunctionType) functionType, theParms, false);
|
||||||
}
|
}
|
||||||
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
||||||
|
|
||||||
|
@ -757,7 +758,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
if (lang == ParserLanguage.C) {
|
if (lang == ParserLanguage.C) {
|
||||||
temp = new CImplicitFunction(__BUILTIN_POPCOUNT, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_POPCOUNT, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_POPCOUNT, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_POPCOUNT, scope, (ICPPFunctionType) functionType, theParms, false);
|
||||||
}
|
}
|
||||||
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
||||||
|
|
||||||
|
@ -766,7 +767,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
if (lang == ParserLanguage.C) {
|
if (lang == ParserLanguage.C) {
|
||||||
temp = new CImplicitFunction(__BUILTIN_PARITY, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_PARITY, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_PARITY, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_PARITY, scope, (ICPPFunctionType) functionType, theParms, false);
|
||||||
}
|
}
|
||||||
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
||||||
}
|
}
|
||||||
|
@ -787,7 +788,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
parms[0] = cpp_unsigned_long;
|
parms[0] = cpp_unsigned_long;
|
||||||
functionType = new CPPFunctionType(cpp_int, parms);
|
functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_FFSL, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_FFSL, scope, (ICPPFunctionType) functionType, theParms, false);
|
||||||
}
|
}
|
||||||
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
||||||
|
|
||||||
|
@ -796,7 +797,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
if (lang == ParserLanguage.C) {
|
if (lang == ParserLanguage.C) {
|
||||||
temp = new CImplicitFunction(__BUILTIN_CLZL, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_CLZL, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_CLZL, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_CLZL, scope, (ICPPFunctionType) functionType, theParms, false);
|
||||||
}
|
}
|
||||||
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
||||||
|
|
||||||
|
@ -805,7 +806,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
if (lang == ParserLanguage.C) {
|
if (lang == ParserLanguage.C) {
|
||||||
temp = new CImplicitFunction(__BUILTIN_CTZL, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_CTZL, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_CTZL, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_CTZL, scope, (ICPPFunctionType) functionType, theParms, false);
|
||||||
}
|
}
|
||||||
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
||||||
|
|
||||||
|
@ -814,7 +815,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
if (lang == ParserLanguage.C) {
|
if (lang == ParserLanguage.C) {
|
||||||
temp = new CImplicitFunction(__BUILTIN_POPCOUNTL, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_POPCOUNTL, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_POPCOUNTL, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_POPCOUNTL, scope, (ICPPFunctionType) functionType, theParms, false);
|
||||||
}
|
}
|
||||||
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
||||||
|
|
||||||
|
@ -823,7 +824,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
if (lang == ParserLanguage.C) {
|
if (lang == ParserLanguage.C) {
|
||||||
temp = new CImplicitFunction(__BUILTIN_PARITYL, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_PARITYL, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_PARITYL, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_PARITYL, scope, (ICPPFunctionType) functionType, theParms, false);
|
||||||
}
|
}
|
||||||
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
||||||
}
|
}
|
||||||
|
@ -844,7 +845,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
parms[0] = cpp_unsigned_long_long;
|
parms[0] = cpp_unsigned_long_long;
|
||||||
functionType = new CPPFunctionType(cpp_int, parms);
|
functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_FFSLL, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_FFSLL, scope, (ICPPFunctionType) functionType, theParms, false);
|
||||||
}
|
}
|
||||||
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
||||||
|
|
||||||
|
@ -853,7 +854,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
if (lang == ParserLanguage.C) {
|
if (lang == ParserLanguage.C) {
|
||||||
temp = new CImplicitFunction(__BUILTIN_CLZLL, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_CLZLL, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_CLZLL, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_CLZLL, scope, (ICPPFunctionType) functionType, theParms, false);
|
||||||
}
|
}
|
||||||
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
||||||
|
|
||||||
|
@ -862,7 +863,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
if (lang == ParserLanguage.C) {
|
if (lang == ParserLanguage.C) {
|
||||||
temp = new CImplicitFunction(__BUILTIN_CTZLL, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_CTZLL, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_CTZLL, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_CTZLL, scope, (ICPPFunctionType) functionType, theParms, false);
|
||||||
}
|
}
|
||||||
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
||||||
|
|
||||||
|
@ -871,7 +872,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
if (lang == ParserLanguage.C) {
|
if (lang == ParserLanguage.C) {
|
||||||
temp = new CImplicitFunction(__BUILTIN_POPCOUNTLL, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_POPCOUNTLL, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_POPCOUNTLL, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_POPCOUNTLL, scope, (ICPPFunctionType) functionType, theParms, false);
|
||||||
}
|
}
|
||||||
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
||||||
|
|
||||||
|
@ -880,7 +881,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
if (lang == ParserLanguage.C) {
|
if (lang == ParserLanguage.C) {
|
||||||
temp = new CImplicitFunction(__BUILTIN_PARITYLL, scope, functionType, theParms, false);
|
temp = new CImplicitFunction(__BUILTIN_PARITYLL, scope, functionType, theParms, false);
|
||||||
} else {
|
} else {
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_PARITYLL, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_PARITYLL, scope, (ICPPFunctionType) functionType, theParms, false);
|
||||||
}
|
}
|
||||||
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
bindings = (IBinding[])ArrayUtil.append(IBinding.class, bindings, temp);
|
||||||
}
|
}
|
||||||
|
@ -919,7 +920,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
theParms[1] = theParms[0];
|
theParms[1] = theParms[0];
|
||||||
temp = new CImplicitFunction(__BUILTIN_TYPES_COMPATIBLE_P, scope, functionType, theParms, true);
|
temp = new CImplicitFunction(__BUILTIN_TYPES_COMPATIBLE_P, scope, functionType, theParms, true);
|
||||||
} else {
|
} else {
|
||||||
IFunctionType functionType = null;
|
ICPPFunctionType functionType = null;
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_unspecified;
|
parms[0] = cpp_unspecified;
|
||||||
parms[1] = cpp_unspecified;
|
parms[1] = cpp_unspecified;
|
||||||
|
@ -949,7 +950,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_double;
|
parms[0] = cpp_double;
|
||||||
parms[1] = cpp_int;
|
parms[1] = cpp_int;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_double, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_double, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -973,7 +974,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_float;
|
parms[0] = cpp_float;
|
||||||
parms[1] = cpp_int;
|
parms[1] = cpp_int;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_float, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_float, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -997,7 +998,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_long_double;
|
parms[0] = cpp_long_double;
|
||||||
parms[1] = cpp_int;
|
parms[1] = cpp_int;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_long_double, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_long_double, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -1020,7 +1021,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_void;
|
parms[0] = cpp_void;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_void, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_void, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_ABORT, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_ABORT, scope, functionType, theParms, false);
|
||||||
|
@ -1047,7 +1048,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_int;
|
parms[0] = cpp_int;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_void, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_void, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_EXIT1, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_EXIT1, scope, functionType, theParms, false);
|
||||||
|
@ -1073,7 +1074,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_double_complex;
|
parms[0] = cpp_double_complex;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_double_complex, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_double_complex, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_CONJ, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_CONJ, scope, functionType, theParms, false);
|
||||||
|
@ -1093,7 +1094,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_float_complex;
|
parms[0] = cpp_float_complex;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_float_complex, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_float_complex, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_CONJF, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_CONJF, scope, functionType, theParms, false);
|
||||||
|
@ -1113,7 +1114,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_long_double_complex;
|
parms[0] = cpp_long_double_complex;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_long_double_complex, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_long_double_complex, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_CONJL, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_CONJL, scope, functionType, theParms, false);
|
||||||
|
@ -1135,7 +1136,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_double_complex;
|
parms[0] = cpp_double_complex;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_double, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_double, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_CREAL, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_CREAL, scope, functionType, theParms, false);
|
||||||
|
@ -1155,7 +1156,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_float_complex;
|
parms[0] = cpp_float_complex;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_float, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_float, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_CREALF, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_CREALF, scope, functionType, theParms, false);
|
||||||
|
@ -1175,7 +1176,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_long_double_complex;
|
parms[0] = cpp_long_double_complex;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_long_double, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_long_double, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_CREALL, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_CREALL, scope, functionType, theParms, false);
|
||||||
|
@ -1194,7 +1195,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_double_complex;
|
parms[0] = cpp_double_complex;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_double, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_double, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_CIMAG, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_CIMAG, scope, functionType, theParms, false);
|
||||||
|
@ -1214,7 +1215,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_float_complex;
|
parms[0] = cpp_float_complex;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_float, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_float, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_CIMAGF, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_CIMAGF, scope, functionType, theParms, false);
|
||||||
|
@ -1234,7 +1235,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_long_double_complex;
|
parms[0] = cpp_long_double_complex;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_long_double, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_long_double, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_CIMAGL, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_CIMAGL, scope, functionType, theParms, false);
|
||||||
|
@ -1256,7 +1257,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_int;
|
parms[0] = cpp_int;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_ABS, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_ABS, scope, functionType, theParms, false);
|
||||||
|
@ -1276,7 +1277,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_double;
|
parms[0] = cpp_double;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_double, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_double, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_FABS, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_FABS, scope, functionType, theParms, false);
|
||||||
|
@ -1296,7 +1297,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_long_int;
|
parms[0] = cpp_long_int;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_long_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_long_int, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_LABS, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_LABS, scope, functionType, theParms, false);
|
||||||
|
@ -1316,7 +1317,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_signed_long_int;
|
parms[0] = cpp_signed_long_int;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_signed_long_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_signed_long_int, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_IMAXABS, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_IMAXABS, scope, functionType, theParms, false);
|
||||||
|
@ -1336,7 +1337,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_long_long_int;
|
parms[0] = cpp_long_long_int;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_long_long_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_long_long_int, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_LLABS, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_LLABS, scope, functionType, theParms, false);
|
||||||
|
@ -1356,7 +1357,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_float;
|
parms[0] = cpp_float;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_float, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_float, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_FABSF, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_FABSF, scope, functionType, theParms, false);
|
||||||
|
@ -1376,7 +1377,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_long_double;
|
parms[0] = cpp_long_double;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_long_double, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_long_double, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_FABSL, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_FABSL, scope, functionType, theParms, false);
|
||||||
|
@ -1398,7 +1399,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_const_char_p_r;
|
parms[0] = cpp_const_char_p_r;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_PRINTF, scope, functionType, theParms, true);
|
temp = new CPPImplicitFunction(__BUILTIN_PRINTF, scope, functionType, theParms, true);
|
||||||
|
@ -1421,7 +1422,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_char_p_r;
|
parms[0] = cpp_char_p_r;
|
||||||
parms[1] = cpp_const_char_p_r;
|
parms[1] = cpp_const_char_p_r;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -1448,7 +1449,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
parms[0] = cpp_char_p_r;
|
parms[0] = cpp_char_p_r;
|
||||||
parms[1] = cpp_size_t;
|
parms[1] = cpp_size_t;
|
||||||
parms[2] = cpp_const_char_p_r;
|
parms[2] = cpp_const_char_p_r;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[3];
|
IParameter[] theParms = new IParameter[3];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -1473,7 +1474,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_FILE_p_r;
|
parms[0] = cpp_FILE_p_r;
|
||||||
parms[1] = cpp_const_char_p_r;
|
parms[1] = cpp_const_char_p_r;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -1497,7 +1498,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_const_char_p_r;
|
parms[0] = cpp_const_char_p_r;
|
||||||
parms[1] = cpp_va_list;
|
parms[1] = cpp_va_list;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -1531,7 +1532,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
parms[1] = cpp_size_t;
|
parms[1] = cpp_size_t;
|
||||||
parms[2] = cpp_const_char_p_r;
|
parms[2] = cpp_const_char_p_r;
|
||||||
parms[3] = cpp_va_list;
|
parms[3] = cpp_va_list;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[4];
|
IParameter[] theParms = new IParameter[4];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -1561,7 +1562,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_const_char_p_r;
|
parms[0] = cpp_const_char_p_r;
|
||||||
parms[1] = cpp_va_list;
|
parms[1] = cpp_va_list;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -1588,7 +1589,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
parms[0] = cpp_const_char_p_r;
|
parms[0] = cpp_const_char_p_r;
|
||||||
parms[1] = cpp_const_char_p_r;
|
parms[1] = cpp_const_char_p_r;
|
||||||
parms[2] = cpp_va_list;
|
parms[2] = cpp_va_list;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[3];
|
IParameter[] theParms = new IParameter[3];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -1610,7 +1611,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_const_char_p_r;
|
parms[0] = cpp_const_char_p_r;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_SCANF, scope, functionType, theParms, true);
|
temp = new CPPImplicitFunction(__BUILTIN_SCANF, scope, functionType, theParms, true);
|
||||||
|
@ -1633,7 +1634,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_const_char_p_r;
|
parms[0] = cpp_const_char_p_r;
|
||||||
parms[1] = cpp_const_char_p_r;
|
parms[1] = cpp_const_char_p_r;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -1669,7 +1670,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_double;
|
parms[0] = cpp_double;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_double, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_double, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_COS, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_COS, scope, functionType, theParms, false);
|
||||||
|
@ -1710,7 +1711,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_float;
|
parms[0] = cpp_float;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_float, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_float, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_COSF, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_COSF, scope, functionType, theParms, false);
|
||||||
|
@ -1751,7 +1752,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_long_double;
|
parms[0] = cpp_long_double;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_long_double, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_long_double, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_COSL, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_COSL, scope, functionType, theParms, false);
|
||||||
|
@ -1784,7 +1785,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_const_char_p_r;
|
parms[0] = cpp_const_char_p_r;
|
||||||
parms[1] = cpp_FILE_p_r;
|
parms[1] = cpp_FILE_p_r;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -1805,7 +1806,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_int;
|
parms[0] = cpp_int;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_PUTCHAR, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_PUTCHAR, scope, functionType, theParms, false);
|
||||||
|
@ -1825,7 +1826,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_const_char_p;
|
parms[0] = cpp_const_char_p;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_PUTS, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_PUTS, scope, functionType, theParms, false);
|
||||||
|
@ -1853,7 +1854,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
parms[0] = cpp_const_void_p;
|
parms[0] = cpp_const_void_p;
|
||||||
parms[1] = cpp_const_void_p;
|
parms[1] = cpp_const_void_p;
|
||||||
parms[2] = cpp_size_t;
|
parms[2] = cpp_size_t;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[3];
|
IParameter[] theParms = new IParameter[3];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -1881,7 +1882,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
parms[0] = cpp_void_p_r;
|
parms[0] = cpp_void_p_r;
|
||||||
parms[1] = cpp_const_void_p_r;
|
parms[1] = cpp_const_void_p_r;
|
||||||
parms[2] = cpp_size_t;
|
parms[2] = cpp_size_t;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_void_p, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_void_p, parms);
|
||||||
IParameter[] theParms = new IParameter[3];
|
IParameter[] theParms = new IParameter[3];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -1909,7 +1910,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
parms[0] = cpp_void_p;
|
parms[0] = cpp_void_p;
|
||||||
parms[1] = cpp_int;
|
parms[1] = cpp_int;
|
||||||
parms[2] = cpp_size_t;
|
parms[2] = cpp_size_t;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_void_p, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_void_p, parms);
|
||||||
IParameter[] theParms = new IParameter[3];
|
IParameter[] theParms = new IParameter[3];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -1936,7 +1937,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_char_p_r;
|
parms[0] = cpp_char_p_r;
|
||||||
parms[1] = cpp_const_char_p_r;
|
parms[1] = cpp_const_char_p_r;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -1960,7 +1961,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_const_char_p;
|
parms[0] = cpp_const_char_p;
|
||||||
parms[1] = cpp_int;
|
parms[1] = cpp_int;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -1984,7 +1985,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_const_char_p;
|
parms[0] = cpp_const_char_p;
|
||||||
parms[1] = cpp_const_char_p;
|
parms[1] = cpp_const_char_p;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -2008,7 +2009,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_char_p_r;
|
parms[0] = cpp_char_p_r;
|
||||||
parms[1] = cpp_const_char_p_r;
|
parms[1] = cpp_const_char_p_r;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -2032,7 +2033,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_const_char_p;
|
parms[0] = cpp_const_char_p;
|
||||||
parms[1] = cpp_const_char_p;
|
parms[1] = cpp_const_char_p;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_size_t, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_size_t, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -2053,7 +2054,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
} else {
|
} else {
|
||||||
IType[] parms = new IType[1];
|
IType[] parms = new IType[1];
|
||||||
parms[0] = cpp_const_char_p;
|
parms[0] = cpp_const_char_p;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_size_t, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_size_t, parms);
|
||||||
IParameter[] theParms = new IParameter[1];
|
IParameter[] theParms = new IParameter[1];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
temp = new CPPImplicitFunction(__BUILTIN_STRLEN, scope, functionType, theParms, false);
|
temp = new CPPImplicitFunction(__BUILTIN_STRLEN, scope, functionType, theParms, false);
|
||||||
|
@ -2076,7 +2077,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_const_char_p;
|
parms[0] = cpp_const_char_p;
|
||||||
parms[1] = cpp_const_char_p;
|
parms[1] = cpp_const_char_p;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -2100,7 +2101,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_const_char_p;
|
parms[0] = cpp_const_char_p;
|
||||||
parms[1] = cpp_int;
|
parms[1] = cpp_int;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -2124,7 +2125,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_const_char_p;
|
parms[0] = cpp_const_char_p;
|
||||||
parms[1] = cpp_const_char_p;
|
parms[1] = cpp_const_char_p;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_size_t, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_size_t, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -2148,7 +2149,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_const_char_p;
|
parms[0] = cpp_const_char_p;
|
||||||
parms[1] = cpp_const_char_p;
|
parms[1] = cpp_const_char_p;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -2175,7 +2176,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
parms[0] = cpp_char_p_r;
|
parms[0] = cpp_char_p_r;
|
||||||
parms[1] = cpp_const_char_p_r;
|
parms[1] = cpp_const_char_p_r;
|
||||||
parms[2] = cpp_size_t;
|
parms[2] = cpp_size_t;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
|
||||||
IParameter[] theParms = new IParameter[3];
|
IParameter[] theParms = new IParameter[3];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -2203,7 +2204,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
parms[0] = cpp_const_char_p;
|
parms[0] = cpp_const_char_p;
|
||||||
parms[1] = cpp_const_char_p;
|
parms[1] = cpp_const_char_p;
|
||||||
parms[2] = cpp_size_t;
|
parms[2] = cpp_size_t;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[3];
|
IParameter[] theParms = new IParameter[3];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -2231,7 +2232,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
parms[0] = cpp_char_p_r;
|
parms[0] = cpp_char_p_r;
|
||||||
parms[1] = cpp_const_char_p_r;
|
parms[1] = cpp_const_char_p_r;
|
||||||
parms[2] = cpp_size_t;
|
parms[2] = cpp_size_t;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_char_p, parms);
|
||||||
IParameter[] theParms = new IParameter[3];
|
IParameter[] theParms = new IParameter[3];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -2258,7 +2259,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_float;
|
parms[0] = cpp_float;
|
||||||
parms[1] = cpp_float;
|
parms[1] = cpp_float;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -2282,7 +2283,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_float;
|
parms[0] = cpp_float;
|
||||||
parms[1] = cpp_float;
|
parms[1] = cpp_float;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -2306,7 +2307,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_float;
|
parms[0] = cpp_float;
|
||||||
parms[1] = cpp_float;
|
parms[1] = cpp_float;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -2330,7 +2331,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_float;
|
parms[0] = cpp_float;
|
||||||
parms[1] = cpp_float;
|
parms[1] = cpp_float;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -2354,7 +2355,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_float;
|
parms[0] = cpp_float;
|
||||||
parms[1] = cpp_float;
|
parms[1] = cpp_float;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
@ -2378,7 +2379,7 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
||||||
IType[] parms = new IType[2];
|
IType[] parms = new IType[2];
|
||||||
parms[0] = cpp_float;
|
parms[0] = cpp_float;
|
||||||
parms[1] = cpp_float;
|
parms[1] = cpp_float;
|
||||||
IFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
ICPPFunctionType functionType = new CPPFunctionType(cpp_int, parms);
|
||||||
IParameter[] theParms = new IParameter[2];
|
IParameter[] theParms = new IParameter[2];
|
||||||
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
theParms[0] = new CPPBuiltinParameter(parms[0]);
|
||||||
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
theParms[1] = new CPPBuiltinParameter(parms[1]);
|
||||||
|
|
|
@ -18,13 +18,13 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IMacroBinding;
|
import org.eclipse.cdt.core.dom.ast.IMacroBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
||||||
|
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.ICPPNamespace;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
||||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||||
|
@ -69,7 +69,7 @@ public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPAST
|
||||||
IBinding temp = null;
|
IBinding temp = null;
|
||||||
IType[] newParms = new IType[1];
|
IType[] newParms = new IType[1];
|
||||||
newParms[0] = cpp_size_t;
|
newParms[0] = cpp_size_t;
|
||||||
IFunctionType newFunctionType = new CPPFunctionType(cpp_void_p, newParms);
|
ICPPFunctionType newFunctionType = new CPPFunctionType(cpp_void_p, newParms);
|
||||||
IParameter[] newTheParms = new IParameter[1];
|
IParameter[] newTheParms = new IParameter[1];
|
||||||
newTheParms[0] = new CPPBuiltinParameter(newParms[0]);
|
newTheParms[0] = new CPPBuiltinParameter(newParms[0]);
|
||||||
temp = new CPPImplicitFunction(OverloadableOperator.NEW.toCharArray(), theScope, newFunctionType, newTheParms, false);
|
temp = new CPPImplicitFunction(OverloadableOperator.NEW.toCharArray(), theScope, newFunctionType, newTheParms, false);
|
||||||
|
@ -88,7 +88,7 @@ public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPAST
|
||||||
temp = null;
|
temp = null;
|
||||||
IType[] deleteParms = new IType[1];
|
IType[] deleteParms = new IType[1];
|
||||||
deleteParms[0] = cpp_void_p;
|
deleteParms[0] = cpp_void_p;
|
||||||
IFunctionType deleteFunctionType = new CPPFunctionType(cpp_void, deleteParms);
|
ICPPFunctionType deleteFunctionType = new CPPFunctionType(cpp_void, deleteParms);
|
||||||
IParameter[] deleteTheParms = new IParameter[1];
|
IParameter[] deleteTheParms = new IParameter[1];
|
||||||
deleteTheParms[0] = new CPPBuiltinParameter(deleteParms[0]);
|
deleteTheParms[0] = new CPPBuiltinParameter(deleteParms[0]);
|
||||||
temp = new CPPImplicitFunction(OverloadableOperator.DELETE.toCharArray(), theScope, deleteFunctionType, deleteTheParms, false);
|
temp = new CPPImplicitFunction(OverloadableOperator.DELETE.toCharArray(), theScope, deleteFunctionType, deleteTheParms, false);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* Andrew Niefer (IBM Corporation) - initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Bryan Wilkinson (QNX)
|
* Bryan Wilkinson (QNX)
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
|
@ -32,7 +32,6 @@ import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
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.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
|
@ -49,6 +48,7 @@ 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.ICPPClassTemplate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
|
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.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.index.IIndexFileSet;
|
import org.eclipse.cdt.core.index.IIndexFileSet;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
|
@ -60,7 +60,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author aniefer
|
* Base implementation for c++ scopes.
|
||||||
*/
|
*/
|
||||||
public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
private static final char[] CONSTRUCTOR_KEY = "!!!CTOR!!!".toCharArray(); //$NON-NLS-1$
|
private static final char[] CONSTRUCTOR_KEY = "!!!CTOR!!!".toCharArray(); //$NON-NLS-1$
|
||||||
|
@ -129,7 +129,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
//copy assignment operator: A& operator = (const A &)
|
//copy assignment operator: A& operator = (const A &)
|
||||||
IType refType = new CPPReferenceType(clsType);
|
IType refType = new CPPReferenceType(clsType);
|
||||||
IPointerType thisType= new CPPPointerType(clsType);
|
IPointerType thisType= new CPPPointerType(clsType);
|
||||||
IFunctionType ft= CPPVisitor.createImplicitFunctionType(refType, ps, thisType);
|
ICPPFunctionType ft= CPPVisitor.createImplicitFunctionType(refType, ps, thisType);
|
||||||
ICPPMethod m = new CPPImplicitMethod(this, OverloadableOperator.ASSIGN.toCharArray(), ft, ps);
|
ICPPMethod m = new CPPImplicitMethod(this, OverloadableOperator.ASSIGN.toCharArray(), ft, ps);
|
||||||
implicits[i++] = m;
|
implicits[i++] = m;
|
||||||
addBinding(m);
|
addBinding(m);
|
||||||
|
@ -138,7 +138,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
if (!ia.hasUserDeclaredDestructor()) {
|
if (!ia.hasUserDeclaredDestructor()) {
|
||||||
//destructor: ~A()
|
//destructor: ~A()
|
||||||
IPointerType thisType= new CPPPointerType(clsType);
|
IPointerType thisType= new CPPPointerType(clsType);
|
||||||
IFunctionType ft= CPPVisitor.createImplicitFunctionType(new CPPBasicType(IBasicType.t_unspecified, 0), voidPs, thisType);
|
ICPPFunctionType ft= CPPVisitor.createImplicitFunctionType(new CPPBasicType(IBasicType.t_unspecified, 0), voidPs, thisType);
|
||||||
char[] dtorName = CharArrayUtils.concat("~".toCharArray(), className); //$NON-NLS-1$
|
char[] dtorName = CharArrayUtils.concat("~".toCharArray(), className); //$NON-NLS-1$
|
||||||
ICPPMethod m = new CPPImplicitMethod(this, dtorName, ft, voidPs);
|
ICPPMethod m = new CPPImplicitMethod(this, dtorName, ft, voidPs);
|
||||||
implicits[i++] = m;
|
implicits[i++] = m;
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.internal.core.dom.Linkage;
|
import org.eclipse.cdt.internal.core.dom.Linkage;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
||||||
|
@ -63,7 +64,7 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
|
||||||
throw new DOMException(this);
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IFunctionType getType() throws DOMException {
|
public ICPPFunctionType getType() throws DOMException {
|
||||||
throw new DOMException(this);
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public boolean isStatic() throws DOMException {
|
public boolean isStatic() throws DOMException {
|
||||||
|
@ -106,7 +107,7 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
|
||||||
|
|
||||||
protected ICPPASTFunctionDeclarator[] declarations;
|
protected ICPPASTFunctionDeclarator[] declarations;
|
||||||
protected ICPPASTFunctionDeclarator definition;
|
protected ICPPASTFunctionDeclarator definition;
|
||||||
protected IFunctionType type = null;
|
protected ICPPFunctionType type = null;
|
||||||
|
|
||||||
private static final int FULLY_RESOLVED = 1;
|
private static final int FULLY_RESOLVED = 1;
|
||||||
private static final int RESOLUTION_IN_PROGRESS = 1 << 1;
|
private static final int RESOLUTION_IN_PROGRESS = 1 << 1;
|
||||||
|
@ -297,9 +298,9 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IFunctionType getType() {
|
public ICPPFunctionType getType() {
|
||||||
if (type == null)
|
if (type == null)
|
||||||
type = (IFunctionType) CPPVisitor.createType((definition != null) ? definition : declarations[0]);
|
type = (ICPPFunctionType) CPPVisitor.createType((definition != null) ? definition : declarations[0]);
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,8 +60,8 @@ public class CPPFunctionInstance extends CPPFunctionSpecialization implements IC
|
||||||
if( (obj instanceof ICPPTemplateInstance) && (obj instanceof ICPPFunction)){
|
if( (obj instanceof ICPPTemplateInstance) && (obj instanceof ICPPFunction)){
|
||||||
try {
|
try {
|
||||||
final ICPPTemplateInstance inst = (ICPPTemplateInstance)obj;
|
final ICPPTemplateInstance inst = (ICPPTemplateInstance)obj;
|
||||||
ICPPFunctionType ct1= (ICPPFunctionType) ((ICPPFunction)getSpecializedBinding()).getType();
|
ICPPFunctionType ct1= ((ICPPFunction)getSpecializedBinding()).getType();
|
||||||
ICPPFunctionType ct2= (ICPPFunctionType) ((ICPPFunction)inst.getTemplateDefinition()).getType();
|
ICPPFunctionType ct2= ((ICPPFunction)inst.getTemplateDefinition()).getType();
|
||||||
if(!ct1.isSameType(ct2))
|
if(!ct1.isSameType(ct2))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
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.ICPPParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
|
@ -37,7 +38,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
* also used as base class for function instances.
|
* also used as base class for function instances.
|
||||||
*/
|
*/
|
||||||
public class CPPFunctionSpecialization extends CPPSpecialization implements ICPPFunction, ICPPInternalFunction {
|
public class CPPFunctionSpecialization extends CPPSpecialization implements ICPPFunction, ICPPInternalFunction {
|
||||||
private IFunctionType type = null;
|
private ICPPFunctionType type = null;
|
||||||
private IParameter[] specializedParams = null;
|
private IParameter[] specializedParams = null;
|
||||||
private IType[] specializedExceptionSpec = null;
|
private IType[] specializedExceptionSpec = null;
|
||||||
|
|
||||||
|
@ -72,10 +73,10 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IFunctionType getType() throws DOMException {
|
public ICPPFunctionType getType() throws DOMException {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
ICPPFunction function = (ICPPFunction) getSpecializedBinding();
|
ICPPFunction function = (ICPPFunction) getSpecializedBinding();
|
||||||
type = (IFunctionType) specializeType(function.getType());
|
type = (ICPPFunctionType) specializeType(function.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* Andrew Niefer (IBM) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
@ -33,12 +33,13 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
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.ICPPFunctionTemplate;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author aniefer
|
* Implementation of function templates
|
||||||
*/
|
*/
|
||||||
public class CPPFunctionTemplate extends CPPTemplateDefinition
|
public class CPPFunctionTemplate extends CPPTemplateDefinition
|
||||||
implements ICPPFunctionTemplate, ICPPFunction, ICPPInternalFunction {
|
implements ICPPFunctionTemplate, ICPPFunction, ICPPInternalFunction {
|
||||||
|
@ -77,7 +78,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
||||||
public IScope getFunctionScope() throws DOMException {
|
public IScope getFunctionScope() throws DOMException {
|
||||||
throw new DOMException(this);
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public IFunctionType getType() throws DOMException {
|
public ICPPFunctionType getType() throws DOMException {
|
||||||
throw new DOMException(this);
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public boolean isStatic() throws DOMException {
|
public boolean isStatic() throws DOMException {
|
||||||
|
@ -100,7 +101,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IFunctionType type = null;
|
protected ICPPFunctionType type = null;
|
||||||
|
|
||||||
public CPPFunctionTemplate(IASTName name) {
|
public CPPFunctionTemplate(IASTName name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
@ -167,7 +168,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IFunctionType getType() {
|
public ICPPFunctionType getType() {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
IASTName name = getTemplateName();
|
IASTName name = getTemplateName();
|
||||||
IASTNode parent = name.getParent();
|
IASTNode parent = name.getParent();
|
||||||
|
@ -175,8 +176,8 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
|
|
||||||
IType temp = CPPVisitor.createType((IASTDeclarator)parent);
|
IType temp = CPPVisitor.createType((IASTDeclarator)parent);
|
||||||
if (temp instanceof IFunctionType)
|
if (temp instanceof ICPPFunctionType)
|
||||||
type = (IFunctionType) temp;
|
type = (ICPPFunctionType) temp;
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
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.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,7 +28,7 @@ public class CPPImplicitConstructor extends CPPImplicitMethod implements ICPPCon
|
||||||
super( scope, name, createFunctionType(scope, params), params );
|
super( scope, name, createFunctionType(scope, params), params );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IFunctionType createFunctionType(ICPPClassScope scope, IParameter[] params) {
|
private static ICPPFunctionType createFunctionType(ICPPClassScope scope, IParameter[] params) {
|
||||||
IType returnType= new CPPBasicType(IBasicType.t_unspecified, 0);
|
IType returnType= new CPPBasicType(IBasicType.t_unspecified, 0);
|
||||||
return CPPVisitor.createImplicitFunctionType(returnType, params, null);
|
return CPPVisitor.createImplicitFunctionType(returnType, params, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,10 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
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.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,18 +25,16 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
* unit but are not actually part of the physical AST created by CDT.
|
* unit but are not actually part of the physical AST created by CDT.
|
||||||
*
|
*
|
||||||
* An example is GCC built-in functions.
|
* An example is GCC built-in functions.
|
||||||
*
|
|
||||||
* @author dsteffle
|
|
||||||
*/
|
*/
|
||||||
public class CPPImplicitFunction extends CPPFunction {
|
public class CPPImplicitFunction extends CPPFunction {
|
||||||
|
|
||||||
private IParameter[] parms=null;
|
private IParameter[] parms=null;
|
||||||
private IScope scope=null;
|
private IScope scope=null;
|
||||||
private IFunctionType functionType=null;
|
private ICPPFunctionType functionType=null;
|
||||||
private boolean takesVarArgs=false;
|
private boolean takesVarArgs=false;
|
||||||
private char[] name=null;
|
private char[] name=null;
|
||||||
|
|
||||||
public CPPImplicitFunction(char[] name, IScope scope, IFunctionType type, IParameter[] parms, boolean takesVarArgs) {
|
public CPPImplicitFunction(char[] name, IScope scope, ICPPFunctionType type, IParameter[] parms, boolean takesVarArgs) {
|
||||||
super( null );
|
super( null );
|
||||||
this.name=name;
|
this.name=name;
|
||||||
this.scope=scope;
|
this.scope=scope;
|
||||||
|
@ -51,7 +49,7 @@ public class CPPImplicitFunction extends CPPFunction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFunctionType getType() {
|
public ICPPFunctionType getType() {
|
||||||
return functionType;
|
return functionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
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.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
||||||
|
@ -39,9 +40,9 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
*/
|
*/
|
||||||
public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod {
|
public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod {
|
||||||
|
|
||||||
public CPPImplicitMethod( ICPPClassScope scope, char[] name, IFunctionType type, IParameter[] params ) {
|
public CPPImplicitMethod(ICPPClassScope scope, char[] name, ICPPFunctionType type, IParameter[] params) {
|
||||||
super( name, scope, type, params, false );
|
super(name, scope, type, params, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getVisibility() throws DOMException {
|
public int getVisibility() throws DOMException {
|
||||||
IASTDeclaration decl = getPrimaryDeclaration();
|
IASTDeclaration decl = getPrimaryDeclaration();
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTInitializerExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTInitializerExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
|
@ -33,9 +32,6 @@ public class CPPTemplateNonTypeParameter extends CPPTemplateParameter implements
|
||||||
|
|
||||||
private IType type = null;
|
private IType type = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param name
|
|
||||||
*/
|
|
||||||
public CPPTemplateNonTypeParameter(IASTName name) {
|
public CPPTemplateNonTypeParameter(IASTName name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
@ -70,39 +66,24 @@ public class CPPTemplateNonTypeParameter extends CPPTemplateParameter implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStatic() throws DOMException {
|
public boolean isStatic() throws DOMException {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExtern() throws DOMException {
|
public boolean isExtern() throws DOMException {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAuto() throws DOMException {
|
public boolean isAuto() throws DOMException {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRegister() throws DOMException {
|
public boolean isRegister() throws DOMException {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addDefinition(IASTNode node) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addDeclaration(IASTNode node) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public IValue getInitialValue() {
|
public IValue getInitialValue() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
public boolean isExternC() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public boolean isMutable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,8 @@ public class CPPTemplateParameterMap implements ICPPTemplateParameterMap {
|
||||||
* Returns the value for the given parameter.
|
* Returns the value for the given parameter.
|
||||||
*/
|
*/
|
||||||
public ICPPTemplateArgument getArgument(ICPPTemplateParameter param) {
|
public ICPPTemplateArgument getArgument(ICPPTemplateParameter param) {
|
||||||
|
if (param == null)
|
||||||
|
return null;
|
||||||
return (ICPPTemplateArgument) fMap.get(param.getParameterID());
|
return (ICPPTemplateArgument) fMap.get(param.getParameterID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,11 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
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.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
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.ICPPFunction;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a reference to a (member) function (instance), which cannot be resolved because
|
* Represents a reference to a (member) function (instance), which cannot be resolved because
|
||||||
|
@ -30,7 +30,7 @@ public class CPPUnknownFunction extends CPPUnknownBinding implements ICPPFunctio
|
||||||
return new CPPUnknownFunction(sample.getOwner(), name.getLastName());
|
return new CPPUnknownFunction(sample.getOwner(), name.getLastName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private IFunctionType fType;
|
private ICPPFunctionType fType;
|
||||||
|
|
||||||
public CPPUnknownFunction(IBinding owner, IASTName name) {
|
public CPPUnknownFunction(IBinding owner, IASTName name) {
|
||||||
super(owner, name);
|
super(owner, name);
|
||||||
|
@ -60,7 +60,7 @@ public class CPPUnknownFunction extends CPPUnknownBinding implements ICPPFunctio
|
||||||
return IParameter.EMPTY_PARAMETER_ARRAY;
|
return IParameter.EMPTY_PARAMETER_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IFunctionType getType() throws DOMException {
|
public ICPPFunctionType getType() throws DOMException {
|
||||||
if (fType == null) {
|
if (fType == null) {
|
||||||
fType= new CPPUnknownFunctionType();
|
fType= new CPPUnknownFunctionType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,7 +227,14 @@ public class CPPSemantics {
|
||||||
if (data.checkAssociatedScopes()) {
|
if (data.checkAssociatedScopes()) {
|
||||||
//3.4.2 argument dependent name lookup, aka Koenig lookup
|
//3.4.2 argument dependent name lookup, aka Koenig lookup
|
||||||
try {
|
try {
|
||||||
if (binding == null || binding.getOwner() instanceof ICPPClassType == false) {
|
boolean doKoenig= true;
|
||||||
|
if (binding != null) {
|
||||||
|
if (binding.getOwner() instanceof ICPPClassType)
|
||||||
|
doKoenig= false;
|
||||||
|
else if (binding instanceof ICPPClassType && data.considerConstructors)
|
||||||
|
doKoenig= false;
|
||||||
|
}
|
||||||
|
if (doKoenig) {
|
||||||
data.ignoreUsingDirectives = true;
|
data.ignoreUsingDirectives = true;
|
||||||
data.forceQualified = true;
|
data.forceQualified = true;
|
||||||
for (int i = 0; i < data.associated.size(); i++) {
|
for (int i = 0; i < data.associated.size(); i++) {
|
||||||
|
@ -800,7 +807,7 @@ public class CPPSemantics {
|
||||||
return (ICPPScope) parentScope;
|
return (ICPPScope) parentScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Object lookupInParents(LookupData data, ICPPScope lookIn, ICPPClassType overallScope) throws DOMException{
|
private static Object lookupInParents(LookupData data, ICPPScope lookIn, ICPPClassType overallScope) {
|
||||||
if (lookIn instanceof ICPPClassScope == false)
|
if (lookIn instanceof ICPPClassScope == false)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -808,7 +815,13 @@ public class CPPSemantics {
|
||||||
if (classType == null)
|
if (classType == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
final ICPPBase[] bases= classType.getBases();
|
ICPPBase[] bases= null;
|
||||||
|
try {
|
||||||
|
bases= classType.getBases();
|
||||||
|
} catch (DOMException e) {
|
||||||
|
// assume that there are no bases
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (bases == null || bases.length == 0)
|
if (bases == null || bases.length == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -831,96 +844,100 @@ public class CPPSemantics {
|
||||||
if (base instanceof IProblemBinding)
|
if (base instanceof IProblemBinding)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
IBinding b = base.getBaseClass();
|
try {
|
||||||
if (!(b instanceof ICPPClassType)) {
|
IBinding b = base.getBaseClass();
|
||||||
// 14.6.2.3 scope is not examined
|
if (!(b instanceof ICPPClassType)) {
|
||||||
if (b instanceof ICPPUnknownBinding) {
|
// 14.6.2.3 scope is not examined
|
||||||
|
if (b instanceof ICPPUnknownBinding) {
|
||||||
|
if (data.skippedScope == null)
|
||||||
|
data.skippedScope= overallScope;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
inherited = null;
|
||||||
|
|
||||||
|
final ICPPClassType cls = (ICPPClassType) b;
|
||||||
|
final ICPPScope classScope = (ICPPScope) cls.getCompositeScope();
|
||||||
|
if (classScope == null || classScope instanceof ICPPInternalUnknownScope) {
|
||||||
|
// 14.6.2.3 scope is not examined
|
||||||
if (data.skippedScope == null)
|
if (data.skippedScope == null)
|
||||||
data.skippedScope= overallScope;
|
data.skippedScope= overallScope;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
continue;
|
if (!base.isVirtual() || !data.visited.containsKey(classScope)) {
|
||||||
}
|
if (base.isVirtual()) {
|
||||||
|
data.visited.put(classScope);
|
||||||
inherited = null;
|
|
||||||
|
|
||||||
final ICPPClassType cls = (ICPPClassType) b;
|
|
||||||
final ICPPScope classScope = (ICPPScope) cls.getCompositeScope();
|
|
||||||
if (classScope == null || classScope instanceof ICPPInternalUnknownScope) {
|
|
||||||
// 14.6.2.3 scope is not examined
|
|
||||||
if (data.skippedScope == null)
|
|
||||||
data.skippedScope= overallScope;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!base.isVirtual() || !data.visited.containsKey(classScope)) {
|
|
||||||
if (base.isVirtual()) {
|
|
||||||
data.visited.put(classScope);
|
|
||||||
}
|
|
||||||
|
|
||||||
//if the inheritanceChain already contains the parent, then that
|
|
||||||
//is circular inheritance
|
|
||||||
if (!data.inheritanceChain.containsKey(classScope)) {
|
|
||||||
//is this name define in this scope?
|
|
||||||
if (ASTInternal.isFullyCached(classScope)) {
|
|
||||||
if (data.astName != null && !data.contentAssist) {
|
|
||||||
inherited = classScope.getBinding(data.astName, true);
|
|
||||||
} else if (data.astName != null) {
|
|
||||||
inherited = classScope.getBindings(data.astName, true, data.prefixLookup);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
inherited = lookupInScope(data, classScope, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inherited == null || data.contentAssist) {
|
//if the inheritanceChain already contains the parent, then that
|
||||||
Object temp = lookupInParents(data, classScope, overallScope);
|
//is circular inheritance
|
||||||
if (inherited != null) {
|
if (!data.inheritanceChain.containsKey(classScope)) {
|
||||||
inherited = mergePrefixResults(null, inherited, true);
|
//is this name define in this scope?
|
||||||
inherited = mergePrefixResults((CharArrayObjectMap)inherited, (CharArrayObjectMap)temp, true);
|
if (ASTInternal.isFullyCached(classScope)) {
|
||||||
|
if (data.astName != null && !data.contentAssist) {
|
||||||
|
inherited = classScope.getBinding(data.astName, true);
|
||||||
|
} else if (data.astName != null) {
|
||||||
|
inherited = classScope.getBindings(data.astName, true, data.prefixLookup);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
inherited = temp;
|
inherited = lookupInScope(data, classScope, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inherited == null || data.contentAssist) {
|
||||||
|
Object temp = lookupInParents(data, classScope, overallScope);
|
||||||
|
if (inherited != null) {
|
||||||
|
inherited = mergePrefixResults(null, inherited, true);
|
||||||
|
inherited = mergePrefixResults((CharArrayObjectMap)inherited, (CharArrayObjectMap)temp, true);
|
||||||
|
} else {
|
||||||
|
inherited = temp;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
visitVirtualBaseClasses(data, cls);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
visitVirtualBaseClasses(data, cls);
|
data.problem = new ProblemBinding(null, IProblemBinding.SEMANTIC_CIRCULAR_INHERITANCE, cls.getNameCharArray());
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
data.problem = new ProblemBinding(null, IProblemBinding.SEMANTIC_CIRCULAR_INHERITANCE, cls.getNameCharArray());
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (inherited != null) {
|
if (inherited != null) {
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
result = inherited;
|
result = inherited;
|
||||||
} else if (!data.contentAssist) {
|
} else if (!data.contentAssist) {
|
||||||
if (result instanceof Object[]) {
|
if (result instanceof Object[]) {
|
||||||
Object[] r = (Object[]) result;
|
Object[] r = (Object[]) result;
|
||||||
for (int j = 0; j < r.length && r[j] != null; j++) {
|
for (int j = 0; j < r.length && r[j] != null; j++) {
|
||||||
if (checkForAmbiguity(data, r[j], inherited)) {
|
if (checkForAmbiguity(data, r[j], inherited)) {
|
||||||
|
data.problem = new ProblemBinding(data.astName,
|
||||||
|
IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (checkForAmbiguity(data, result, inherited)) {
|
||||||
data.problem = new ProblemBinding(data.astName,
|
data.problem = new ProblemBinding(data.astName,
|
||||||
IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name());
|
IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (checkForAmbiguity(data, result, inherited)) {
|
CharArrayObjectMap temp = (CharArrayObjectMap) inherited;
|
||||||
data.problem = new ProblemBinding(data.astName,
|
CharArrayObjectMap r = (CharArrayObjectMap) result;
|
||||||
IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name());
|
char[] key = null;
|
||||||
return null;
|
int tempSize = temp.size();
|
||||||
}
|
for (int ii = 0; ii < tempSize; ii++) {
|
||||||
}
|
key = temp.keyAt(ii);
|
||||||
} else {
|
if (!r.containsKey(key)) {
|
||||||
CharArrayObjectMap temp = (CharArrayObjectMap) inherited;
|
r.put(key, temp.get(key));
|
||||||
CharArrayObjectMap r = (CharArrayObjectMap) result;
|
} else {
|
||||||
char[] key = null;
|
//TODO: prefixLookup ambiguity checking
|
||||||
int tempSize = temp.size();
|
}
|
||||||
for (int ii = 0; ii < tempSize; ii++) {
|
|
||||||
key = temp.keyAt(ii);
|
|
||||||
if (!r.containsKey(key)) {
|
|
||||||
r.put(key, temp.get(key));
|
|
||||||
} else {
|
|
||||||
//TODO: prefixLookup ambiguity checking
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (DOMException e) {
|
||||||
|
// assume that the base has not been specified
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPMethodTemplateSpecializat
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPParameter;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPParameter;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerToMemberType;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerToMemberType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPQualifierType;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateArgument;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateArgument;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateDefinition;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateDefinition;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateNonTypeParameter;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateNonTypeParameter;
|
||||||
|
@ -789,7 +788,8 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type instanceof ITypeContainer) {
|
if (type instanceof ITypeContainer) {
|
||||||
IType nestedType = ((ITypeContainer) type).getType();
|
final ITypeContainer tc = (ITypeContainer) type;
|
||||||
|
IType nestedType = tc.getType();
|
||||||
IType newNestedType = instantiateType(nestedType, tpMap, within);
|
IType newNestedType = instantiateType(nestedType, tpMap, within);
|
||||||
if (type instanceof ICPPPointerToMemberType) {
|
if (type instanceof ICPPPointerToMemberType) {
|
||||||
ICPPPointerToMemberType ptm = (ICPPPointerToMemberType) type;
|
ICPPPointerToMemberType ptm = (ICPPPointerToMemberType) type;
|
||||||
|
@ -804,20 +804,7 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newNestedType != nestedType) {
|
if (newNestedType != nestedType) {
|
||||||
// bug 249085 make sure not to add unnecessary qualifications
|
return SemanticUtil.replaceNestedType(tc, newNestedType);
|
||||||
if (type instanceof IQualifierType) {
|
|
||||||
IQualifierType qt1= (IQualifierType) type;
|
|
||||||
if (newNestedType instanceof IQualifierType) {
|
|
||||||
IQualifierType qt2= (IQualifierType) newNestedType;
|
|
||||||
return new CPPQualifierType(qt2.getType(), qt1.isConst() || qt2.isConst(), qt1.isVolatile() || qt2.isVolatile());
|
|
||||||
} else if (newNestedType instanceof IPointerType) {
|
|
||||||
IPointerType pt2= (IPointerType) newNestedType;
|
|
||||||
return new CPPPointerType(pt2.getType(), qt1.isConst() || pt2.isConst(), qt1.isVolatile() || pt2.isVolatile());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
type = (IType) type.clone();
|
|
||||||
((ITypeContainer) type).setType(newNestedType);
|
|
||||||
return type;
|
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
@ -1404,9 +1391,8 @@ public class CPPTemplates {
|
||||||
* returns <code>false</code> if there is no mapping.
|
* returns <code>false</code> if there is no mapping.
|
||||||
*/
|
*/
|
||||||
private static boolean deduceTemplateParameterMapFromFunctionParameters(ICPPFunctionTemplate template, IType[] fnArgs, CPPTemplateParameterMap map) throws DOMException{
|
private static boolean deduceTemplateParameterMapFromFunctionParameters(ICPPFunctionTemplate template, IType[] fnArgs, CPPTemplateParameterMap map) throws DOMException{
|
||||||
ICPPFunction function = (ICPPFunction) template;
|
|
||||||
try {
|
try {
|
||||||
IType[] fnPars = function.getType().getParameterTypes();
|
IType[] fnPars = template.getType().getParameterTypes();
|
||||||
int len= Math.min(fnPars.length, fnArgs.length);
|
int len= Math.min(fnPars.length, fnArgs.length);
|
||||||
for (int j= 0; j < len; j++) {
|
for (int j= 0; j < len; j++) {
|
||||||
IType par= fnPars[j];
|
IType par= fnPars[j];
|
||||||
|
@ -1810,7 +1796,7 @@ public class CPPTemplates {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public IFunctionType getType() {
|
public ICPPFunctionType getType() {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
type = CPPVisitor.createImplicitFunctionType(new CPPBasicType(IBasicType.t_void, 0), functionParameters, null);
|
type = CPPVisitor.createImplicitFunctionType(new CPPBasicType(IBasicType.t_void, 0), functionParameters, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,6 +193,12 @@ public class CPPVisitor extends ASTQueries {
|
||||||
public static final String TYPE_INFO= "type_info"; //$NON-NLS-1$
|
public static final String TYPE_INFO= "type_info"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static IBinding createBinding(IASTName name) {
|
public static IBinding createBinding(IASTName name) {
|
||||||
|
if (name.toString().equals("GetCharset"))
|
||||||
|
// mstodo
|
||||||
|
{
|
||||||
|
int ____i = 0;
|
||||||
|
____i++;
|
||||||
|
}
|
||||||
IASTNode parent = name.getParent();
|
IASTNode parent = name.getParent();
|
||||||
IBinding binding = null;
|
IBinding binding = null;
|
||||||
if (parent instanceof IASTNamedTypeSpecifier ||
|
if (parent instanceof IASTNamedTypeSpecifier ||
|
||||||
|
@ -1491,7 +1497,7 @@ public class CPPVisitor extends ASTQueries {
|
||||||
* Generate a function type for an implicit function.
|
* Generate a function type for an implicit function.
|
||||||
* NOTE: This does not correctly handle parameters with typedef types.
|
* NOTE: This does not correctly handle parameters with typedef types.
|
||||||
*/
|
*/
|
||||||
public static IFunctionType createImplicitFunctionType(IType returnType, IParameter[] parameters, IPointerType thisType) {
|
public static ICPPFunctionType createImplicitFunctionType(IType returnType, IParameter[] parameters, IPointerType thisType) {
|
||||||
IType[] pTypes = new IType[parameters.length];
|
IType[] pTypes = new IType[parameters.length];
|
||||||
IType pt = null;
|
IType pt = null;
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
|
import org.eclipse.cdt.core.model.ITypeDef;
|
||||||
import org.eclipse.cdt.core.parser.Keywords;
|
import org.eclipse.cdt.core.parser.Keywords;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArraySet;
|
import org.eclipse.cdt.core.parser.util.CharArraySet;
|
||||||
|
@ -37,6 +38,7 @@ import org.eclipse.cdt.core.parser.util.ObjectSet;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionType;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPQualifierType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateArgument;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateArgument;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.OverloadableOperator;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.OverloadableOperator;
|
||||||
|
@ -260,16 +262,21 @@ public class SemanticUtil {
|
||||||
return new CPPFunctionType(ret, params, ((ICPPFunctionType) type).getThisType());
|
return new CPPFunctionType(ret, params, ((ICPPFunctionType) type).getThisType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type instanceof ITypeDef) {
|
||||||
|
IType t= ((ITypedef) type).getType();
|
||||||
|
if (t != null)
|
||||||
|
return getSimplifiedType(t);
|
||||||
|
return type;
|
||||||
|
}
|
||||||
if (type instanceof ITypeContainer) {
|
if (type instanceof ITypeContainer) {
|
||||||
final IType nestedType= ((ITypeContainer) type).getType();
|
final ITypeContainer tc = (ITypeContainer) type;
|
||||||
|
final IType nestedType= tc.getType();
|
||||||
if (nestedType == null)
|
if (nestedType == null)
|
||||||
return type;
|
return type;
|
||||||
|
|
||||||
IType newType= getSimplifiedType(nestedType);
|
IType newType= getSimplifiedType(nestedType);
|
||||||
if (newType != nestedType) {
|
if (newType != nestedType) {
|
||||||
type= (IType) type.clone();
|
return replaceNestedType(tc, newType);
|
||||||
((ITypeContainer) type).setType(newType);
|
|
||||||
return type;
|
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
@ -278,6 +285,24 @@ public class SemanticUtil {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IType replaceNestedType(ITypeContainer type, IType newNestedType) throws DOMException {
|
||||||
|
// bug 249085 make sure not to add unnecessary qualifications
|
||||||
|
if (type instanceof IQualifierType) {
|
||||||
|
IQualifierType qt1= (IQualifierType) type;
|
||||||
|
if (newNestedType instanceof IQualifierType) {
|
||||||
|
IQualifierType qt2= (IQualifierType) newNestedType;
|
||||||
|
return new CPPQualifierType(qt2.getType(), qt1.isConst() || qt2.isConst(), qt1.isVolatile() || qt2.isVolatile());
|
||||||
|
} else if (newNestedType instanceof IPointerType) {
|
||||||
|
IPointerType pt2= (IPointerType) newNestedType;
|
||||||
|
return new CPPPointerType(pt2.getType(), qt1.isConst() || pt2.isConst(), qt1.isVolatile() || pt2.isVolatile());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type = (ITypeContainer) type.clone();
|
||||||
|
type.setType(newNestedType);
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static IType[] getSimplifiedTypes(IType[] types) {
|
public static IType[] getSimplifiedTypes(IType[] types) {
|
||||||
// Don't create a new array until it's really needed.
|
// Don't create a new array until it's really needed.
|
||||||
IType[] result = types;
|
IType[] result = types;
|
||||||
|
|
|
@ -59,4 +59,5 @@ public interface IIndexCPPBindingConstants {
|
||||||
int CPP_UNKNOWN_CLASS_INSTANCE= IIndexBindingConstants.LAST_CONSTANT + 43;
|
int CPP_UNKNOWN_CLASS_INSTANCE= IIndexBindingConstants.LAST_CONSTANT + 43;
|
||||||
int CPP_TEMPLATE_NON_TYPE_PARAMETER= IIndexBindingConstants.LAST_CONSTANT + 44;
|
int CPP_TEMPLATE_NON_TYPE_PARAMETER= IIndexBindingConstants.LAST_CONSTANT + 44;
|
||||||
int CPP_FRIEND_DECLARATION = IIndexBindingConstants.LAST_CONSTANT + 45;
|
int CPP_FRIEND_DECLARATION = IIndexBindingConstants.LAST_CONSTANT + 45;
|
||||||
|
int CPP_TEMPLATE_TEMPLATE_PARAMETER= IIndexBindingConstants.LAST_CONSTANT + 46;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ 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.ICPPTemplateInstance;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||||
|
@ -230,6 +231,16 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
|
||||||
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
|
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if(binding instanceof ICPPTemplateParameter) {
|
||||||
|
if (binding instanceof ICPPTemplateTypeParameter) {
|
||||||
|
result = new CompositeCPPTemplateTypeParameter(this, (ICPPTemplateTypeParameter) binding);
|
||||||
|
} else if (binding instanceof ICPPTemplateNonTypeParameter) {
|
||||||
|
result = new CompositeCPPTemplateNonTypeParameter(this, (ICPPTemplateNonTypeParameter) binding);
|
||||||
|
} else if (binding instanceof ICPPTemplateTemplateParameter) {
|
||||||
|
result = new CompositeCPPTemplateTemplateParameter(this, (ICPPTemplateTemplateParameter) binding);
|
||||||
|
} else {
|
||||||
|
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
}
|
||||||
} else if (binding instanceof ICPPTemplateDefinition) {
|
} else if (binding instanceof ICPPTemplateDefinition) {
|
||||||
if (binding instanceof ICPPClassTemplate) {
|
if (binding instanceof ICPPClassTemplate) {
|
||||||
ICPPClassType def= (ICPPClassType) findOneBinding(binding);
|
ICPPClassType def= (ICPPClassType) findOneBinding(binding);
|
||||||
|
@ -243,14 +254,6 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
|
||||||
} else {
|
} else {
|
||||||
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
|
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
} else if(binding instanceof ICPPTemplateParameter) {
|
|
||||||
if (binding instanceof ICPPTemplateTypeParameter) {
|
|
||||||
result = new CompositeCPPTemplateTypeParameter(this, (ICPPTemplateTypeParameter) binding);
|
|
||||||
} else if (binding instanceof ICPPTemplateNonTypeParameter) {
|
|
||||||
result = new CompositeCPPTemplateNonTypeParameter(this, (ICPPTemplateNonTypeParameter) binding);
|
|
||||||
} else {
|
|
||||||
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
}
|
|
||||||
} else if (binding instanceof ICPPParameter) {
|
} else if (binding instanceof ICPPParameter) {
|
||||||
result = new CompositeCPPParameter(this, (ICPPParameter) binding);
|
result = new CompositeCPPParameter(this, (ICPPParameter) binding);
|
||||||
} else if (binding instanceof ICPPField) {
|
} else if (binding instanceof ICPPField) {
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
@ -25,22 +23,6 @@ abstract class CompositeCPPBinding extends CompositeIndexBinding implements ICPP
|
||||||
super(cf, (IIndexFragmentBinding) rbinding);
|
super(cf, (IIndexFragmentBinding) rbinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasQualifiedName(char[][] qname) {
|
|
||||||
boolean result = true;
|
|
||||||
try {
|
|
||||||
char[][] myQN = getQualifiedNameCharArray();
|
|
||||||
result &= qname.length == myQN.length;
|
|
||||||
for(int i=0; result && i<qname.length; i++) {
|
|
||||||
char[] qnamePart = qname[i];
|
|
||||||
result &= Arrays.equals(qnamePart, myQN[i]);
|
|
||||||
}
|
|
||||||
} catch(DOMException de) {
|
|
||||||
CCorePlugin.log(de);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getQualifiedName() {
|
public String[] getQualifiedName() {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -53,11 +53,7 @@ public class CompositeCPPClassTemplate extends CompositeCPPClassType
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
|
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
|
||||||
ICPPTemplateParameter[] result= ((ICPPClassTemplate) rbinding).getTemplateParameters();
|
return TemplateInstanceUtil.convert(cf, ((ICPPClassTemplate) rbinding).getTemplateParameters());
|
||||||
for (int i= 0; i < result.length; i++) {
|
|
||||||
result[i]= (ICPPTemplateParameter) cf.getCompositeBinding((IIndexFragmentBinding) result[i]);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
||||||
|
|
|
@ -39,11 +39,7 @@ CompositeCPPClassSpecialization implements ICPPClassTemplate, ICPPInstanceCache{
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
|
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
|
||||||
ICPPTemplateParameter[] result= ((ICPPClassTemplate) rbinding).getTemplateParameters();
|
return TemplateInstanceUtil.convert(cf, ((ICPPClassTemplate) rbinding).getTemplateParameters());
|
||||||
for (int i= 0; i < result.length; i++) {
|
|
||||||
result[i]= (ICPPTemplateParameter) cf.getCompositeBinding((IIndexFragmentBinding) result[i]);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
||||||
|
|
|
@ -13,11 +13,11 @@ package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
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.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.IIndexFragmentBinding;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||||
|
@ -52,9 +52,9 @@ class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IFunctionType getType() throws DOMException {
|
public ICPPFunctionType getType() throws DOMException {
|
||||||
IType rtype = ((ICPPFunction)rbinding).getType();
|
IType rtype = ((ICPPFunction)rbinding).getType();
|
||||||
return (IFunctionType) cf.getCompositeType((IIndexType)rtype);
|
return (ICPPFunctionType) cf.getCompositeType((IIndexType)rtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAuto() throws DOMException {
|
public boolean isAuto() throws DOMException {
|
||||||
|
|
|
@ -18,7 +18,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
|
||||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||||
|
|
||||||
public class CompositeCPPFunctionTemplate extends CompositeCPPFunction
|
public class CompositeCPPFunctionTemplate extends CompositeCPPFunction
|
||||||
|
@ -29,11 +28,7 @@ public class CompositeCPPFunctionTemplate extends CompositeCPPFunction
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
|
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
|
||||||
ICPPTemplateParameter[] result= ((ICPPFunctionTemplate) rbinding).getTemplateParameters();
|
return TemplateInstanceUtil.convert(cf, ((ICPPFunctionTemplate) rbinding).getTemplateParameters());
|
||||||
for (int i= 0; i < result.length; i++) {
|
|
||||||
result[i]= (ICPPTemplateParameter) cf.getCompositeBinding((IIndexFragmentBinding) result[i]);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
||||||
|
|
|
@ -18,7 +18,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
|
||||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||||
|
|
||||||
public class CompositeCPPFunctionTemplateSpecialization extends CompositeCPPFunctionSpecialization
|
public class CompositeCPPFunctionTemplateSpecialization extends CompositeCPPFunctionSpecialization
|
||||||
|
@ -29,11 +28,7 @@ public class CompositeCPPFunctionTemplateSpecialization extends CompositeCPPFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
|
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
|
||||||
ICPPTemplateParameter[] result= ((ICPPFunctionTemplate) rbinding).getTemplateParameters();
|
return TemplateInstanceUtil.convert(cf, ((ICPPFunctionTemplate) rbinding).getTemplateParameters());
|
||||||
for (int i= 0; i < result.length; i++) {
|
|
||||||
result[i]= (ICPPTemplateParameter) cf.getCompositeBinding((IIndexFragmentBinding) result[i]);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
|
||||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||||
|
|
||||||
public class CompositeCPPTemplateNonTypeParameter extends CompositeCPPVariable implements ICPPTemplateNonTypeParameter {
|
public class CompositeCPPTemplateNonTypeParameter extends CompositeCPPVariable implements ICPPTemplateNonTypeParameter {
|
||||||
|
@ -48,7 +47,7 @@ public class CompositeCPPTemplateNonTypeParameter extends CompositeCPPVariable i
|
||||||
|
|
||||||
public ICPPTemplateArgument getDefaultValue() {
|
public ICPPTemplateArgument getDefaultValue() {
|
||||||
try {
|
try {
|
||||||
return TemplateInstanceUtil.convert(cf, ((ICPPTemplateTypeParameter)rbinding).getDefaultValue());
|
return TemplateInstanceUtil.convert(cf, ((ICPPTemplateNonTypeParameter)rbinding).getDefaultValue());
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,149 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2007, 2008 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
|
||||||
|
* Markus Schorn (Wind River Systems)
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
|
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.ICPPTemplateArgument;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTemplateParameter;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownType;
|
||||||
|
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||||
|
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||||
|
|
||||||
|
public class CompositeCPPTemplateTemplateParameter extends CompositeCPPBinding
|
||||||
|
implements ICPPTemplateTemplateParameter, ICPPUnknownBinding, ICPPUnknownType, IIndexType {
|
||||||
|
|
||||||
|
private ICPPScope unknownScope;
|
||||||
|
|
||||||
|
public CompositeCPPTemplateTemplateParameter(ICompositesFactory cf, ICPPTemplateTemplateParameter binding) {
|
||||||
|
super(cf, binding);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IType getDefault() throws DOMException {
|
||||||
|
IIndexType preresult= (IIndexType) ((ICPPTemplateTemplateParameter)rbinding).getDefault();
|
||||||
|
return cf.getCompositeType(preresult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getParameterPosition() {
|
||||||
|
return ((ICPPTemplateParameter)rbinding).getParameterPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getTemplateNestingLevel() {
|
||||||
|
return ((ICPPTemplateParameter)rbinding).getTemplateNestingLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getParameterID() {
|
||||||
|
return ((ICPPTemplateParameter)rbinding).getParameterID();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSameType(IType type) {
|
||||||
|
return ((IType)rbinding).isSameType(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object clone() {
|
||||||
|
fail(); return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPScope asScope() {
|
||||||
|
if (unknownScope == null) {
|
||||||
|
unknownScope= new CompositeCPPUnknownScope(this, getUnknownName());
|
||||||
|
}
|
||||||
|
return unknownScope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTName getUnknownName() {
|
||||||
|
return new CPPASTName(getNameCharArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPTemplateArgument getDefaultValue() {
|
||||||
|
try {
|
||||||
|
return TemplateInstanceUtil.convert(cf, ((ICPPTemplateTemplateParameter)rbinding).getDefaultValue());
|
||||||
|
} catch (DOMException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
|
||||||
|
return TemplateInstanceUtil.convert(cf, ((ICPPTemplateTemplateParameter)rbinding).getTemplateParameters());
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() {
|
||||||
|
return ICPPClassTemplatePartialSpecialization.EMPTY_PARTIAL_SPECIALIZATION_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IField findField(String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPMethod[] getAllDeclaredMethods() {
|
||||||
|
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPBase[] getBases() {
|
||||||
|
return ICPPBase.EMPTY_BASE_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPConstructor[] getConstructors() {
|
||||||
|
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPField[] getDeclaredFields() {
|
||||||
|
return ICPPField.EMPTY_CPPFIELD_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPMethod[] getDeclaredMethods() {
|
||||||
|
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IField[] getFields() {
|
||||||
|
return ICPPField.EMPTY_CPPFIELD_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBinding[] getFriends() {
|
||||||
|
return IBinding.EMPTY_BINDING_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPMethod[] getMethods() {
|
||||||
|
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPClassType[] getNestedClasses() {
|
||||||
|
return ICPPClassType.EMPTY_CLASS_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IScope getCompositeScope() {
|
||||||
|
return asScope();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getKey() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAnonymous() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
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.ICPPTemplateInstance;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||||
|
@ -88,6 +89,8 @@ public class TemplateInstanceUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
static ICPPTemplateArgument convert(ICompositesFactory cf, ICPPTemplateArgument arg) throws DOMException {
|
static ICPPTemplateArgument convert(ICompositesFactory cf, ICPPTemplateArgument arg) throws DOMException {
|
||||||
|
if (arg == null)
|
||||||
|
return null;
|
||||||
if (arg.isNonTypeValue()) {
|
if (arg.isNonTypeValue()) {
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
@ -150,4 +153,12 @@ public class TemplateInstanceUtil {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ICPPTemplateParameter[] convert(ICompositesFactory cf, ICPPTemplateParameter[] preResult) {
|
||||||
|
ICPPTemplateParameter[] result= new ICPPTemplateParameter[preResult.length];
|
||||||
|
for (int i= 0; i < result.length; i++) {
|
||||||
|
result[i]= (ICPPTemplateParameter) cf.getCompositeBinding((IIndexFragmentBinding) preResult[i]);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,11 +167,12 @@ public class PDOM extends PlatformObject implements IPDOM {
|
||||||
* 75.0 - support for friends, bug 250167
|
* 75.0 - support for friends, bug 250167
|
||||||
* 76.0 - support for exception specification, bug 252697
|
* 76.0 - support for exception specification, bug 252697
|
||||||
* 77.0 - support for parameter annotations, bug 254520
|
* 77.0 - support for parameter annotations, bug 254520
|
||||||
|
* 78.0 - support for updating class templates, bug 254520
|
||||||
*/
|
*/
|
||||||
private static int version(int major, int minor) {
|
private static int version(int major, int minor) {
|
||||||
return major << 16 + minor;
|
return major << 16 + minor;
|
||||||
}
|
}
|
||||||
public static final int MAJOR_VERSION = 77;
|
public static final int MAJOR_VERSION = 78;
|
||||||
public static final int MINOR_VERSION = 0; // minor versions must be compatible
|
public static final int MINOR_VERSION = 0; // minor versions must be compatible
|
||||||
|
|
||||||
public static final int CURRENT_VERSION= version(MAJOR_VERSION, MINOR_VERSION);
|
public static final int CURRENT_VERSION= version(MAJOR_VERSION, MINOR_VERSION);
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Markus Schorn - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.IPDOMNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common, but internal methods for all pdom nodes.
|
||||||
|
*/
|
||||||
|
public interface IInternalPDOMNode extends IPDOMNode {
|
||||||
|
public int getRecord();
|
||||||
|
}
|
|
@ -18,6 +18,7 @@ import java.util.Arrays;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
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.Database;
|
||||||
|
@ -84,6 +85,24 @@ public abstract class PDOMNamedNode extends PDOMNode {
|
||||||
return getDBName().equals(name);
|
return getDBName().equals(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Template parameters need to update their name.
|
||||||
|
* @throws CoreException
|
||||||
|
*/
|
||||||
|
protected void updateName(char[] nameCharArray) throws CoreException {
|
||||||
|
if (fName != null && CharArrayUtils.equals(fName, nameCharArray))
|
||||||
|
return;
|
||||||
|
|
||||||
|
IString name= getDBName();
|
||||||
|
if (!name.equals(nameCharArray)) {
|
||||||
|
name.delete();
|
||||||
|
final Database db= pdom.getDB();
|
||||||
|
db.putInt(record + NAME, db.newString(nameCharArray).getRecord());
|
||||||
|
}
|
||||||
|
fName= nameCharArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(PDOMLinkage linkage) throws CoreException {
|
public void delete(PDOMLinkage linkage) throws CoreException {
|
||||||
final Database db = pdom.getDB();
|
final Database db = pdom.getDB();
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2007 QNX Software Systems and others.
|
* Copyright (c) 2005, 2008 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* Doug Schaefer (QNX) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -14,20 +14,17 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
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.IPDOMVisitor;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
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.Database;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Doug Schaefer
|
|
||||||
*
|
|
||||||
* This is a basic node in the PDOM database.
|
* This is a basic node in the PDOM database.
|
||||||
* PDOM nodes form a multi-root tree with linkages being the roots.
|
* PDOM nodes form a multi-root tree with linkages being the roots.
|
||||||
* This class managed the parent pointer.
|
* This class managed the parent pointer.
|
||||||
*/
|
*/
|
||||||
public abstract class PDOMNode implements IPDOMNode {
|
public abstract class PDOMNode implements IInternalPDOMNode {
|
||||||
|
|
||||||
private static final int TYPE = 0;
|
private static final int TYPE = 0;
|
||||||
private static final int PARENT = 4;
|
private static final int PARENT = 4;
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Markus Schorn - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.dom.IInternalPDOMNode;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for template parameters stored in the index.
|
||||||
|
*/
|
||||||
|
public interface IPDOMCPPTemplateParameter extends IInternalPDOMNode, ICPPTemplateParameter {
|
||||||
|
|
||||||
|
IPDOMCPPTemplateParameter[] EMPTY_ARRAY = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default values are updated after the class template is stored, because we
|
||||||
|
* may have to refer to the other template parameters.
|
||||||
|
*/
|
||||||
|
void configure(ICPPTemplateParameter templateParameter);
|
||||||
|
|
||||||
|
void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* parameters of template template parameters need to be deleted.
|
||||||
|
* @throws CoreException
|
||||||
|
*/
|
||||||
|
void forceDelete(PDOMLinkage pdom) throws CoreException;
|
||||||
|
}
|
|
@ -17,8 +17,12 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
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.ICPPBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||||
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
|
@ -39,21 +43,42 @@ abstract class PDOMCPPBinding extends PDOMBinding implements ICPPBinding {
|
||||||
super(pdom, parent, name);
|
super(pdom, parent, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasQualifiedName(char[][] qname, int idx) {
|
protected boolean isSameOwner(IBinding owner1, IBinding owner2) {
|
||||||
try {
|
if (owner1 == null)
|
||||||
if (getDBName().equals(qname[idx])) {
|
return owner2 == null;
|
||||||
PDOMNode parent= getParentNode();
|
if (owner2 == null)
|
||||||
if (--idx < 0) {
|
return false;
|
||||||
return parent == null;
|
|
||||||
}
|
if (owner1 instanceof IType) {
|
||||||
if (parent instanceof PDOMCPPBinding) {
|
if (owner2 instanceof IType) {
|
||||||
return ((PDOMCPPBinding) parent).hasQualifiedName(qname, idx);
|
return ((IType) owner1).isSameType((IType) owner2);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
return false;
|
||||||
CCorePlugin.log(e);
|
|
||||||
}
|
}
|
||||||
return false;
|
try {
|
||||||
|
while(owner1 instanceof ICPPNamespace && owner2 instanceof ICPPNamespace) {
|
||||||
|
final char[] n1 = owner1.getNameCharArray();
|
||||||
|
// ignore unknown namespaces
|
||||||
|
if (n1.length == 0) {
|
||||||
|
owner1= owner1.getOwner();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
final char[] n2= owner2.getNameCharArray();
|
||||||
|
if (n2.length == 0) {
|
||||||
|
owner2= owner2.getOwner();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!CharArrayUtils.equals(n1, n2))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
owner1= owner1.getOwner();
|
||||||
|
owner2= owner2.getOwner();
|
||||||
|
}
|
||||||
|
} catch (DOMException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return owner1 == null && owner2 == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public char[][] getQualifiedNameCharArray() throws DOMException {
|
final public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
|
@ -14,12 +14,11 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMNode;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
||||||
|
@ -32,32 +31,43 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
||||||
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
|
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.PDOMNode;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Bryan Wilkinson
|
* Implementation for class templates in the index, base class for partial specializations.
|
||||||
*/
|
*/
|
||||||
public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
||||||
implements ICPPClassTemplate, ICPPInstanceCache, IPDOMCPPTemplateParameterOwner {
|
implements ICPPClassTemplate, ICPPInstanceCache, IPDOMCPPTemplateParameterOwner {
|
||||||
private static final int PARAMETERS = PDOMCPPClassType.RECORD_SIZE + 0;
|
private static final int PARAMETERS = PDOMCPPClassType.RECORD_SIZE + 0;
|
||||||
private static final int FIRST_PARTIAL = PDOMCPPClassType.RECORD_SIZE + 4;
|
private static final short RELEVANT_PARAMETERS= PDOMCPPClassType.RECORD_SIZE + 4;
|
||||||
|
private static final int FIRST_PARTIAL = PDOMCPPClassType.RECORD_SIZE + 6;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The size in bytes of a PDOMCPPClassTemplate record in the database.
|
* The size in bytes of a PDOMCPPClassTemplate record in the database.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("hiding")
|
@SuppressWarnings("hiding")
|
||||||
protected static final int RECORD_SIZE = PDOMCPPClassType.RECORD_SIZE + 8;
|
protected static final int RECORD_SIZE = PDOMCPPClassType.RECORD_SIZE + 10;
|
||||||
|
|
||||||
private ICPPTemplateParameter[] params; // Cached template parameters.
|
private ICPPTemplateParameter[] params; // Cached template parameters.
|
||||||
|
|
||||||
public PDOMCPPClassTemplate(PDOM pdom, PDOMNode parent, ICPPClassTemplate template) throws CoreException {
|
public PDOMCPPClassTemplate(PDOM pdom, PDOMCPPLinkage linkage, PDOMNode parent, ICPPClassTemplate template) throws CoreException, DOMException {
|
||||||
super(pdom, parent, template);
|
super(pdom, parent, template);
|
||||||
|
|
||||||
|
final Database db = pdom.getDB();
|
||||||
|
final ICPPTemplateParameter[] origParams= template.getTemplateParameters();
|
||||||
|
final IPDOMCPPTemplateParameter[] params = PDOMTemplateParameterArray.createPDOMTemplateParameters(pdom, this, origParams);
|
||||||
|
int rec= PDOMTemplateParameterArray.putArray(db, params);
|
||||||
|
db.putInt(record + PARAMETERS, rec);
|
||||||
|
db.putShort(record + RELEVANT_PARAMETERS, (short) params.length);
|
||||||
|
linkage.new ConfigureTemplateParameters(origParams, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPClassTemplate(PDOM pdom, int bindingRecord) {
|
public PDOMCPPClassTemplate(PDOM pdom, int bindingRecord) {
|
||||||
|
@ -74,36 +84,116 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
||||||
return IIndexCPPBindingConstants.CPP_CLASS_TEMPLATE;
|
return IIndexCPPBindingConstants.CPP_CLASS_TEMPLATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TemplateParameterCollector implements IPDOMVisitor {
|
|
||||||
private List<IPDOMNode> params = new ArrayList<IPDOMNode>();
|
|
||||||
public boolean visit(IPDOMNode node) throws CoreException {
|
|
||||||
if (node instanceof ICPPTemplateParameter)
|
|
||||||
params.add(node);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public void leave(IPDOMNode node) throws CoreException {
|
|
||||||
}
|
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() {
|
|
||||||
return params.toArray(new ICPPTemplateParameter[params.size()]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() {
|
public ICPPTemplateParameter[] getTemplateParameters() {
|
||||||
if (params == null) {
|
if (params == null) {
|
||||||
try {
|
try {
|
||||||
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + PARAMETERS, getLinkageImpl());
|
final Database db = pdom.getDB();
|
||||||
TemplateParameterCollector visitor = new TemplateParameterCollector();
|
int rec= db.getInt(record + PARAMETERS);
|
||||||
list.accept(visitor);
|
int count= Math.max(0, db.getShort(record + RELEVANT_PARAMETERS));
|
||||||
params = visitor.getTemplateParameters();
|
if (rec == 0 || count == 0) {
|
||||||
|
params= ICPPTemplateParameter.EMPTY_TEMPLATE_PARAMETER_ARRAY;
|
||||||
|
} else {
|
||||||
|
IPDOMCPPTemplateParameter[] allParams = PDOMTemplateParameterArray.getArray(this, rec);
|
||||||
|
count= Math.min(count, allParams.length);
|
||||||
|
if (count == allParams.length) {
|
||||||
|
params= allParams;
|
||||||
|
} else {
|
||||||
|
params= new ICPPTemplateParameter[count];
|
||||||
|
System.arraycopy(allParams, 0, params, 0, count);
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
params = ICPPTemplateParameter.EMPTY_TEMPLATE_PARAMETER_ARRAY;
|
params = ICPPTemplateParameter.EMPTY_TEMPLATE_PARAMETER_ARRAY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Copy to a new array for safety.
|
return params;
|
||||||
ICPPTemplateParameter[] result = new ICPPTemplateParameter[params.length];
|
}
|
||||||
System.arraycopy(params, 0, result, 0, params.length);
|
|
||||||
return result;
|
@Override
|
||||||
|
public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
|
||||||
|
super.update(linkage, newBinding);
|
||||||
|
if (newBinding instanceof ICPPClassTemplate) {
|
||||||
|
ICPPClassTemplate ct= (ICPPClassTemplate) newBinding;
|
||||||
|
try {
|
||||||
|
updateTemplateParameters(linkage, ct.getTemplateParameters());
|
||||||
|
} catch (DOMException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateTemplateParameters(PDOMLinkage linkage, ICPPTemplateParameter[] newParams) throws CoreException, DOMException {
|
||||||
|
final Database db = pdom.getDB();
|
||||||
|
int rec= db.getInt(record + PARAMETERS);
|
||||||
|
IPDOMCPPTemplateParameter[] allParams;
|
||||||
|
if (rec == 0) {
|
||||||
|
allParams= IPDOMCPPTemplateParameter.EMPTY_ARRAY;
|
||||||
|
} else {
|
||||||
|
allParams = PDOMTemplateParameterArray.getArray(this, rec);
|
||||||
|
}
|
||||||
|
|
||||||
|
final int newParamLength = newParams.length;
|
||||||
|
int[] props= new int[allParams.length];
|
||||||
|
int[] result= new int[newParamLength];
|
||||||
|
int additionalPars= 0;
|
||||||
|
boolean reorder= false;
|
||||||
|
for (int i = 0; i < props.length; i++) {
|
||||||
|
final IPDOMCPPTemplateParameter par = allParams[i];
|
||||||
|
props[i]= getProperty(par);
|
||||||
|
}
|
||||||
|
|
||||||
|
outer: for (int i = 0; i < newParamLength; i++) {
|
||||||
|
ICPPTemplateParameter newPar = newParams[i];
|
||||||
|
int prop= getProperty(newPar);
|
||||||
|
for (int j = 0; j < props.length; j++) {
|
||||||
|
if (props[j] == prop) {
|
||||||
|
// reuse param
|
||||||
|
result[i]= j;
|
||||||
|
props[j]= -1;
|
||||||
|
allParams[j].update(linkage, newPar);
|
||||||
|
if (j != i)
|
||||||
|
reorder= true;
|
||||||
|
continue outer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result[i]= -1;
|
||||||
|
additionalPars++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalPars > 0 || reorder) {
|
||||||
|
params= null;
|
||||||
|
IPDOMCPPTemplateParameter[] newAllParams= new IPDOMCPPTemplateParameter[allParams.length+additionalPars];
|
||||||
|
for (int j = 0; j < newParamLength; j++) {
|
||||||
|
int idx= result[j];
|
||||||
|
if (idx >= 0) {
|
||||||
|
newAllParams[j]= allParams[idx];
|
||||||
|
allParams[idx]= null;
|
||||||
|
} else {
|
||||||
|
newAllParams[j]= PDOMTemplateParameterArray.createPDOMTemplateParameter(pdom, this, newParams[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int pos= newParamLength;
|
||||||
|
for (int j = 0; j < allParams.length; j++) {
|
||||||
|
IPDOMCPPTemplateParameter unused = allParams[j];
|
||||||
|
if (unused != null)
|
||||||
|
newAllParams[pos++]= unused;
|
||||||
|
}
|
||||||
|
if (rec != 0)
|
||||||
|
db.free(rec);
|
||||||
|
rec= PDOMTemplateParameterArray.putArray(db, newAllParams);
|
||||||
|
db.putInt(record + PARAMETERS, rec);
|
||||||
|
}
|
||||||
|
db.putShort(record + RELEVANT_PARAMETERS, (short) newParamLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getProperty(ICPPTemplateParameter par) {
|
||||||
|
int result= par.getParameterPosition() & 0xffff;
|
||||||
|
if (par instanceof ICPPTemplateTypeParameter)
|
||||||
|
return result;
|
||||||
|
if (par instanceof ICPPTemplateNonTypeParameter)
|
||||||
|
return result | 0x10000;
|
||||||
|
return result | 0x20000;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PDOMCPPClassTemplatePartialSpecialization getFirstPartial() throws CoreException {
|
private PDOMCPPClassTemplatePartialSpecialization getFirstPartial() throws CoreException {
|
||||||
|
@ -134,24 +224,6 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(IPDOMVisitor visitor) throws CoreException {
|
|
||||||
super.accept(visitor);
|
|
||||||
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + PARAMETERS, getLinkageImpl());
|
|
||||||
list.accept(visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addChild(PDOMNode member) throws CoreException {
|
|
||||||
if (member instanceof ICPPTemplateParameter) {
|
|
||||||
params= null; // clear cache
|
|
||||||
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + PARAMETERS, getLinkageImpl());
|
|
||||||
list.addMember(member);
|
|
||||||
} else {
|
|
||||||
super.addChild(member);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSameType(IType type) {
|
public boolean isSameType(IType type) {
|
||||||
if (type instanceof ITypedef) {
|
if (type instanceof ITypedef) {
|
||||||
|
@ -179,46 +251,14 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
||||||
ICPPClassType ctype= (ICPPClassType) type;
|
ICPPClassType ctype= (ICPPClassType) type;
|
||||||
if (ctype.getKey() != getKey())
|
if (ctype.getKey() != getKey())
|
||||||
return false;
|
return false;
|
||||||
|
char[] nchars = ctype.getNameCharArray();
|
||||||
final char[][] qname= ctype.getQualifiedNameCharArray();
|
if (nchars.length == 0) {
|
||||||
if (!hasQualifiedName(qname, qname.length - 1))
|
nchars= ASTTypeUtil.createNameForAnonymous(ctype);
|
||||||
return false;
|
|
||||||
|
|
||||||
ICPPTemplateParameter[] params1= getTemplateParameters();
|
|
||||||
ICPPTemplateParameter[] params2= ((ICPPClassTemplate) type).getTemplateParameters();
|
|
||||||
|
|
||||||
if (params1 == params2)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (params1 == null || params2 == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (params1.length != params2.length)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for (int i = 0; i < params1.length; i++) {
|
|
||||||
ICPPTemplateParameter p1= params1[i];
|
|
||||||
ICPPTemplateParameter p2= params2[i];
|
|
||||||
if (p1 instanceof IType && p2 instanceof IType) {
|
|
||||||
IType t1= (IType) p1;
|
|
||||||
IType t2= (IType) p2;
|
|
||||||
if (!t1.isSameType(t2)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (p1 instanceof ICPPTemplateNonTypeParameter
|
|
||||||
&& p2 instanceof ICPPTemplateNonTypeParameter) {
|
|
||||||
IType t1= ((ICPPTemplateNonTypeParameter)p1).getType();
|
|
||||||
IType t2= ((ICPPTemplateNonTypeParameter)p2).getType();
|
|
||||||
if (t1 != t2) {
|
|
||||||
if (t1 == null || t2 == null || !t1.isSameType(t2)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
if (nchars == null || !CharArrayUtils.equals(nchars, getNameCharArray()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return isSameOwner(getOwner(), ctype.getOwner());
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -239,24 +279,21 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
||||||
public ICPPTemplateParameter adaptTemplateParameter(ICPPTemplateParameter param) {
|
public ICPPTemplateParameter adaptTemplateParameter(ICPPTemplateParameter param) {
|
||||||
// Template parameters are identified by their position in the parameter list.
|
// Template parameters are identified by their position in the parameter list.
|
||||||
int pos = param.getParameterPosition();
|
int pos = param.getParameterPosition();
|
||||||
if (params != null) {
|
ICPPTemplateParameter[] pars = getTemplateParameters();
|
||||||
return pos < params.length ? params[pos] : null;
|
|
||||||
}
|
if (pars == null || pos >= pars.length)
|
||||||
try {
|
return null;
|
||||||
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + PARAMETERS, getLinkageImpl());
|
|
||||||
ICPPTemplateParameter result= (ICPPTemplateParameter) list.getNodeAt(pos);
|
ICPPTemplateParameter result= pars[pos];
|
||||||
if (param instanceof ICPPTemplateTypeParameter) {
|
if (param instanceof ICPPTemplateTypeParameter) {
|
||||||
if (result instanceof ICPPTemplateTypeParameter)
|
if (result instanceof ICPPTemplateTypeParameter)
|
||||||
return result;
|
return result;
|
||||||
} else if (param instanceof ICPPTemplateNonTypeParameter) {
|
} else if (param instanceof ICPPTemplateNonTypeParameter) {
|
||||||
if (result instanceof ICPPTemplateNonTypeParameter)
|
if (result instanceof ICPPTemplateNonTypeParameter)
|
||||||
return result;
|
return result;
|
||||||
} else if (param instanceof ICPPTemplateTemplateParameter) {
|
} else if (param instanceof ICPPTemplateTemplateParameter) {
|
||||||
if (result instanceof ICPPTemplateTemplateParameter)
|
if (result instanceof ICPPTemplateTemplateParameter)
|
||||||
return result;
|
return result;
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
CCorePlugin.log(e);
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,10 @@ class PDOMCPPClassTemplatePartialSpecialization extends PDOMCPPClassTemplate
|
||||||
@SuppressWarnings("hiding")
|
@SuppressWarnings("hiding")
|
||||||
protected static final int RECORD_SIZE = PDOMCPPClassTemplate.RECORD_SIZE + 16;
|
protected static final int RECORD_SIZE = PDOMCPPClassTemplate.RECORD_SIZE + 16;
|
||||||
|
|
||||||
public PDOMCPPClassTemplatePartialSpecialization(PDOM pdom,
|
public PDOMCPPClassTemplatePartialSpecialization(PDOM pdom, PDOMCPPLinkage linkage,
|
||||||
PDOMNode parent, ICPPClassTemplatePartialSpecialization partial, PDOMCPPClassTemplate primary) throws CoreException {
|
PDOMNode parent, ICPPClassTemplatePartialSpecialization partial, PDOMCPPClassTemplate primary)
|
||||||
super(pdom, parent, partial);
|
throws CoreException, DOMException {
|
||||||
|
super(pdom, linkage, parent, partial);
|
||||||
pdom.getDB().putInt(record + PRIMARY, primary.getRecord());
|
pdom.getDB().putInt(record + PRIMARY, primary.getRecord());
|
||||||
primary.addPartial(this);
|
primary.addPartial(this);
|
||||||
|
|
||||||
|
@ -65,6 +66,7 @@ class PDOMCPPClassTemplatePartialSpecialization extends PDOMCPPClassTemplate
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
throw new CoreException(Util.createStatus(e));
|
throw new CoreException(Util.createStatus(e));
|
||||||
}
|
}
|
||||||
|
linkage.new ConfigurePartialSpecialization(this, partial);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPClassTemplatePartialSpecialization(PDOM pdom,
|
public PDOMCPPClassTemplatePartialSpecialization(PDOM pdom,
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
import org.eclipse.cdt.internal.core.Util;
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
||||||
|
@ -40,7 +41,6 @@ import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList;
|
import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
|
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMASTAdapter;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
|
@ -260,12 +260,17 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
|
||||||
|
|
||||||
if (type instanceof ICPPClassType && !(type instanceof ProblemBinding)) {
|
if (type instanceof ICPPClassType && !(type instanceof ProblemBinding)) {
|
||||||
ICPPClassType ctype= (ICPPClassType) type;
|
ICPPClassType ctype= (ICPPClassType) type;
|
||||||
ctype= (ICPPClassType) PDOMASTAdapter.getAdapterForAnonymousASTBinding(ctype);
|
|
||||||
try {
|
try {
|
||||||
if (ctype.getKey() == getKey()) {
|
if (ctype.getKey() != getKey())
|
||||||
char[][] qname= ctype.getQualifiedNameCharArray();
|
return false;
|
||||||
return hasQualifiedName(qname, qname.length-1);
|
char[] nchars = ctype.getNameCharArray();
|
||||||
|
if (nchars.length == 0) {
|
||||||
|
nchars= ASTTypeUtil.createNameForAnonymous(ctype);
|
||||||
}
|
}
|
||||||
|
if (nchars == null || !CharArrayUtils.equals(nchars, getNameCharArray()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return isSameOwner(getOwner(), ctype.getOwner());
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
class PDOMCPPConstructor extends PDOMCPPMethod implements ICPPConstructor {
|
class PDOMCPPConstructor extends PDOMCPPMethod implements ICPPConstructor {
|
||||||
|
|
||||||
public PDOMCPPConstructor(PDOM pdom, PDOMNode parent, ICPPConstructor method) throws CoreException {
|
public PDOMCPPConstructor(PDOM pdom, PDOMNode parent, ICPPConstructor method) throws CoreException, DOMException {
|
||||||
super(pdom, parent, method);
|
super(pdom, parent, method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,9 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
class PDOMCPPConstructorTemplate extends PDOMCPPMethodTemplate implements
|
class PDOMCPPConstructorTemplate extends PDOMCPPMethodTemplate implements
|
||||||
ICPPConstructor {
|
ICPPConstructor {
|
||||||
|
|
||||||
public PDOMCPPConstructorTemplate(PDOM pdom, PDOMNode parent, ICPPConstructor method) throws CoreException {
|
public PDOMCPPConstructorTemplate(PDOM pdom, PDOMCPPLinkage linkage, PDOMNode parent, ICPPConstructor method)
|
||||||
super(pdom, parent, method);
|
throws CoreException, DOMException {
|
||||||
|
super(pdom, linkage, parent, method);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPConstructorTemplate(PDOM pdom, int record) {
|
public PDOMCPPConstructorTemplate(PDOM pdom, int record) {
|
||||||
|
|
|
@ -29,7 +29,9 @@ 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.ICPPScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
||||||
|
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateParameterMap;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||||
|
@ -107,7 +109,7 @@ class PDOMCPPDeferredClassInstance extends PDOMCPPSpecialization implements ICPP
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPClassTemplate getClassTemplate() {
|
public ICPPClassTemplate getClassTemplate() {
|
||||||
return (ICPPClassTemplate) getTemplateDefinition();
|
return (ICPPClassTemplate) getSpecializedBinding();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -164,7 +166,7 @@ class PDOMCPPDeferredClassInstance extends PDOMCPPSpecialization implements ICPP
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getKey() throws DOMException{
|
public int getKey() throws DOMException{
|
||||||
return 0;
|
return getClassTemplate().getKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -195,12 +197,22 @@ class PDOMCPPDeferredClassInstance extends PDOMCPPSpecialization implements ICPP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAnonymous() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectMap getArgumentMap() {
|
||||||
|
return ObjectMap.EMPTY_MAP;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CPPTemplateParameterMap getTemplateParameterMap() {
|
||||||
|
return CPPTemplateParameterMap.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public IType[] getArguments() {
|
public IType[] getArguments() {
|
||||||
return CPPTemplates.getArguments(getTemplateArguments());
|
return CPPTemplates.getArguments(getTemplateArguments());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAnonymous() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,16 +15,16 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
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.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMASTAdapter;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||||
|
@ -110,17 +110,15 @@ class PDOMCPPEnumeration extends PDOMCPPBinding implements IEnumeration, IIndexT
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (type instanceof IEnumeration) {
|
if (type instanceof IEnumeration) {
|
||||||
if (type instanceof ICPPBinding) {
|
IEnumeration etype= (IEnumeration) type;
|
||||||
ICPPBinding etype= (ICPPBinding) type;
|
char[] nchars = etype.getNameCharArray();
|
||||||
etype= (ICPPBinding) PDOMASTAdapter.getAdapterForAnonymousASTBinding(etype);
|
if (nchars.length == 0) {
|
||||||
char[][] qname = etype.getQualifiedNameCharArray();
|
nchars= ASTTypeUtil.createNameForAnonymous(etype);
|
||||||
return hasQualifiedName(qname, qname.length-1);
|
|
||||||
}
|
|
||||||
else if (type instanceof PDOMCPPEnumeration) {
|
|
||||||
PDOMCPPEnumeration etype= (PDOMCPPEnumeration) type;
|
|
||||||
char[][] qname= etype.getQualifiedNameCharArray();
|
|
||||||
return hasQualifiedName(qname, qname.length-1);
|
|
||||||
}
|
}
|
||||||
|
if (nchars == null || !CharArrayUtils.equals(nchars, getNameCharArray()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return isSameOwner(getOwner(), etype.getOwner());
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
|
|
|
@ -81,26 +81,27 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
||||||
@SuppressWarnings("hiding")
|
@SuppressWarnings("hiding")
|
||||||
protected static final int RECORD_SIZE = PDOMCPPBinding.RECORD_SIZE + 21;
|
protected static final int RECORD_SIZE = PDOMCPPBinding.RECORD_SIZE + 21;
|
||||||
|
|
||||||
public PDOMCPPFunction(PDOM pdom, PDOMNode parent, ICPPFunction function, boolean setTypes) throws CoreException {
|
public PDOMCPPFunction(PDOM pdom, PDOMNode parent, ICPPFunction function, boolean setTypes) throws CoreException, DOMException {
|
||||||
super(pdom, parent, function.getNameCharArray());
|
super(pdom, parent, function.getNameCharArray());
|
||||||
Database db = pdom.getDB();
|
Database db = pdom.getDB();
|
||||||
try {
|
Integer sigHash = IndexCPPSignatureUtil.getSignatureHash(function);
|
||||||
Integer sigHash = IndexCPPSignatureUtil.getSignatureHash(function);
|
pdom.getDB().putInt(record + SIGNATURE_HASH, sigHash != null ? sigHash.intValue() : 0);
|
||||||
pdom.getDB().putInt(record + SIGNATURE_HASH, sigHash != null ? sigHash.intValue() : 0);
|
|
||||||
|
|
||||||
if (setTypes) {
|
if (setTypes) {
|
||||||
initData((ICPPFunctionType) function.getType(), function.getParameters());
|
initData(function.getType(), function.getParameters());
|
||||||
}
|
|
||||||
db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(function));
|
|
||||||
storeExceptionSpec(db, function);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
throw new CoreException(Util.createStatus(e));
|
|
||||||
}
|
}
|
||||||
|
db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(function));
|
||||||
|
storeExceptionSpec(db, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initData(ICPPFunctionType ftype, IParameter[] params) throws CoreException {
|
public void initData(ICPPFunctionType ftype, IParameter[] params) {
|
||||||
PDOMCPPFunctionType pft= setType(ftype);
|
PDOMCPPFunctionType pft;
|
||||||
setParameters(pft, params);
|
try {
|
||||||
|
pft = setType(ftype);
|
||||||
|
setParameters(pft, params);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -111,7 +112,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
||||||
IParameter[] newParams;
|
IParameter[] newParams;
|
||||||
byte newAnnotation;
|
byte newAnnotation;
|
||||||
try {
|
try {
|
||||||
newType= (ICPPFunctionType) func.getType();
|
newType= func.getType();
|
||||||
newParams = func.getParameters();
|
newParams = func.getParameters();
|
||||||
newAnnotation = PDOMCPPAnnotation.encodeAnnotation(func);
|
newAnnotation = PDOMCPPAnnotation.encodeAnnotation(func);
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
|
@ -120,7 +121,8 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
||||||
|
|
||||||
IFunctionType oldType= getType();
|
IFunctionType oldType= getType();
|
||||||
PDOMCPPParameter oldParams= getFirstParameter();
|
PDOMCPPParameter oldParams= getFirstParameter();
|
||||||
initData(newType, newParams);
|
PDOMCPPFunctionType pft= setType(newType);
|
||||||
|
setParameters(pft, newParams);
|
||||||
if (oldType != null) {
|
if (oldType != null) {
|
||||||
linkage.deleteType(oldType, record);
|
linkage.deleteType(oldType, record);
|
||||||
}
|
}
|
||||||
|
@ -235,7 +237,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IFunctionType getType() {
|
public ICPPFunctionType getType() {
|
||||||
try {
|
try {
|
||||||
int offset= pdom.getDB().getInt(record + FUNCTION_TYPE);
|
int offset= pdom.getDB().getInt(record + FUNCTION_TYPE);
|
||||||
return offset==0 ? null : new PDOMCPPFunctionType(pdom, offset);
|
return offset==0 ? null : new PDOMCPPFunctionType(pdom, offset);
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
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.ICPPFunction;
|
||||||
|
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.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
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.ICPPSpecialization;
|
||||||
|
@ -172,7 +173,7 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IFunctionType getType() throws DOMException {
|
public ICPPFunctionType getType() throws DOMException {
|
||||||
try {
|
try {
|
||||||
int offset= pdom.getDB().getInt(record + FUNCTION_TYPE);
|
int offset= pdom.getDB().getInt(record + FUNCTION_TYPE);
|
||||||
return offset==0 ? null : new PDOMCPPFunctionType(pdom, offset);
|
return offset==0 ? null : new PDOMCPPFunctionType(pdom, offset);
|
||||||
|
|
|
@ -6,21 +6,15 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
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.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
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.ICPPFunctionTemplate;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||||
|
@ -31,14 +25,14 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
|
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
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.PDOMNode;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Bryan Wilkinson
|
* Represents a function template, base class for method/constructor templates.
|
||||||
*/
|
*/
|
||||||
class PDOMCPPFunctionTemplate extends PDOMCPPFunction
|
class PDOMCPPFunctionTemplate extends PDOMCPPFunction
|
||||||
implements ICPPFunctionTemplate, ICPPInstanceCache, IPDOMMemberOwner, IPDOMCPPTemplateParameterOwner {
|
implements ICPPFunctionTemplate, ICPPInstanceCache, IPDOMMemberOwner, IPDOMCPPTemplateParameterOwner {
|
||||||
|
@ -51,9 +45,17 @@ class PDOMCPPFunctionTemplate extends PDOMCPPFunction
|
||||||
@SuppressWarnings("hiding")
|
@SuppressWarnings("hiding")
|
||||||
protected static final int RECORD_SIZE = PDOMCPPFunction.RECORD_SIZE + 4;
|
protected static final int RECORD_SIZE = PDOMCPPFunction.RECORD_SIZE + 4;
|
||||||
|
|
||||||
public PDOMCPPFunctionTemplate(PDOM pdom, PDOMNode parent, ICPPFunctionTemplate template)
|
private IPDOMCPPTemplateParameter[] params; // Cached template parameters.
|
||||||
throws CoreException {
|
|
||||||
super(pdom, parent, (ICPPFunction) template, false);
|
public PDOMCPPFunctionTemplate(PDOM pdom, PDOMCPPLinkage linkage, PDOMNode parent, ICPPFunctionTemplate template)
|
||||||
|
throws CoreException, DOMException {
|
||||||
|
super(pdom, parent, template, false);
|
||||||
|
final ICPPTemplateParameter[] origParams= template.getTemplateParameters();
|
||||||
|
params = PDOMTemplateParameterArray.createPDOMTemplateParameters(pdom, this, origParams);
|
||||||
|
final Database db = pdom.getDB();
|
||||||
|
int rec= PDOMTemplateParameterArray.putArray(db, params);
|
||||||
|
db.putInt(record + TEMPLATE_PARAMS, rec);
|
||||||
|
linkage.new ConfigureFunctionTemplate(template, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPFunctionTemplate(PDOM pdom, int bindingRecord) {
|
public PDOMCPPFunctionTemplate(PDOM pdom, int bindingRecord) {
|
||||||
|
@ -75,46 +77,21 @@ class PDOMCPPFunctionTemplate extends PDOMCPPFunction
|
||||||
return IIndexCPPBindingConstants.CPP_FUNCTION_TEMPLATE;
|
return IIndexCPPBindingConstants.CPP_FUNCTION_TEMPLATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TemplateParameterCollector implements IPDOMVisitor {
|
public IPDOMCPPTemplateParameter[] getTemplateParameters() {
|
||||||
private List<IPDOMNode> params = new ArrayList<IPDOMNode>();
|
if (params == null) {
|
||||||
public boolean visit(IPDOMNode node) throws CoreException {
|
try {
|
||||||
if (node instanceof ICPPTemplateParameter)
|
int rec= pdom.getDB().getInt(record + TEMPLATE_PARAMS);
|
||||||
params.add(node);
|
if (rec == 0) {
|
||||||
return false;
|
params= IPDOMCPPTemplateParameter.EMPTY_ARRAY;
|
||||||
|
} else {
|
||||||
|
params= PDOMTemplateParameterArray.getArray(this, rec);
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
params = IPDOMCPPTemplateParameter.EMPTY_ARRAY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void leave(IPDOMNode node) throws CoreException {
|
return params;
|
||||||
}
|
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() {
|
|
||||||
return params.toArray(new ICPPTemplateParameter[params.size()]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
|
|
||||||
try {
|
|
||||||
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + TEMPLATE_PARAMS, getLinkageImpl());
|
|
||||||
TemplateParameterCollector visitor = new TemplateParameterCollector();
|
|
||||||
list.accept(visitor);
|
|
||||||
|
|
||||||
return visitor.getTemplateParameters();
|
|
||||||
} catch (CoreException e) {
|
|
||||||
CCorePlugin.log(e);
|
|
||||||
return new ICPPTemplateParameter[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addChild(PDOMNode member) throws CoreException {
|
|
||||||
if (member instanceof ICPPTemplateParameter) {
|
|
||||||
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + TEMPLATE_PARAMS, getLinkageImpl());
|
|
||||||
list.addMember(member);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(IPDOMVisitor visitor) throws CoreException {
|
|
||||||
super.accept(visitor);
|
|
||||||
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + TEMPLATE_PARAMS, getLinkageImpl());
|
|
||||||
list.accept(visitor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
|
||||||
|
@ -132,21 +109,21 @@ class PDOMCPPFunctionTemplate extends PDOMCPPFunction
|
||||||
public ICPPTemplateParameter adaptTemplateParameter(ICPPTemplateParameter param) {
|
public ICPPTemplateParameter adaptTemplateParameter(ICPPTemplateParameter param) {
|
||||||
// Template parameters are identified by their position in the parameter list.
|
// Template parameters are identified by their position in the parameter list.
|
||||||
int pos = param.getParameterPosition();
|
int pos = param.getParameterPosition();
|
||||||
try {
|
ICPPTemplateParameter[] pars = getTemplateParameters();
|
||||||
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + TEMPLATE_PARAMS, getLinkageImpl());
|
|
||||||
ICPPTemplateParameter result= (ICPPTemplateParameter) list.getNodeAt(pos);
|
if (pars == null || pos >= pars.length)
|
||||||
if (param instanceof ICPPTemplateTypeParameter) {
|
return null;
|
||||||
if (result instanceof ICPPTemplateTypeParameter)
|
|
||||||
return result;
|
ICPPTemplateParameter result= pars[pos];
|
||||||
} else if (param instanceof ICPPTemplateNonTypeParameter) {
|
if (param instanceof ICPPTemplateTypeParameter) {
|
||||||
if (result instanceof ICPPTemplateNonTypeParameter)
|
if (result instanceof ICPPTemplateTypeParameter)
|
||||||
return result;
|
return result;
|
||||||
} else if (param instanceof ICPPTemplateTemplateParameter) {
|
} else if (param instanceof ICPPTemplateNonTypeParameter) {
|
||||||
if (result instanceof ICPPTemplateTemplateParameter)
|
if (result instanceof ICPPTemplateNonTypeParameter)
|
||||||
return result;
|
return result;
|
||||||
}
|
} else if (param instanceof ICPPTemplateTemplateParameter) {
|
||||||
} catch (CoreException e) {
|
if (result instanceof ICPPTemplateTemplateParameter)
|
||||||
CCorePlugin.log(e);
|
return result;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
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.ICPPFunctionTemplate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||||
|
@ -34,7 +33,7 @@ class PDOMCPPFunctionTemplateSpecialization extends PDOMCPPFunctionSpecializatio
|
||||||
|
|
||||||
public PDOMCPPFunctionTemplateSpecialization(PDOM pdom, PDOMNode parent, ICPPFunctionTemplate template, PDOMBinding specialized)
|
public PDOMCPPFunctionTemplateSpecialization(PDOM pdom, PDOMNode parent, ICPPFunctionTemplate template, PDOMBinding specialized)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
super(pdom, parent, (ICPPFunction) template, specialized);
|
super(pdom, parent, template, specialized);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPFunctionTemplateSpecialization(PDOM pdom, int bindingRecord) {
|
public PDOMCPPFunctionTemplateSpecialization(PDOM pdom, int bindingRecord) {
|
||||||
|
|
|
@ -13,9 +13,12 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
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.IPointerType;
|
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
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.PDOMNode;
|
||||||
|
@ -23,6 +26,32 @@ import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCFunctionType;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
public class PDOMCPPFunctionType extends PDOMCFunctionType implements ICPPFunctionType {
|
public class PDOMCPPFunctionType extends PDOMCFunctionType implements ICPPFunctionType {
|
||||||
|
private static IType FALLBACK_RETURN_TYPE= new CPPBasicType(IBasicType.t_void, 0);
|
||||||
|
static ICPPFunctionType FALLBACK= new ICPPFunctionType() {
|
||||||
|
public IPointerType getThisType() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public boolean isConst() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public boolean isVolatile() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public IType[] getParameterTypes() throws DOMException {
|
||||||
|
return IType.EMPTY_TYPE_ARRAY;
|
||||||
|
}
|
||||||
|
public IType getReturnType() throws DOMException {
|
||||||
|
return FALLBACK_RETURN_TYPE;
|
||||||
|
}
|
||||||
|
public boolean isSameType(IType type) {
|
||||||
|
return this == type || type.isSameType(this);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Object clone() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Offset for <code>this</code> type of this function (relative to
|
* Offset for <code>this</code> type of this function (relative to
|
||||||
* the beginning of the record).
|
* the beginning of the record).
|
||||||
|
|
|
@ -13,9 +13,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
@ -28,6 +26,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
@ -57,9 +56,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
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.ICPPTemplateInstance;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
|
||||||
|
@ -70,7 +67,6 @@ import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPBasicType;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
import org.eclipse.cdt.internal.core.Util;
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownClassInstance;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownClassInstance;
|
||||||
|
@ -99,6 +95,8 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
public final static int CACHE_INSTANCES= 2;
|
public final static int CACHE_INSTANCES= 2;
|
||||||
public final static int CACHE_INSTANCE_SCOPE= 3;
|
public final static int CACHE_INSTANCE_SCOPE= 3;
|
||||||
|
|
||||||
|
private LinkedList<Runnable> postProcesses = new LinkedList<Runnable>();
|
||||||
|
|
||||||
public PDOMCPPLinkage(PDOM pdom, int record) {
|
public PDOMCPPLinkage(PDOM pdom, int record) {
|
||||||
super(pdom, record);
|
super(pdom, record);
|
||||||
}
|
}
|
||||||
|
@ -126,33 +124,26 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Binding types
|
// Binding types
|
||||||
|
class ConfigureTemplateParameters implements Runnable {
|
||||||
|
private final IPDOMCPPTemplateParameter[] fPersisted;
|
||||||
|
private final ICPPTemplateParameter[] fOriginal;
|
||||||
|
|
||||||
private class ConfigureTemplate implements Runnable {
|
public ConfigureTemplateParameters(ICPPTemplateParameter[] original, IPDOMCPPTemplateParameter[] params) {
|
||||||
ICPPTemplateDefinition template;
|
fOriginal= original;
|
||||||
|
fPersisted= params;
|
||||||
public ConfigureTemplate(ICPPTemplateDefinition template) {
|
postProcesses.add(this);
|
||||||
this.template = template;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
for (int i = 0; i < fOriginal.length; i++) {
|
||||||
ICPPTemplateParameter[] params = template.getTemplateParameters();
|
final IPDOMCPPTemplateParameter tp = fPersisted[i];
|
||||||
for (int i = 0; i < params.length; i++) {
|
if (tp != null)
|
||||||
if (params[i] != null && !(params[i] instanceof ProblemBinding)) {
|
tp.configure(fOriginal[i]);
|
||||||
addBinding(params[i], null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
CCorePlugin.log(e);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
CCorePlugin.log(e);
|
|
||||||
} finally {
|
|
||||||
template = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ConfigurePartialSpecialization implements Runnable {
|
class ConfigurePartialSpecialization implements Runnable {
|
||||||
PDOMCPPClassTemplatePartialSpecialization partial;
|
PDOMCPPClassTemplatePartialSpecialization partial;
|
||||||
ICPPClassTemplatePartialSpecialization binding;
|
ICPPClassTemplatePartialSpecialization binding;
|
||||||
|
|
||||||
|
@ -160,6 +151,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
ICPPClassTemplatePartialSpecialization binding) {
|
ICPPClassTemplatePartialSpecialization binding) {
|
||||||
this.partial = partial;
|
this.partial = partial;
|
||||||
this.binding = binding;
|
this.binding = binding;
|
||||||
|
postProcesses.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -177,31 +169,33 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ConfigureFunctionTemplate implements Runnable {
|
class ConfigureFunctionTemplate implements Runnable {
|
||||||
PDOMCPPFunctionTemplate template;
|
private final PDOMCPPFunctionTemplate fTemplate;
|
||||||
ICPPFunction function;
|
private final IPDOMCPPTemplateParameter[] fTemplateParameters;
|
||||||
|
private final ICPPTemplateParameter[] fOriginalTemplateParameters;
|
||||||
|
private final ICPPFunctionType fOriginalFunctionType;
|
||||||
|
private final IParameter[] fOriginalParameters;
|
||||||
|
|
||||||
public ConfigureFunctionTemplate(PDOMCPPFunctionTemplate template, ICPPFunction binding) {
|
public ConfigureFunctionTemplate(ICPPFunctionTemplate original, PDOMCPPFunctionTemplate template) throws DOMException {
|
||||||
this.template = template;
|
fTemplate = template;
|
||||||
this.function = binding;
|
fTemplateParameters= template.getTemplateParameters();
|
||||||
|
fOriginalTemplateParameters= original.getTemplateParameters();
|
||||||
|
fOriginalFunctionType= original.getType();
|
||||||
|
fOriginalParameters= original.getParameters();
|
||||||
|
postProcesses.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
for (int i = 0; i < fOriginalTemplateParameters.length; i++) {
|
||||||
template.initData((ICPPFunctionType) function.getType(), function.getParameters());
|
final IPDOMCPPTemplateParameter tp = fTemplateParameters[i];
|
||||||
} catch (CoreException e) {
|
if (tp != null)
|
||||||
CCorePlugin.log(e);
|
tp.configure(fOriginalTemplateParameters[i]);
|
||||||
} catch (DOMException e) {
|
|
||||||
CCorePlugin.log(e);
|
|
||||||
} finally {
|
|
||||||
template = null;
|
|
||||||
function = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fTemplate.initData(fOriginalFunctionType, fOriginalParameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Runnable> postProcesses = new ArrayList<Runnable>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds or returns existing binding for the given name.
|
* Adds or returns existing binding for the given name.
|
||||||
*/
|
*/
|
||||||
|
@ -276,6 +270,8 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
|
|
||||||
private boolean shouldUpdate(PDOMBinding pdomBinding, IASTName fromName) throws CoreException {
|
private boolean shouldUpdate(PDOMBinding pdomBinding, IASTName fromName) throws CoreException {
|
||||||
if (fromName != null) {
|
if (fromName != null) {
|
||||||
|
if (pdomBinding instanceof IParameter || pdomBinding instanceof ICPPTemplateParameter)
|
||||||
|
return false;
|
||||||
if (fromName.isReference()) {
|
if (fromName.isReference()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -300,6 +296,10 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
PDOMBinding createBinding(PDOMNode parent, IBinding binding) throws CoreException, DOMException {
|
PDOMBinding createBinding(PDOMNode parent, IBinding binding) throws CoreException, DOMException {
|
||||||
PDOMBinding pdomBinding= null;
|
PDOMBinding pdomBinding= null;
|
||||||
|
|
||||||
|
// template parameters are created directly by their owners.
|
||||||
|
if (binding instanceof ICPPTemplateParameter)
|
||||||
|
return null;
|
||||||
|
|
||||||
if (binding instanceof ICPPSpecialization) {
|
if (binding instanceof ICPPSpecialization) {
|
||||||
IBinding specialized = ((ICPPSpecialization)binding).getSpecializedBinding();
|
IBinding specialized = ((ICPPSpecialization)binding).getSpecializedBinding();
|
||||||
PDOMBinding pdomSpecialized= addBinding(specialized, null);
|
PDOMBinding pdomSpecialized= addBinding(specialized, null);
|
||||||
|
@ -307,15 +307,6 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
pdomBinding = createSpecialization(parent, pdomSpecialized, binding);
|
pdomBinding = createSpecialization(parent, pdomSpecialized, binding);
|
||||||
} else if (binding instanceof ICPPTemplateParameter) {
|
|
||||||
if (binding instanceof ICPPTemplateTypeParameter) {
|
|
||||||
pdomBinding = new PDOMCPPTemplateTypeParameter(pdom, parent, (ICPPTemplateTypeParameter)binding);
|
|
||||||
} else if (binding instanceof ICPPTemplateNonTypeParameter) {
|
|
||||||
pdomBinding = new PDOMCPPTemplateNonTypeParameter(pdom, parent, (ICPPTemplateNonTypeParameter)binding);
|
|
||||||
}
|
|
||||||
// TODO other template parameter types
|
|
||||||
// else if (binding instanceof ICPPTemplateTemplateParameter) {
|
|
||||||
// pdomBinding = new PDOMCPPTemplateTemplateParameter(pdom, parent, (ICPPTemplateTemplateParameter)binding);
|
|
||||||
} else if (binding instanceof ICPPField) {
|
} else if (binding instanceof ICPPField) {
|
||||||
if (parent instanceof PDOMCPPClassType || parent instanceof PDOMCPPClassSpecialization) {
|
if (parent instanceof PDOMCPPClassType || parent instanceof PDOMCPPClassSpecialization) {
|
||||||
pdomBinding = new PDOMCPPField(pdom, parent, (ICPPField) binding);
|
pdomBinding = new PDOMCPPField(pdom, parent, (ICPPField) binding);
|
||||||
|
@ -325,11 +316,11 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
pdomBinding = new PDOMCPPVariable(pdom, parent, var);
|
pdomBinding = new PDOMCPPVariable(pdom, parent, var);
|
||||||
} else if (binding instanceof ICPPFunctionTemplate) {
|
} else if (binding instanceof ICPPFunctionTemplate) {
|
||||||
if (binding instanceof ICPPConstructor) {
|
if (binding instanceof ICPPConstructor) {
|
||||||
pdomBinding= new PDOMCPPConstructorTemplate(pdom, parent, (ICPPConstructor) binding);
|
pdomBinding= new PDOMCPPConstructorTemplate(pdom, this, parent, (ICPPConstructor) binding);
|
||||||
} else if (binding instanceof ICPPMethod) {
|
} else if (binding instanceof ICPPMethod) {
|
||||||
pdomBinding= new PDOMCPPMethodTemplate(pdom, parent, (ICPPMethod) binding);
|
pdomBinding= new PDOMCPPMethodTemplate(pdom, this, parent, (ICPPMethod) binding);
|
||||||
} else if (binding instanceof ICPPFunction) {
|
} else if (binding instanceof ICPPFunction) {
|
||||||
pdomBinding= new PDOMCPPFunctionTemplate(pdom, parent, (ICPPFunctionTemplate) binding);
|
pdomBinding= new PDOMCPPFunctionTemplate(pdom, this, parent, (ICPPFunctionTemplate) binding);
|
||||||
}
|
}
|
||||||
} else if (binding instanceof ICPPConstructor) {
|
} else if (binding instanceof ICPPConstructor) {
|
||||||
if (parent instanceof PDOMCPPClassType || parent instanceof PDOMCPPClassSpecialization) {
|
if (parent instanceof PDOMCPPClassType || parent instanceof PDOMCPPClassSpecialization) {
|
||||||
|
@ -342,7 +333,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
} else if (binding instanceof ICPPFunction) {
|
} else if (binding instanceof ICPPFunction) {
|
||||||
pdomBinding = new PDOMCPPFunction(pdom, parent, (ICPPFunction) binding, true);
|
pdomBinding = new PDOMCPPFunction(pdom, parent, (ICPPFunction) binding, true);
|
||||||
} else if (binding instanceof ICPPClassTemplate) {
|
} else if (binding instanceof ICPPClassTemplate) {
|
||||||
pdomBinding= new PDOMCPPClassTemplate(pdom, parent, (ICPPClassTemplate) binding);
|
pdomBinding= new PDOMCPPClassTemplate(pdom, this, parent, (ICPPClassTemplate) binding);
|
||||||
} else if (binding instanceof ICPPClassType) {
|
} else if (binding instanceof ICPPClassType) {
|
||||||
if (binding instanceof ICPPUnknownClassInstance) {
|
if (binding instanceof ICPPUnknownClassInstance) {
|
||||||
pdomBinding= new PDOMCPPUnknownClassInstance(pdom, parent, (ICPPUnknownClassInstance) binding);
|
pdomBinding= new PDOMCPPUnknownClassInstance(pdom, parent, (ICPPUnknownClassInstance) binding);
|
||||||
|
@ -378,12 +369,11 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
afterAddBinding(pdomBinding);
|
afterAddBinding(pdomBinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
pushPostProcesses(pdomBinding, binding);
|
|
||||||
|
|
||||||
return pdomBinding;
|
return pdomBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PDOMBinding createSpecialization(PDOMNode parent, PDOMBinding orig, IBinding special) throws CoreException {
|
private PDOMBinding createSpecialization(PDOMNode parent, PDOMBinding orig, IBinding special)
|
||||||
|
throws CoreException, DOMException {
|
||||||
PDOMBinding result= null;
|
PDOMBinding result= null;
|
||||||
if (special instanceof ICPPDeferredClassInstance) {
|
if (special instanceof ICPPDeferredClassInstance) {
|
||||||
if (orig instanceof ICPPClassTemplate) {
|
if (orig instanceof ICPPClassTemplate) {
|
||||||
|
@ -402,7 +392,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
} else if (special instanceof ICPPClassTemplatePartialSpecialization) {
|
} else if (special instanceof ICPPClassTemplatePartialSpecialization) {
|
||||||
if (orig instanceof PDOMCPPClassTemplate) {
|
if (orig instanceof PDOMCPPClassTemplate) {
|
||||||
result= new PDOMCPPClassTemplatePartialSpecialization(
|
result= new PDOMCPPClassTemplatePartialSpecialization(
|
||||||
pdom, parent, (ICPPClassTemplatePartialSpecialization) special,
|
pdom, this, parent, (ICPPClassTemplatePartialSpecialization) special,
|
||||||
(PDOMCPPClassTemplate) orig);
|
(PDOMCPPClassTemplate) orig);
|
||||||
}
|
}
|
||||||
} else if (special instanceof ICPPField) {
|
} else if (special instanceof ICPPField) {
|
||||||
|
@ -432,24 +422,6 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pushPostProcesses(PDOMBinding pdomBinding, IBinding binding) throws CoreException, DOMException {
|
|
||||||
if (pdomBinding instanceof PDOMCPPClassTemplatePartialSpecialization &&
|
|
||||||
binding instanceof ICPPClassTemplatePartialSpecialization) {
|
|
||||||
PDOMCPPClassTemplatePartialSpecialization pdomSpec = (PDOMCPPClassTemplatePartialSpecialization) pdomBinding;
|
|
||||||
ICPPClassTemplatePartialSpecialization spec = (ICPPClassTemplatePartialSpecialization) binding;
|
|
||||||
pushPostProcess(new ConfigurePartialSpecialization(pdomSpec, spec));
|
|
||||||
}
|
|
||||||
if (pdomBinding instanceof PDOMCPPFunctionTemplate && binding instanceof ICPPFunction) {
|
|
||||||
PDOMCPPFunctionTemplate pdomTemplate = (PDOMCPPFunctionTemplate) pdomBinding;
|
|
||||||
ICPPFunction function = (ICPPFunction) binding;
|
|
||||||
pushPostProcess(new ConfigureFunctionTemplate(pdomTemplate, function));
|
|
||||||
}
|
|
||||||
if (pdomBinding instanceof ICPPTemplateDefinition && binding instanceof ICPPTemplateDefinition) {
|
|
||||||
ICPPTemplateDefinition template = (ICPPTemplateDefinition) binding;
|
|
||||||
pushPostProcess(new ConfigureTemplate(template));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addImplicitMethods(PDOMBinding type, ICPPClassType binding) throws CoreException {
|
private void addImplicitMethods(PDOMBinding type, ICPPClassType binding) throws CoreException {
|
||||||
try {
|
try {
|
||||||
IScope scope = binding.getCompositeScope();
|
IScope scope = binding.getCompositeScope();
|
||||||
|
@ -726,18 +698,10 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
|
|
||||||
private void handlePostProcesses() {
|
private void handlePostProcesses() {
|
||||||
while (!postProcesses.isEmpty()) {
|
while (!postProcesses.isEmpty()) {
|
||||||
popPostProcess().run();
|
postProcesses.removeFirst().run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pushPostProcess(Runnable process) {
|
|
||||||
postProcesses.add(postProcesses.size(), process);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Runnable popPostProcess() {
|
|
||||||
return postProcesses.remove(postProcesses.size() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDOMNode getNode(int record) throws CoreException {
|
public PDOMNode getNode(int record) throws CoreException {
|
||||||
if (record == 0)
|
if (record == 0)
|
||||||
|
@ -804,9 +768,8 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
return new PDOMCPPUnknownClassInstance(pdom, record);
|
return new PDOMCPPUnknownClassInstance(pdom, record);
|
||||||
case CPP_TEMPLATE_TYPE_PARAMETER:
|
case CPP_TEMPLATE_TYPE_PARAMETER:
|
||||||
return new PDOMCPPTemplateTypeParameter(pdom, record);
|
return new PDOMCPPTemplateTypeParameter(pdom, record);
|
||||||
// TODO other template parameter types
|
case CPP_TEMPLATE_TEMPLATE_PARAMETER:
|
||||||
// case CPP_TEMPLATE_TEMPLATE_PARAMETER:
|
return new PDOMCPPTemplateTemplateParameter(pdom, record);
|
||||||
// return new PDOMCPPTemplateTemplateParameter(pdom, record);
|
|
||||||
case CPP_TEMPLATE_NON_TYPE_PARAMETER:
|
case CPP_TEMPLATE_NON_TYPE_PARAMETER:
|
||||||
return new PDOMCPPTemplateNonTypeParameter(pdom, record);
|
return new PDOMCPPTemplateNonTypeParameter(pdom, record);
|
||||||
case CPP_FIELD_SPECIALIZATION:
|
case CPP_FIELD_SPECIALIZATION:
|
||||||
|
|
|
@ -60,7 +60,7 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod {
|
||||||
*/
|
*/
|
||||||
private static final int CV_OFFSET = PDOMCPPAnnotation.MAX_EXTRA_OFFSET + 1;
|
private static final int CV_OFFSET = PDOMCPPAnnotation.MAX_EXTRA_OFFSET + 1;
|
||||||
|
|
||||||
public PDOMCPPMethod(PDOM pdom, PDOMNode parent, ICPPMethod method) throws CoreException {
|
public PDOMCPPMethod(PDOM pdom, PDOMNode parent, ICPPMethod method) throws CoreException, DOMException {
|
||||||
super(pdom, parent, method, true);
|
super(pdom, parent, method, true);
|
||||||
|
|
||||||
Database db = pdom.getDB();
|
Database db = pdom.getDB();
|
||||||
|
|
|
@ -55,7 +55,7 @@ class PDOMCPPMethodSpecialization extends PDOMCPPFunctionSpecialization
|
||||||
Database db = pdom.getDB();
|
Database db = pdom.getDB();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ICPPFunctionType type = (ICPPFunctionType) method.getType();
|
ICPPFunctionType type = method.getType();
|
||||||
byte annotation = 0;
|
byte annotation = 0;
|
||||||
annotation |= PDOMCAnnotation.encodeCVQualifiers(type) << CV_OFFSET;
|
annotation |= PDOMCAnnotation.encodeCVQualifiers(type) << CV_OFFSET;
|
||||||
annotation |= PDOMCPPAnnotation.encodeExtraAnnotation(method);
|
annotation |= PDOMCPPAnnotation.encodeExtraAnnotation(method);
|
||||||
|
|
|
@ -47,14 +47,14 @@ class PDOMCPPMethodTemplate extends PDOMCPPFunctionTemplate implements ICPPMetho
|
||||||
*/
|
*/
|
||||||
private static final int CV_OFFSET = PDOMCPPAnnotation.MAX_EXTRA_OFFSET + 1;
|
private static final int CV_OFFSET = PDOMCPPAnnotation.MAX_EXTRA_OFFSET + 1;
|
||||||
|
|
||||||
public PDOMCPPMethodTemplate(PDOM pdom, PDOMNode parent,
|
public PDOMCPPMethodTemplate(PDOM pdom, PDOMCPPLinkage linkage, PDOMNode parent, ICPPMethod method)
|
||||||
ICPPMethod method) throws CoreException {
|
throws CoreException, DOMException {
|
||||||
super(pdom, parent, (ICPPFunctionTemplate) method);
|
super(pdom, linkage, parent, (ICPPFunctionTemplate) method);
|
||||||
|
|
||||||
Database db = pdom.getDB();
|
Database db = pdom.getDB();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ICPPFunctionType type = (ICPPFunctionType) method.getType();
|
ICPPFunctionType type = method.getType();
|
||||||
byte annotation = 0;
|
byte annotation = 0;
|
||||||
annotation |= PDOMCAnnotation.encodeCVQualifiers(type) << CV_OFFSET;
|
annotation |= PDOMCAnnotation.encodeCVQualifiers(type) << CV_OFFSET;
|
||||||
annotation |= PDOMCPPAnnotation.encodeExtraAnnotation(method);
|
annotation |= PDOMCPPAnnotation.encodeExtraAnnotation(method);
|
||||||
|
|
|
@ -14,31 +14,35 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateArgument;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateArgument;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
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.Database;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.IString;
|
import org.eclipse.cdt.internal.core.pdom.db.IString;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
|
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
|
||||||
|
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.PDOMNode;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binding for template non-type parameter in the index.
|
* Binding for template non-type parameter in the index.
|
||||||
*/
|
*/
|
||||||
class PDOMCPPTemplateNonTypeParameter extends PDOMCPPVariable implements IPDOMMemberOwner,
|
class PDOMCPPTemplateNonTypeParameter extends PDOMCPPBinding implements IPDOMMemberOwner,
|
||||||
ICPPTemplateNonTypeParameter {
|
ICPPTemplateNonTypeParameter, IPDOMCPPTemplateParameter {
|
||||||
|
|
||||||
private static final int MEMBERLIST = PDOMCPPVariable.RECORD_SIZE;
|
private static final int TYPE_OFFSET= PDOMCPPBinding.RECORD_SIZE;
|
||||||
private static final int PARAMETERID= PDOMCPPVariable.RECORD_SIZE + 4;
|
private static final int PARAMETERID= PDOMCPPBinding.RECORD_SIZE + 4;
|
||||||
private static final int DEFAULTVAL= PDOMCPPVariable.RECORD_SIZE + 8;
|
private static final int DEFAULTVAL= PDOMCPPBinding.RECORD_SIZE + 8;
|
||||||
|
|
||||||
private int fCachedParamID= -1;
|
private int fCachedParamID= -1;
|
||||||
|
|
||||||
|
@ -50,17 +54,9 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPVariable implements IPDOMMe
|
||||||
|
|
||||||
public PDOMCPPTemplateNonTypeParameter(PDOM pdom, PDOMNode parent,
|
public PDOMCPPTemplateNonTypeParameter(PDOM pdom, PDOMNode parent,
|
||||||
ICPPTemplateNonTypeParameter param) throws CoreException {
|
ICPPTemplateNonTypeParameter param) throws CoreException {
|
||||||
super(pdom, parent, param);
|
super(pdom, parent, param.getNameCharArray());
|
||||||
final Database db = pdom.getDB();
|
final Database db = pdom.getDB();
|
||||||
db.putInt(record + PARAMETERID, param.getParameterID());
|
db.putInt(record + PARAMETERID, param.getParameterID());
|
||||||
ICPPTemplateArgument val= param.getDefaultValue();
|
|
||||||
if (val != null) {
|
|
||||||
IValue sval= val.getNonTypeValue();
|
|
||||||
if (sval != null) {
|
|
||||||
IString s= db.newString(sval.getCanonicalRepresentation());
|
|
||||||
db.putInt(record + DEFAULTVAL, s.getRecord());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPTemplateNonTypeParameter(PDOM pdom, int bindingRecord) {
|
public PDOMCPPTemplateNonTypeParameter(PDOM pdom, int bindingRecord) {
|
||||||
|
@ -93,6 +89,40 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPVariable implements IPDOMMe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
|
||||||
|
if (newBinding instanceof ICPPTemplateNonTypeParameter) {
|
||||||
|
ICPPTemplateNonTypeParameter ntp= (ICPPTemplateNonTypeParameter) newBinding;
|
||||||
|
updateName(newBinding.getNameCharArray());
|
||||||
|
final Database db = pdom.getDB();
|
||||||
|
IType mytype= getType();
|
||||||
|
int valueRec= db.getInt(record + DEFAULTVAL);
|
||||||
|
try {
|
||||||
|
IType newType= ntp.getType();
|
||||||
|
setType(linkage, newType);
|
||||||
|
if (mytype != null)
|
||||||
|
linkage.deleteType(mytype, record);
|
||||||
|
if (setDefaultValue(db, ntp) && valueRec != 0) {
|
||||||
|
db.getString(valueRec).delete();
|
||||||
|
}
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void forceDelete(PDOMLinkage linkage) throws CoreException {
|
||||||
|
getDBName().delete();
|
||||||
|
IType type= getType();
|
||||||
|
if (type instanceof PDOMNode) {
|
||||||
|
((PDOMNode) type).delete(linkage);
|
||||||
|
}
|
||||||
|
Database db= pdom.getDB();
|
||||||
|
int valueRec= db.getInt(record + DEFAULTVAL);
|
||||||
|
if (valueRec != 0)
|
||||||
|
db.getString(valueRec).delete();
|
||||||
|
}
|
||||||
|
|
||||||
public short getParameterPosition() {
|
public short getParameterPosition() {
|
||||||
readParamID();
|
readParamID();
|
||||||
return (short) fCachedParamID;
|
return (short) fCachedParamID;
|
||||||
|
@ -120,23 +150,82 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPVariable implements IPDOMMe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void setType(final PDOMLinkage linkage, IType newType) throws CoreException, DOMException {
|
||||||
public void addChild(PDOMNode member) throws CoreException {
|
PDOMNode typeNode = linkage.addType(this, newType);
|
||||||
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + MEMBERLIST, getLinkageImpl());
|
pdom.getDB().putInt(record + TYPE_OFFSET, typeNode != null ? typeNode.getRecord() : 0);
|
||||||
list.addMember(member);
|
}
|
||||||
|
|
||||||
|
public void configure(ICPPTemplateParameter param) {
|
||||||
|
try {
|
||||||
|
if (param instanceof ICPPTemplateNonTypeParameter) {
|
||||||
|
ICPPTemplateNonTypeParameter nonTypeParm= (ICPPTemplateNonTypeParameter) param;
|
||||||
|
setType(getLinkage(), nonTypeParm.getType());
|
||||||
|
final Database db= pdom.getDB();
|
||||||
|
setDefaultValue(db, nonTypeParm);
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
} catch (DOMException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean setDefaultValue(Database db, ICPPTemplateNonTypeParameter nonTypeParm) throws CoreException {
|
||||||
|
ICPPTemplateArgument val= nonTypeParm.getDefaultValue();
|
||||||
|
if (val != null) {
|
||||||
|
IValue sval= val.getNonTypeValue();
|
||||||
|
if (sval != null) {
|
||||||
|
IString s= db.newString(sval.getCanonicalRepresentation());
|
||||||
|
db.putInt(record + DEFAULTVAL, s.getRecord());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IType getType() {
|
||||||
|
try {
|
||||||
|
int typeRec = pdom.getDB().getInt(record + TYPE_OFFSET);
|
||||||
|
return (IType)getLinkageImpl().getNode(typeRec);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IValue getInitialValue() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public boolean isAuto() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public boolean isExtern() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public boolean isRegister() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public boolean isStatic() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public boolean isExternC() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public boolean isMutable() {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(IPDOMVisitor visitor) throws CoreException {
|
public Object clone() {
|
||||||
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + MEMBERLIST, getLinkageImpl());
|
fail();
|
||||||
list.accept(visitor);
|
return null;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
@Override
|
* @deprecated
|
||||||
public Object clone() { fail(); return null; }
|
*/
|
||||||
|
@Deprecated
|
||||||
|
|
||||||
public IASTExpression getDefault() {
|
public IASTExpression getDefault() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,349 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Markus Schorn - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
|
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.ICPPBase;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
|
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.ICPPTemplateArgument;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTemplateParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateArgument;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownType;
|
||||||
|
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||||
|
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
|
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.core.runtime.CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mstodo
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PDOMCPPTemplateTemplateParameter extends PDOMCPPBinding
|
||||||
|
implements ICPPTemplateTemplateParameter, ICPPUnknownBinding, ICPPUnknownType, IIndexType,
|
||||||
|
IPDOMCPPTemplateParameter, IPDOMCPPTemplateParameterOwner {
|
||||||
|
|
||||||
|
private static final int DEFAULT_TYPE = PDOMCPPBinding.RECORD_SIZE + 0;
|
||||||
|
private static final int MEMBERLIST = PDOMCPPBinding.RECORD_SIZE + 4;
|
||||||
|
private static final int PARAMETERID= PDOMCPPBinding.RECORD_SIZE + 8;
|
||||||
|
private static final int PARAMETERS= PDOMCPPBinding.RECORD_SIZE + 12;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The size in bytes of a PDOMCPPTemplateTypeParameter record in the database.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("hiding")
|
||||||
|
protected static final int RECORD_SIZE = PDOMCPPBinding.RECORD_SIZE + 14;
|
||||||
|
|
||||||
|
private ICPPScope fUnknownScope;
|
||||||
|
private int fCachedParamID= -1;
|
||||||
|
private IPDOMCPPTemplateParameter[] params;
|
||||||
|
|
||||||
|
public PDOMCPPTemplateTemplateParameter(PDOM pdom, PDOMNode parent, ICPPTemplateTemplateParameter param)
|
||||||
|
throws CoreException, DOMException {
|
||||||
|
super(pdom, parent, param.getNameCharArray());
|
||||||
|
|
||||||
|
final Database db = pdom.getDB();
|
||||||
|
db.putInt(record + PARAMETERID, param.getParameterID());
|
||||||
|
final ICPPTemplateParameter[] origParams= param.getTemplateParameters();
|
||||||
|
final IPDOMCPPTemplateParameter[] params = PDOMTemplateParameterArray.createPDOMTemplateParameters(pdom, this, origParams);
|
||||||
|
int rec= PDOMTemplateParameterArray.putArray(db, params);
|
||||||
|
pdom.getDB().putInt(record + PARAMETERS, rec);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PDOMCPPTemplateTemplateParameter(PDOM pdom, int bindingRecord) {
|
||||||
|
super(pdom, bindingRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getRecordSize() {
|
||||||
|
return RECORD_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getNodeType() {
|
||||||
|
return IIndexCPPBindingConstants.CPP_TEMPLATE_TEMPLATE_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getParameterPosition() {
|
||||||
|
readParamID();
|
||||||
|
return (short) fCachedParamID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getTemplateNestingLevel() {
|
||||||
|
readParamID();
|
||||||
|
return (short)(fCachedParamID >> 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getParameterID() {
|
||||||
|
readParamID();
|
||||||
|
return fCachedParamID;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readParamID() {
|
||||||
|
if (fCachedParamID == -1) {
|
||||||
|
try {
|
||||||
|
final Database db = pdom.getDB();
|
||||||
|
fCachedParamID= db.getInt(record + PARAMETERID);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
fCachedParamID= -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addChild(PDOMNode member) throws CoreException {
|
||||||
|
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + MEMBERLIST, getLinkageImpl());
|
||||||
|
list.addMember(member);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(IPDOMVisitor visitor) throws CoreException {
|
||||||
|
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + MEMBERLIST, getLinkageImpl());
|
||||||
|
list.accept(visitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSameType(IType type) {
|
||||||
|
if (type instanceof ITypedef) {
|
||||||
|
return type.isSameType(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(type instanceof ICPPTemplateTemplateParameter))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return getParameterID() == ((ICPPTemplateParameter) type).getParameterID();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IType getDefault() {
|
||||||
|
try {
|
||||||
|
PDOMNode node = getLinkageImpl().getNode(pdom.getDB().getInt(record + DEFAULT_TYPE));
|
||||||
|
if (node instanceof IType) {
|
||||||
|
return (IType) node;
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPTemplateArgument getDefaultValue() {
|
||||||
|
IType d= getDefault();
|
||||||
|
if (d == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return new CPPTemplateArgument(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object clone() { fail(); return null; }
|
||||||
|
|
||||||
|
|
||||||
|
public ICPPScope asScope() {
|
||||||
|
if (fUnknownScope == null) {
|
||||||
|
fUnknownScope= new PDOMCPPUnknownScope(this, new CPPASTName(getNameCharArray()));
|
||||||
|
}
|
||||||
|
return fUnknownScope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTName getUnknownName() {
|
||||||
|
return new CPPASTName(getNameCharArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void configure(ICPPTemplateParameter param) {
|
||||||
|
try {
|
||||||
|
ICPPTemplateArgument val= param.getDefaultValue();
|
||||||
|
if (val != null) {
|
||||||
|
IType dflt= val.getTypeValue();
|
||||||
|
if (dflt != null) {
|
||||||
|
final Database db= getPDOM().getDB();
|
||||||
|
PDOMNode typeNode = getLinkageImpl().addType(this, dflt);
|
||||||
|
if (typeNode != null) {
|
||||||
|
db.putInt(record + DEFAULT_TYPE, typeNode.getRecord());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
|
||||||
|
if (newBinding instanceof ICPPTemplateTemplateParameter) {
|
||||||
|
final Database db = pdom.getDB();
|
||||||
|
ICPPTemplateTemplateParameter ttp= (ICPPTemplateTemplateParameter) newBinding;
|
||||||
|
updateName(newBinding.getNameCharArray());
|
||||||
|
IType newDefault= null;
|
||||||
|
try {
|
||||||
|
newDefault = ttp.getDefault();
|
||||||
|
} catch (DOMException e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
if (newDefault != null) {
|
||||||
|
IType mytype= getDefault();
|
||||||
|
PDOMNode typeNode = getLinkageImpl().addType(this, newDefault);
|
||||||
|
if (typeNode != null) {
|
||||||
|
db.putInt(record + DEFAULT_TYPE, typeNode.getRecord());
|
||||||
|
if (mytype != null)
|
||||||
|
linkage.deleteType(mytype, record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int oldRec= db.getInt(record + PARAMETERS);
|
||||||
|
IPDOMCPPTemplateParameter[] oldParams= getTemplateParameters();
|
||||||
|
try {
|
||||||
|
params= PDOMTemplateParameterArray.createPDOMTemplateParameters(pdom, this, ttp.getTemplateParameters());
|
||||||
|
int newRec= PDOMTemplateParameterArray.putArray(db, params);
|
||||||
|
db.putInt(record + PARAMETERS, newRec);
|
||||||
|
if (oldRec != 0)
|
||||||
|
db.free(oldRec);
|
||||||
|
for (IPDOMCPPTemplateParameter opar : oldParams) {
|
||||||
|
opar.forceDelete(linkage);
|
||||||
|
}
|
||||||
|
} catch (DOMException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void forceDelete(PDOMLinkage linkage) throws CoreException {
|
||||||
|
getDBName().delete();
|
||||||
|
IType type= getDefault();
|
||||||
|
if (type instanceof PDOMNode) {
|
||||||
|
((PDOMNode) type).delete(linkage);
|
||||||
|
}
|
||||||
|
Database db= pdom.getDB();
|
||||||
|
int valueRec= db.getInt(record + DEFAULT_TYPE);
|
||||||
|
if (valueRec != 0)
|
||||||
|
db.getString(valueRec).delete();
|
||||||
|
|
||||||
|
int oldRec= db.getInt(record + PARAMETERS);
|
||||||
|
IPDOMCPPTemplateParameter[] oldParams= getTemplateParameters();
|
||||||
|
if (oldRec != 0)
|
||||||
|
db.free(oldRec);
|
||||||
|
for (IPDOMCPPTemplateParameter opar : oldParams) {
|
||||||
|
opar.forceDelete(linkage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IPDOMCPPTemplateParameter[] getTemplateParameters() {
|
||||||
|
if (params == null) {
|
||||||
|
try {
|
||||||
|
int rec= pdom.getDB().getInt(record + PARAMETERS);
|
||||||
|
if (rec == 0) {
|
||||||
|
params= IPDOMCPPTemplateParameter.EMPTY_ARRAY;
|
||||||
|
} else {
|
||||||
|
params= PDOMTemplateParameterArray.getArray(this, rec);
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
params = IPDOMCPPTemplateParameter.EMPTY_ARRAY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() {
|
||||||
|
return ICPPClassTemplatePartialSpecialization.EMPTY_PARTIAL_SPECIALIZATION_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IField findField(String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPMethod[] getAllDeclaredMethods() {
|
||||||
|
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPBase[] getBases() {
|
||||||
|
return ICPPBase.EMPTY_BASE_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPConstructor[] getConstructors() {
|
||||||
|
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPField[] getDeclaredFields() {
|
||||||
|
return ICPPField.EMPTY_CPPFIELD_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPMethod[] getDeclaredMethods() {
|
||||||
|
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IField[] getFields() {
|
||||||
|
return ICPPField.EMPTY_CPPFIELD_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBinding[] getFriends() {
|
||||||
|
return IBinding.EMPTY_BINDING_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPMethod[] getMethods() {
|
||||||
|
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPClassType[] getNestedClasses() {
|
||||||
|
return ICPPClassType.EMPTY_CLASS_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IScope getCompositeScope() {
|
||||||
|
return asScope();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getKey() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAnonymous() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPTemplateParameter adaptTemplateParameter(ICPPTemplateParameter param) {
|
||||||
|
int pos = param.getParameterPosition();
|
||||||
|
ICPPTemplateParameter[] pars = getTemplateParameters();
|
||||||
|
|
||||||
|
if (pars == null || pos >= pars.length)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
ICPPTemplateParameter result= pars[pos];
|
||||||
|
if (param instanceof ICPPTemplateTypeParameter) {
|
||||||
|
if (result instanceof ICPPTemplateTypeParameter)
|
||||||
|
return result;
|
||||||
|
} else if (param instanceof ICPPTemplateNonTypeParameter) {
|
||||||
|
if (result instanceof ICPPTemplateNonTypeParameter)
|
||||||
|
return result;
|
||||||
|
} else if (param instanceof ICPPTemplateTemplateParameter) {
|
||||||
|
if (result instanceof ICPPTemplateTemplateParameter)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,13 +16,13 @@ import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
||||||
import org.eclipse.cdt.internal.core.Util;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateArgument;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateArgument;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
||||||
|
@ -33,6 +33,7 @@ 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.Database;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList;
|
import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
|
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
|
||||||
|
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.PDOMNode;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
@ -40,7 +41,8 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
* Binding for template type parameters in the index.
|
* Binding for template type parameters in the index.
|
||||||
*/
|
*/
|
||||||
class PDOMCPPTemplateTypeParameter extends PDOMCPPBinding implements IPDOMMemberOwner,
|
class PDOMCPPTemplateTypeParameter extends PDOMCPPBinding implements IPDOMMemberOwner,
|
||||||
ICPPTemplateTypeParameter, ICPPUnknownBinding, ICPPUnknownType, IIndexType {
|
ICPPTemplateTypeParameter, ICPPUnknownBinding, ICPPUnknownType, IIndexType,
|
||||||
|
IPDOMCPPTemplateParameter {
|
||||||
|
|
||||||
private static final int DEFAULT_TYPE = PDOMCPPBinding.RECORD_SIZE + 0;
|
private static final int DEFAULT_TYPE = PDOMCPPBinding.RECORD_SIZE + 0;
|
||||||
private static final int MEMBERLIST = PDOMCPPBinding.RECORD_SIZE + 4;
|
private static final int MEMBERLIST = PDOMCPPBinding.RECORD_SIZE + 4;
|
||||||
|
@ -55,23 +57,12 @@ class PDOMCPPTemplateTypeParameter extends PDOMCPPBinding implements IPDOMMember
|
||||||
private ICPPScope fUnknownScope;
|
private ICPPScope fUnknownScope;
|
||||||
private int fCachedParamID= -1;
|
private int fCachedParamID= -1;
|
||||||
|
|
||||||
public PDOMCPPTemplateTypeParameter(PDOM pdom, PDOMNode parent,
|
public PDOMCPPTemplateTypeParameter(PDOM pdom, PDOMNode parent, ICPPTemplateTypeParameter param)
|
||||||
ICPPTemplateTypeParameter param) throws CoreException {
|
throws CoreException {
|
||||||
super(pdom, parent, param.getNameCharArray());
|
super(pdom, parent, param.getNameCharArray());
|
||||||
|
|
||||||
try {
|
final Database db = pdom.getDB();
|
||||||
final Database db = pdom.getDB();
|
db.putInt(record + PARAMETERID, param.getParameterID());
|
||||||
db.putInt(record + PARAMETERID, param.getParameterID());
|
|
||||||
IType dflt = param.getDefault();
|
|
||||||
if (dflt != null) {
|
|
||||||
PDOMNode typeNode = getLinkageImpl().addType(this, dflt);
|
|
||||||
if (typeNode != null) {
|
|
||||||
db.putInt(record + DEFAULT_TYPE, typeNode.getRecord());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (DOMException e) {
|
|
||||||
throw new CoreException(Util.createStatus(e));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPTemplateTypeParameter(PDOM pdom, int bindingRecord) {
|
public PDOMCPPTemplateTypeParameter(PDOM pdom, int bindingRecord) {
|
||||||
|
@ -172,4 +163,54 @@ class PDOMCPPTemplateTypeParameter extends PDOMCPPBinding implements IPDOMMember
|
||||||
public IASTName getUnknownName() {
|
public IASTName getUnknownName() {
|
||||||
return new CPPASTName(getNameCharArray());
|
return new CPPASTName(getNameCharArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void configure(ICPPTemplateParameter param) {
|
||||||
|
try {
|
||||||
|
ICPPTemplateArgument val= param.getDefaultValue();
|
||||||
|
if (val != null) {
|
||||||
|
IType dflt= val.getTypeValue();
|
||||||
|
if (dflt != null) {
|
||||||
|
final Database db= getPDOM().getDB();
|
||||||
|
PDOMNode typeNode = getLinkageImpl().addType(this, dflt);
|
||||||
|
if (typeNode != null) {
|
||||||
|
db.putInt(record + DEFAULT_TYPE, typeNode.getRecord());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
|
||||||
|
if (newBinding instanceof ICPPTemplateTypeParameter) {
|
||||||
|
ICPPTemplateTypeParameter ttp= (ICPPTemplateTypeParameter) newBinding;
|
||||||
|
updateName(newBinding.getNameCharArray());
|
||||||
|
IType newDefault= null;
|
||||||
|
try {
|
||||||
|
newDefault = ttp.getDefault();
|
||||||
|
} catch (DOMException e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
if (newDefault != null) {
|
||||||
|
final Database db = pdom.getDB();
|
||||||
|
IType mytype= getDefault();
|
||||||
|
PDOMNode typeNode = getLinkageImpl().addType(this, newDefault);
|
||||||
|
if (typeNode != null) {
|
||||||
|
db.putInt(record + DEFAULT_TYPE, typeNode.getRecord());
|
||||||
|
if (mytype != null)
|
||||||
|
linkage.deleteType(mytype, record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void forceDelete(PDOMLinkage linkage) throws CoreException {
|
||||||
|
getDBName().delete();
|
||||||
|
IType type= getDefault();
|
||||||
|
if (type instanceof PDOMNode) {
|
||||||
|
((PDOMNode) type).delete(linkage);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2008 Wind River Systems, Inc. and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Markus Schorn - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTemplateParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
||||||
|
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.PDOMLinkage;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
|
import org.eclipse.core.runtime.Assert;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collects methods to store an argument list in the database
|
||||||
|
*/
|
||||||
|
public class PDOMTemplateParameterArray {
|
||||||
|
/**
|
||||||
|
* Stores the given template arguments in the database.
|
||||||
|
* @return the record by which the arguments can be referenced.
|
||||||
|
*/
|
||||||
|
public static int putArray(final Database db, IPDOMCPPTemplateParameter[] params) throws CoreException {
|
||||||
|
final short len= (short) Math.min(params.length, (Database.MAX_MALLOC_SIZE-2)/8);
|
||||||
|
final int block= db.malloc(2+8*len);
|
||||||
|
int p= block;
|
||||||
|
|
||||||
|
db.putShort(p, len); p+=2;
|
||||||
|
for (int i=0; i<len; i++, p+=4) {
|
||||||
|
final IPDOMCPPTemplateParameter elem= params[i];
|
||||||
|
db.putInt(p, elem == null ? 0 : elem.getRecord());
|
||||||
|
}
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restores an array of template arguments from the database.
|
||||||
|
*/
|
||||||
|
public static IPDOMCPPTemplateParameter[] getArray(PDOMNode parent, int rec) throws CoreException {
|
||||||
|
final PDOMLinkage linkage= parent.getLinkage();
|
||||||
|
final Database db= linkage.getPDOM().getDB();
|
||||||
|
final short len= db.getShort(rec);
|
||||||
|
|
||||||
|
Assert.isTrue(len >= 0 && len <= (Database.MAX_MALLOC_SIZE-2)/8);
|
||||||
|
if (len == 0) {
|
||||||
|
return IPDOMCPPTemplateParameter.EMPTY_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
rec+=2;
|
||||||
|
IPDOMCPPTemplateParameter[] result= new IPDOMCPPTemplateParameter[len];
|
||||||
|
for (int i=0; i<len; i++) {
|
||||||
|
final int nodeRec= db.getInt(rec); rec+=4;
|
||||||
|
result[i]= nodeRec == 0 ? null : (IPDOMCPPTemplateParameter) linkage.getNode(nodeRec);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates template parameters in the pdom
|
||||||
|
*/
|
||||||
|
public static IPDOMCPPTemplateParameter[] createPDOMTemplateParameters(PDOM pdom, PDOMNode parent, ICPPTemplateParameter[] origParams) throws CoreException, DOMException {
|
||||||
|
IPDOMCPPTemplateParameter[] params= new IPDOMCPPTemplateParameter[origParams.length];
|
||||||
|
for (int i = 0; i < origParams.length; i++) {
|
||||||
|
params[i]= createPDOMTemplateParameter(pdom, parent, origParams[i]);
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a template parameter in the pdom
|
||||||
|
*/
|
||||||
|
public static IPDOMCPPTemplateParameter createPDOMTemplateParameter(PDOM pdom, PDOMNode parent, ICPPTemplateParameter origParam) throws CoreException, DOMException {
|
||||||
|
IPDOMCPPTemplateParameter param= null;
|
||||||
|
if (origParam instanceof ICPPTemplateNonTypeParameter) {
|
||||||
|
param= new PDOMCPPTemplateNonTypeParameter(pdom, parent, (ICPPTemplateNonTypeParameter) origParam);
|
||||||
|
} else if (origParam instanceof ICPPTemplateTypeParameter) {
|
||||||
|
param= new PDOMCPPTemplateTypeParameter(pdom, parent, (ICPPTemplateTypeParameter) origParam);
|
||||||
|
} else if (origParam instanceof ICPPTemplateTemplateParameter) {
|
||||||
|
param= new PDOMCPPTemplateTemplateParameter(pdom, parent, (ICPPTemplateTemplateParameter) origParam);
|
||||||
|
}
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue