1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-13 12:05:21 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2013-07-21 19:30:00 -07:00
parent 2050fe2bfb
commit 9827378be6
16 changed files with 156 additions and 157 deletions

View file

@ -19,10 +19,10 @@
package org.eclipse.cdt.core.parser.tests.ast2; package org.eclipse.cdt.core.parser.tests.ast2;
import static org.eclipse.cdt.core.parser.ParserLanguage.CPP; import static org.eclipse.cdt.core.parser.ParserLanguage.CPP;
import static org.eclipse.cdt.core.parser.tests.VisibilityAsserts.assertVisibility;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF; import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getNestedType; import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getNestedType;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getUltimateType; import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getUltimateType;
import static org.eclipse.cdt.core.parser.tests.VisibilityAsserts.assertVisibility;
import java.io.IOException; import java.io.IOException;
@ -126,7 +126,7 @@ public class AST2TemplateTests extends AST2TestBase {
private IASTTranslationUnit parseAndCheckBindings(final String code) throws Exception { private IASTTranslationUnit parseAndCheckBindings(final String code) throws Exception {
return parseAndCheckBindings(code, CPP); return parseAndCheckBindings(code, CPP);
} }
protected IASTTranslationUnit parseAndCheckImplicitNameBindings() throws Exception { protected IASTTranslationUnit parseAndCheckImplicitNameBindings() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), CPP, false, true, false); IASTTranslationUnit tu = parse(getAboveComment(), CPP, false, true, false);
NameCollector col = new NameCollector(true /* visit implicit names */); NameCollector col = new NameCollector(true /* visit implicit names */);
@ -1978,7 +1978,7 @@ public class AST2TemplateTests extends AST2TestBase {
ITypedef myType = (ITypedef) col.getName(31).resolveBinding(); ITypedef myType = (ITypedef) col.getName(31).resolveBinding();
ICPPClassType A = (ICPPClassType) myType.getType(); ICPPClassType A = (ICPPClassType) myType.getType();
ICPPClassTemplatePartialSpecialization Aspec = ICPPClassTemplatePartialSpecialization Aspec =
(ICPPClassTemplatePartialSpecialization) col.getName(10).resolveBinding(); (ICPPClassTemplatePartialSpecialization) col.getName(10).resolveBinding();
assertTrue(A instanceof ICPPTemplateInstance); assertTrue(A instanceof ICPPTemplateInstance);
@ -3235,7 +3235,7 @@ public class AST2TemplateTests extends AST2TestBase {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP);
ba.assertNonProblem("foo(s", 3); ba.assertNonProblem("foo(s", 3);
} }
// template<typename U> // template<typename U>
// struct result : U { // struct result : U {
// typedef typename result::result_type type; // typedef typename result::result_type type;
@ -3251,12 +3251,12 @@ public class AST2TemplateTests extends AST2TestBase {
ITypedef waldo = bh.assertNonProblem("waldo"); ITypedef waldo = bh.assertNonProblem("waldo");
assertSameType(waldo.getType(), CommonTypes.int_); assertSameType(waldo.getType(), CommonTypes.int_);
} }
// template <typename T> // template <typename T>
// struct A { // struct A {
// template <typename U> // template <typename U>
// struct result; // struct result;
// //
// template <typename V> // template <typename V>
// struct result<V*> : T { // struct result<V*> : T {
// typedef typename result::result_type type; // typedef typename result::result_type type;
@ -3277,8 +3277,8 @@ public class AST2TemplateTests extends AST2TestBase {
// template <typename T> // template <typename T>
// struct A { // struct A {
// template <typename U> // template <typename U>
// struct result; // struct result;
// //
// template <typename V> // template <typename V>
// struct result<V*> : T { // struct result<V*> : T {
// typedef typename result::result_type type; // typedef typename result::result_type type;
@ -3295,7 +3295,7 @@ public class AST2TemplateTests extends AST2TestBase {
ITypedef waldo = bh.assertNonProblem("waldo"); ITypedef waldo = bh.assertNonProblem("waldo");
assertSameType(waldo.getType(), CommonTypes.int_); assertSameType(waldo.getType(), CommonTypes.int_);
} }
// template <class T> // template <class T>
// class A { // class A {
// public: // public:
@ -4507,7 +4507,7 @@ public class AST2TemplateTests extends AST2TestBase {
public void testFunctionTemplateOrdering_388805() throws Exception { public void testFunctionTemplateOrdering_388805() throws Exception {
parseAndCheckBindings(); parseAndCheckBindings();
} }
// template <typename T> // template <typename T>
// struct identity { // struct identity {
// typedef T type; // typedef T type;
@ -4527,8 +4527,8 @@ public class AST2TemplateTests extends AST2TestBase {
} }
// template <typename T> // template <typename T>
// struct identity { // struct identity {
// typedef T type; // typedef T type;
// }; // };
// //
// template <typename> struct W; // template <typename> struct W;
@ -4554,7 +4554,7 @@ public class AST2TemplateTests extends AST2TestBase {
public void testFunctionTemplateOrdering_409094b() throws Exception { public void testFunctionTemplateOrdering_409094b() throws Exception {
parseAndCheckBindings(); parseAndCheckBindings();
} }
// template<typename T> class CT {}; // template<typename T> class CT {};
// template<int I> class CTI {}; // template<int I> class CTI {};
// //
@ -6216,9 +6216,9 @@ public class AST2TemplateTests extends AST2TestBase {
// template <typename T> // template <typename T>
// struct B { // struct B {
// struct base : id<id<T>> {}; // struct base : id<id<T>> {};
// //
// typedef typename base::type base2; // typedef typename base::type base2;
// //
// struct result : base2 {}; // struct result : base2 {};
// }; // };
// //
@ -6410,7 +6410,7 @@ public class AST2TemplateTests extends AST2TestBase {
public void testPointerToMemberOfTemplateClass_402861() throws Exception { public void testPointerToMemberOfTemplateClass_402861() throws Exception {
parseAndCheckBindings(); parseAndCheckBindings();
} }
// struct N { // struct N {
// int node; // int node;
// }; // };
@ -6425,7 +6425,7 @@ public class AST2TemplateTests extends AST2TestBase {
public void testDependentTemplateParameterInNestedTemplate_407497() throws Exception { public void testDependentTemplateParameterInNestedTemplate_407497() throws Exception {
parseAndCheckBindings(); parseAndCheckBindings();
} }
// template <typename T> // template <typename T>
// struct enclosing { // struct enclosing {
// template <typename U = T> // template <typename U = T>
@ -7235,7 +7235,7 @@ public class AST2TemplateTests extends AST2TestBase {
assertNotNull(val); assertNotNull(val);
assertEquals(0 /* false */, val.longValue()); assertEquals(0 /* false */, val.longValue());
} }
// struct S { // struct S {
// S(int); // S(int);
// }; // };
@ -7247,7 +7247,7 @@ public class AST2TemplateTests extends AST2TestBase {
// struct meta<S> { // struct meta<S> {
// typedef void type; // typedef void type;
// }; // };
// //
// struct B { // struct B {
// template <typename T, typename = typename meta<T>::type> // template <typename T, typename = typename meta<T>::type>
// operator T() const; // operator T() const;
@ -7501,9 +7501,9 @@ public class AST2TemplateTests extends AST2TestBase {
// template <typename F> // template <typename F>
// struct W { // struct W {
// F f; // F f;
// //
// auto operator()() const -> decltype(f()) { // auto operator()() const -> decltype(f()) {
// return f(); // return f();
// } // }
// }; // };
// //
@ -7513,7 +7513,7 @@ public class AST2TemplateTests extends AST2TestBase {
IType waldo = bh.assertNonProblem("waldo"); IType waldo = bh.assertNonProblem("waldo");
assertSameType(waldo, CommonTypes.int_); assertSameType(waldo, CommonTypes.int_);
} }
// template <typename _Tp> // template <typename _Tp>
// struct remove_reference { // struct remove_reference {
// typedef _Tp type; // typedef _Tp type;

View file

@ -13,6 +13,9 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.index.tests; package org.eclipse.cdt.internal.index.tests;
import java.util.ArrayList;
import java.util.List;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
@ -65,9 +68,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
import org.eclipse.cdt.internal.core.index.IIndexScope; import org.eclipse.cdt.internal.core.index.IIndexScope;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import java.util.ArrayList;
import java.util.List;
/** /**
* Tests for exercising resolution of template bindings against IIndex * Tests for exercising resolution of template bindings against IIndex
*/ */
@ -2322,7 +2322,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
public void testSpecializationRedefinition_409444() throws Exception { public void testSpecializationRedefinition_409444() throws Exception {
checkBindings(); checkBindings();
} }
// struct N { // struct N {
// int node; // int node;
// }; // };
@ -2332,12 +2332,12 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
// template <int T::*> // template <int T::*>
// struct Base {}; // struct Base {};
// }; // };
// List<N>::Base<&N::node> base; // List<N>::Base<&N::node> base;
public void testDependentTemplateParameterInNestedTemplate_407497() throws Exception { public void testDependentTemplateParameterInNestedTemplate_407497() throws Exception {
checkBindings(); checkBindings();
} }
// template <typename T> // template <typename T>
// struct enclosing { // struct enclosing {
// template <typename U = T> // template <typename U = T>
@ -2345,12 +2345,12 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
// typedef U type; // typedef U type;
// }; // };
// }; // };
// typedef enclosing<int>::nested<>::type waldo; // typedef enclosing<int>::nested<>::type waldo;
public void testDependentTemplateParameterInNestedTemplate_399454() throws Exception { public void testDependentTemplateParameterInNestedTemplate_399454() throws Exception {
checkBindings(); checkBindings();
} }
// void f(int); // void f(int);
// //
// template <typename... Args> // template <typename... Args>

View file

@ -32,17 +32,16 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
*/ */
public class CPPClassTemplateSpecialization extends CPPClassSpecialization public class CPPClassTemplateSpecialization extends CPPClassSpecialization
implements ICPPClassTemplate, ICPPInternalClassTemplate { implements ICPPClassTemplate, ICPPInternalClassTemplate {
private ObjectMap instances;
private ObjectMap instances = null;
private ICPPDeferredClassInstance fDeferredInstance; private ICPPDeferredClassInstance fDeferredInstance;
private ICPPClassTemplatePartialSpecialization[] fPartialSpecs; private ICPPClassTemplatePartialSpecialization[] fPartialSpecs;
private ICPPTemplateParameter[] fTemplateParameters; private ICPPTemplateParameter[] fTemplateParameters;
public CPPClassTemplateSpecialization(ICPPClassTemplate orig, ICPPClassSpecialization owner, public CPPClassTemplateSpecialization(ICPPClassTemplate orig, ICPPClassSpecialization owner,
ICPPTemplateParameterMap argumentMap) { ICPPTemplateParameterMap argumentMap) {
super(orig, owner, argumentMap); super(orig, owner, argumentMap);
} }
public void setTemplateParameters(ICPPTemplateParameter[] templateParameters) { public void setTemplateParameters(ICPPTemplateParameter[] templateParameters) {
fTemplateParameters = templateParameters; fTemplateParameters = templateParameters;
} }
@ -105,12 +104,12 @@ public class CPPClassTemplateSpecialization extends CPPClassSpecialization
public String toString() { public String toString() {
return getName(); return getName();
} }
@Override @Override
public IBinding resolveTemplateParameter(ICPPTemplateParameter param) { public IBinding resolveTemplateParameter(ICPPTemplateParameter param) {
return param; return param;
} }
@Override @Override
public final ICPPDeferredClassInstance asDeferredInstance() { public final ICPPDeferredClassInstance asDeferredInstance() {
if (fDeferredInstance == null) { if (fDeferredInstance == null) {
@ -118,17 +117,17 @@ public class CPPClassTemplateSpecialization extends CPPClassSpecialization
} }
return fDeferredInstance; return fDeferredInstance;
} }
@Override @Override
public ICPPTemplateArgument getDefaultArgFromIndex(int paramPos) throws DOMException { public ICPPTemplateArgument getDefaultArgFromIndex(int paramPos) throws DOMException {
return null; return null;
} }
@Override @Override
public ICPPClassSpecialization getOwner() { public ICPPClassSpecialization getOwner() {
return (ICPPClassSpecialization) super.getOwner(); return (ICPPClassSpecialization) super.getOwner();
} }
@Override @Override
public ICPPClassTemplate getSpecializedBinding() { public ICPPClassTemplate getSpecializedBinding() {
return (ICPPClassTemplate) super.getSpecializedBinding(); return (ICPPClassTemplate) super.getSpecializedBinding();

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * IBM Corporation - 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;
@ -20,9 +20,9 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
/** /**
* Specialization of a constructor template * Specialization of a constructor template
*/ */
public class CPPConstructorTemplateSpecialization extends CPPMethodTemplateSpecialization public class CPPConstructorTemplateSpecialization extends CPPMethodTemplateSpecialization
implements ICPPConstructor { implements ICPPConstructor {
public CPPConstructorTemplateSpecialization(ICPPConstructor original, public CPPConstructorTemplateSpecialization(ICPPConstructor original,
ICPPClassSpecialization owner, ICPPTemplateParameterMap tpmap, ICPPFunctionType type, IType[] exceptionSpecs) { ICPPClassSpecialization owner, ICPPTemplateParameterMap tpmap, ICPPFunctionType type, IType[] exceptionSpecs) {
super(original, owner, tpmap, type, exceptionSpecs); super(original, owner, tpmap, type, exceptionSpecs);

View file

@ -25,16 +25,15 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
/** /**
* The specialization of a method template in the context of a class specialization. * The specialization of a method template in the context of a class specialization.
*/ */
public class CPPMethodTemplateSpecialization extends CPPFunctionTemplateSpecialization public class CPPMethodTemplateSpecialization extends CPPFunctionTemplateSpecialization
implements ICPPMethod { implements ICPPMethod {
private ICPPTemplateParameter[] fTemplateParameters; private ICPPTemplateParameter[] fTemplateParameters;
public CPPMethodTemplateSpecialization(ICPPMethod specialized, ICPPClassSpecialization owner, public CPPMethodTemplateSpecialization(ICPPMethod specialized, ICPPClassSpecialization owner,
ICPPTemplateParameterMap ctmap, ICPPFunctionType type, IType[] exceptionSpecs) { ICPPTemplateParameterMap ctmap, ICPPFunctionType type, IType[] exceptionSpecs) {
super(specialized, owner, ctmap, type, exceptionSpecs); super(specialized, owner, ctmap, type, exceptionSpecs);
} }
public void setTemplateParameters(ICPPTemplateParameter[] templateParameters) { public void setTemplateParameters(ICPPTemplateParameter[] templateParameters) {
fTemplateParameters = templateParameters; fTemplateParameters = templateParameters;
} }
@ -59,7 +58,7 @@ public class CPPMethodTemplateSpecialization extends CPPFunctionTemplateSpeciali
return ((ICPPMethod) m).getVisibility(); return ((ICPPMethod) m).getVisibility();
return 0; return 0;
} }
@Override @Override
public ICPPClassType getClassOwner() { public ICPPClassType getClassOwner() {
return getOwner(); return getOwner();
@ -70,7 +69,7 @@ public class CPPMethodTemplateSpecialization extends CPPFunctionTemplateSpeciali
char[] name = getNameCharArray(); char[] name = getNameCharArray();
if (name.length > 1 && name[0] == '~') if (name.length > 1 && name[0] == '~')
return true; return true;
return false; return false;
} }
@ -81,7 +80,7 @@ public class CPPMethodTemplateSpecialization extends CPPFunctionTemplateSpeciali
return ((ICPPMethod) m).isImplicit(); return ((ICPPMethod) m).isImplicit();
return false; return false;
} }
@Override @Override
public boolean isExplicit() { public boolean isExplicit() {
IBinding m = getSpecializedBinding(); IBinding m = getSpecializedBinding();
@ -107,7 +106,7 @@ public class CPPMethodTemplateSpecialization extends CPPFunctionTemplateSpeciali
public boolean isFinal() { public boolean isFinal() {
return false; return false;
} }
@Override @Override
public ICPPClassSpecialization getOwner() { public ICPPClassSpecialization getOwner() {
return (ICPPClassSpecialization) super.getOwner(); return (ICPPClassSpecialization) super.getOwner();

View file

@ -22,21 +22,20 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
* A specialization of a non-type template parameter. This is needed when a nested template * A specialization of a non-type template parameter. This is needed when a nested template
* has a non-type template parameter whose type or default value is dependent on a template * has a non-type template parameter whose type or default value is dependent on a template
* parameter of an enclosing template. * parameter of an enclosing template.
* *
* This class can represent a specialization of either an AST or a PDOM template parameter. * This class can represent a specialization of either an AST or a PDOM template parameter.
*/ */
public class CPPTemplateNonTypeParameterSpecialization extends CPPTemplateParameterSpecialization public class CPPTemplateNonTypeParameterSpecialization extends CPPTemplateParameterSpecialization
implements ICPPTemplateNonTypeParameter { implements ICPPTemplateNonTypeParameter {
private final IType fType; private final IType fType;
public CPPTemplateNonTypeParameterSpecialization(ICPPSpecialization owner, ICPPScope scope, public CPPTemplateNonTypeParameterSpecialization(ICPPSpecialization owner, ICPPScope scope,
ICPPTemplateNonTypeParameter specialized, ICPPTemplateArgument defaultValue, IType type) { ICPPTemplateNonTypeParameter specialized, ICPPTemplateArgument defaultValue, IType type) {
super(owner, scope, specialized, defaultValue); super(owner, scope, specialized, defaultValue);
this.fType = type; this.fType = type;
} }
@Override @Override
public ICPPTemplateNonTypeParameter getSpecializedBinding() { public ICPPTemplateNonTypeParameter getSpecializedBinding() {
return (ICPPTemplateNonTypeParameter) super.getSpecializedBinding(); return (ICPPTemplateNonTypeParameter) super.getSpecializedBinding();
@ -56,22 +55,22 @@ public class CPPTemplateNonTypeParameterSpecialization extends CPPTemplateParame
public boolean isStatic() { public boolean isStatic() {
return false; return false;
} }
@Override @Override
public boolean isExtern() { public boolean isExtern() {
return false; return false;
} }
@Override @Override
public boolean isRegister() { public boolean isRegister() {
return false; return false;
} }
@Override @Override
public boolean isAuto() { public boolean isAuto() {
return false; return false;
} }
@Override @Override
public IType getType() { public IType getType() {
return fType; return fType;

View file

@ -24,20 +24,19 @@ import org.eclipse.core.runtime.PlatformObject;
/** /**
* A specialization of a template parameter. * A specialization of a template parameter.
* *
* This class provides common implementation for CPPTemplateNonTypeParameterSpecialization, * This class provides common implementation for CPPTemplateNonTypeParameterSpecialization,
* CPPTemplateTypeParameterSpecialization, and CPPTemplateTemplateParameterSpecialization. * CPPTemplateTypeParameterSpecialization, and CPPTemplateTemplateParameterSpecialization.
*/ */
public abstract class CPPTemplateParameterSpecialization extends PlatformObject public abstract class CPPTemplateParameterSpecialization extends PlatformObject
implements ICPPTemplateParameter, ICPPSpecialization { implements ICPPTemplateParameter, ICPPSpecialization {
private final ICPPSpecialization fOwner; private final ICPPSpecialization fOwner;
private final ICPPScope fScope; private final ICPPScope fScope;
private final ICPPTemplateParameter fSpecialized; private final ICPPTemplateParameter fSpecialized;
private final ICPPTemplateParameterMap fTemplateParameterMap; private final ICPPTemplateParameterMap fTemplateParameterMap;
private final ICPPTemplateArgument fDefaultValue; private final ICPPTemplateArgument fDefaultValue;
public CPPTemplateParameterSpecialization(ICPPSpecialization owner, ICPPScope scope, ICPPTemplateParameter specialized, public CPPTemplateParameterSpecialization(ICPPSpecialization owner, ICPPScope scope, ICPPTemplateParameter specialized,
ICPPTemplateArgument defaultValue) { ICPPTemplateArgument defaultValue) {
fOwner = owner; fOwner = owner;
fScope = scope; fScope = scope;
@ -126,5 +125,4 @@ public abstract class CPPTemplateParameterSpecialization extends PlatformObject
public boolean isParameterPack() { public boolean isParameterPack() {
return fSpecialized.isParameterPack(); return fSpecialized.isParameterPack();
} }
} }

View file

@ -33,7 +33,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTemplateParameter;
* A specialization of a template template parameter. This is needed when a nested template * A specialization of a template template parameter. This is needed when a nested template
* has a template template parameter whose default value is dependent on a template * has a template template parameter whose default value is dependent on a template
* parameter of an enclosing template. * parameter of an enclosing template.
* *
* This class can represent a specialization of either an AST or a PDOM template parameter. * This class can represent a specialization of either an AST or a PDOM template parameter.
*/ */
public class CPPTemplateTemplateParameterSpecialization extends CPPTemplateParameterSpecialization public class CPPTemplateTemplateParameterSpecialization extends CPPTemplateParameterSpecialization
@ -43,7 +43,7 @@ public class CPPTemplateTemplateParameterSpecialization extends CPPTemplateParam
ICPPTemplateTemplateParameter specialized, ICPPTemplateArgument defaultValue) { ICPPTemplateTemplateParameter specialized, ICPPTemplateArgument defaultValue) {
super(owner, scope, specialized, defaultValue); super(owner, scope, specialized, defaultValue);
} }
@Override @Override
public ICPPTemplateTemplateParameter getSpecializedBinding() { public ICPPTemplateTemplateParameter getSpecializedBinding() {
return (ICPPTemplateTemplateParameter) super.getSpecializedBinding(); return (ICPPTemplateTemplateParameter) super.getSpecializedBinding();
@ -63,47 +63,47 @@ public class CPPTemplateTemplateParameterSpecialization extends CPPTemplateParam
public ICPPBase[] getBases() { public ICPPBase[] getBases() {
return ICPPBase.EMPTY_BASE_ARRAY; return ICPPBase.EMPTY_BASE_ARRAY;
} }
@Override @Override
public IField[] getFields() { public IField[] getFields() {
return IField.EMPTY_FIELD_ARRAY; return IField.EMPTY_FIELD_ARRAY;
} }
@Override @Override
public IField findField(String name) { public IField findField(String name) {
return null; return null;
} }
@Override @Override
public ICPPField[] getDeclaredFields() { public ICPPField[] getDeclaredFields() {
return ICPPField.EMPTY_CPPFIELD_ARRAY; return ICPPField.EMPTY_CPPFIELD_ARRAY;
} }
@Override @Override
public ICPPMethod[] getMethods() { public ICPPMethod[] getMethods() {
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY; return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
} }
@Override @Override
public ICPPMethod[] getAllDeclaredMethods() { public ICPPMethod[] getAllDeclaredMethods() {
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY; return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
} }
@Override @Override
public ICPPMethod[] getDeclaredMethods() { public ICPPMethod[] getDeclaredMethods() {
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY; return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
} }
@Override @Override
public ICPPConstructor[] getConstructors() { public ICPPConstructor[] getConstructors() {
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY; return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
} }
@Override @Override
public IBinding[] getFriends() { public IBinding[] getFriends() {
return IBinding.EMPTY_BINDING_ARRAY; return IBinding.EMPTY_BINDING_ARRAY;
} }
@Override @Override
public ICPPClassType[] getNestedClasses() { public ICPPClassType[] getNestedClasses() {
return ICPPClassType.EMPTY_CLASS_ARRAY; return ICPPClassType.EMPTY_CLASS_ARRAY;

View file

@ -23,12 +23,12 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
* A specialization of a type template parameter. This is needed when a nested template * A specialization of a type template parameter. This is needed when a nested template
* has a type template parameter whose default value is dependent on a template * has a type template parameter whose default value is dependent on a template
* parameter of an enclosing template. * parameter of an enclosing template.
* *
* This class can represent a specialization of either an AST or a PDOM template parameter. * This class can represent a specialization of either an AST or a PDOM template parameter.
*/ */
public class CPPTemplateTypeParameterSpecialization extends CPPTemplateParameterSpecialization public class CPPTemplateTypeParameterSpecialization extends CPPTemplateParameterSpecialization
implements ICPPTemplateTypeParameter { implements ICPPTemplateTypeParameter {
public CPPTemplateTypeParameterSpecialization(ICPPSpecialization owner, ICPPScope scope, public CPPTemplateTypeParameterSpecialization(ICPPSpecialization owner, ICPPScope scope,
ICPPTemplateTypeParameter specialized, ICPPTemplateArgument defaultValue) { ICPPTemplateTypeParameter specialized, ICPPTemplateArgument defaultValue) {
super(owner, scope, specialized, defaultValue); super(owner, scope, specialized, defaultValue);
@ -52,7 +52,7 @@ public class CPPTemplateTypeParameterSpecialization extends CPPTemplateParameter
return type.isSameType(this); return type.isSameType(this);
if (!(type instanceof ICPPTemplateTypeParameter)) if (!(type instanceof ICPPTemplateTypeParameter))
return false; return false;
return getParameterID() == ((ICPPTemplateParameter) type).getParameterID(); return getParameterID() == ((ICPPTemplateParameter) type).getParameterID();
} }

View file

@ -26,6 +26,8 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPFunctionParamet
* Assists in evaluating expressions. * Assists in evaluating expressions.
*/ */
public interface ICPPEvaluation extends ISerializableEvaluation { public interface ICPPEvaluation extends ISerializableEvaluation {
public static final ICPPEvaluation[] EMPTY_ARRAY = {};
boolean isInitializerList(); boolean isInitializerList();
boolean isFunctionSet(); boolean isFunctionSet();

View file

@ -172,7 +172,7 @@ public class CPPTemplates {
// The three constants below are used as special return values for the various overloads // The three constants below are used as special return values for the various overloads
// of CPPTemplates.determinePackSize() and for ICPPEvaluation.determinePackSize(), which // of CPPTemplates.determinePackSize() and for ICPPEvaluation.determinePackSize(), which
// search a type, template argument, or value for a usage of a template parameter pack // search a type, template argument, or value for a usage of a template parameter pack
// and return the number of arguments bound to that parameter pack in an // and return the number of arguments bound to that parameter pack in an
// ICPPTemplateParameterMap. // ICPPTemplateParameterMap.
// Used to indicate that the parameter pack is not bound to any arguments in the // Used to indicate that the parameter pack is not bound to any arguments in the
@ -820,9 +820,9 @@ public class CPPTemplates {
} else if (decl instanceof ICPPClassTemplate) { } else if (decl instanceof ICPPClassTemplate) {
ICPPClassTemplate template = (ICPPClassTemplate) decl; ICPPClassTemplate template = (ICPPClassTemplate) decl;
CPPClassTemplateSpecialization classTemplateSpec = new CPPClassTemplateSpecialization(template, owner, tpMap); CPPClassTemplateSpecialization classTemplateSpec = new CPPClassTemplateSpecialization(template, owner, tpMap);
classTemplateSpec.setTemplateParameters(CPPTemplates.specializeTemplateParameters(classTemplateSpec, classTemplateSpec.setTemplateParameters(CPPTemplates.specializeTemplateParameters(classTemplateSpec,
(ICPPScope) classTemplateSpec.getScope(), template.getTemplateParameters(), owner, point)); (ICPPScope) classTemplateSpec.getScope(), template.getTemplateParameters(), owner, point));
spec = classTemplateSpec; spec = classTemplateSpec;
} else if (decl instanceof ICPPClassType) { } else if (decl instanceof ICPPClassType) {
IBinding oldOwner = decl.getOwner(); IBinding oldOwner = decl.getOwner();
if (oldOwner instanceof IType && owner.getSpecializedBinding().isSameType((IType) oldOwner)) { if (oldOwner instanceof IType && owner.getSpecializedBinding().isSameType((IType) oldOwner)) {
@ -841,7 +841,7 @@ public class CPPTemplates {
ICPPClassSpecialization within = getSpecializationContext(owner); ICPPClassSpecialization within = getSpecializationContext(owner);
ICPPFunctionType type= (ICPPFunctionType) instantiateType(func.getType(), tpMap, -1, within, point); ICPPFunctionType type= (ICPPFunctionType) instantiateType(func.getType(), tpMap, -1, within, point);
IType[] exceptionSpecs= instantiateTypes(func.getExceptionSpecification(), tpMap, -1, within, point); IType[] exceptionSpecs= instantiateTypes(func.getExceptionSpecification(), tpMap, -1, within, point);
if (decl instanceof ICPPFunctionTemplate) { if (decl instanceof ICPPFunctionTemplate) {
if (decl instanceof ICPPMethod) { if (decl instanceof ICPPMethod) {
CPPMethodTemplateSpecialization methodSpec; CPPMethodTemplateSpecialization methodSpec;
@ -849,8 +849,8 @@ public class CPPTemplates {
methodSpec = new CPPConstructorTemplateSpecialization((ICPPConstructor) decl, owner, tpMap, type, exceptionSpecs); methodSpec = new CPPConstructorTemplateSpecialization((ICPPConstructor) decl, owner, tpMap, type, exceptionSpecs);
} else { } else {
methodSpec = new CPPMethodTemplateSpecialization((ICPPMethod) decl, owner, tpMap, type, exceptionSpecs); methodSpec = new CPPMethodTemplateSpecialization((ICPPMethod) decl, owner, tpMap, type, exceptionSpecs);
} }
methodSpec.setTemplateParameters(CPPTemplates.specializeTemplateParameters(methodSpec, methodSpec.setTemplateParameters(CPPTemplates.specializeTemplateParameters(methodSpec,
(ICPPScope) methodSpec.getScope(), ((ICPPFunctionTemplate) decl).getTemplateParameters(), owner, point)); (ICPPScope) methodSpec.getScope(), ((ICPPFunctionTemplate) decl).getTemplateParameters(), owner, point));
spec = methodSpec; spec = methodSpec;
} else { } else {
@ -1354,7 +1354,7 @@ public class CPPTemplates {
* Specialize a template parameter of a nested template by subtituting values for the template * Specialize a template parameter of a nested template by subtituting values for the template
* parameters of enclosing templates into the template parameter's default value and, in the * parameters of enclosing templates into the template parameter's default value and, in the
* case of a non-type template parameter, type. * case of a non-type template parameter, type.
* *
* @param owner the specialization of the nested template. This will be the owner of the * @param owner the specialization of the nested template. This will be the owner of the
* specialized template parameter. * specialized template parameter.
* @param scope the scope of the nested template specialization * @param scope the scope of the nested template specialization
@ -1374,38 +1374,38 @@ public class CPPTemplates {
IType type = instantiateType(spec.getType(), tpMap, 0, within, point); IType type = instantiateType(spec.getType(), tpMap, 0, within, point);
return new CPPTemplateNonTypeParameterSpecialization(owner, scope, spec, defaultValue, type); return new CPPTemplateNonTypeParameterSpecialization(owner, scope, spec, defaultValue, type);
} else if (specialized instanceof ICPPTemplateTypeParameter) { } else if (specialized instanceof ICPPTemplateTypeParameter) {
return new CPPTemplateTypeParameterSpecialization(owner, scope, (ICPPTemplateTypeParameter) specialized, return new CPPTemplateTypeParameterSpecialization(owner, scope, (ICPPTemplateTypeParameter) specialized,
defaultValue); defaultValue);
} else if (specialized instanceof ICPPTemplateTemplateParameter) { } else if (specialized instanceof ICPPTemplateTemplateParameter) {
return new CPPTemplateTemplateParameterSpecialization(owner, scope, (ICPPTemplateTemplateParameter) specialized, return new CPPTemplateTemplateParameterSpecialization(owner, scope, (ICPPTemplateTemplateParameter) specialized,
defaultValue); defaultValue);
} }
return null; return null;
} }
/** /**
* Convenience method for specializing all template parameters in an array. * Convenience method for specializing all template parameters in an array.
* See specializeTemplateParameter(). * See specializeTemplateParameter().
*/ */
public static ICPPTemplateParameter[] specializeTemplateParameters(ICPPSpecialization owner, ICPPScope scope, public static ICPPTemplateParameter[] specializeTemplateParameters(ICPPSpecialization owner, ICPPScope scope,
ICPPTemplateParameter[] specialized, ICPPClassSpecialization within, IASTNode point) { ICPPTemplateParameter[] specialized, ICPPClassSpecialization within, IASTNode point) {
ICPPTemplateParameter[] result = new ICPPTemplateParameter[specialized.length]; ICPPTemplateParameter[] result = new ICPPTemplateParameter[specialized.length];
for (int i = 0; i < specialized.length; ++i) for (int i = 0; i < specialized.length; ++i)
result[i] = specializeTemplateParameter(owner, scope, specialized[i], within, point); result[i] = specializeTemplateParameter(owner, scope, specialized[i], within, point);
return result; return result;
} }
public static IBinding instantiateBinding(IBinding binding, ICPPTemplateParameterMap tpMap, int packOffset, public static IBinding instantiateBinding(IBinding binding, ICPPTemplateParameterMap tpMap, int packOffset,
ICPPClassSpecialization within, int maxdepth, IASTNode point) throws DOMException { ICPPClassSpecialization within, int maxdepth, IASTNode point) throws DOMException {
if (binding instanceof ICPPClassTemplate) { if (binding instanceof ICPPClassTemplate) {
binding = createDeferredInstance((ICPPClassTemplate) binding); binding = createDeferredInstance((ICPPClassTemplate) binding);
} }
if (binding instanceof ICPPUnknownBinding) { if (binding instanceof ICPPUnknownBinding) {
return resolveUnknown((ICPPUnknownBinding) binding, tpMap, packOffset, within, point); return resolveUnknown((ICPPUnknownBinding) binding, tpMap, packOffset, within, point);
} else if (binding instanceof IEnumerator } else if (binding instanceof IEnumerator
|| binding instanceof ICPPMethod || binding instanceof ICPPMethod
|| binding instanceof ICPPField || binding instanceof ICPPField
|| binding instanceof ICPPEnumeration || binding instanceof ICPPEnumeration
|| binding instanceof ICPPClassType) { || binding instanceof ICPPClassType) {
IBinding owner = binding.getOwner(); IBinding owner = binding.getOwner();
@ -1422,20 +1422,20 @@ public class CPPTemplates {
} }
} }
} else if (binding instanceof CPPFunctionInstance) { } else if (binding instanceof CPPFunctionInstance) {
// TODO(nathanridge): // TODO(nathanridge):
// Maybe we should introduce a CPPDeferredFunctionInstance and have things that can return // Maybe we should introduce a CPPDeferredFunctionInstance and have things that can return
// a dependent CPPFunctionInstance (like instantiateForAddressOfFunction) return that when // a dependent CPPFunctionInstance (like instantiateForAddressOfFunction) return that when
// appropriate? // appropriate?
CPPFunctionInstance origInstance = (CPPFunctionInstance) binding; CPPFunctionInstance origInstance = (CPPFunctionInstance) binding;
ICPPTemplateArgument[] origArgs = origInstance.getTemplateArguments(); ICPPTemplateArgument[] origArgs = origInstance.getTemplateArguments();
ICPPTemplateArgument[] newArgs = instantiateArguments(origArgs, tpMap, packOffset, within, point, false); ICPPTemplateArgument[] newArgs = instantiateArguments(origArgs, tpMap, packOffset, within, point, false);
if (origArgs != newArgs) { if (origArgs != newArgs) {
CPPTemplateParameterMap newMap = instantiateArgumentMap(origInstance.getTemplateParameterMap(), CPPTemplateParameterMap newMap = instantiateArgumentMap(origInstance.getTemplateParameterMap(),
tpMap, packOffset, within, point); tpMap, packOffset, within, point);
IType newType = instantiateType(origInstance.getType(), tpMap, packOffset, within, point); IType newType = instantiateType(origInstance.getType(), tpMap, packOffset, within, point);
IType[] newExceptionSpecs = instantiateTypes(origInstance.getExceptionSpecification(), IType[] newExceptionSpecs = instantiateTypes(origInstance.getExceptionSpecification(),
tpMap, packOffset, within, point); tpMap, packOffset, within, point);
return new CPPFunctionInstance((ICPPFunction) origInstance.getTemplateDefinition(), origInstance.getOwner(), return new CPPFunctionInstance((ICPPFunction) origInstance.getTemplateDefinition(), origInstance.getOwner(),
newMap, newArgs, (ICPPFunctionType) newType, newExceptionSpecs); newMap, newArgs, (ICPPFunctionType) newType, newExceptionSpecs);
} }
} }
@ -2341,7 +2341,7 @@ public class CPPTemplates {
return arg != null && isValidType(arg.isTypeValue() ? arg.getTypeValue() : arg.getTypeOfNonTypeValue()); return arg != null && isValidType(arg.isTypeValue() ? arg.getTypeValue() : arg.getTypeOfNonTypeValue());
} }
static ICPPTemplateArgument matchTemplateParameterAndArgument(ICPPTemplateDefinition template, static ICPPTemplateArgument matchTemplateParameterAndArgument(ICPPTemplateDefinition template,
ICPPTemplateParameter param, ICPPTemplateArgument arg, CPPTemplateParameterMap map, IASTNode point) { ICPPTemplateParameter param, ICPPTemplateArgument arg, CPPTemplateParameterMap map, IASTNode point) {
if (arg == null || !isValidType(arg.getTypeValue())) { if (arg == null || !isValidType(arg.getTypeValue())) {
return null; return null;
@ -2461,12 +2461,12 @@ public class CPPTemplates {
} }
/** /**
* Converts the template argument <code>arg</code> to match the parameter type * Converts the template argument {@code arg} to match the parameter type {@code paramType}
* <code>paramType</code> or returns <code>null</code>, if this violates the rules * or returns {@code null}, if this violates the rules specified in 14.3.2 - 5.
* specified in 14.3.2 - 5. *
* @throws DOMException * @throws DOMException
*/ */
private static ICPPTemplateArgument convertNonTypeTemplateArgument(ICPPTemplateDefinition template, private static ICPPTemplateArgument convertNonTypeTemplateArgument(ICPPTemplateDefinition template,
final IType paramType, ICPPTemplateArgument arg, IASTNode point) throws DOMException { final IType paramType, ICPPTemplateArgument arg, IASTNode point) throws DOMException {
//14.1s8 function to pointer and array to pointer conversions //14.1s8 function to pointer and array to pointer conversions
IType a= arg.getTypeOfNonTypeValue(); IType a= arg.getTypeOfNonTypeValue();

View file

@ -39,6 +39,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
public EvalTypeId(IType type, IASTNode pointOfDefinition, ICPPEvaluation... arguments) { public EvalTypeId(IType type, IASTNode pointOfDefinition, ICPPEvaluation... arguments) {
this(type, findEnclosingTemplate(pointOfDefinition), arguments); this(type, findEnclosingTemplate(pointOfDefinition), arguments);
} }
public EvalTypeId(IType type, IBinding templateDefinition, ICPPEvaluation... arguments) { public EvalTypeId(IType type, IBinding templateDefinition, ICPPEvaluation... arguments) {
super(templateDefinition); super(templateDefinition);
fInputType= type; fInputType= type;
@ -83,7 +84,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
return Value.create(this); return Value.create(this);
if (fArguments == null) if (fArguments == null)
return Value.UNKNOWN; return Value.UNKNOWN;
if (isTypeDependent()) if (isTypeDependent())
return Value.create(this); return Value.create(this);
if (fOutputType instanceof ICPPClassType) { if (fOutputType instanceof ICPPClassType) {
@ -136,7 +137,8 @@ public class EvalTypeId extends CPPDependentEvaluation {
marshalTemplateDefinition(buffer); marshalTemplateDefinition(buffer);
} }
public static ISerializableEvaluation unmarshal(short firstBytes, ITypeMarshalBuffer buffer) throws CoreException { public static ISerializableEvaluation unmarshal(short firstBytes, ITypeMarshalBuffer buffer)
throws CoreException {
IType type= buffer.unmarshalType(); IType type= buffer.unmarshalType();
ICPPEvaluation[] args= null; ICPPEvaluation[] args= null;
if ((firstBytes & ITypeMarshalBuffer.FLAG1) != 0) { if ((firstBytes & ITypeMarshalBuffer.FLAG1) != 0) {
@ -146,7 +148,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
args[i]= (ICPPEvaluation) buffer.unmarshalEvaluation(); args[i]= (ICPPEvaluation) buffer.unmarshalEvaluation();
} }
} else { } else {
args = new ICPPEvaluation[0]; // arguments must not be null args = ICPPEvaluation.EMPTY_ARRAY; // arguments must not be null
} }
IBinding templateDefinition= buffer.unmarshalBinding(); IBinding templateDefinition= buffer.unmarshalBinding();
return new EvalTypeId(type, templateDefinition, args); return new EvalTypeId(type, templateDefinition, args);

View file

@ -104,7 +104,7 @@ public class PDOM extends PlatformObject implements IPDOM {
private static final int BLOCKED_WRITE_LOCK_OUTPUT_INTERVAL = 30000; private static final int BLOCKED_WRITE_LOCK_OUTPUT_INTERVAL = 30000;
private static final int LONG_WRITE_LOCK_REPORT_THRESHOLD = 1000; private static final int LONG_WRITE_LOCK_REPORT_THRESHOLD = 1000;
private static final int LONG_READ_LOCK_WAIT_REPORT_THRESHOLD = 1000; private static final int LONG_READ_LOCK_WAIT_REPORT_THRESHOLD = 1000;
static boolean sDEBUG_LOCKS= false; // initialized in the PDOMManager, because IBM needs PDOM independent of runtime plugin. static boolean sDEBUG_LOCKS= false; // Initialized in the PDOMManager, because IBM needs PDOM independent of runtime plugin.
/** /**
* Identifier for PDOM format * Identifier for PDOM format
@ -236,9 +236,11 @@ public class PDOM extends PlatformObject implements IPDOM {
* 142.0 - Changed marshalling of evaluations to allow more than 15 evaluation kinds, bug 401479. * 142.0 - Changed marshalling of evaluations to allow more than 15 evaluation kinds, bug 401479.
* 143.0 - Store implied object type in EvalFunctionSet, bug 402409. * 143.0 - Store implied object type in EvalFunctionSet, bug 402409.
* 144.0 - Add support for storing function sets with zero functions in EvalFunctionSet, bug 402498. * 144.0 - Add support for storing function sets with zero functions in EvalFunctionSet, bug 402498.
* 145.0 - Changed marshalling of CPPBasicType to store the associated numerical value, bug 407808. * 145.0 - Changed marshalling of CPPBasicType to store the associated numerical value, bug 407808.
* 146.0 - Added visibility support on class type level, bug 402878. * 146.0 - Added visibility support on class type level, bug 402878.
* #147.0# - Store whether function name is qualified in EvalFunctionSet, bug 408296. <<CDT 8.2>> * #147.0# - Store whether function name is qualified in EvalFunctionSet, bug 408296. <<CDT 8.2>>
*
* CDT 8.3 development (versions not supported on the 8.2.x branch)
* 148.0 - Store specialized template parameters of class/function template specializations, bug 407497. * 148.0 - Store specialized template parameters of class/function template specializations, bug 407497.
*/ */
private static final int MIN_SUPPORTED_VERSION= version(148, 0); private static final int MIN_SUPPORTED_VERSION= version(148, 0);

View file

@ -42,18 +42,17 @@ import org.eclipse.core.runtime.CoreException;
/** /**
* Specialization of a class template. * Specialization of a class template.
*/ */
class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization
implements ICPPClassTemplate, ICPPInstanceCache { implements ICPPClassTemplate, ICPPInstanceCache {
private static final int TEMPLATE_PARAMS = PDOMCPPClassSpecialization.RECORD_SIZE; private static final int TEMPLATE_PARAMS = PDOMCPPClassSpecialization.RECORD_SIZE;
@SuppressWarnings("hiding") @SuppressWarnings("hiding")
protected static final int RECORD_SIZE = TEMPLATE_PARAMS + Database.PTR_SIZE; protected static final int RECORD_SIZE = TEMPLATE_PARAMS + Database.PTR_SIZE;
private volatile IPDOMCPPTemplateParameter[] fTemplateParameters; private volatile IPDOMCPPTemplateParameter[] fTemplateParameters;
public PDOMCPPClassTemplateSpecialization(PDOMCPPLinkage linkage, PDOMNode parent, ICPPClassTemplate template, PDOMBinding specialized) public PDOMCPPClassTemplateSpecialization(PDOMCPPLinkage linkage, PDOMNode parent,
throws CoreException { ICPPClassTemplate template, PDOMBinding specialized) throws CoreException {
super(linkage, parent, template, specialized); super(linkage, parent, template, specialized);
computeTemplateParameters(template); // sets fTemplateParameters computeTemplateParameters(template); // sets fTemplateParameters
final Database db = getDB(); final Database db = getDB();
@ -65,7 +64,7 @@ class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization
public PDOMCPPClassTemplateSpecialization(PDOMLinkage linkage, long bindingRecord) { public PDOMCPPClassTemplateSpecialization(PDOMLinkage linkage, long bindingRecord) {
super(linkage, bindingRecord); super(linkage, bindingRecord);
} }
@Override @Override
protected int getRecordSize() { protected int getRecordSize() {
return RECORD_SIZE; return RECORD_SIZE;
@ -75,7 +74,7 @@ class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization
public int getNodeType() { public int getNodeType() {
return IIndexCPPBindingConstants.CPP_CLASS_TEMPLATE_SPECIALIZATION; return IIndexCPPBindingConstants.CPP_CLASS_TEMPLATE_SPECIALIZATION;
} }
@Override @Override
public ICPPTemplateParameter[] getTemplateParameters() { public ICPPTemplateParameter[] getTemplateParameters() {
if (fTemplateParameters == null) { if (fTemplateParameters == null) {
@ -96,19 +95,19 @@ class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization
@Override @Override
public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) { public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) {
return PDOMInstanceCache.getCache(this).getInstance(arguments); return PDOMInstanceCache.getCache(this).getInstance(arguments);
} }
@Override @Override
public void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) { public void addInstance(ICPPTemplateArgument[] arguments, ICPPTemplateInstance instance) {
PDOMInstanceCache.getCache(this).addInstance(arguments, instance); PDOMInstanceCache.getCache(this).addInstance(arguments, instance);
} }
@Override @Override
public ICPPTemplateInstance[] getAllInstances() { public ICPPTemplateInstance[] getAllInstances() {
return PDOMInstanceCache.getCache(this).getAllInstances(); return PDOMInstanceCache.getCache(this).getAllInstances();
} }
@Override @Override
public boolean isSameType(IType type) { public boolean isSameType(IType type) {
if( type == this ) if( type == this )
@ -125,15 +124,15 @@ class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization
} }
// require a class template specialization // require a class template specialization
if (type instanceof ICPPClassSpecialization == false || if (type instanceof ICPPClassSpecialization == false ||
type instanceof ICPPTemplateDefinition == false || type instanceof IProblemBinding) type instanceof ICPPTemplateDefinition == false || type instanceof IProblemBinding)
return false; return false;
final ICPPClassSpecialization classSpec2 = (ICPPClassSpecialization) type; final ICPPClassSpecialization classSpec2 = (ICPPClassSpecialization) type;
if (getKey() != classSpec2.getKey()) if (getKey() != classSpec2.getKey())
return false; return false;
if (!CharArrayUtils.equals(getNameCharArray(), classSpec2.getNameCharArray())) if (!CharArrayUtils.equals(getNameCharArray(), classSpec2.getNameCharArray()))
return false; return false;
@ -180,7 +179,7 @@ class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization
return ((ICPPClassType) owner1).isSameType((ICPPClassType) owner2); return ((ICPPClassType) owner1).isSameType((ICPPClassType) owner2);
} }
@Override @Override
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() { public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() {
IASTNode point= null; // Instantiation of dependent expressions may not work. IASTNode point= null; // Instantiation of dependent expressions may not work.
@ -193,7 +192,7 @@ class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization
} }
return spec; return spec;
} }
@Override @Override
public final ICPPDeferredClassInstance asDeferredInstance() { public final ICPPDeferredClassInstance asDeferredInstance() {
PDOMInstanceCache cache= PDOMInstanceCache.getCache(this); PDOMInstanceCache cache= PDOMInstanceCache.getCache(this);
@ -206,11 +205,11 @@ class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization
return dci; return dci;
} }
} }
private void computeTemplateParameters(ICPPClassTemplate originalTemplate) { private void computeTemplateParameters(ICPPClassTemplate originalTemplate) {
try { try {
fTemplateParameters = PDOMTemplateParameterArray.createPDOMTemplateParameters(getLinkage(), this, fTemplateParameters = PDOMTemplateParameterArray.createPDOMTemplateParameters(getLinkage(),
originalTemplate.getTemplateParameters()); this, originalTemplate.getTemplateParameters());
} catch (DOMException e) { } catch (DOMException e) {
CCorePlugin.log(e); CCorePlugin.log(e);
fTemplateParameters = IPDOMCPPTemplateParameter.EMPTY_ARRAY; fTemplateParameters = IPDOMCPPTemplateParameter.EMPTY_ARRAY;

View file

@ -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 * QNX - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp; package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -27,16 +27,16 @@ class PDOMCPPConstructorTemplateSpecialization extends PDOMCPPMethodTemplateSpec
*/ */
@SuppressWarnings("hiding") @SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PDOMCPPFunctionSpecialization.RECORD_SIZE + 0; protected static final int RECORD_SIZE = PDOMCPPFunctionSpecialization.RECORD_SIZE + 0;
public PDOMCPPConstructorTemplateSpecialization(PDOMCPPLinkage linkage, PDOMNode parent, ICPPConstructor constructor, PDOMBinding specialized) public PDOMCPPConstructorTemplateSpecialization(PDOMCPPLinkage linkage, PDOMNode parent,
throws CoreException { ICPPConstructor constructor, PDOMBinding specialized) throws CoreException {
super(linkage, parent, constructor, specialized); super(linkage, parent, constructor, specialized);
} }
public PDOMCPPConstructorTemplateSpecialization(PDOMLinkage linkage, long bindingRecord) { public PDOMCPPConstructorTemplateSpecialization(PDOMLinkage linkage, long bindingRecord) {
super(linkage, bindingRecord); super(linkage, bindingRecord);
} }
@Override @Override
protected int getRecordSize() { protected int getRecordSize() {
return RECORD_SIZE; return RECORD_SIZE;

View file

@ -29,32 +29,31 @@ import org.eclipse.core.runtime.CoreException;
/** /**
* @author Bryan Wilkinson * @author Bryan Wilkinson
*
*/ */
class PDOMCPPMethodTemplateSpecialization extends class PDOMCPPMethodTemplateSpecialization extends PDOMCPPFunctionTemplateSpecialization
PDOMCPPFunctionTemplateSpecialization implements ICPPMethod { implements ICPPMethod {
private static final int TEMPLATE_PARAMS = PDOMCPPFunctionTemplateSpecialization.RECORD_SIZE; private static final int TEMPLATE_PARAMS = PDOMCPPFunctionTemplateSpecialization.RECORD_SIZE;
@SuppressWarnings("hiding") @SuppressWarnings("hiding")
protected static final int RECORD_SIZE = TEMPLATE_PARAMS + Database.PTR_SIZE; protected static final int RECORD_SIZE = TEMPLATE_PARAMS + Database.PTR_SIZE;
private volatile IPDOMCPPTemplateParameter[] fTemplateParameters; private volatile IPDOMCPPTemplateParameter[] fTemplateParameters;
public PDOMCPPMethodTemplateSpecialization(PDOMCPPLinkage linkage, PDOMNode parent, ICPPMethod method, PDOMBinding specialized) public PDOMCPPMethodTemplateSpecialization(PDOMCPPLinkage linkage, PDOMNode parent,
throws CoreException { ICPPMethod method, PDOMBinding specialized) throws CoreException {
super(linkage, parent, (ICPPFunctionTemplate) method, specialized); super(linkage, parent, (ICPPFunctionTemplate) method, specialized);
computeTemplateParameters((ICPPFunctionTemplate) method); // sets fTemplateParameters computeTemplateParameters((ICPPFunctionTemplate) method); // Sets fTemplateParameters
final Database db = getDB(); final Database db = getDB();
long rec = PDOMTemplateParameterArray.putArray(db, fTemplateParameters); long rec = PDOMTemplateParameterArray.putArray(db, fTemplateParameters);
db.putRecPtr(record + TEMPLATE_PARAMS, rec); db.putRecPtr(record + TEMPLATE_PARAMS, rec);
linkage.new ConfigureTemplateParameters(((ICPPFunctionTemplate) method).getTemplateParameters(), fTemplateParameters); linkage.new ConfigureTemplateParameters(((ICPPFunctionTemplate) method).getTemplateParameters(),
fTemplateParameters);
} }
public PDOMCPPMethodTemplateSpecialization(PDOMLinkage linkage, long bindingRecord) { public PDOMCPPMethodTemplateSpecialization(PDOMLinkage linkage, long bindingRecord) {
super(linkage, bindingRecord); super(linkage, bindingRecord);
} }
@Override @Override
protected int getRecordSize() { protected int getRecordSize() {
return RECORD_SIZE; return RECORD_SIZE;
@ -82,7 +81,7 @@ class PDOMCPPMethodTemplateSpecialization extends
public int getNodeType() { public int getNodeType() {
return IIndexCPPBindingConstants.CPP_METHOD_TEMPLATE_SPECIALIZATION; return IIndexCPPBindingConstants.CPP_METHOD_TEMPLATE_SPECIALIZATION;
} }
@Override @Override
public boolean isDestructor() { public boolean isDestructor() {
IBinding spec = getSpecializedBinding(); IBinding spec = getSpecializedBinding();
@ -100,7 +99,7 @@ class PDOMCPPMethodTemplateSpecialization extends
} }
return false; return false;
} }
@Override @Override
public boolean isExplicit() { public boolean isExplicit() {
IBinding spec = getSpecializedBinding(); IBinding spec = getSpecializedBinding();
@ -132,7 +131,7 @@ class PDOMCPPMethodTemplateSpecialization extends
} }
return 0; return 0;
} }
@Override @Override
public boolean isExternC() { public boolean isExternC() {
return false; return false;
@ -152,11 +151,11 @@ class PDOMCPPMethodTemplateSpecialization extends
public boolean isFinal() { public boolean isFinal() {
return false; return false;
} }
private void computeTemplateParameters(ICPPFunctionTemplate originalMethodTemplate) { private void computeTemplateParameters(ICPPFunctionTemplate originalMethodTemplate) {
try { try {
fTemplateParameters = PDOMTemplateParameterArray.createPDOMTemplateParameters(getLinkage(), this, fTemplateParameters = PDOMTemplateParameterArray.createPDOMTemplateParameters(getLinkage(),
originalMethodTemplate.getTemplateParameters()); this, originalMethodTemplate.getTemplateParameters());
} catch (DOMException e) { } catch (DOMException e) {
CCorePlugin.log(e); CCorePlugin.log(e);
fTemplateParameters = IPDOMCPPTemplateParameter.EMPTY_ARRAY; fTemplateParameters = IPDOMCPPTemplateParameter.EMPTY_ARRAY;