diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java index 9dba1e44cce..66cc3129c3b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java @@ -30,6 +30,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IFunction; import org.eclipse.cdt.core.dom.ast.IFunctionType; import org.eclipse.cdt.core.dom.ast.IParameter; +import org.eclipse.cdt.core.dom.ast.IProblemBinding; import org.eclipse.cdt.core.dom.ast.IScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator; @@ -262,7 +263,14 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt if( size > 0 ){ for( int i = 0; i < size; i++ ){ IASTParameterDeclaration p = params[i]; - result[i] = (IParameter) p.getDeclarator().getName().resolveBinding(); + final IASTName name = p.getDeclarator().getName(); + final IBinding binding= name.resolveBinding(); + if (binding instanceof IParameter) { + result[i]= (IParameter) binding; + } + else { + result[i] = new CPPParameter.CPPParameterProblem(p, IProblemBinding.SEMANTIC_INVALID_TYPE, name.toCharArray()); + } } } return result; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPParameter.java index 44071a199e6..42f9e7b2451 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPParameter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. + * Copyright (c) 2004, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,6 +32,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter; import org.eclipse.cdt.core.parser.util.ArrayUtil; import org.eclipse.cdt.internal.core.dom.Linkage; import org.eclipse.cdt.internal.core.dom.parser.ASTNode; +import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding; import org.eclipse.core.runtime.PlatformObject; /** @@ -65,6 +66,42 @@ public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPI } } + public static class CPPParameterProblem extends ProblemBinding implements ICPPParameter { + public CPPParameterProblem( IASTNode node, int id, char[] arg ) { + super( node, id, arg ); + } + public IType getType() throws DOMException { + throw new DOMException( this ); + } + public boolean isStatic() throws DOMException { + throw new DOMException( this ); + } + public boolean isExtern() throws DOMException { + throw new DOMException( this ); + } + public boolean isAuto() throws DOMException { + throw new DOMException( this ); + } + public boolean isRegister() throws DOMException { + throw new DOMException( this ); + } + public boolean hasDefaultValue() { + return false; + } + public boolean isMutable() throws DOMException { + throw new DOMException( this ); + } + public String[] getQualifiedName() throws DOMException { + throw new DOMException( this ); + } + public char[][] getQualifiedNameCharArray() throws DOMException { + throw new DOMException( this ); + } + public boolean isGloballyQualified() throws DOMException { + throw new DOMException( this ); + } + } + private IType type = null; private IASTName [] declarations = null;