mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
avoid infinite recursive loop (caused by malformed AST) by requiring that the declaration of the type of a function parameter occurs before
the start of that function's declarator
This commit is contained in:
parent
b4a9f10228
commit
975dc239e9
1 changed files with 10 additions and 0 deletions
|
@ -1383,6 +1383,16 @@ public class CPPSemantics {
|
||||||
} else if( obj instanceof ASTNode ){
|
} else if( obj instanceof ASTNode ){
|
||||||
nd = (ASTNode) obj;
|
nd = (ASTNode) obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//avoid recursive loops in case of a malformed AST by requiring the decl of the type of a function parameter
|
||||||
|
//to occur before the start of that function's declarator.
|
||||||
|
if( node instanceof IASTName && node.getPropertyInParent() == IASTNamedTypeSpecifier.NAME ) {
|
||||||
|
IASTNode n = node.getParent();
|
||||||
|
if( n.getPropertyInParent() == IASTParameterDeclaration.DECL_SPECIFIER ){
|
||||||
|
node = (ASTNode) n.getParent().getParent(); //parent is param, parent.parent is fnDtor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( nd != null ){
|
if( nd != null ){
|
||||||
int pointOfDecl = 0;
|
int pointOfDecl = 0;
|
||||||
ASTNodeProperty prop = nd.getPropertyInParent();
|
ASTNodeProperty prop = nd.getPropertyInParent();
|
||||||
|
|
Loading…
Add table
Reference in a new issue