summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2013-08-26 02:01:28 (EDT)
committer Sergey Prigogin2013-08-26 22:38:20 (EDT)
commit9745cb982655172e4a354dd967e80dee06ad3bc5 (patch)
tree7f3bfdbefef42ffb6c6f307798ff0f95577e9434
parentc68190a67c294597289762543edb8bcd91c2e8a7 (diff)
downloadorg.eclipse.cdt-9745cb982655172e4a354dd967e80dee06ad3bc5.zip
org.eclipse.cdt-9745cb982655172e4a354dd967e80dee06ad3bc5.tar.gz
org.eclipse.cdt-9745cb982655172e4a354dd967e80dee06ad3bc5.tar.bz2
Bug 413204 - "field could not be resolved" error in function returning
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);