mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
bug 73869: exceptions while parsing boost headers
This commit is contained in:
parent
5bb3a3f5a1
commit
aec1c2f69e
6 changed files with 27 additions and 12 deletions
|
@ -62,6 +62,9 @@ public class CPPNamespace implements ICPPNamespace, ICPPInternalBinding {
|
|||
ICPPASTTranslationUnit tu = null;
|
||||
public CPPNamespace( ICPPASTNamespaceDefinition nsDef ){
|
||||
findAllDefinitions( nsDef );
|
||||
if( namespaceDefinitions.length == 0 ){
|
||||
namespaceDefinitions = (IASTName[]) ArrayUtil.append( IASTName.class, namespaceDefinitions, nsDef.getName() );
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -2215,7 +2215,7 @@ public class CPPSemantics {
|
|||
numSourceParams = ( useImplicitObj ) ? sourceParameters.length + 1 : sourceParameters.length;
|
||||
int numTargetParams = 0;
|
||||
|
||||
if( currFnCost == null ){
|
||||
if( currFnCost == null || currFnCost.length != ((numSourceParams == 0) ? 1 : numSourceParams) ){
|
||||
currFnCost = new Cost [ (numSourceParams == 0) ? 1 : numSourceParams ];
|
||||
}
|
||||
|
||||
|
@ -2279,8 +2279,10 @@ public class CPPSemantics {
|
|||
//In order for this function to be better than the previous best, it must
|
||||
//have at least one parameter match that is better that the corresponding
|
||||
//match for the other function, and none that are worse.
|
||||
for( int j = 0; j < numSourceParams || j == 0; j++ ){
|
||||
if( currFnCost[ j ].rank < 0 ){
|
||||
int len = ( bestFnCost == null || currFnCost.length < bestFnCost.length ) ? currFnCost.length : bestFnCost.length;
|
||||
for( int j = 1; j <= len; j++ ){
|
||||
Cost currCost = currFnCost[ currFnCost.length - j ];
|
||||
if( currCost.rank < 0 ){
|
||||
hasWorse = true;
|
||||
hasBetter = false;
|
||||
break;
|
||||
|
@ -2288,10 +2290,9 @@ public class CPPSemantics {
|
|||
|
||||
//an ambiguity in the user defined conversion sequence is only a problem
|
||||
//if this function turns out to be the best.
|
||||
currHasAmbiguousParam = ( currFnCost[ j ].userDefined == 1 );
|
||||
|
||||
currHasAmbiguousParam = ( currCost.userDefined == 1 );
|
||||
if( bestFnCost != null ){
|
||||
comparison = currFnCost[ j ].compare( bestFnCost[ j ] );
|
||||
comparison = currCost.compare( bestFnCost[ bestFnCost.length - j ] );
|
||||
hasWorse |= ( comparison < 0 );
|
||||
hasBetter |= ( comparison > 0 );
|
||||
} else {
|
||||
|
|
|
@ -150,6 +150,11 @@ public abstract class CPPTemplateDefinition implements ICPPTemplateDefinition, I
|
|||
}
|
||||
|
||||
public void addSpecialization( IType [] types, ICPPSpecialization spec ){
|
||||
if( types == null )
|
||||
return;
|
||||
for( int i = 0; i < types.length; i++ )
|
||||
if( types[i] == null )
|
||||
return;
|
||||
if( instances == null )
|
||||
instances = new ObjectMap( 2 );
|
||||
instances.put( types, spec );
|
||||
|
|
|
@ -488,7 +488,7 @@ public class CPPTemplates {
|
|||
else if( !t.isSameType( arg ) ){
|
||||
continue outer;
|
||||
}
|
||||
} else if( arg == null || !matchTemplateParameterAndArgument( param, arg )){
|
||||
} else if( arg == null || !matchTemplateParameterAndArgument( param, arg, map )){
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
|
@ -541,7 +541,7 @@ public class CPPTemplates {
|
|||
arg = (IType) map.get( param );
|
||||
}
|
||||
|
||||
if( arg == null || !matchTemplateParameterAndArgument( param, arg ) )
|
||||
if( arg == null || !matchTemplateParameterAndArgument( param, arg, map ) )
|
||||
return null;
|
||||
|
||||
result[i] = arg;
|
||||
|
@ -1394,7 +1394,7 @@ public class CPPTemplates {
|
|||
//TODO
|
||||
return true;
|
||||
}
|
||||
static protected boolean matchTemplateParameterAndArgument( ICPPTemplateParameter param, IType argument ){
|
||||
static protected boolean matchTemplateParameterAndArgument( ICPPTemplateParameter param, IType argument, ObjectMap map ){
|
||||
if( !isValidArgument(param, argument) ){
|
||||
return false;
|
||||
}
|
||||
|
@ -1431,6 +1431,9 @@ public class CPPTemplates {
|
|||
} else {
|
||||
try {
|
||||
IType pType = ((ICPPTemplateNonTypeParameter)param).getType();
|
||||
if( map != null && pType != null && map.containsKey( pType ) ){
|
||||
pType = (IType) map.get( pType );
|
||||
}
|
||||
Cost cost = CPPSemantics.checkStandardConversionSequence( argument, pType );
|
||||
|
||||
if( cost == null || cost.rank == Cost.NO_MATCH_RANK ){
|
||||
|
@ -1532,7 +1535,7 @@ public class CPPTemplates {
|
|||
}
|
||||
}
|
||||
|
||||
if( CPPTemplates.matchTemplateParameterAndArgument( param, arg ) ){
|
||||
if( CPPTemplates.matchTemplateParameterAndArgument( param, arg, map ) ){
|
||||
map.put( param, arg );
|
||||
actualArgs[i] = arg;
|
||||
} else {
|
||||
|
|
|
@ -821,7 +821,10 @@ public class CPPVisitor {
|
|||
}
|
||||
}
|
||||
} catch( DOMException e ){
|
||||
return e.getProblem();
|
||||
IProblemBinding problem = e.getProblem();
|
||||
if( problem instanceof ICPPScope )
|
||||
return problem;
|
||||
return new CPPScope.CPPScopeProblem( problem.getASTNode(), problem.getID(), problem.getNameCharArray() );
|
||||
}
|
||||
return getContainingScope( parent );
|
||||
}
|
||||
|
|
|
@ -1894,7 +1894,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
name = operatorId(start, null);
|
||||
else {
|
||||
backup(mark);
|
||||
throwBacktrack(start.getOffset(), end.getEndOffset()
|
||||
throwBacktrack(start.getOffset(), (end != null ? end.getEndOffset() : start.getEndOffset())
|
||||
- start.getOffset());
|
||||
}
|
||||
} else if (LT(1) == IToken.t_operator)
|
||||
|
|
Loading…
Add table
Reference in a new issue