Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2012-01-13 08:51:22 -0500
committerMarkus Schorn2012-01-13 08:52:13 -0500
commit1467a456bd822e30ce023b723bf21aecb98798db (patch)
tree2a3ed7d361868476f9f0aa54b2cf62566e48551c
parent856f097e70c6b799c1626a85be2d8e97f21d1b3e (diff)
downloadorg.eclipse.cdt-1467a456bd822e30ce023b723bf21aecb98798db.tar.gz
org.eclipse.cdt-1467a456bd822e30ce023b723bf21aecb98798db.tar.xz
org.eclipse.cdt-1467a456bd822e30ce023b723bf21aecb98798db.zip
Bug 368404: Current instantiation of class template partial specializations.
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2BaseTest.java2
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassTemplate.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassTemplatePartialSpecialization.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java9
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplatePartialSpecialization.java45
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplatePartialSpecializationSpecialization.java40
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplateSpecialization.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredClassInstance.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionSpecialization.java14
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSpecialization.java39
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java79
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java104
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexCPPSignatureUtil.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassTemplate.java11
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassTemplatePartialSpecializationSpecialization.java11
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassTemplateSpecialization.java11
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/TemplateInstanceUtil.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java10
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplatePartialSpecialization.java22
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java11
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexLabelProvider.java15
27 files changed, 211 insertions, 266 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2BaseTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2BaseTest.java
index 90ae7463ca..51a2daceaa 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2BaseTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2BaseTest.java
@@ -628,6 +628,8 @@ public class AST2BaseTest extends BaseTestCase {
}
public <T extends IBinding> T assertNonProblem(String section, int len, Class<T> type, Class... cs) {
+ if (len <= 0)
+ len+= section.length();
IBinding binding= binding(section, len);
assertTrue("ProblemBinding for name: " + section.substring(0, len),
!(binding instanceof IProblemBinding));
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
index e64d924e81..9d913dd1a9 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
@@ -3274,8 +3274,7 @@ public class AST2TemplateTests extends AST2BaseTest {
public void testBug238180_ClassCast() throws Exception {
// the code above used to trigger a ClassCastException
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
- String tmplId= "str<true, true, false, A, B>";
- ICPPClassType p= ba.assertNonProblem(tmplId, tmplId.length(), ICPPClassType.class);
+ ICPPClassType p= ba.assertNonProblem("str<true, true, false, A, B>", 0, ICPPClassType.class);
ICPPConstructor con= p.getConstructors()[1];
ICPPReferenceType reftype= (ICPPReferenceType) con.getType().getParameterTypes()[0];
IQualifierType qt= (IQualifierType) reftype.getType();
@@ -4197,7 +4196,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// void test(A<int> x) {
// f(x);
// }
- public void _testInlineFriendFunction_284690_2() throws Exception {
+ public void testInlineFriendFunction_287409() throws Exception {
final String code = getAboveComment();
BindingAssertionHelper bh= new BindingAssertionHelper(code, true);
ICPPFunction func= bh.assertNonProblem("f(x)", 1, ICPPFunction.class);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassTemplate.java
index d15b346c59..27e0e81beb 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassTemplate.java
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
-import org.eclipse.cdt.core.dom.ast.DOMException;
/**
* @noextend This interface is not intended to be extended by clients.
@@ -24,5 +23,5 @@ public interface ICPPClassTemplate extends ICPPTemplateDefinition, ICPPClassType
* Returns a deferred instance that allows lookups within this class template.
* @since 5.1
*/
- public ICPPTemplateInstance asDeferredInstance() throws DOMException;
+ public ICPPTemplateInstance asDeferredInstance();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassTemplatePartialSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassTemplatePartialSpecialization.java
index c6de47a82f..d100f28cdb 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassTemplatePartialSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassTemplatePartialSpecialization.java
@@ -38,7 +38,7 @@ public interface ICPPClassTemplatePartialSpecialization extends ICPPClassTemplat
* Returns the arguments of this partial specialization.
* @since 5.1
*/
- public ICPPTemplateArgument[] getTemplateArguments() throws DOMException;
+ public ICPPTemplateArgument[] getTemplateArguments();
/**
* @deprecated use {@link #getTemplateArguments()}, instead.
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java
index 8e12dcb703..d2ce969630 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java
@@ -226,8 +226,8 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
@Override
public IBinding[] getFriends() {
- // not yet supported
- return IBinding.EMPTY_BINDING_ARRAY;
+ IBinding[] friends = specialClass.getSpecializedBinding().getFriends();
+ return specializeMembers(friends);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java
index 7583bd9c98..1bead9371e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java
@@ -23,7 +23,6 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.dom.IName;
-import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.EScopeKind;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
@@ -62,7 +61,6 @@ import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.core.parser.util.ObjectSet;
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
-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.SemanticUtil;
import org.eclipse.cdt.internal.core.parser.util.ContentAssistMatcherFactory;
@@ -99,10 +97,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
ICPPClassType clsType = (ICPPClassType) binding;
if (clsType instanceof ICPPClassTemplate) {
- try {
- clsType= CPPTemplates.instantiateWithinClassTemplate((ICPPClassTemplate) clsType);
- } catch (DOMException e) {
- }
+ clsType= (ICPPClassType) ((ICPPClassTemplate) clsType).asDeferredInstance();
}
char[] className = name.getLookupKey();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java
index 03a1070257..a7aa9075a6 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java
@@ -225,18 +225,13 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
}
@Override
- public final ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
+ public final ICPPDeferredClassInstance asDeferredInstance() {
if (fDeferredInstance == null) {
- fDeferredInstance= createDeferredInstance();
+ fDeferredInstance= CPPTemplates.createDeferredInstance(this);
}
return fDeferredInstance;
}
- protected ICPPDeferredClassInstance createDeferredInstance() throws DOMException {
- ICPPTemplateArgument[] args = CPPTemplates.templateParametersAsArguments(getTemplateParameters());
- return new CPPDeferredClassInstance(this, args, getCompositeScope());
- }
-
@Override
public ICPPTemplateArgument getDefaultArgFromIndex(int paramPos) throws DOMException {
ICPPClassTemplate ib = getIndexBinding();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplatePartialSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplatePartialSpecialization.java
index ad8ca63cf4..ca97cc3e94 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplatePartialSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplatePartialSpecialization.java
@@ -41,7 +41,7 @@ public class CPPClassTemplatePartialSpecialization extends CPPClassTemplate
}
@Override
- public ICPPTemplateArgument[] getTemplateArguments() throws DOMException {
+ public ICPPTemplateArgument[] getTemplateArguments() {
return arguments;
}
@@ -61,25 +61,12 @@ public class CPPClassTemplatePartialSpecialization extends CPPClassTemplate
@Override
public ICPPTemplateParameterMap getTemplateParameterMap() {
- try {
- return CPPTemplates.createParameterMap(getPrimaryClassTemplate(), getTemplateArguments());
- } catch (DOMException e) {
- return CPPTemplateParameterMap.EMPTY;
- }
+ return CPPTemplates.createParameterMap(getPrimaryClassTemplate(), getTemplateArguments());
}
@Override
- protected ICPPDeferredClassInstance createDeferredInstance() throws DOMException {
- return new CPPDeferredClassInstance(this, getTemplateArguments(), getCompositeScope());
- }
-
- @Override
public String toString() {
- try {
- return super.toString() + ASTTypeUtil.getArgumentListString(getTemplateArguments(), true);
- } catch (DOMException e) {
- return super.toString() + '<' + e.getProblem().toString() + '>';
- }
+ return super.toString() + ASTTypeUtil.getArgumentListString(getTemplateArguments(), true);
}
@Override
@@ -113,23 +100,19 @@ public class CPPClassTemplatePartialSpecialization extends CPPClassTemplate
public static boolean isSamePartialClassSpecialization(
ICPPClassTemplatePartialSpecialization lhs,
ICPPClassTemplatePartialSpecialization rhs) {
- try {
- ICPPClassType ct1= lhs.getPrimaryClassTemplate();
- ICPPClassType ct2= rhs.getPrimaryClassTemplate();
- if(!ct1.isSameType(ct2))
- return false;
-
- ICPPTemplateArgument[] args1= lhs.getTemplateArguments();
- ICPPTemplateArgument[] args2= rhs.getTemplateArguments();
- if (args1.length != args2.length)
- return false;
+ ICPPClassType ct1= lhs.getPrimaryClassTemplate();
+ ICPPClassType ct2= rhs.getPrimaryClassTemplate();
+ if(!ct1.isSameType(ct2))
+ return false;
- for (int i = 0; i < args2.length; i++) {
- if (args1[i].isSameValue(args2[i]))
- return false;
- }
- } catch (DOMException e) {
+ ICPPTemplateArgument[] args1= lhs.getTemplateArguments();
+ ICPPTemplateArgument[] args2= rhs.getTemplateArguments();
+ if (args1.length != args2.length)
return false;
+
+ for (int i = 0; i < args2.length; i++) {
+ if (!args1[i].isSameValue(args2[i]))
+ return false;
}
return true;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplatePartialSpecializationSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplatePartialSpecializationSpecialization.java
index 5a2698fb02..c638b8f0ab 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplatePartialSpecializationSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplatePartialSpecializationSpecialization.java
@@ -14,6 +14,7 @@ import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
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.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
@@ -81,10 +82,9 @@ public class CPPClassTemplatePartialSpecializationSpecialization extends CPPClas
}
@Override
- public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
+ public ICPPDeferredClassInstance asDeferredInstance() {
if (fDeferredInstance == null) {
- ICPPTemplateArgument[] args = CPPTemplates.templateParametersAsArguments(getTemplateParameters());
- fDeferredInstance= new CPPDeferredClassInstance(this, args, getCompositeScope());
+ fDeferredInstance= CPPTemplates.createDeferredInstance(this);
}
return fDeferredInstance;
}
@@ -95,13 +95,18 @@ public class CPPClassTemplatePartialSpecializationSpecialization extends CPPClas
}
@Override
- public ICPPTemplateArgument[] getTemplateArguments() throws DOMException {
+ public ICPPTemplateArgument[] getTemplateArguments() {
ICPPTemplateArgument[] args = ((ICPPClassTemplatePartialSpecialization) getSpecializedBinding()).getTemplateArguments();
- final IBinding owner = getOwner();
- if (owner instanceof ICPPClassSpecialization) {
- return CPPTemplates.instantiateArguments(args, getTemplateParameterMap(), -1, (ICPPClassSpecialization) owner);
+ try {
+ final IBinding owner = getOwner();
+ if (owner instanceof ICPPClassSpecialization) {
+ return CPPTemplates.instantiateArguments(args, getTemplateParameterMap(), -1,
+ (ICPPClassSpecialization) owner);
+ }
+ return CPPTemplates.instantiateArguments(args, getTemplateParameterMap(), -1, null);
+ } catch (DOMException e) {
+ return args;
}
- return CPPTemplates.instantiateArguments(args, getTemplateParameterMap(), -1, null);
}
@Override
@@ -114,12 +119,21 @@ public class CPPClassTemplatePartialSpecializationSpecialization extends CPPClas
}
@Override
- public String toString() {
- try {
- return super.toString() + ASTTypeUtil.getArgumentListString(getTemplateArguments(), true);
- } catch (DOMException e) {
- return super.toString() + '<' + e.getProblem().toString() + '>';
+ public boolean isSameType(IType type) {
+ if (type == this)
+ return true;
+ if (type instanceof ITypedef)
+ return type.isSameType(this);
+
+ if (type instanceof ICPPClassTemplatePartialSpecializationSpecialization) {
+ return CPPClassTemplatePartialSpecialization.isSamePartialClassSpecialization(this, (ICPPClassTemplatePartialSpecializationSpecialization) type);
}
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + ASTTypeUtil.getArgumentListString(getTemplateArguments(), true);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplateSpecialization.java
index 1e971a0d7a..ca033dceb1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplateSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplateSpecialization.java
@@ -105,10 +105,9 @@ public class CPPClassTemplateSpecialization extends CPPClassSpecialization
}
@Override
- public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
+ public final ICPPDeferredClassInstance asDeferredInstance() {
if (fDeferredInstance == null) {
- ICPPTemplateArgument[] args = CPPTemplates.templateParametersAsArguments(getTemplateParameters());
- fDeferredInstance= new CPPDeferredClassInstance(this, args, getCompositeScope());
+ fDeferredInstance= CPPTemplates.createDeferredInstance(this);
}
return fDeferredInstance;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredClassInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredClassInstance.java
index 5fa4b79536..7e045431fc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredClassInstance.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredClassInstance.java
@@ -35,7 +35,7 @@ public class CPPDeferredClassInstance extends CPPUnknownClass implements ICPPDef
private final ICPPScope fLookupScope;
public CPPDeferredClassInstance(ICPPClassTemplate template, ICPPTemplateArgument[] arguments,
- ICPPScope lookupScope) throws DOMException {
+ ICPPScope lookupScope) {
// With template template parameters the owner must not be calculated, it'd lead to an infinite loop.
// Rather than that we override getOwner().
super(null, template.getNameCharArray());
@@ -44,7 +44,7 @@ public class CPPDeferredClassInstance extends CPPUnknownClass implements ICPPDef
fLookupScope= lookupScope;
}
- public CPPDeferredClassInstance(ICPPClassTemplate template, ICPPTemplateArgument[] arguments) throws DOMException {
+ public CPPDeferredClassInstance(ICPPClassTemplate template, ICPPTemplateArgument[] arguments) {
this(template, arguments, null);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionSpecialization.java
index a32e0a8c9e..cb65bd8666 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionSpecialization.java
@@ -24,6 +24,7 @@ import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
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;
@@ -42,9 +43,22 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
private ICPPFunctionType type = null;
private ICPPParameter[] fParams = null;
private IType[] specializedExceptionSpec = null;
+ private final ICPPClassSpecialization fContext;
public CPPFunctionSpecialization(ICPPFunction orig, IBinding owner, ICPPTemplateParameterMap argMap) {
+ this(orig, owner, argMap, null);
+ }
+
+ public CPPFunctionSpecialization(ICPPFunction orig, IBinding owner, ICPPTemplateParameterMap argMap, ICPPClassSpecialization context) {
super(orig, owner, argMap);
+ fContext= context;
+ }
+
+ @Override
+ protected ICPPClassSpecialization getSpecializationContext() {
+ if (fContext != null)
+ return fContext;
+ return super.getSpecializationContext();
}
private ICPPFunction getFunction() {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSpecialization.java
index 87c4757dda..5f989523d0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSpecialization.java
@@ -53,29 +53,28 @@ public abstract class CPPSpecialization extends PlatformObject implements ICPPSp
}
public IType specializeType(IType type) {
- if (owner instanceof ICPPClassSpecialization) {
- ICPPClassSpecialization within = getWithin((ICPPClassSpecialization) owner);
- return CPPTemplates.instantiateType(type, getTemplateParameterMap(), -1, within);
- } else {
- return CPPTemplates.instantiateType(type, getTemplateParameterMap(), -1, null);
- }
+ return CPPTemplates.instantiateType(type, getTemplateParameterMap(), -1, getSpecializationContext());
}
- private ICPPClassSpecialization getWithin(ICPPClassSpecialization within) {
- ICPPClassType orig = within.getSpecializedBinding();
- for(;;) {
- IBinding o1 = within.getOwner();
- IBinding o2 = orig.getOwner();
- if (!(o1 instanceof ICPPClassSpecialization && o2 instanceof ICPPClassType))
- return within;
- ICPPClassSpecialization nextWithin = (ICPPClassSpecialization) o1;
- orig= (ICPPClassType) o2;
- if (orig.isSameType(nextWithin))
- return within;
- within= nextWithin;
- }
+ protected ICPPClassSpecialization getSpecializationContext() {
+ if (owner instanceof ICPPClassSpecialization) {
+ ICPPClassSpecialization within = (ICPPClassSpecialization) owner;
+ ICPPClassType orig = within.getSpecializedBinding();
+ for(;;) {
+ IBinding o1 = within.getOwner();
+ IBinding o2 = orig.getOwner();
+ if (!(o1 instanceof ICPPClassSpecialization && o2 instanceof ICPPClassType))
+ return within;
+ ICPPClassSpecialization nextWithin = (ICPPClassSpecialization) o1;
+ orig= (ICPPClassType) o2;
+ if (orig.isSameType(nextWithin))
+ return within;
+ within= nextWithin;
+ }
+ }
+ return null;
}
-
+
public IType[] specializeTypePack(ICPPParameterPackType type) {
if (owner instanceof ICPPClassSpecialization) {
return CPPTemplates.instantiateTypes(new IType[]{type}, getTemplateParameterMap(), -1, (ICPPClassSpecialization) owner);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
index a43ea8824e..25c6e7a83f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
@@ -19,17 +19,7 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.typeOrFunctionSet;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.valueCat;
-import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.ALLCVQ;
-import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.ARRAY;
-import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE;
-import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.MPTR;
-import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.PTR;
-import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.REF;
-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.calculateInheritanceDepth;
-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.getUltimateTypeUptoPointers;
-import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.isConversionOperator;
+import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.*;
import java.util.ArrayList;
import java.util.Arrays;
@@ -337,9 +327,11 @@ public class CPPSemantics {
if (prop != ICPPASTTemplateId.TEMPLATE_NAME && !data.astName.isQualified()) {
// You cannot use a class template name outside of the class template scope,
// mark it as a problem.
- IBinding replacement= CPPTemplates.isUsedInClassTemplateScope((ICPPClassTemplate) binding, data.astName);
- if (replacement != null) {
- binding= replacement;
+ IBinding user= CPPTemplates.isUsedInClassTemplateScope((ICPPClassTemplate) binding, data.astName);
+ if (user instanceof ICPPClassTemplate) {
+ binding= ((ICPPClassTemplate) user).asDeferredInstance();
+ } else if (user != null) {
+ binding= user;
} else {
boolean ok= false;
IASTNode node= data.astName.getParent();
@@ -372,10 +364,12 @@ public class CPPSemantics {
// try to replace binding by the one pointing to the enclosing template declaration.
ICPPDeferredClassInstance dcl= (ICPPDeferredClassInstance) binding;
IBinding usedHere= CPPTemplates.isUsedInClassTemplateScope(dcl.getClassTemplate(), data.astName);
- if (usedHere instanceof ICPPDeferredClassInstance) {
- ICPPDeferredClassInstance alt= (ICPPDeferredClassInstance) usedHere;
- if (CPPTemplates.areSameArguments(alt.getTemplateArguments(), dcl.getTemplateArguments())) {
- binding= alt;
+ if (usedHere instanceof ICPPClassTemplatePartialSpecialization) {
+ if (CPPTemplates.areSameArguments(((ICPPClassTemplatePartialSpecialization) usedHere).getTemplateArguments(), dcl.getTemplateArguments()))
+ binding= ((ICPPClassTemplatePartialSpecialization) usedHere).asDeferredInstance();
+ } else if (usedHere instanceof ICPPClassTemplate) {
+ if (CPPTemplates.areSameArguments(CPPTemplates.templateParametersAsArguments(((ICPPClassTemplate) usedHere).getTemplateParameters()), dcl.getTemplateArguments())) {
+ binding= ((ICPPClassTemplate) usedHere).asDeferredInstance();
}
}
}
@@ -544,12 +538,14 @@ public class CPPSemantics {
private static void doKoenigLookup(LookupData data) throws DOMException {
data.ignoreUsingDirectives = true;
data.forceQualified = true;
- Set<ICPPNamespaceScope> associated = getAssociatedScopes(data);
+ Set<ICPPFunction> friendFns = new HashSet<ICPPFunction>(2);
+ Set<ICPPNamespaceScope> associated = getAssociatedScopes(data, friendFns);
for (ICPPNamespaceScope scope : associated) {
if (!data.visited.containsKey(scope)) {
lookup(data, scope);
}
}
+ mergeResults(data, friendFns.toArray(), false);
}
static IBinding checkDeclSpecifier(IBinding binding, IASTName name, IASTNode decl) {
@@ -645,7 +641,7 @@ public class CPPSemantics {
return data;
}
- private static Set<ICPPNamespaceScope> getAssociatedScopes(LookupData data) {
+ private static Set<ICPPNamespaceScope> getAssociatedScopes(LookupData data, Set<ICPPFunction> friendFns) {
if (!data.hasFunctionArguments())
return Collections.emptySet();
@@ -654,7 +650,7 @@ public class CPPSemantics {
ObjectSet<IType> handled = new ObjectSet<IType>(2);
for (IType p : ps) {
try {
- getAssociatedScopes(p, namespaces, handled, data.tu);
+ getAssociatedScopes(p, namespaces, friendFns, handled, data.tu);
} catch (DOMException e) {
}
}
@@ -682,7 +678,7 @@ public class CPPSemantics {
// 3.4.2-2
private static void getAssociatedScopes(IType t, Set<ICPPNamespaceScope> namespaces,
- ObjectSet<IType> handled, CPPASTTranslationUnit tu) throws DOMException {
+ Set<ICPPFunction> friendFns, ObjectSet<IType> handled, CPPASTTranslationUnit tu) throws DOMException {
t = getNestedType(t, TDEF | CVTYPE | PTR | ARRAY | REF);
if (t instanceof IBinding) {
if (handled.containsKey(t))
@@ -691,7 +687,7 @@ public class CPPSemantics {
IBinding owner= ((IBinding) t).getOwner();
if (owner instanceof ICPPClassType) {
- getAssociatedScopes((IType) owner, namespaces, handled, tu);
+ getAssociatedScopes((IType) owner, namespaces, friendFns, handled, tu);
} else {
getAssociatedNamespaceScopes(getContainingNamespaceScope((IBinding) t, tu), namespaces);
}
@@ -702,35 +698,40 @@ public class CPPSemantics {
for (ICPPBase base : bases) {
IBinding b = base.getBaseClass();
if (b instanceof IType)
- getAssociatedScopes((IType) b, namespaces, handled, tu);
+ getAssociatedScopes((IType) b, namespaces, friendFns, handled, tu);
}
// Furthermore, if T is a class template ...
// * ... types of the template arguments for template type parameters
// (excluding template template parameters);
// * ... owners of which any template template arguments are members;
if (ct instanceof ICPPTemplateInstance) {
+ for (IBinding friend : ct.getFriends()) {
+ if (friend instanceof ICPPFunction) {
+ friendFns.add((ICPPFunction) friend);
+ }
+ }
ICPPTemplateArgument[] args = ((ICPPTemplateInstance) ct).getTemplateArguments();
for (ICPPTemplateArgument arg : args) {
if (arg.isTypeValue()) {
- getAssociatedScopes(arg.getTypeValue(), namespaces, handled, tu);
+ getAssociatedScopes(arg.getTypeValue(), namespaces, friendFns, handled, tu);
}
}
}
} else if (t instanceof IFunctionType) {
IFunctionType ft = (IFunctionType) t;
- getAssociatedScopes(ft.getReturnType(), namespaces, handled, tu);
+ getAssociatedScopes(ft.getReturnType(), namespaces, friendFns, handled, tu);
IType[] ps = ft.getParameterTypes();
for (IType pt : ps) {
- getAssociatedScopes(pt, namespaces, handled, tu);
+ getAssociatedScopes(pt, namespaces, friendFns, handled, tu);
}
} else if (t instanceof ICPPPointerToMemberType) {
final ICPPPointerToMemberType pmt = (ICPPPointerToMemberType) t;
- getAssociatedScopes(pmt.getMemberOfClass(), namespaces, handled, tu);
- getAssociatedScopes(pmt.getType(), namespaces, handled, tu);
+ getAssociatedScopes(pmt.getMemberOfClass(), namespaces, friendFns, handled, tu);
+ getAssociatedScopes(pmt.getType(), namespaces, friendFns, handled, tu);
} else if (t instanceof FunctionSetType) {
FunctionSetType fst= (FunctionSetType) t;
for (ICPPFunction fn : fst.getFunctionSet()) {
- getAssociatedScopes(fn.getType(), namespaces, handled, tu);
+ getAssociatedScopes(fn.getType(), namespaces, friendFns, handled, tu);
}
}
}
@@ -2397,6 +2398,7 @@ public class CPPSemantics {
// Loop over all functions
List<FunctionCost> potentialCosts= null;
+ IFunction unknownFunction= null;
for (ICPPFunction fn : fns) {
if (fn == null)
continue;
@@ -2407,9 +2409,9 @@ public class CPPSemantics {
if (fnCost == CONTAINS_DEPENDENT_TYPES) {
if (viableCount == 1)
- return fns[0];
- setTargetedFunctionsToUnknown(argTypes);
- return CPPUnknownFunction.createForSample(fns[0]);
+ return fn;
+ unknownFunction = fn;
+ continue;
}
if (fnCost.hasDeferredUDC()) {
@@ -2442,8 +2444,13 @@ public class CPPSemantics {
}
}
- if (bestFnCost == null)
- return null;
+ if (bestFnCost == null) {
+ if (unknownFunction == null)
+ return null;
+
+ setTargetedFunctionsToUnknown(argTypes);
+ return CPPUnknownFunction.createForSample(unknownFunction);
+ }
if (ambiguousFunctions != null) {
ambiguousFunctions= ArrayUtil.append(IFunction.class, ambiguousFunctions, bestFnCost.getFunction());
@@ -2723,7 +2730,7 @@ public class CPPSemantics {
IType implicitType;
ICPPClassType owner= m.getClassOwner();
if (owner instanceof ICPPClassTemplate) {
- owner= CPPTemplates.instantiateWithinClassTemplate((ICPPClassTemplate) owner);
+ owner= (ICPPClassType) ((ICPPClassTemplate) owner).asDeferredInstance();
}
ICPPFunctionType ft= m.getType();
implicitType= SemanticUtil.addQualifiers(owner, ft.isConst(), ft.isVolatile(), false);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
index dea3993383..4d6d2f36d9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
@@ -79,6 +79,7 @@ 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.ICPPParameterPackType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
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.ICPPTemplateDefinition;
@@ -273,12 +274,12 @@ public class CPPTemplates {
if (scope instanceof ICPPClassScope) {
ICPPClassType b= ((ICPPClassScope) scope).getClassType();
if (b != null && ct.isSameType(b)) {
- return CPPTemplates.instantiateWithinClassTemplate(ct);
+ return ct;
}
if (b instanceof ICPPClassTemplatePartialSpecialization) {
ICPPClassTemplatePartialSpecialization pspec= (ICPPClassTemplatePartialSpecialization) b;
if (ct.isSameType(pspec.getPrimaryClassTemplate())) {
- return CPPTemplates.instantiateWithinClassTemplate(pspec);
+ return pspec;
}
} else if (b instanceof ICPPClassSpecialization) {
ICPPClassSpecialization specialization= (ICPPClassSpecialization) b;
@@ -466,34 +467,21 @@ public class CPPTemplates {
return completeArgs;
}
- /**
- * Instantiates the template for usage within its own body. May return <code>null</code>.
- */
- public static ICPPClassType instantiateWithinClassTemplate(ICPPClassTemplate template) throws DOMException {
- ICPPTemplateInstance di= template.asDeferredInstance();
- if (di instanceof ICPPClassType)
- return (ICPPClassType) di;
-
+ public static ICPPDeferredClassInstance createDeferredInstance(ICPPClassTemplate ct) {
ICPPTemplateArgument[] args;
- if (template instanceof ICPPClassTemplatePartialSpecialization) {
- args= ((ICPPClassTemplatePartialSpecialization) template).getTemplateArguments();
+ if (ct instanceof ICPPClassTemplatePartialSpecialization) {
+ args= ((ICPPClassTemplatePartialSpecialization) ct).getTemplateArguments();
} else {
- ICPPTemplateParameter[] templateParameters = template.getTemplateParameters();
- args = templateParametersAsArguments(templateParameters);
+ args = CPPTemplates.templateParametersAsArguments(ct.getTemplateParameters());
}
- IBinding result = deferredInstance(template, args);
- if (result instanceof ICPPClassType)
- return (ICPPClassType) result;
-
- return template;
+ return new CPPDeferredClassInstance(ct, args, (ICPPScope) ct.getCompositeScope());
}
- public static ICPPTemplateArgument[] templateParametersAsArguments(
- ICPPTemplateParameter[] templateParameters) throws DOMException {
+ public static ICPPTemplateArgument[] templateParametersAsArguments(ICPPTemplateParameter[] tpars) {
ICPPTemplateArgument[] args;
- args = new ICPPTemplateArgument[templateParameters.length];
- for (int i = 0; i < templateParameters.length; i++) {
- final ICPPTemplateParameter tp = templateParameters[i];
+ args = new ICPPTemplateArgument[tpars.length];
+ for (int i = 0; i < tpars.length; i++) {
+ final ICPPTemplateParameter tp = tpars[i];
if (tp instanceof IType) {
IType t= (IType) tp;
if (tp.isParameterPack()) {
@@ -773,7 +761,12 @@ public class CPPTemplates {
} else if (decl instanceof ICPPClassTemplate) {
spec = new CPPClassTemplateSpecialization((ICPPClassTemplate) decl, owner, tpMap);
} else if (decl instanceof ICPPClassType) {
- spec = new CPPClassSpecialization((ICPPClassType) decl, owner, tpMap);
+ IBinding oldOwner = decl.getOwner();
+ if (oldOwner instanceof IType && owner.getSpecializedBinding().isSameType((IType) oldOwner)) {
+ spec = new CPPClassSpecialization((ICPPClassType) decl, owner, tpMap);
+ } else {
+ spec = new CPPClassSpecialization((ICPPClassType) decl, oldOwner, tpMap);
+ }
} else if (decl instanceof ICPPField) {
spec = new CPPFieldSpecialization(decl, owner, tpMap);
} else if (decl instanceof ICPPFunctionTemplate) {
@@ -788,7 +781,8 @@ public class CPPTemplates {
} else if (decl instanceof ICPPMethod) {
spec = new CPPMethodSpecialization((ICPPMethod) decl, owner, tpMap);
} else if (decl instanceof ICPPFunction) {
- spec = new CPPFunctionSpecialization((ICPPFunction) decl, owner, tpMap);
+ IBinding oldOwner = decl.getOwner();
+ spec = new CPPFunctionSpecialization((ICPPFunction) decl, oldOwner, tpMap, owner);
} else if (decl instanceof ITypedef) {
spec = new CPPTypedefSpecialization(decl, owner, tpMap);
} else if (decl instanceof IEnumeration || decl instanceof IEnumerator) {
@@ -1081,11 +1075,11 @@ public class CPPTemplates {
}
/**
- * This method propagates the specialization of a member to the types used by the member.
- * @param type a type to instantiate.
- * @param tpMap a mapping between template parameters and the corresponding arguments.
+ * Instantiates the given type with the provided map and packoffset.
+ * The context is used to replace templates with their specialization, where appropriate.
*/
- public static IType instantiateType(IType type, ICPPTemplateParameterMap tpMap, int packOffset, ICPPClassSpecialization within) {
+ public static IType instantiateType(IType type, ICPPTemplateParameterMap tpMap, int packOffset,
+ ICPPClassSpecialization within) {
try {
if (tpMap == null)
return type;
@@ -1145,24 +1139,25 @@ public class CPPTemplates {
}
if (within != null && type instanceof IBinding) {
- IType unwound= getNestedType(type, TDEF);
- if (unwound instanceof ICPPClassType) {
- // Convert (partial) class-templates (specializations) or typedefs to such to
- // the actual instance.
- ICPPClassType originalClass= within.getSpecializedBinding();
- if (originalClass.isSameType(unwound))
- return within;
- }
-
IBinding typeAsBinding= (IBinding) type;
- IBinding typeOwner= typeAsBinding.getOwner();
- if (typeOwner instanceof IType) {
- IType newOwner= instantiateType((IType) typeOwner, tpMap, packOffset, within);
- if (newOwner != typeOwner && newOwner instanceof ICPPClassSpecialization) {
+ IBinding owner= typeAsBinding.getOwner();
+ if (owner instanceof IType) {
+ final IType ownerAsType = getNestedType((IType) owner, TDEF);
+ Object newOwner= owner;
+ if (ownerAsType instanceof ICPPClassType && ownerAsType.isSameType(within.getSpecializedBinding())) {
+ // Convert (partial) class-templates (specializations) that are used as owner of
+ // another binding, to the more specialized version.
+ newOwner= within;
+ } else {
+ newOwner= instantiateType(ownerAsType, tpMap, packOffset, within);
+ }
+
+ if (newOwner != owner && newOwner instanceof ICPPClassSpecialization) {
return (IType) ((ICPPClassSpecialization) newOwner).specializeMember(typeAsBinding);
}
}
+ IType unwound= getNestedType(type, TDEF);
if (unwound instanceof ICPPTemplateInstance && !(unwound instanceof ICPPDeferredClassInstance)) {
// Argument of a class specialization can be a nested class subject to specialization.
final ICPPTemplateInstance classInstance = (ICPPTemplateInstance) unwound;
@@ -1944,12 +1939,8 @@ public class CPPTemplates {
if (pspecs != null && pspecs.length > 0) {
final String argStr= ASTTypeUtil.getArgumentListString(args, true);
for (ICPPClassTemplatePartialSpecialization pspec : pspecs) {
- try {
- if (argStr.equals(ASTTypeUtil.getArgumentListString(pspec.getTemplateArguments(), true)))
- return pspec;
- } catch (DOMException e) {
- // ignore partial specializations with problems
- }
+ if (argStr.equals(ASTTypeUtil.getArgumentListString(pspec.getTemplateArguments(), true)))
+ return pspec;
}
}
return null;
@@ -2311,6 +2302,11 @@ public class CPPTemplates {
t= ((ITypeContainer) t).getType();
} else if (t instanceof InitializerListType) {
return isDependentInitializerList(((InitializerListType) t).getInitializerList());
+ } else if (t instanceof IBinding) {
+ IBinding owner = ((IBinding) t).getOwner();
+ if (owner instanceof ICPPClassTemplate)
+ return true;
+ return (owner instanceof IType) && owner != t && isDependentType((IType) owner);
} else {
return false;
}
@@ -2414,7 +2410,15 @@ public class CPPTemplates {
}
if (changed) {
- IBinding inst= instantiate(classTemplate, newArgs);
+ IBinding inst= null;
+ if (classTemplate instanceof ICPPClassTemplatePartialSpecialization) {
+ try {
+ inst= instantiatePartialSpecialization((ICPPClassTemplatePartialSpecialization) classTemplate, newArgs, false, null);
+ } catch (DOMException e) {
+ }
+ } else {
+ inst= instantiate(classTemplate, newArgs);
+ }
if (inst != null)
return inst;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
index 6fbb424e8c..fb6a0564da 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
@@ -13,11 +13,7 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
-import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.ALLCVQ;
-import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE;
-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.getUltimateTypeUptoPointers;
+import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.*;
import java.util.ArrayList;
import java.util.Collections;
@@ -2175,7 +2171,7 @@ public class CPPVisitor extends ASTQueries {
ICPPClassScope cScope = (ICPPClassScope) s;
IType type = cScope.getClassType();
if (type instanceof ICPPClassTemplate) {
- type= CPPTemplates.instantiateWithinClassTemplate((ICPPClassTemplate) type);
+ type= (ICPPClassType) ((ICPPClassTemplate) type).asDeferredInstance();
}
return SemanticUtil.addQualifiers(type, dtor.isConst(), dtor.isVolatile(), false);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexCPPSignatureUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexCPPSignatureUtil.java
index 0be175bad7..21c2372bea 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexCPPSignatureUtil.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexCPPSignatureUtil.java
@@ -32,6 +32,7 @@ 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.ICPPDeferredClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
import org.eclipse.core.runtime.CoreException;
@@ -53,6 +54,9 @@ public class IndexCPPSignatureUtil {
*/
public static String getSignature(IBinding binding) throws CoreException, DOMException {
StringBuilder buffer = new StringBuilder();
+ if (binding instanceof ICPPDeferredClassInstance) {
+ buffer.append(getSignature(((ICPPDeferredClassInstance) binding).getTemplateDefinition()));
+ }
if (binding instanceof ICPPTemplateInstance) {
ICPPTemplateInstance inst = (ICPPTemplateInstance) binding;
buffer.append(getTemplateArgString(inst.getTemplateArguments(), true));
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassTemplate.java
index e29c56407d..757ec16452 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassTemplate.java
@@ -12,7 +12,6 @@
package org.eclipse.cdt.internal.core.index.composite.cpp;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
@@ -20,7 +19,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.ICPPTemplateParameter;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPDeferredClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
@@ -80,20 +78,15 @@ public class CompositeCPPClassTemplate extends CompositeCPPClassType
}
@Override
- public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
+ public final ICPPDeferredClassInstance asDeferredInstance() {
CompositeInstanceCache cache= CompositeInstanceCache.getCache(cf, rbinding);
synchronized (cache) {
ICPPDeferredClassInstance dci= cache.getDeferredInstance();
if (dci == null) {
- dci= createDeferredInstance();
+ dci= CPPTemplates.createDeferredInstance(this);
cache.putDeferredInstance(dci);
}
return dci;
}
}
-
- protected ICPPDeferredClassInstance createDeferredInstance() throws DOMException {
- ICPPTemplateArgument[] args = CPPTemplates.templateParametersAsArguments(getTemplateParameters());
- return new CPPDeferredClassInstance(this, args, getCompositeScope());
- }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassTemplatePartialSpecializationSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassTemplatePartialSpecializationSpecialization.java
index f7f2006d63..1418d866aa 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassTemplatePartialSpecializationSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassTemplatePartialSpecializationSpecialization.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp;
-import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
@@ -18,7 +17,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecializationSp
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.ICPPTemplateParameter;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPDeferredClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
@@ -68,22 +66,17 @@ public class CompositeCPPClassTemplatePartialSpecializationSpecialization extend
}
@Override
- public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
+ public ICPPDeferredClassInstance asDeferredInstance() {
CompositeInstanceCache cache= CompositeInstanceCache.getCache(cf, rbinding);
synchronized (cache) {
ICPPDeferredClassInstance dci= cache.getDeferredInstance();
if (dci == null) {
- dci= createDeferredInstance();
+ dci= CPPTemplates.createDeferredInstance(this);
cache.putDeferredInstance(dci);
}
return dci;
}
}
-
- protected ICPPDeferredClassInstance createDeferredInstance() throws DOMException {
- ICPPTemplateArgument[] args = CPPTemplates.templateParametersAsArguments(getTemplateParameters());
- return new CPPDeferredClassInstance(this, args, getCompositeScope());
- }
@Override
@Deprecated
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassTemplateSpecialization.java
index 4d419dd02a..4d51d06a9a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassTemplateSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassTemplateSpecialization.java
@@ -11,14 +11,12 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp;
-import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
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.ICPPTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPDeferredClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
@@ -63,20 +61,15 @@ CompositeCPPClassSpecialization implements ICPPClassTemplate, ICPPInstanceCache{
@Override
- public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
+ public final ICPPDeferredClassInstance asDeferredInstance() {
CompositeInstanceCache cache= CompositeInstanceCache.getCache(cf, rbinding);
synchronized (cache) {
ICPPDeferredClassInstance dci= cache.getDeferredInstance();
if (dci == null) {
- dci= createDeferredInstance();
+ dci= CPPTemplates.createDeferredInstance(this);
cache.putDeferredInstance(dci);
}
return dci;
}
}
-
- protected ICPPDeferredClassInstance createDeferredInstance() throws DOMException {
- ICPPTemplateArgument[] args = CPPTemplates.templateParametersAsArguments(getTemplateParameters());
- return new CPPDeferredClassInstance(this, args, getCompositeScope());
- }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/TemplateInstanceUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/TemplateInstanceUtil.java
index 720f2c6e6d..66e64038c7 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/TemplateInstanceUtil.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/TemplateInstanceUtil.java
@@ -61,13 +61,7 @@ public class TemplateInstanceUtil {
}
public static ICPPTemplateArgument[] getTemplateArguments(ICompositesFactory cf, ICPPClassTemplatePartialSpecialization rbinding) {
- try {
- return convert(cf, rbinding.getTemplateArguments());
- } catch (DOMException e) {
- // index bindings don't throw DOMExceptions
- assert false;
- }
- return ICPPTemplateArgument.EMPTY_ARGUMENTS;
+ return convert(cf, rbinding.getTemplateArguments());
}
public static IBinding getSpecializedBinding(ICompositesFactory cf, IIndexBinding rbinding) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java
index 01c73df88c..f6e4161314 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java
@@ -33,7 +33,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTemplateParameter;
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.cpp.CPPDeferredClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
@@ -303,20 +302,15 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
}
@Override
- public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
+ public final ICPPDeferredClassInstance asDeferredInstance() {
PDOMInstanceCache cache= PDOMInstanceCache.getCache(this);
synchronized (cache) {
ICPPDeferredClassInstance dci= cache.getDeferredInstance();
if (dci == null) {
- dci= createDeferredInstance();
+ dci= CPPTemplates.createDeferredInstance(this);
cache.putDeferredInstance(dci);
}
return dci;
}
}
-
- protected ICPPDeferredClassInstance createDeferredInstance() throws DOMException {
- ICPPTemplateArgument[] args = CPPTemplates.templateParametersAsArguments(getTemplateParameters());
- return new CPPDeferredClassInstance(this, args, getCompositeScope());
- }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplatePartialSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplatePartialSpecialization.java
index c5e4af6af9..56b8be83af 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplatePartialSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplatePartialSpecialization.java
@@ -18,13 +18,13 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
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.ICPPSpecialization;
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.ICPPTemplateParameterMap;
import org.eclipse.cdt.core.parser.util.ObjectMap;
import org.eclipse.cdt.internal.core.Util;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassTemplatePartialSpecialization;
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.IndexCPPSignatureUtil;
@@ -184,25 +184,7 @@ class PDOMCPPClassTemplatePartialSpecialization extends PDOMCPPClassTemplate
}
final ICPPClassTemplatePartialSpecialization rhs = (ICPPClassTemplatePartialSpecialization)type;
- try {
- ICPPClassType ct1= getPrimaryClassTemplate();
- ICPPClassType ct2= rhs.getPrimaryClassTemplate();
- if(!ct1.isSameType(ct2))
- return false;
-
- ICPPTemplateArgument[] args1= getTemplateArguments();
- ICPPTemplateArgument[] args2= rhs.getTemplateArguments();
- if (args1.length != args2.length)
- return false;
-
- for (int i = 0; i < args2.length; i++) {
- if (args1[i].isSameValue(args2[i]))
- return false;
- }
- } catch (DOMException e) {
- return false;
- }
- return true;
+ return CPPClassTemplatePartialSpecialization.isSamePartialClassSpecialization(this, rhs);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java
index 4e2c110e1b..f53318c54a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
-import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IType;
@@ -26,7 +25,6 @@ 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.parser.util.CharArrayUtils;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPDeferredClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
@@ -169,20 +167,15 @@ class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization
}
@Override
- public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
+ public final ICPPDeferredClassInstance asDeferredInstance() {
PDOMInstanceCache cache= PDOMInstanceCache.getCache(this);
synchronized (cache) {
ICPPDeferredClassInstance dci= cache.getDeferredInstance();
if (dci == null) {
- dci= createDeferredInstance();
+ dci= CPPTemplates.createDeferredInstance(this);
cache.putDeferredInstance(dci);
}
return dci;
}
}
-
- protected ICPPDeferredClassInstance createDeferredInstance() throws DOMException {
- ICPPTemplateArgument[] args = CPPTemplates.templateParametersAsArguments(getTemplateParameters());
- return new CPPDeferredClassInstance(this, args, getCompositeScope());
- }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java
index 4f93fd5141..0ca965e826 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java
@@ -186,8 +186,6 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
partial.setArguments(args);
} catch (CoreException e) {
CCorePlugin.log(e);
- } catch (DOMException e) {
- CCorePlugin.log(e);
} finally {
partial = null;
binding = null;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java
index 091b5db727..1d876f39df 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java
@@ -363,7 +363,7 @@ public class PDOMCPPTemplateTemplateParameter extends PDOMCPPBinding
}
@Override
- public ICPPDeferredClassInstance asDeferredInstance() throws DOMException {
+ public ICPPDeferredClassInstance asDeferredInstance() {
return null;
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexLabelProvider.java
index cc1205827e..d7791aeabe 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexLabelProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexLabelProvider.java
@@ -23,7 +23,6 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.cdt.core.dom.IPDOMNode;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
-import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.IEnumeration;
import org.eclipse.cdt.core.dom.ast.IEnumerator;
@@ -112,15 +111,11 @@ public class IndexLabelProvider extends LabelProvider {
StringBuffer buffer = new StringBuffer("Part: "); //$NON-NLS-1$
buffer.append(result);
buffer.append('<');
- try {
- ICPPTemplateArgument[] types = ((ICPPClassTemplatePartialSpecialization) element).getTemplateArguments();
- for (int i = 0; i < types.length; i++) {
- if (i > 0)
- buffer.append(',');
- buffer.append(ASTTypeUtil.getArgumentString(types[i], false));
- }
- } catch (DOMException e) {
- buffer.append(e.getProblem().toString());
+ ICPPTemplateArgument[] types = ((ICPPClassTemplatePartialSpecialization) element).getTemplateArguments();
+ for (int i = 0; i < types.length; i++) {
+ if (i > 0)
+ buffer.append(',');
+ buffer.append(ASTTypeUtil.getArgumentString(types[i], false));
}
buffer.append('>');
result = buffer.toString();

Back to the top