mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 356818: Explicit instance, which would be illegal as implicit one.
This commit is contained in:
parent
ad4729d954
commit
7d0c06294a
20 changed files with 134 additions and 87 deletions
|
@ -5466,4 +5466,19 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
ICPPTemplateInstance inst= bh.assertNonProblem("f() {", 1);
|
||||
assertSame(template, inst.getTemplateDefinition());
|
||||
}
|
||||
|
||||
// template<typename T1,typename T2> class A{};
|
||||
// template<typename T1> class A<T1, int>{};
|
||||
// template<typename T2> class A<int, T2>{};
|
||||
// template<> class A<int, int>;
|
||||
// A<int, int> fooA();
|
||||
//
|
||||
// template<typename T1,typename T2> class B{};
|
||||
// template<typename T1> class B<T1, int>{};
|
||||
// template<typename T2> class B<int, T2>{};
|
||||
// template<> class B<int, int> {};
|
||||
// A<int, int> fooB();
|
||||
public void testExplicitSpecializationOfForbiddenAsImplicit_356818() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
|
|||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IMacroBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
final class TestMacro implements IMacroBinding {
|
||||
private String fName;
|
||||
|
@ -36,7 +35,7 @@ final class TestMacro implements IMacroBinding {
|
|||
return fParams != null;
|
||||
}
|
||||
|
||||
public ILinkage getLinkage() throws CoreException {
|
||||
public ILinkage getLinkage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1558,11 +1558,11 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
|
||||
ICPPTemplateInstance inst= (ICPPTemplateInstance) t1;
|
||||
final ICPPClassTemplate tmplDef = (ICPPClassTemplate) inst.getTemplateDefinition();
|
||||
IBinding inst2= CPPTemplates.instantiate(tmplDef, inst.getTemplateArguments(), false);
|
||||
IBinding inst2= CPPTemplates.instantiate(tmplDef, inst.getTemplateArguments());
|
||||
assertSame(inst, inst2);
|
||||
|
||||
IBinding charInst1= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateArgument(new CPPBasicType(Kind.eChar, 0))}, false);
|
||||
IBinding charInst2= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateArgument(new CPPBasicType(Kind.eChar, 0))}, false);
|
||||
IBinding charInst1= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateArgument(new CPPBasicType(Kind.eChar, 0))});
|
||||
IBinding charInst2= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateArgument(new CPPBasicType(Kind.eChar, 0))});
|
||||
assertSame(charInst1, charInst2);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
|
||||
/**
|
||||
|
@ -42,7 +41,7 @@ public interface IBinding extends IAdaptable {
|
|||
* Returns the linkage the binding belongs to. C++-declarations declared as
|
||||
* extern "C" will still return c++-linkage.
|
||||
*/
|
||||
public ILinkage getLinkage() throws CoreException;
|
||||
public ILinkage getLinkage();
|
||||
|
||||
/**
|
||||
* Returns the binding that owns this binding, or <code>null</code> if there is no owner.
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
|
@ -45,6 +46,17 @@ public class CPPClassInstance extends CPPClassSpecialization implements ICPPTemp
|
|||
return arguments;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ICPPClassSpecializationScope getSpecializationScope() {
|
||||
// An instance with a declaration has no specialization scope.
|
||||
checkForDefinition();
|
||||
final IASTNode[] decls = getDeclarations();
|
||||
if (decls != null && decls.length > 0 && decls[0] != null)
|
||||
return null;
|
||||
|
||||
return super.getSpecializationScope();
|
||||
}
|
||||
|
||||
public boolean isExplicitSpecialization() {
|
||||
return !(getCompositeScope() instanceof ICPPClassSpecializationScope);
|
||||
}
|
||||
|
|
|
@ -26,9 +26,8 @@ import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
|||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
||||
|
@ -83,9 +82,10 @@ public class CPPClassSpecialization extends CPPSpecialization
|
|||
}
|
||||
}
|
||||
|
||||
private class FindDefinitionAction extends ASTVisitor {
|
||||
private class FindDeclarationDefinitionAction extends ASTVisitor {
|
||||
private char [] nameArray = CPPClassSpecialization.this.getNameCharArray();
|
||||
public IASTName result = null;
|
||||
public IASTName foundDef = null;
|
||||
public IASTName foundDecl = null;
|
||||
|
||||
{
|
||||
shouldVisitNames = true;
|
||||
|
@ -95,32 +95,27 @@ public class CPPClassSpecialization extends CPPSpecialization
|
|||
}
|
||||
|
||||
@Override
|
||||
public int visit( IASTName name ){
|
||||
if( name instanceof ICPPASTTemplateId )
|
||||
return PROCESS_SKIP;
|
||||
if( name instanceof ICPPASTQualifiedName )
|
||||
return PROCESS_CONTINUE;
|
||||
char[] c = name.getLookupKey();
|
||||
|
||||
if (name.getParent() instanceof ICPPASTQualifiedName) {
|
||||
IASTName[] ns = ((ICPPASTQualifiedName) name.getParent()).getNames();
|
||||
if (ns[ns.length - 1] != name)
|
||||
return PROCESS_CONTINUE;
|
||||
name = (IASTName) name.getParent();
|
||||
}
|
||||
|
||||
if (name.getParent() instanceof ICPPASTCompositeTypeSpecifier && CharArrayUtils.equals(c, nameArray)) {
|
||||
IBinding binding = name.resolveBinding();
|
||||
if (binding == CPPClassSpecialization.this) {
|
||||
if (name instanceof ICPPASTQualifiedName) {
|
||||
IASTName[] ns = ((ICPPASTQualifiedName) name).getNames();
|
||||
name = ns[ns.length - 1];
|
||||
public int visit(IASTName name) {
|
||||
final IASTNode parent = name.getParent();
|
||||
final boolean isDef = parent instanceof ICPPASTCompositeTypeSpecifier;
|
||||
final boolean isDecl = !isDef && parent instanceof ICPPASTElaboratedTypeSpecifier
|
||||
&& parent.getParent() instanceof IASTSimpleDeclaration;
|
||||
if (isDef || isDecl) {
|
||||
name= name.getLastName();
|
||||
if (CharArrayUtils.equals(name.getLookupKey(), nameArray)) {
|
||||
IBinding binding = name.resolveBinding();
|
||||
if (binding == CPPClassSpecialization.this) {
|
||||
if (isDef) {
|
||||
foundDef= name;
|
||||
return PROCESS_ABORT;
|
||||
}
|
||||
if (foundDecl == null)
|
||||
foundDecl= name;
|
||||
}
|
||||
result = name;
|
||||
return PROCESS_ABORT;
|
||||
}
|
||||
}
|
||||
return PROCESS_CONTINUE;
|
||||
// Don't look at members of qualified names or template ids.
|
||||
return PROCESS_SKIP;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -155,9 +150,12 @@ public class CPPClassSpecialization extends CPPSpecialization
|
|||
orig= ((ICPPSpecialization) orig).getSpecializedBinding();
|
||||
}
|
||||
if (tu != null) {
|
||||
FindDefinitionAction action= new FindDefinitionAction();
|
||||
FindDeclarationDefinitionAction action= new FindDeclarationDefinitionAction();
|
||||
tu.accept( action );
|
||||
definition = action.result;
|
||||
definition = action.foundDef;
|
||||
if (definition == null && action.foundDecl != null) {
|
||||
addDeclaration(action.foundDecl);
|
||||
}
|
||||
}
|
||||
checked = true;
|
||||
}
|
||||
|
@ -260,10 +258,14 @@ public class CPPClassSpecialization extends CPPSpecialization
|
|||
if (specScope != null)
|
||||
return specScope;
|
||||
|
||||
return getCompositeTypeSpecifier().getScope();
|
||||
final ICPPASTCompositeTypeSpecifier typeSpecifier = getCompositeTypeSpecifier();
|
||||
if (typeSpecifier != null)
|
||||
return typeSpecifier.getScope();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private ICPPClassSpecializationScope getSpecializationScope() {
|
||||
protected ICPPClassSpecializationScope getSpecializationScope() {
|
||||
checkForDefinition();
|
||||
if (getDefinition() != null)
|
||||
return null;
|
||||
|
|
|
@ -351,7 +351,7 @@ public class CPPScopeMapper {
|
|||
if (template instanceof IIndexBinding && template instanceof ICPPClassType) {
|
||||
IBinding mapped= mapToAST((ICPPClassType) template);
|
||||
if (mapped != template && mapped instanceof ICPPClassType) {
|
||||
mapped= CPPTemplates.instantiate((ICPPClassTemplate) mapped, inst.getTemplateArguments(), false);
|
||||
mapped= CPPTemplates.instantiate((ICPPClassTemplate) mapped, inst.getTemplateArguments());
|
||||
if (mapped instanceof ICPPClassType)
|
||||
return (ICPPClassType) mapped;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
|
|||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateTypeParameter;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
* This class represents a template function used for deducing 'auto' types (C++0x: 7.1.6.4).
|
||||
|
@ -115,7 +114,7 @@ class AutoTypeResolver implements ICPPFunctionTemplate {
|
|||
throw new UnsupportedOperationException(UNEXPECTED_CALL);
|
||||
}
|
||||
|
||||
public ILinkage getLinkage() throws CoreException {
|
||||
public ILinkage getLinkage() {
|
||||
throw new UnsupportedOperationException(UNEXPECTED_CALL);
|
||||
}
|
||||
|
||||
|
|
|
@ -373,7 +373,7 @@ public class CPPSemantics {
|
|||
if (data.tu != null) {
|
||||
ICPPASTTemplateId id = (ICPPASTTemplateId) data.astName;
|
||||
ICPPTemplateArgument[] args = CPPTemplates.createTemplateArgumentArray(id);
|
||||
IBinding inst= CPPTemplates.instantiate((ICPPClassTemplate) cls, args, false);
|
||||
IBinding inst= CPPTemplates.instantiate((ICPPClassTemplate) cls, args);
|
||||
if (inst instanceof ICPPClassType) {
|
||||
cls= (ICPPClassType) inst;
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeTemplateParameter;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplatedTypeTemplateParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
||||
|
@ -155,11 +156,19 @@ public class CPPTemplates {
|
|||
private static final int PACK_SIZE_NOT_FOUND = Integer.MAX_VALUE;
|
||||
private static final ICPPFunction[] NO_FUNCTIONS = {};
|
||||
static enum TypeSelection {PARAMETERS, RETURN_TYPE, PARAMETERS_AND_RETURN_TYPE}
|
||||
|
||||
/**
|
||||
* Instantiates a class template with the given arguments. May return <code>null</code>.
|
||||
*/
|
||||
public static IBinding instantiate(ICPPClassTemplate template, ICPPTemplateArgument[] args) {
|
||||
return instantiate(template, args, false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a class template with the given arguments. May return <code>null</code>.
|
||||
*/
|
||||
public static IBinding instantiate(ICPPClassTemplate template, ICPPTemplateArgument[] args, boolean isDef) {
|
||||
private static IBinding instantiate(ICPPClassTemplate template, ICPPTemplateArgument[] args,
|
||||
boolean isDefinition, boolean isExplicitSpecialization) {
|
||||
try {
|
||||
// Add default arguments, if necessary.
|
||||
ICPPTemplateArgument[] arguments= SemanticUtil.getSimplifiedArguments(args);
|
||||
|
@ -172,7 +181,7 @@ public class CPPTemplates {
|
|||
}
|
||||
|
||||
if (template instanceof ICPPClassTemplatePartialSpecialization) {
|
||||
return instantiatePartialSpecialization((ICPPClassTemplatePartialSpecialization) template, arguments, isDef, null);
|
||||
return instantiatePartialSpecialization((ICPPClassTemplatePartialSpecialization) template, arguments, isDefinition, null);
|
||||
}
|
||||
|
||||
|
||||
|
@ -222,15 +231,17 @@ public class CPPTemplates {
|
|||
map.put(param, pack);
|
||||
}
|
||||
|
||||
ICPPTemplateInstance prim= getInstance(template, arguments, isDef);
|
||||
if (prim != null && prim.isExplicitSpecialization())
|
||||
ICPPTemplateInstance prim= getInstance(template, arguments, isDefinition);
|
||||
if (prim != null && (isExplicitSpecialization || prim.isExplicitSpecialization()))
|
||||
return prim;
|
||||
|
||||
IBinding result= CPPTemplates.selectSpecialization(template, arguments, isDef);
|
||||
if (result != null)
|
||||
return result;
|
||||
if (!isExplicitSpecialization) {
|
||||
IBinding result= CPPTemplates.selectSpecialization(template, arguments, isDefinition);
|
||||
if (result != null)
|
||||
return result;
|
||||
}
|
||||
|
||||
return instantiatePrimaryTemplate(template, arguments, map, isDef);
|
||||
return instantiatePrimaryTemplate(template, arguments, map, isDefinition);
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
}
|
||||
|
@ -620,23 +631,26 @@ public class CPPTemplates {
|
|||
parentOfName = parentOfName.getParent();
|
||||
}
|
||||
|
||||
boolean isDecl= false;
|
||||
boolean isDef= false;
|
||||
if (isLastName) {
|
||||
if (parentOfName instanceof ICPPASTElaboratedTypeSpecifier) {
|
||||
IASTNode parentOfDeclaration= parentOfName;
|
||||
while (parentOfDeclaration != null) {
|
||||
if (parentOfDeclaration instanceof IASTDeclaration) {
|
||||
parentOfDeclaration= parentOfDeclaration.getParent();
|
||||
break;
|
||||
boolean isDeclaration= false;
|
||||
boolean isDefinition= false;
|
||||
boolean isExplicitSpecialization= false;
|
||||
if (isLastName && parentOfName != null) {
|
||||
IASTNode declaration= parentOfName.getParent();
|
||||
if (declaration instanceof IASTSimpleDeclaration) {
|
||||
if (parentOfName instanceof ICPPASTElaboratedTypeSpecifier) {
|
||||
isDeclaration= true;
|
||||
} else if (parentOfName instanceof ICPPASTCompositeTypeSpecifier) {
|
||||
isDefinition= true;
|
||||
}
|
||||
if (isDeclaration || isDefinition) {
|
||||
IASTNode parentOfDeclaration = declaration.getParent();
|
||||
if (parentOfDeclaration instanceof ICPPASTExplicitTemplateInstantiation) {
|
||||
isDeclaration= false;
|
||||
} else if (parentOfDeclaration instanceof ICPPASTTemplateSpecialization) {
|
||||
isExplicitSpecialization= true;
|
||||
}
|
||||
parentOfDeclaration= parentOfDeclaration.getParent();
|
||||
}
|
||||
|
||||
isDecl= !(parentOfDeclaration instanceof ICPPASTExplicitTemplateInstantiation);
|
||||
} else if (parentOfName instanceof ICPPASTCompositeTypeSpecifier) {
|
||||
isDef= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
// class template instance
|
||||
|
@ -669,7 +683,7 @@ public class CPPTemplates {
|
|||
result= classTemplate;
|
||||
} else {
|
||||
ICPPClassTemplatePartialSpecialization partialSpec= findPartialSpecialization(classTemplate, args);
|
||||
if (isDecl || isDef) {
|
||||
if (isDeclaration || isDefinition) {
|
||||
if (partialSpec == null) {
|
||||
partialSpec = new CPPClassTemplatePartialSpecialization(id);
|
||||
if (template instanceof ICPPInternalClassTemplate)
|
||||
|
@ -684,11 +698,11 @@ public class CPPTemplates {
|
|||
}
|
||||
}
|
||||
if (result == null) {
|
||||
result= instantiate(classTemplate, args, isDef);
|
||||
result= instantiate(classTemplate, args, isDefinition, isExplicitSpecialization);
|
||||
if (result instanceof ICPPInternalBinding) {
|
||||
if (isDecl) {
|
||||
if (isDeclaration) {
|
||||
ASTInternal.addDeclaration(result, id);
|
||||
} else if (isDef) {
|
||||
} else if (isDefinition) {
|
||||
ASTInternal.addDefinition(result, id);
|
||||
}
|
||||
}
|
||||
|
@ -2320,7 +2334,7 @@ public class CPPTemplates {
|
|||
ICPPTemplateArgument[] newArgs = CPPTemplates.instantiateArguments(
|
||||
((ICPPUnknownClassInstance) unknown).getArguments(), tpMap, packOffset, within);
|
||||
if (result instanceof ICPPClassTemplate) {
|
||||
result = instantiate((ICPPClassTemplate) result, newArgs, false);
|
||||
result = instantiate((ICPPClassTemplate) result, newArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2349,7 +2363,7 @@ public class CPPTemplates {
|
|||
}
|
||||
|
||||
if (changed) {
|
||||
IBinding inst= instantiate(classTemplate, newArgs, false);
|
||||
IBinding inst= instantiate(classTemplate, newArgs);
|
||||
if (inst != null)
|
||||
return inst;
|
||||
}
|
||||
|
|
|
@ -1893,7 +1893,7 @@ public class CPPVisitor extends ASTQueries {
|
|||
return new ProblemType(ISemanticProblem.TYPE_CANNOT_DEDUCE_AUTO_TYPE);
|
||||
}
|
||||
type = (IType) CPPTemplates.instantiate(initializer_list_template,
|
||||
new ICPPTemplateArgument[] { new CPPTemplateArgument(type) }, true);
|
||||
new ICPPTemplateArgument[] { new CPPTemplateArgument(type) });
|
||||
if (type instanceof IProblemBinding) {
|
||||
return new ProblemType(ISemanticProblem.TYPE_CANNOT_DEDUCE_AUTO_TYPE);
|
||||
}
|
||||
|
@ -1924,7 +1924,7 @@ public class CPPVisitor extends ASTQueries {
|
|||
type = argument.getTypeValue();
|
||||
if (initClause instanceof ICPPASTInitializerList) {
|
||||
type = (IType) CPPTemplates.instantiate(initializer_list_template,
|
||||
new ICPPTemplateArgument[] { new CPPTemplateArgument(type) }, true);
|
||||
new ICPPTemplateArgument[] { new CPPTemplateArgument(type) });
|
||||
}
|
||||
return decorateType(type, declSpec, declarator);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
|||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public class CPPTypedefClone implements ITypedef, ITypeContainer, IIndexType, ICPPBinding {
|
||||
protected final ITypedef delegate;
|
||||
|
@ -35,7 +34,7 @@ public class CPPTypedefClone implements ITypedef, ITypeContainer, IIndexType, IC
|
|||
return type;
|
||||
}
|
||||
|
||||
public ILinkage getLinkage() throws CoreException {
|
||||
public ILinkage getLinkage() {
|
||||
return delegate.getLinkage();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public interface IIndexFragmentBinding extends IIndexBinding {
|
|||
/**
|
||||
* Returns the linkage the binding belongs to.
|
||||
*/
|
||||
ILinkage getLinkage() throws CoreException;
|
||||
ILinkage getLinkage();
|
||||
|
||||
/**
|
||||
* Returns whether this binding has any definitions associated with it
|
||||
|
|
|
@ -46,7 +46,7 @@ public abstract class CompositeIndexBinding implements IIndexBinding {
|
|||
this.rbinding = rbinding;
|
||||
}
|
||||
|
||||
public ILinkage getLinkage() throws CoreException {
|
||||
public ILinkage getLinkage() {
|
||||
return rbinding.getLinkage();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.pdom.dom;
|
|||
import org.eclipse.cdt.core.dom.IPDOMNode;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
* Marker for bindings in the pdom
|
||||
|
@ -33,5 +32,5 @@ public interface IPDOMBinding extends IPDOMNode, IIndexFragmentBinding {
|
|||
/**
|
||||
* Returns the linkage of the binding.
|
||||
*/
|
||||
PDOMLinkage getLinkage() throws CoreException;
|
||||
PDOMLinkage getLinkage();
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||
import org.eclipse.cdt.core.parser.IToken;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public class PDOMASTAdapter {
|
||||
private static class AnonymousASTName implements IASTName {
|
||||
|
@ -253,7 +252,7 @@ public class PDOMASTAdapter {
|
|||
return fDelegate.getEnumerators();
|
||||
}
|
||||
|
||||
public ILinkage getLinkage() throws CoreException {
|
||||
public ILinkage getLinkage() {
|
||||
return fDelegate.getLinkage();
|
||||
}
|
||||
|
||||
|
@ -321,7 +320,7 @@ public class PDOMASTAdapter {
|
|||
return fDelegate.getKey();
|
||||
}
|
||||
|
||||
public ILinkage getLinkage() throws CoreException {
|
||||
public ILinkage getLinkage() {
|
||||
return fDelegate.getLinkage();
|
||||
}
|
||||
|
||||
|
@ -395,7 +394,7 @@ public class PDOMASTAdapter {
|
|||
return fDelegate.getAdapter(adapter);
|
||||
}
|
||||
|
||||
public ILinkage getLinkage() throws CoreException {
|
||||
public ILinkage getLinkage() {
|
||||
return fDelegate.getLinkage();
|
||||
}
|
||||
|
||||
|
|
|
@ -357,8 +357,8 @@ public class PDOMMacro implements IIndexMacro, IPDOMBinding, IASTFileLocation {
|
|||
return false;
|
||||
}
|
||||
|
||||
public PDOMLinkage getLinkage() throws CoreException {
|
||||
return getFile().getLinkage();
|
||||
public PDOMLinkage getLinkage() {
|
||||
return fLinkage;
|
||||
}
|
||||
|
||||
public IIndexScope getScope() {
|
||||
|
|
|
@ -77,6 +77,12 @@ class PDOMCPPClassInstance extends PDOMCPPClassSpecialization implements ICPPTem
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasOwnScope() throws CoreException {
|
||||
// An instance with a declaration does not use the original template.
|
||||
return hasDeclaration();
|
||||
}
|
||||
|
||||
public boolean isExplicitSpecialization() {
|
||||
return !(getCompositeScope() instanceof ICPPClassSpecializationScope);
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements
|
|||
public ICPPClassScope getCompositeScope() {
|
||||
if (fScope == null) {
|
||||
try {
|
||||
if (hasDefinition()) {
|
||||
if (hasOwnScope()) {
|
||||
fScope= new PDOMCPPClassScope(this);
|
||||
return fScope;
|
||||
}
|
||||
|
@ -140,6 +140,10 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements
|
|||
return fScope;
|
||||
}
|
||||
|
||||
protected boolean hasOwnScope() throws CoreException {
|
||||
return hasDefinition();
|
||||
}
|
||||
|
||||
public PDOMCPPBase getFirstBase() throws CoreException {
|
||||
long rec = getDB().getRecPtr(record + FIRSTBASE);
|
||||
return rec != 0 ? new PDOMCPPBase(getLinkage(), rec) : null;
|
||||
|
|
|
@ -71,7 +71,7 @@ class PDOMCPPFunctionInstance extends PDOMCPPFunctionSpecialization implements I
|
|||
|
||||
public boolean isExplicitSpecialization() {
|
||||
try {
|
||||
return hasDefinition();
|
||||
return hasDeclaration();
|
||||
} catch (CoreException e) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue