From 975dc239e9a741e903e44c8ad5307b3db85ded7d Mon Sep 17 00:00:00 2001 From: Andrew Niefer Date: Mon, 11 Apr 2005 23:23:15 +0000 Subject: [PATCH] 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 --- .../cdt/internal/core/dom/parser/cpp/CPPSemantics.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java index 3db874d9f54..9d4fc96d2e4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java @@ -1383,6 +1383,16 @@ public class CPPSemantics { } else if( obj instanceof ASTNode ){ 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 ){ int pointOfDecl = 0; ASTNodeProperty prop = nd.getPropertyInParent();