summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2013-08-26 02:01:28 (EDT)
committerSergey Prigogin2013-08-26 20:48:26 (EDT)
commit8a58b3aa2334302078fbb6888d66caaf39dcbe92 (patch)
tree1b6201b654616315b74e2c16e988868be9bac819
parent4fdb74888110d1c808604cf16f5bf15409611932 (diff)
downloadorg.eclipse.cdt-8a58b3aa2334302078fbb6888d66caaf39dcbe92.zip
org.eclipse.cdt-8a58b3aa2334302078fbb6888d66caaf39dcbe92.tar.gz
org.eclipse.cdt-8a58b3aa2334302078fbb6888d66caaf39dcbe92.tar.bz2
Bug 413204 - "field could not be resolved" error in function returningrefs/changes/40/15840/3
function pointer (really fixed this time) Change-Id: Ica4255ca554db6952248fe1fae53d188a1b78d75 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com> Reviewed-on: https://git.eclipse.org/r/15840 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java9
2 files changed, 4 insertions, 7 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java
index 816f687..f435876 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java
@@ -7459,7 +7459,7 @@ public class AST2Tests extends AST2TestBase {
// a->x;
// }
public void testFunctionReturningFunctionPointer_413204() throws Exception {
- parseAndCheckBindings(getAboveComment(), CPP);
+ parseAndCheckBindings();
}
// double d = 00.9;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java
index f0a49f4..16b1839 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java
@@ -727,12 +727,9 @@ public class CVisitor extends ASTQueries {
boolean isFunction= false;
if (parent instanceof IASTParameterDeclaration || parent.getPropertyInParent() == ICASTKnRFunctionDeclarator.FUNCTION_PARAMETER) {
IASTDeclarator fdtor = (IASTDeclarator) parent.getParent();
- if (ASTQueries.findTypeRelevantDeclarator(fdtor) instanceof IASTFunctionDeclarator) {
- IASTDeclarator dtor = fdtor;
- while (dtor.getNestedDeclarator() != null && !(dtor.getNestedDeclarator() instanceof IASTFunctionDeclarator)) {
- dtor = dtor.getNestedDeclarator();
- }
- IASTName n = dtor.getName();
+ // Create parameter bindings only if the declarator declares a function
+ if (ASTQueries.findTypeRelevantDeclarator(fdtor) == fdtor) {
+ IASTName n = ASTQueries.findInnermostDeclarator(fdtor).getName();
IBinding temp = n.resolveBinding();
if (temp != null && temp instanceof CFunction) {
binding = ((CFunction) temp).resolveParameter(name);