mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
181735: fix case of failing function resolution
This commit is contained in:
parent
ead2da2599
commit
335151f5f3
2 changed files with 19 additions and 4 deletions
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* Andrew Ferguson (Symbian)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||||
|
|
||||||
|
@ -151,15 +152,18 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
assertNoProblemBindings( col );
|
assertNoProblemBindings( col );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IASTTranslationUnit parseAndCheckBindings( String code ) throws Exception
|
protected IASTTranslationUnit parseAndCheckBindings( String code, ParserLanguage lang ) throws Exception {
|
||||||
{
|
IASTTranslationUnit tu = parse( code, lang );
|
||||||
IASTTranslationUnit tu = parse( code, ParserLanguage.C );
|
|
||||||
CNameCollector col = new CNameCollector();
|
CNameCollector col = new CNameCollector();
|
||||||
tu.accept(col);
|
tu.accept(col);
|
||||||
assertNoProblemBindings( col );
|
assertNoProblemBindings( col );
|
||||||
return tu;
|
return tu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected IASTTranslationUnit parseAndCheckBindings( String code ) throws Exception {
|
||||||
|
return parseAndCheckBindings(code, ParserLanguage.C);
|
||||||
|
}
|
||||||
|
|
||||||
public void testBasicFunction() throws Exception {
|
public void testBasicFunction() throws Exception {
|
||||||
StringBuffer buff = new StringBuffer();
|
StringBuffer buff = new StringBuffer();
|
||||||
buff.append("int x;\n"); //$NON-NLS-1$
|
buff.append("int x;\n"); //$NON-NLS-1$
|
||||||
|
@ -3623,4 +3627,15 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
assertFalse(lang.toString(), binding instanceof IProblemBinding);
|
assertFalse(lang.toString(), binding instanceof IProblemBinding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testBug181735() throws Exception {
|
||||||
|
String code=
|
||||||
|
"int (*f)(int);\n"
|
||||||
|
+ "int g(int n) {return n;}\n"
|
||||||
|
+ "int g(int n, int m) {return n;}\n"
|
||||||
|
+ "void foo() { f=g; }";
|
||||||
|
|
||||||
|
for (int i = 0; i < LANGUAGES.length; i++)
|
||||||
|
parseAndCheckBindings(code, LANGUAGES[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2572,7 +2572,7 @@ public class CPPSemantics {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
IASTIdExpression idExp = (IASTIdExpression) name.getParent();
|
IASTIdExpression idExp = (IASTIdExpression) name.getParent();
|
||||||
IASTNode node = idExp.getParent();
|
IASTNode node = idExp;
|
||||||
ASTNodeProperty prop = null;
|
ASTNodeProperty prop = null;
|
||||||
while( node != null ){
|
while( node != null ){
|
||||||
prop = node.getPropertyInParent();
|
prop = node.getPropertyInParent();
|
||||||
|
|
Loading…
Add table
Reference in a new issue