mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 13:55:39 +02:00
Correct determination of default template arguments, bug 281781.
This commit is contained in:
parent
aa1e4bd52c
commit
be997b5279
4 changed files with 28 additions and 22 deletions
|
@ -43,13 +43,15 @@ public class CPPTemplateNonTypeParameter extends CPPTemplateParameter implements
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
for (IASTName name : nds) {
|
for (IASTName name : nds) {
|
||||||
IASTNode parent = name.getParent();
|
if (name != null) {
|
||||||
assert parent instanceof IASTDeclarator;
|
IASTNode parent = name.getParent();
|
||||||
if (parent instanceof IASTDeclarator) {
|
assert parent instanceof IASTDeclarator;
|
||||||
IASTDeclarator dtor = (IASTDeclarator) parent;
|
if (parent instanceof IASTDeclarator) {
|
||||||
IASTInitializer initializer = dtor.getInitializer();
|
IASTDeclarator dtor = (IASTDeclarator) parent;
|
||||||
if (initializer instanceof IASTInitializerExpression)
|
IASTInitializer initializer = dtor.getInitializer();
|
||||||
return ((IASTInitializerExpression) initializer).getExpression();
|
if (initializer instanceof IASTInitializerExpression)
|
||||||
|
return ((IASTInitializerExpression) initializer).getExpression();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -95,13 +95,15 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
|
||||||
if (nds == null || nds.length == 0)
|
if (nds == null || nds.length == 0)
|
||||||
return null;
|
return null;
|
||||||
for (IASTName nd : nds) {
|
for (IASTName nd : nds) {
|
||||||
IASTNode parent = nd.getParent();
|
if (nd != null) {
|
||||||
assert parent instanceof ICPPASTTemplatedTypeTemplateParameter;
|
IASTNode parent = nd.getParent();
|
||||||
if (parent instanceof ICPPASTTemplatedTypeTemplateParameter) {
|
assert parent instanceof ICPPASTTemplatedTypeTemplateParameter;
|
||||||
ICPPASTTemplatedTypeTemplateParameter param = (ICPPASTTemplatedTypeTemplateParameter) parent;
|
if (parent instanceof ICPPASTTemplatedTypeTemplateParameter) {
|
||||||
IASTExpression value = param.getDefaultValue();
|
ICPPASTTemplatedTypeTemplateParameter param = (ICPPASTTemplatedTypeTemplateParameter) parent;
|
||||||
if (value != null)
|
IASTExpression value = param.getDefaultValue();
|
||||||
return CPPVisitor.createType(value);
|
if (value != null)
|
||||||
|
return CPPVisitor.createType(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -50,13 +50,15 @@ public class CPPTemplateTypeParameter extends CPPTemplateParameter implements
|
||||||
if (nds == null || nds.length == 0)
|
if (nds == null || nds.length == 0)
|
||||||
return null;
|
return null;
|
||||||
for (IASTName nd : nds) {
|
for (IASTName nd : nds) {
|
||||||
IASTNode parent = nd.getParent();
|
if (nd != null) {
|
||||||
assert parent instanceof ICPPASTSimpleTypeTemplateParameter;
|
IASTNode parent = nd.getParent();
|
||||||
if (parent instanceof ICPPASTSimpleTypeTemplateParameter) {
|
assert parent instanceof ICPPASTSimpleTypeTemplateParameter;
|
||||||
ICPPASTSimpleTypeTemplateParameter simple = (ICPPASTSimpleTypeTemplateParameter) parent;
|
if (parent instanceof ICPPASTSimpleTypeTemplateParameter) {
|
||||||
IASTTypeId typeId = simple.getDefaultType();
|
ICPPASTSimpleTypeTemplateParameter simple = (ICPPASTSimpleTypeTemplateParameter) parent;
|
||||||
if (typeId != null)
|
IASTTypeId typeId = simple.getDefaultType();
|
||||||
return CPPVisitor.createType(typeId);
|
if (typeId != null)
|
||||||
|
return CPPVisitor.createType(typeId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -212,7 +212,7 @@ abstract public class PDOMWriter {
|
||||||
th= e;
|
th= e;
|
||||||
}
|
}
|
||||||
if (th != null) {
|
if (th != null) {
|
||||||
stati.add(createStatus(NLS.bind(Messages.PDOMWriter_errorWhileParsing, ifl.getURI().getPath(), th)));
|
stati.add(createStatus(NLS.bind(Messages.PDOMWriter_errorWhileParsing, ifl.getURI().getPath()), th));
|
||||||
}
|
}
|
||||||
if (i<ifls.length-1) {
|
if (i<ifls.length-1) {
|
||||||
updateFileCount(0, 0, 1); // update header count
|
updateFileCount(0, 0, 1); // update header count
|
||||||
|
|
Loading…
Add table
Reference in a new issue