Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2016-12-16 07:36:44 +0000
committerNathan Ridge2016-12-31 18:29:36 +0000
commit94f4b03a0683e5b320cd2079c2af7f0e25f7cedb (patch)
tree433436282ea894f37dc2401b62a5c1bcb12ed5d5
parentd45c9b485174c4229d90c2efeabe3781e9fa93da (diff)
downloadorg.eclipse.cdt-94f4b03a0683e5b320cd2079c2af7f0e25f7cedb.tar.gz
org.eclipse.cdt-94f4b03a0683e5b320cd2079c2af7f0e25f7cedb.tar.xz
org.eclipse.cdt-94f4b03a0683e5b320cd2079c2af7f0e25f7cedb.zip
Bug 508254 - Have adapter bindings for anonymous AST bindings implement ICPPInternalBinding
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java9
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java33
2 files changed, 41 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java
index ac0b9375d31..9348367373c 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java
@@ -2399,4 +2399,13 @@ public class IndexCPPBindingResolutionTest extends IndexBindingResolutionTestBas
public void testStaticFieldOfEnclosingType_508254() throws Exception {
checkBindings();
}
+
+ // namespace {
+ // struct {} waldo;
+ // }
+
+ // // empty file
+ public void testAnonymousStructInAnonymousNamespace_508254() throws Exception {
+ checkBindings();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java
index 8b145ce61a8..a9d74762eb2 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java
@@ -45,6 +45,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.index.IIndexBinding;
import org.eclipse.cdt.core.parser.IToken;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding;
public class PDOMASTAdapter {
private static class AnonymousASTName implements IASTName {
@@ -430,7 +431,7 @@ public class PDOMASTAdapter {
}
}
- private static class AnonymousCPPBinding implements ICPPBinding {
+ private static class AnonymousCPPBinding implements ICPPInternalBinding {
protected ICPPBinding fDelegate;
private char[] fName;
@@ -498,6 +499,36 @@ public class PDOMASTAdapter {
public IBinding getOwner() {
return fDelegate.getOwner();
}
+
+ @Override
+ public IASTNode getDefinition() {
+ if (fDelegate instanceof ICPPInternalBinding) {
+ return ((ICPPInternalBinding) fDelegate).getDefinition();
+ }
+ return null;
+ }
+
+ @Override
+ public IASTNode[] getDeclarations() {
+ if (fDelegate instanceof ICPPInternalBinding) {
+ return ((ICPPInternalBinding) fDelegate).getDeclarations();
+ }
+ return null;
+ }
+
+ @Override
+ public void addDefinition(IASTNode node) {
+ if (fDelegate instanceof ICPPInternalBinding) {
+ ((ICPPInternalBinding) fDelegate).addDefinition(node);
+ }
+ }
+
+ @Override
+ public void addDeclaration(IASTNode node) {
+ if (fDelegate instanceof ICPPInternalBinding) {
+ ((ICPPInternalBinding) fDelegate).addDeclaration(node);
+ }
+ }
}
private static class AnonymousCPPEnumeration extends AnonymousCPPBinding implements ICPPEnumeration {

Back to the top