mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 03:53:21 +02:00
Patch for Bryan - Bug 179173 Fixing a few exceptions.
This commit is contained in:
parent
57c6cf3ad2
commit
e855aa7a21
5 changed files with 32 additions and 13 deletions
|
@ -56,7 +56,7 @@ public class CPPClassInstance extends CPPInstance implements ICPPClassType, ICPP
|
||||||
ICPPBase [] bindings = cls.getBases();
|
ICPPBase [] bindings = cls.getBases();
|
||||||
for (int i = 0; i < bindings.length; i++) {
|
for (int i = 0; i < bindings.length; i++) {
|
||||||
IBinding base = bindings[i].getBaseClass();
|
IBinding base = bindings[i].getBaseClass();
|
||||||
if (base instanceof IType) {
|
if (bindings[i] instanceof CPPBaseClause && base instanceof IType) {
|
||||||
IType specBase = CPPTemplates.instantiateType((IType) base, argumentMap);
|
IType specBase = CPPTemplates.instantiateType((IType) base, argumentMap);
|
||||||
((CPPBaseClause)bindings[i]).setBaseClass((ICPPClassType)specBase);
|
((CPPBaseClause)bindings[i]).setBaseClass((ICPPClassType)specBase);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class CPPClassSpecialization extends CPPSpecialization implements
|
||||||
ICPPBase[] bindings = ((ICPPClassType)getSpecializedBinding()).getBases();
|
ICPPBase[] bindings = ((ICPPClassType)getSpecializedBinding()).getBases();
|
||||||
for (int i = 0; i < bindings.length; i++) {
|
for (int i = 0; i < bindings.length; i++) {
|
||||||
IBinding base = bindings[i].getBaseClass();
|
IBinding base = bindings[i].getBaseClass();
|
||||||
if (base instanceof IType) {
|
if (bindings[i] instanceof CPPBaseClause && base instanceof IType) {
|
||||||
IType specBase = CPPTemplates.instantiateType((IType) base, argumentMap);
|
IType specBase = CPPTemplates.instantiateType((IType) base, argumentMap);
|
||||||
((CPPBaseClause)bindings[i]).setBaseClass((ICPPClassType)specBase);
|
((CPPBaseClause)bindings[i]).setBaseClass((ICPPClassType)specBase);
|
||||||
}
|
}
|
||||||
|
|
|
@ -382,8 +382,9 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( spec != null ){
|
if (spec != null) {
|
||||||
((ICPPInternalBinding)spec).addDefinition( id );
|
if( spec instanceof ICPPInternalBinding )
|
||||||
|
((ICPPInternalBinding)spec).addDefinition( id );
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,11 +436,11 @@ public class CPPTemplates {
|
||||||
|
|
||||||
ICPPSpecialization spec = null;
|
ICPPSpecialization spec = null;
|
||||||
if( parent.getParent() instanceof ICPPASTExplicitTemplateInstantiation ){
|
if( parent.getParent() instanceof ICPPASTExplicitTemplateInstantiation ){
|
||||||
spec = ((ICPPInternalTemplate)function).getInstance( (IType[])map_types[1] );
|
spec = ((ICPPInternalTemplateInstantiator)function).getInstance( (IType[])map_types[1] );
|
||||||
if( spec == null )
|
if( spec == null )
|
||||||
spec = (ICPPSpecialization) CPPTemplates.createInstance( scope, function, (ObjectMap)map_types[0], (IType[])map_types[1] );
|
spec = (ICPPSpecialization) CPPTemplates.createInstance( scope, function, (ObjectMap)map_types[0], (IType[])map_types[1] );
|
||||||
} else {
|
} else {
|
||||||
spec = ((ICPPInternalTemplate)function).getInstance( (IType[])map_types[1] );
|
spec = ((ICPPInternalTemplateInstantiator)function).getInstance( (IType[])map_types[1] );
|
||||||
if( spec == null ) {
|
if( spec == null ) {
|
||||||
if( function instanceof ICPPConstructor )
|
if( function instanceof ICPPConstructor )
|
||||||
spec = new CPPConstructorSpecialization( function, scope, (ObjectMap) map_types[0] );
|
spec = new CPPConstructorSpecialization( function, scope, (ObjectMap) map_types[0] );
|
||||||
|
@ -449,12 +450,15 @@ public class CPPTemplates {
|
||||||
spec = new CPPFunctionSpecialization( function, scope, (ObjectMap) map_types[0] );
|
spec = new CPPFunctionSpecialization( function, scope, (ObjectMap) map_types[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( parent instanceof IASTSimpleDeclaration )
|
if (spec instanceof ICPPInternalBinding) {
|
||||||
((ICPPInternalBinding)spec).addDeclaration( name );
|
if( parent instanceof IASTSimpleDeclaration )
|
||||||
else if( parent instanceof IASTFunctionDefinition )
|
((ICPPInternalBinding)spec).addDeclaration( name );
|
||||||
((ICPPInternalBinding)spec).addDefinition( name );
|
else if( parent instanceof IASTFunctionDefinition )
|
||||||
|
((ICPPInternalBinding)spec).addDefinition( name );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
((ICPPInternalTemplate)function).addSpecialization( (IType[]) map_types[1], spec );
|
if (function instanceof ICPPInternalTemplate)
|
||||||
|
((ICPPInternalTemplate)function).addSpecialization( (IType[]) map_types[1], spec );
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
//TODO problem?
|
//TODO problem?
|
||||||
|
@ -1275,14 +1279,14 @@ public class CPPTemplates {
|
||||||
//Using the transformed parameter list, perform argument deduction against the other
|
//Using the transformed parameter list, perform argument deduction against the other
|
||||||
//function template
|
//function template
|
||||||
IType [] args = createArgsForFunctionTemplateOrdering( f1 );
|
IType [] args = createArgsForFunctionTemplateOrdering( f1 );
|
||||||
ICPPFunction function = (ICPPFunction) ((ICPPInternalTemplate)f1).instantiate( args );
|
ICPPFunction function = (ICPPFunction) ((ICPPInternalTemplateInstantiator)f1).instantiate( args );
|
||||||
|
|
||||||
ObjectMap m1 = null;
|
ObjectMap m1 = null;
|
||||||
if( function != null )
|
if( function != null )
|
||||||
m1 = deduceTemplateArguments( f2, function.getType().getParameterTypes() );
|
m1 = deduceTemplateArguments( f2, function.getType().getParameterTypes() );
|
||||||
|
|
||||||
args = createArgsForFunctionTemplateOrdering( f2 );
|
args = createArgsForFunctionTemplateOrdering( f2 );
|
||||||
function = (ICPPFunction) ((ICPPInternalTemplate)f2).instantiate( args );
|
function = (ICPPFunction) ((ICPPInternalTemplateInstantiator)f2).instantiate( args );
|
||||||
|
|
||||||
ObjectMap m2 = null;
|
ObjectMap m2 = null;
|
||||||
if( function != null )
|
if( function != null )
|
||||||
|
|
|
@ -573,6 +573,19 @@ public class CPPVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (binding instanceof IIndexBinding) {
|
||||||
|
ICPPASTTemplateDeclaration templateDecl = CPPTemplates.getTemplateDeclaration(name);
|
||||||
|
if (templateDecl != null) {
|
||||||
|
ICPPASTTemplateParameter[] params = templateDecl.getTemplateParameters();
|
||||||
|
for (int i = 0; i < params.length; i++) {
|
||||||
|
IASTName paramName = CPPTemplates.getTemplateParameterName(params[i]);
|
||||||
|
paramName.setBinding(null);
|
||||||
|
//unsetting the index bindings so that they
|
||||||
|
//can be re-resolved with normal bindings
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( scope instanceof ICPPClassScope ){
|
if( scope instanceof ICPPClassScope ){
|
||||||
if( isConstructor( scope, declarator) )
|
if( isConstructor( scope, declarator) )
|
||||||
binding = template ? (ICPPConstructor) new CPPConstructorTemplate( name )
|
binding = template ? (ICPPConstructor) new CPPConstructorTemplate( name )
|
||||||
|
|
|
@ -573,6 +573,8 @@ class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
return new PDOMCPPNamespaceAlias(pdom, record);
|
return new PDOMCPPNamespaceAlias(pdom, record);
|
||||||
case CPPBASICTYPE:
|
case CPPBASICTYPE:
|
||||||
return new PDOMCPPBasicType(pdom, record);
|
return new PDOMCPPBasicType(pdom, record);
|
||||||
|
case CPPPARAMETER:
|
||||||
|
return new PDOMCPPParameter(pdom, record);
|
||||||
case CPPENUMERATION:
|
case CPPENUMERATION:
|
||||||
return new PDOMCPPEnumeration(pdom, record);
|
return new PDOMCPPEnumeration(pdom, record);
|
||||||
case CPPENUMERATOR:
|
case CPPENUMERATOR:
|
||||||
|
|
Loading…
Add table
Reference in a new issue