1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-19 06:55:23 +02:00

Bindings for names resolved via using declarations, bug 219424.

This commit is contained in:
Markus Schorn 2008-02-22 12:25:38 +00:00
parent b803bae59f
commit 270e8513e6
78 changed files with 418 additions and 1449 deletions

View file

@ -87,7 +87,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
@ -1080,17 +1079,17 @@ public class AST2CPPTests extends AST2BaseTest {
ICPPUsingDeclaration using = (ICPPUsingDeclaration) collector
.getName(5).resolveBinding();
ICPPDelegate[] delegates = using.getDelegates();
IBinding[] delegates = using.getDelegates();
assertEquals(delegates.length, 1);
assertSame(delegates[0].getBinding(), f);
assertInstances(collector, delegates[0], 2);
assertSame(delegates[0], f);
assertInstances(collector, delegates[0], 3); // decl + using-decl + ref
assertInstances(collector, A, 2);
assertInstances(collector, X, 3);
ICPPUsingDeclaration using_g = (ICPPUsingDeclaration) collector
.getName(8).resolveBinding();
assertSame(using_g.getDelegates()[0].getBinding(), g);
assertInstances(collector, using_g.getDelegates()[0], 2);
assertSame(using_g.getDelegates()[0], g);
assertInstances(collector, using_g.getDelegates()[0], 3); // decl + using-decl + ref
}
public void testFunctionDeclarations() throws Exception {
@ -1516,8 +1515,8 @@ public class AST2CPPTests extends AST2BaseTest {
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
IVariable x = (IVariable) col.getName(1).resolveBinding();
ICPPNamespace B = (ICPPNamespace) col.getName(2).resolveBinding();
assertTrue(B instanceof ICPPDelegate);
assertSame(((ICPPDelegate) B).getBinding(), A);
assertTrue(B instanceof ICPPNamespaceAlias);
assertSame(((ICPPNamespaceAlias) B).getBinding(), A);
assertInstances(col, A, 2);
assertInstances(col, B, 2);
@ -2859,26 +2858,25 @@ public class AST2CPPTests extends AST2BaseTest {
tu.accept(col);
ICPPFunction f_ref = (ICPPFunction) col.getName(12).resolveBinding();
assertTrue(f_ref instanceof ICPPDelegate);
IFunction g_ref = (IFunction) col.getName(15).resolveBinding();
ICPPFunction g_ref = (ICPPFunction) col.getName(15).resolveBinding();
ICPPFunction f = (ICPPFunction) col.getName(1).resolveBinding();
assertSame(((ICPPDelegate) f_ref).getBinding(), f);
assertSame(f_ref, f);
IFunction g = (IFunction) col.getName(13).resolveBinding();
assertSame(g, g_ref);
assertInstances(col, f_ref, 1);
assertInstances(col, f_ref, 2);
assertInstances(col, g_ref, 2);
String[] s = f_ref.getQualifiedName();
assertEquals(s[0], "D"); //$NON-NLS-1$
assertEquals(s[0], "B"); //$NON-NLS-1$
assertEquals(s[1], "f"); //$NON-NLS-1$
assertTrue(f_ref.isGloballyQualified());
s = f.getQualifiedName();
assertEquals(s[0], "B"); //$NON-NLS-1$
assertEquals(s[1], "f"); //$NON-NLS-1$
s = g_ref.getQualifiedName();
assertEquals(s[0], "D"); //$NON-NLS-1$
assertEquals(s[1], "g"); //$NON-NLS-1$
assertTrue(f.isGloballyQualified());
}
@ -2901,8 +2899,8 @@ public class AST2CPPTests extends AST2BaseTest {
s = alias.getQualifiedName();
assertEquals(s[0], "CWVLN"); //$NON-NLS-1$
assertTrue(alias instanceof ICPPDelegate);
assertSame(((ICPPDelegate) alias).getBinding(), ns);
assertTrue(alias instanceof ICPPNamespaceAlias);
assertSame(((ICPPNamespaceAlias) alias).getBinding(), ns);
IASTName[] refs = tu.getReferences(ns);
assertEquals(refs.length, 2);
@ -2944,7 +2942,7 @@ public class AST2CPPTests extends AST2BaseTest {
assertSame(decls[0], col.getName(1));
assertSame(decls[1], col.getName(3));
ICPPDelegate[] delegates = u.getDelegates();
IBinding[] delegates = u.getDelegates();
assertEquals(delegates.length, 2);
decls = tu.getDeclarationsInAST(delegates[0]);
@ -2952,8 +2950,8 @@ public class AST2CPPTests extends AST2BaseTest {
assertSame(decls[0], col.getName(1));
assertSame(decls[1], col.getName(7));
decls = tu.getDeclarationsInAST(delegates[0].getBinding());
assertEquals(1, decls.length);
decls = tu.getDeclarationsInAST(delegates[0]);
assertEquals(2, decls.length); // function-decl + using-decl
assertSame(decls[0], col.getName(1));
}
@ -2980,8 +2978,7 @@ public class AST2CPPTests extends AST2BaseTest {
IFunction f_decl = (IFunction) col.getName(10).resolveBinding();
IFunction f_ref = (IFunction) col.getName(19).resolveBinding();
assertTrue(f_ref instanceof ICPPDelegate);
assertSame(f_decl, ((ICPPDelegate) f_ref).getBinding());
assertSame(f_decl, f_ref);
}
public void testBug86470_3() throws Exception {
@ -3003,15 +3000,12 @@ public class AST2CPPTests extends AST2BaseTest {
IBinding ref1 = col.getName(8).resolveBinding();
IBinding ref2 = col.getName(9).resolveBinding();
assertTrue(ref1 instanceof ICPPDelegate);
assertTrue(ref2 instanceof ICPPDelegate);
ICPPClassType g_struct = (ICPPClassType) col.getName(1)
.resolveBinding();
IFunction g_func = (IFunction) col.getName(2).resolveBinding();
assertSame(g_struct, ((ICPPDelegate) ref2).getBinding());
assertSame(g_func, ((ICPPDelegate) ref1).getBinding());
assertSame(g_struct,ref2);
assertSame(g_func, ref1);
ICPPUsingDeclaration comp = (ICPPUsingDeclaration) col.getName(7)
.resolveBinding();
@ -3048,10 +3042,8 @@ public class AST2CPPTests extends AST2BaseTest {
.resolveBinding();
IVariable x_var = (IVariable) col.getName(1).resolveBinding();
assertTrue(ref1 instanceof ICPPDelegate);
assertTrue(ref2 instanceof ICPPDelegate);
assertSame(x_struct, ((ICPPDelegate) ref2).getBinding());
assertSame(x_var, ((ICPPDelegate) ref1).getBinding());
assertSame(x_struct, ref2);
assertSame(x_var, ref1);
IASTName[] refs = tu.getReferences(x_struct);
assertEquals(2, refs.length); // 1 ref + using-decl
@ -3059,8 +3051,9 @@ public class AST2CPPTests extends AST2BaseTest {
assertSame(refs[1], col.getName(12));
String[] s = ref2.getQualifiedName();
assertEquals(s[0], "x"); //$NON-NLS-1$
assertFalse(ref2.isGloballyQualified());
assertEquals(s[0], "B"); //$NON-NLS-1$
assertEquals(s[1], "x"); //$NON-NLS-1$
assertTrue(ref2.isGloballyQualified());
s = x_struct.getQualifiedName();
assertEquals(s[0], "B"); //$NON-NLS-1$
@ -3087,12 +3080,12 @@ public class AST2CPPTests extends AST2BaseTest {
ICPPFunction f = (ICPPFunction) col.getName(3).resolveBinding();
ICPPFunction f_ref = (ICPPFunction) col.getName(11).resolveBinding();
assertTrue(f_ref instanceof ICPPDelegate);
assertSame(((ICPPDelegate) f_ref).getBinding(), f);
assertSame( f_ref, f);
String[] s = f_ref.getQualifiedName();
assertEquals(s[0], "f"); //$NON-NLS-1$
assertFalse(f_ref.isGloballyQualified());
assertEquals(s[0], "A"); //$NON-NLS-1$
assertEquals(s[1], "f"); //$NON-NLS-1$
assertTrue(f_ref.isGloballyQualified());
s = f.getQualifiedName();
assertEquals(s[0], "A"); //$NON-NLS-1$
@ -3352,20 +3345,15 @@ public class AST2CPPTests extends AST2BaseTest {
IBinding[] bs = scope.find("f"); //$NON-NLS-1$
assertEquals(bs.length, 3);
assertSame(bs[0], f3);
assertSame(((ICPPDelegate) bs[1]).getBinding(), f1);
assertSame(((ICPPDelegate) bs[2]).getBinding(), f2);
assertSame( bs[1], f1);
assertSame( bs[2], f2);
String[] s = ((ICPPDelegate) bs[1]).getQualifiedName();
assertEquals(s.length, 1);
assertEquals(s[0], "f"); //$NON-NLS-1$
assertFalse(((ICPPDelegate) bs[1]).isGloballyQualified());
s = ((ICPPBinding) ((ICPPDelegate) bs[1]).getBinding())
.getQualifiedName();
String[] s = ((ICPPBinding) bs[1]).getQualifiedName();
assertEquals(s.length, 2);
assertEquals(s[0], "A"); //$NON-NLS-1$
assertEquals(s[1], "f"); //$NON-NLS-1$
assertTrue(((ICPPBinding) ((ICPPDelegate) bs[1]).getBinding())
assertTrue(((ICPPBinding) bs[1])
.isGloballyQualified());
}
@ -5369,9 +5357,9 @@ public class AST2CPPTests extends AST2BaseTest {
ICPPField i = (ICPPField) col.getName(1).resolveBinding();
ICPPUsingDeclaration using = (ICPPUsingDeclaration) col.getName(6).resolveBinding();
ICPPDelegate [] delegates = using.getDelegates();
IBinding[] delegates = using.getDelegates();
assertEquals( delegates.length, 1 );
assertSame( i, delegates[0].getBinding() );
assertSame( i, delegates[0]);
assertSame( i, col.getName(16).resolveBinding() );
}
@ -5627,18 +5615,18 @@ public class AST2CPPTests extends AST2BaseTest {
// check class
IBinding b= cldef.getName().resolveBinding();
assertEquals(3, tu.getReferences(b).length); // 2 refs + using-decl
assertEquals(1, tu.getDefinitionsInAST(b).length); // class-def
assertEquals(1, tu.getDeclarationsInAST(b).length); // class-def
assertEquals(2, tu.getDefinitionsInAST(b).length); // class-def + using-decl
assertEquals(2, tu.getDeclarationsInAST(b).length); // class-def + using-decl
// check functions
b= fdecl1.getName().resolveBinding();
assertEquals(3, tu.getReferences(b).length); // 2 refs + using-decl
assertEquals(0, tu.getDefinitionsInAST(b).length); // no def
assertEquals(1, tu.getDeclarationsInAST(b).length); // func-decl
assertEquals(1, tu.getDefinitionsInAST(b).length); // using-decl
assertEquals(2, tu.getDeclarationsInAST(b).length); // func-decl + using-decl
b= fdecl2.getName().resolveBinding();
assertEquals(3, tu.getReferences(b).length); // 2 refs + using-decl
assertEquals(0, tu.getDefinitionsInAST(b).length); // no def
assertEquals(1, tu.getDeclarationsInAST(b).length); // func-decl
assertEquals(1, tu.getDefinitionsInAST(b).length); // using-decl
assertEquals(2, tu.getDeclarationsInAST(b).length); // func-decl + using-decl
// check using declaration class
b= udcl.getName().resolveBinding();
@ -5734,7 +5722,7 @@ public class AST2CPPTests extends AST2BaseTest {
// func(qualified);
// func(unqualified);
// }
public void _testScopeOfUsingDelegates_Bug219424() throws Exception {
public void testScopeOfUsingDelegates_Bug219424() throws Exception {
BindingAssertionHelper bh= new BindingAssertionHelper(getContents(1)[0].toString(), true);
bh.assertNonProblem("cl c", 2);

View file

@ -1,19 +1,16 @@
/*******************************************************************************
* Copyright (c) 2005, 2007 IBM Corporation and others.
* Copyright (c) 2005, 2008 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Bryan Wilkinson (QNX)
* Andrew Ferguson (Symbian)
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Bryan Wilkinson (QNX)
* Andrew Ferguson (Symbian)
*******************************************************************************/
/*
* Created on Mar 11, 2005
*/
package org.eclipse.cdt.core.parser.tests.ast2;
import java.util.Iterator;
@ -47,7 +44,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
@ -1150,8 +1146,7 @@ public class AST2TemplateTests extends AST2BaseTest {
assertSame( ((ICPPTemplateInstance)A3).getTemplateDefinition(), A2 );
ICPPClassTemplate A4 = (ICPPClassTemplate) col.getName(14).resolveBinding();
assertTrue( A4 instanceof ICPPDelegate );
assertSame( ((ICPPDelegate)A4).getBinding(), A1 );
assertSame( A4, A1 );
}
public void testTemplateTemplateParameter() throws Exception {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2007 IBM Corporation and others.
* Copyright (c) 2004, 2008 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
@ -55,7 +55,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
@ -106,7 +105,8 @@ public class CompleteParser2Tests extends BaseTestCase {
shouldVisitNames = true;
}
public List nameList = new ArrayList();
public int visit( IASTName name ){
@Override
public int visit( IASTName name ){
nameList.add( name );
return PROCESS_CONTINUE;
}
@ -122,7 +122,8 @@ public class CompleteParser2Tests extends BaseTestCase {
shouldVisitNames = true;
}
public List nameList = new ArrayList();
public int visit( IASTName name ){
@Override
public int visit( IASTName name ){
nameList.add( name );
return PROCESS_CONTINUE;
}
@ -414,10 +415,10 @@ public class CompleteParser2Tests extends BaseTestCase {
assertInstances( col, C, 2 );
assertInstances( col, y, 1 );
ICPPDelegate [] ds = using_x.getDelegates();
assertSame( ds[0].getBinding(), x );
assertSame( using_C.getDelegates()[0].getBinding(), C );
assertSame( using_y.getDelegates()[0].getBinding(), y );
IBinding [] ds = using_x.getDelegates();
assertSame( ds[0], x );
assertSame( using_C.getDelegates()[0], C );
assertSame( using_y.getDelegates()[0], y );
}
public void testEnumerations() throws Exception
@ -536,8 +537,8 @@ public class CompleteParser2Tests extends BaseTestCase {
assertInstances( col, A, 2 );
assertInstances( col, bar, 1 );
assertSame( using_foo.getDelegates()[0].getBinding(), foo );
assertSame( using_bar.getDelegates()[0].getBinding(), bar );
assertSame( using_foo.getDelegates()[0], foo );
assertSame( using_bar.getDelegates()[0], bar );
}
public void testLinkageSpec() throws Exception

View file

@ -31,7 +31,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
@ -700,14 +699,12 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
// }
public void testAdvanceUsingDeclaration_Bug217102() throws Exception {
IBinding cl = getBindingFromASTName("Bar* Foo", 3);
assertTrue(cl instanceof ICPPDelegate);
cl= ((ICPPDelegate) cl).getBinding();
assertEquals("Bar", cl.getName());
assertTrue(cl instanceof ICPPClassType);
assertEquals("BAR", cl.getScope().getScopeName().toString());
cl = getBindingFromASTName("Bar* pBar", 3);
cl= ((ICPPDelegate) cl).getBinding();
assertEquals("Bar", cl.getName());
assertTrue(cl instanceof ICPPClassType);
assertEquals("BAR", cl.getScope().getScopeName().toString());

View file

@ -27,7 +27,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
@ -69,13 +68,7 @@ public class CElementHandleFactory {
public static ICElementHandle internalCreate(ITranslationUnit tu, IBinding binding, boolean definition,
IRegion region, long timestamp) throws CoreException, DOMException {
if (binding instanceof ICPPDelegate) {
ICPPDelegate delegate= (ICPPDelegate) binding;
if (delegate.getDelegateType() == ICPPDelegate.USING_DECLARATION) {
binding= delegate.getBinding();
}
}
ICElement parentElement= create(tu, binding.getScope());
if (parentElement == null) {
return null;

View file

@ -1,44 +0,0 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
/*
* Created on Mar 15, 2005
*/
package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.IBinding;
/**
* ICPPDelegate is meant to represent IBindings that are identical in most
* ways to another binding. Namespace aliases and using declarations will both
* be represented by delegates
*
* @author aniefer
*/
public interface ICPPDelegate extends ICPPBinding, Cloneable {
/**
* Kinds of things delegates can represent
*/
public static final int NAMESPACE_ALIAS = 1;
public static final int USING_DECLARATION = 2;
/**
* What type of delegate is this?
* @return
*/
public int getDelegateType();
/**
* get the original binding that we are a delegate of
* @return
*/
public IBinding getBinding();
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 IBM Corporation and others.
* Copyright (c) 2005, 2008 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
@ -8,14 +8,18 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
/*
* Created on Mar 17, 2005
*/
package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.IBinding;
/**
* @author aniefer
*/
public interface ICPPNamespaceAlias extends ICPPNamespace, ICPPDelegate {
public interface ICPPNamespaceAlias extends ICPPNamespace {
/**
* get the binding of the original namespace.
*/
public IBinding getBinding();
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others.
* Copyright (c) 2004, 2008 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
@ -8,13 +8,9 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
/*
* Created on Mar 16, 2005
*/
package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBinding;
/**
* A using declaration introduces a name into the declarative region in which
@ -31,5 +27,5 @@ public interface ICPPUsingDeclaration extends ICPPBinding {
* is a reference.
* @return
*/
ICPPDelegate [] getDelegates() throws DOMException;
IBinding[] getDelegates();
}

View file

@ -22,12 +22,10 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDeferredTemplateInstance;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.core.parser.util.ObjectMap;
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
@ -159,18 +157,12 @@ public class CPPClassInstance extends CPPInstance implements ICPPClassType, ICPP
/* (non-Javadoc)
* @see java.lang.Object#clone()
*/
@Override
public Object clone(){
// TODO Auto-generated method stub
return this;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPClassType.CPPClassTypeDelegate( usingDecl, this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
*/
@ -216,6 +208,7 @@ public class CPPClassInstance extends CPPInstance implements ICPPClassType, ICPP
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
}
@Override
public boolean equals(Object obj) {
return obj instanceof ICPPClassType ? isSameType((ICPPClassType)obj) : false;
}

View file

@ -30,11 +30,9 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.core.parser.util.ObjectMap;
@ -242,13 +240,7 @@ public class CPPClassSpecialization extends CPPSpecialization implements
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPClassType.CPPClassTypeDelegate( usingDecl, this );
}
@Override
public Object clone() {
// TODO Auto-generated method stub
return this;

View file

@ -37,12 +37,9 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.internal.core.index.IIndexType;
@ -55,40 +52,6 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements
ICPPClassTemplate, ICPPClassType, ICPPInternalClassType, ICPPInternalClassTemplate,
ICPPInternalClassTypeMixinHost {
public static class CPPClassTemplateDelegate extends CPPClassType.CPPClassTypeDelegate
implements ICPPClassTemplate, ICPPInternalClassTemplate {
public CPPClassTemplateDelegate(ICPPUsingDeclaration usingDecl, ICPPClassType cls) {
super(usingDecl, cls);
}
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() throws DOMException {
return ((ICPPClassTemplate)getBinding()).getPartialSpecializations();
}
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
return ((ICPPClassTemplate)getBinding()).getTemplateParameters();
}
public void addSpecialization(IType[] arguments, ICPPSpecialization specialization) {
final IBinding binding = getBinding();
if (binding instanceof ICPPInternalBinding) {
((ICPPInternalTemplate)binding).addSpecialization(arguments, specialization);
}
}
public IBinding instantiate(IType[] arguments) {
return ((ICPPInternalTemplateInstantiator)getBinding()).instantiate(arguments);
}
public ICPPSpecialization deferredInstance(IType[] arguments) {
return ((ICPPInternalTemplateInstantiator)getBinding()).deferredInstance(arguments);
}
public ICPPSpecialization getInstance(IType[] arguments) {
return ((ICPPInternalTemplateInstantiator)getBinding()).getInstance(arguments);
}
public void addPartialSpecialization(ICPPClassTemplatePartialSpecialization spec) {
final IBinding binding = getBinding();
if (binding instanceof ICPPInternalClassTemplate) {
((ICPPInternalClassTemplate)getBinding()).addPartialSpecialization(spec);
}
}
}
private class FindDefinitionAction extends CPPASTVisitor {
private char[] nameArray = CPPClassTemplate.this.getNameCharArray();
public IASTName result = null;
@ -100,6 +63,7 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements
shouldVisitDeclarators = true;
}
@Override
public int visit(IASTName name) {
if (name instanceof ICPPASTTemplateId || name instanceof ICPPASTQualifiedName)
return PROCESS_CONTINUE;
@ -128,14 +92,17 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements
return PROCESS_CONTINUE;
}
@Override
public int visit(IASTDeclaration declaration) {
if (declaration instanceof IASTSimpleDeclaration || declaration instanceof ICPPASTTemplateDeclaration)
return PROCESS_CONTINUE;
return PROCESS_SKIP;
}
@Override
public int visit(IASTDeclSpecifier declSpec) {
return (declSpec instanceof ICPPASTCompositeTypeSpecifier) ? PROCESS_CONTINUE : PROCESS_SKIP;
}
@Override
public int visit(IASTDeclarator declarator) { return PROCESS_SKIP; }
}
@ -147,6 +114,7 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements
this.mixin= new ClassTypeMixin(this);
}
@Override
public ICPPSpecialization deferredInstance(IType[] arguments) {
ICPPSpecialization instance = getInstance(arguments);
if (instance == null) {
@ -229,15 +197,11 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements
partialSpecializations = (ICPPClassTemplatePartialSpecialization[]) ArrayUtil.trim(ICPPClassTemplatePartialSpecialization.class, partialSpecializations);
return partialSpecializations;
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPClassTemplateDelegate(usingDecl, this);
}
public boolean isSameType(IType type) {
if (type == this)
return true;
if (type instanceof ITypedef || type instanceof IIndexType || type instanceof ICPPDelegate)
if (type instanceof ITypedef || type instanceof IIndexType)
return type.isSameType(this);
return false;
}
@ -286,6 +250,7 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements
return mixin.findField(name);
}
@Override
public Object clone() {
try {
return super.clone();
@ -297,6 +262,7 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements
/* (non-Javadoc)
* For debug purposes only
*/
@Override
public String toString() {
return ASTTypeUtil.getType(this);
}

View file

@ -40,11 +40,9 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.index.IIndexBinding;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
@ -59,56 +57,6 @@ import org.eclipse.core.runtime.PlatformObject;
* @author aniefer
*/
public class CPPClassType extends PlatformObject implements ICPPInternalClassTypeMixinHost, ICPPClassType, ICPPInternalClassType {
public static class CPPClassTypeDelegate extends CPPDelegate implements ICPPClassType {
public CPPClassTypeDelegate( ICPPUsingDeclaration usingDecl, ICPPClassType cls ){
super( usingDecl, cls );
}
public ICPPBase[] getBases() throws DOMException {
return ((ICPPClassType)getBinding()).getBases();
}
public IField[] getFields() throws DOMException {
return ((ICPPClassType)getBinding()).getFields();
}
public IField findField( String name ) throws DOMException {
return ((ICPPClassType)getBinding()).findField( name );
}
public ICPPField[] getDeclaredFields() throws DOMException {
return ((ICPPClassType)getBinding()).getDeclaredFields();
}
public ICPPMethod[] getMethods() throws DOMException {
return ((ICPPClassType)getBinding()).getMethods();
}
public ICPPMethod[] getAllDeclaredMethods() throws DOMException {
return ((ICPPClassType)getBinding()).getAllDeclaredMethods();
}
public ICPPMethod[] getDeclaredMethods() throws DOMException {
return ((ICPPClassType)getBinding()).getDeclaredMethods();
}
public ICPPConstructor[] getConstructors() throws DOMException {
return ((ICPPClassType)getBinding()).getConstructors();
}
public IBinding[] getFriends() throws DOMException {
return ((ICPPClassType)getBinding()).getFriends();
}
public int getKey() throws DOMException {
return ((ICPPClassType)getBinding()).getKey();
}
public IScope getCompositeScope() throws DOMException {
return ((ICPPClassType)getBinding()).getCompositeScope();
}
public ICPPMethod[] getConversionOperators() throws DOMException {
IBinding binding = getBinding();
if( binding instanceof ICPPInternalClassType )
return ((ICPPInternalClassType)binding).getConversionOperators();
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
}
public boolean isSameType( IType type ) {
return ((ICPPClassType)getBinding()).isSameType( type );
}
public ICPPClassType[] getNestedClasses() throws DOMException {
return ((ICPPClassType)getBinding()).getNestedClasses();
}
}
public static class CPPClassTypeProblem extends ProblemBinding implements ICPPClassType{
public CPPClassTypeProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
@ -144,9 +92,11 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
public IScope getCompositeScope() throws DOMException {
throw new DOMException( this );
}
@Override
public IScope getParent() throws DOMException {
throw new DOMException( this );
}
@Override
public IBinding[] find(String name) throws DOMException {
throw new DOMException( this );
}
@ -178,6 +128,7 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
shouldVisitDeclarators = true;
}
@Override
public int visit( IASTName name ){
if( name instanceof ICPPASTTemplateId )
return PROCESS_SKIP;
@ -208,14 +159,17 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
return PROCESS_CONTINUE;
}
@Override
public int visit( IASTDeclaration declaration ){
if(declaration instanceof IASTSimpleDeclaration || declaration instanceof ICPPASTTemplateDeclaration)
return PROCESS_CONTINUE;
return PROCESS_SKIP;
}
@Override
public int visit( IASTDeclSpecifier declSpec ){
return (declSpec instanceof ICPPASTCompositeTypeSpecifier ) ? PROCESS_CONTINUE : PROCESS_SKIP;
}
@Override
public int visit( IASTDeclarator declarator ) { return PROCESS_SKIP; }
}
@ -404,11 +358,6 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
return true;
}
public ICPPDelegate createDelegate( ICPPUsingDeclaration usingDecl ) {
return new CPPClassTypeDelegate( usingDecl, this );
}
public ILinkage getLinkage() {
return Linkage.CPP_LINKAGE;
}
@ -418,7 +367,7 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
public boolean isSameType( IType type ) {
if (type == this)
return true;
if (type instanceof ITypedef || type instanceof IIndexType || type instanceof ICPPDelegate)
if (type instanceof ITypedef || type instanceof IIndexType)
return type.isSameType(this);
return false;
}
@ -467,6 +416,7 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
return mixin.findField(name);
}
@Override
public Object clone() {
try {
return super.clone();

View file

@ -20,11 +20,9 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDeferredTemplateInstance;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ObjectMap;
/**
@ -107,14 +105,6 @@ public class CPPDeferredClassInstance extends CPPInstance implements
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getKey()
*/
@ -132,7 +122,8 @@ public class CPPDeferredClassInstance extends CPPInstance implements
/* (non-Javadoc)
* @see java.lang.Object#clone()
*/
public Object clone() {
@Override
public Object clone() {
return this;
}

View file

@ -20,13 +20,11 @@ import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDeferredTemplateInstance;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ObjectMap;
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
@ -68,6 +66,7 @@ public class CPPDeferredFunctionInstance extends CPPInstance implements ICPPFunc
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance#getArguments()
*/
@Override
public IType[] getArguments() {
return arguments;
}
@ -168,14 +167,6 @@ public class CPPDeferredFunctionInstance extends CPPInstance implements ICPPFunc
return ((ICPPFunction)getTemplateDefinition()).takesVarArgs();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalFunction#isStatic(boolean)
*/

View file

@ -1,163 +0,0 @@
/*******************************************************************************
* Copyright (c) 2005, 2008 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ILinkage;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.Linkage;
import org.eclipse.core.runtime.PlatformObject;
/**
* @author aniefer
*/
public class CPPDelegate extends PlatformObject implements ICPPDelegate, ICPPInternalBinding {
private final IBinding originalBinding;
private ICPPUsingDeclaration usingDeclaration;
/**
*
*/
public CPPDelegate(ICPPUsingDeclaration usingDecl, IBinding original ) {
this.originalBinding = original;
this.usingDeclaration = usingDecl;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate#getDelegateType()
*/
public int getDelegateType() {
return USING_DECLARATION;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate#getBinding()
*/
public IBinding getBinding() {
return originalBinding;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#getQualifiedName()
*/
public String[] getQualifiedName() {
return CPPVisitor.getQualifiedName( this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#getQualifiedNameCharArray()
*/
public char[][] getQualifiedNameCharArray() {
return CPPVisitor.getQualifiedNameCharArray( this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#isGloballyQualified()
*/
public boolean isGloballyQualified() throws DOMException {
IScope scope = getScope();
while( scope != null ){
if( scope instanceof ICPPBlockScope )
return false;
scope = scope.getParent();
}
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
*/
public String getName() {
return usingDeclaration.getName();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getNameCharArray()
*/
public char[] getNameCharArray() {
return usingDeclaration.getNameCharArray();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
*/
public IScope getScope() throws DOMException {
return usingDeclaration.getScope();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#getDeclarations()
*/
public IASTNode[] getDeclarations() {
if (usingDeclaration instanceof ICPPInternalBinding) {
return ((ICPPInternalBinding) usingDeclaration).getDeclarations();
}
return IASTNode.EMPTY_NODE_ARRAY;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#getDefinition()
*/
public IASTNode getDefinition() {
if (usingDeclaration instanceof ICPPInternalBinding) {
return ((ICPPInternalBinding) usingDeclaration).getDefinition();
}
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate( ICPPUsingDeclaration decl ) {
CPPDelegate delegate= (CPPDelegate) clone();
delegate.usingDeclaration= decl;
return delegate;
}
@Override
public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
// cannot be thrown because we implement Clonable
}
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/
public void addDefinition(IASTNode node) {
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDeclaration(org.eclipse.cdt.core.dom.ast.IASTNode)
*/
public void addDeclaration(IASTNode node) {
}
public void removeDeclaration(IASTNode node) {
}
public ILinkage getLinkage() {
return Linkage.CPP_LINKAGE;
}
public ICPPUsingDeclaration getUsingDeclaration() {
return usingDeclaration;
}
}

View file

@ -23,8 +23,6 @@ import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.Linkage;
import org.eclipse.cdt.internal.core.index.IIndexType;
import org.eclipse.core.runtime.PlatformObject;
@ -33,17 +31,6 @@ import org.eclipse.core.runtime.PlatformObject;
* @author aniefer
*/
public class CPPEnumeration extends PlatformObject implements IEnumeration, ICPPInternalBinding {
public static class CPPEnumerationDelegate extends CPPDelegate implements IEnumeration {
public CPPEnumerationDelegate( ICPPUsingDeclaration name, IEnumeration binding ) {
super( name, binding );
}
public IEnumerator[] getEnumerators() throws DOMException {
return ((IEnumeration)getBinding()).getEnumerators();
}
public boolean isSameType( IType type ) {
return ((IEnumeration)getBinding()).isSameType( type );
}
}
private IASTName enumName;
/**
* @param specifier
@ -95,7 +82,8 @@ public class CPPEnumeration extends PlatformObject implements IEnumeration, ICPP
return enumName;
}
public Object clone(){
@Override
public Object clone(){
IType t = null;
try {
t = (IType) super.clone();
@ -145,13 +133,6 @@ public class CPPEnumeration extends PlatformObject implements IEnumeration, ICPP
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl ) {
return new CPPEnumerationDelegate( usingDecl, this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/
@ -178,7 +159,7 @@ public class CPPEnumeration extends PlatformObject implements IEnumeration, ICPP
public boolean isSameType( IType type ) {
if( type == this )
return true;
if( type instanceof ITypedef || type instanceof IIndexType || type instanceof ICPPDelegate)
if( type instanceof ITypedef || type instanceof IIndexType)
return type.isSameType( this );
return false;
}

View file

@ -21,8 +21,6 @@ import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.Linkage;
import org.eclipse.core.runtime.PlatformObject;
@ -30,14 +28,6 @@ import org.eclipse.core.runtime.PlatformObject;
* @author aniefer
*/
public class CPPEnumerator extends PlatformObject implements IEnumerator, ICPPInternalBinding {
public static class CPPEnumeratorDelegate extends CPPDelegate implements IEnumerator {
public CPPEnumeratorDelegate( ICPPUsingDeclaration name, IEnumerator binding ) {
super( name, binding );
}
public IType getType() throws DOMException {
return ((IEnumerator)getBinding()).getType();
}
}
private IASTName enumName;
/**
@ -128,13 +118,6 @@ public class CPPEnumerator extends PlatformObject implements IEnumerator, ICPPIn
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl ) {
return new CPPEnumeratorDelegate( usingDecl, this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/

View file

@ -25,9 +25,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisiblityLabel;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
@ -35,20 +33,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
* @author aniefer
*/
public class CPPField extends CPPVariable implements ICPPField, ICPPInternalBinding {
public static class CPPFieldDelegate extends CPPVariable.CPPVariableDelegate implements ICPPField {
public CPPFieldDelegate( ICPPUsingDeclaration name, ICPPField binding ) {
super( name, binding );
}
public int getVisibility() throws DOMException {
return ((ICPPField)getBinding()).getVisibility();
}
public ICPPClassType getClassOwner() throws DOMException {
return ((ICPPField)getBinding()).getClassOwner();
}
public ICompositeType getCompositeTypeOwner() throws DOMException {
return getClassOwner();
}
}
public static class CPPFieldProblem extends CPPVariable.CPPVariableProblem implements ICPPField {
/**
* @param id
@ -160,22 +144,17 @@ public class CPPField extends CPPVariable implements ICPPField, ICPPInternalBind
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable#isMutable()
*/
public boolean isMutable() {
@Override
public boolean isMutable() {
return hasStorageClass( ICPPASTDeclSpecifier.sc_mutable);
}
public boolean isExtern() {
@Override
public boolean isExtern() {
//7.1.1-5 The extern specifier can not be used in the declaration of class members
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl ) {
return new CPPFieldDelegate( usingDecl, this );
}
public ICompositeType getCompositeTypeOwner() throws DOMException {
return getClassOwner();
}

View file

@ -16,12 +16,9 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ObjectMap;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPField.CPPFieldDelegate;
/**
* @author aniefer
@ -80,10 +77,6 @@ public class CPPFieldSpecialization extends CPPSpecialization implements ICPPFie
return false;
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPFieldDelegate( usingDecl, this );
}
public ICompositeType getCompositeTypeOwner() throws DOMException {
return getClassOwner();
}

View file

@ -24,7 +24,6 @@ import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
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;
@ -34,9 +33,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.Linkage;
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
@ -49,59 +46,6 @@ import org.eclipse.core.runtime.PlatformObject;
*/
public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInternalFunction {
public static class CPPFunctionDelegate extends CPPDelegate implements ICPPFunction, ICPPInternalFunction {
public CPPFunctionDelegate( ICPPUsingDeclaration usingDecl, ICPPFunction binding ) {
super( usingDecl, binding );
}
public IParameter[] getParameters() throws DOMException {
return ((ICPPFunction)getBinding()).getParameters();
}
public IScope getFunctionScope() throws DOMException {
return ((ICPPFunction)getBinding()).getFunctionScope();
}
public IFunctionType getType() throws DOMException {
return ((ICPPFunction)getBinding()).getType();
}
public boolean isStatic() throws DOMException {
return ((ICPPFunction)getBinding()).isStatic();
}
public boolean isMutable() throws DOMException {
return ((ICPPFunction)getBinding()).isMutable();
}
public boolean isInline() throws DOMException {
return ((ICPPFunction)getBinding()).isInline();
}
public boolean isExternC() throws DOMException {
return ((ICPPFunction)getBinding()).isExternC();
}
public boolean isExtern() throws DOMException {
return ((ICPPFunction)getBinding()).isExtern();
}
public boolean isAuto() throws DOMException {
return ((ICPPFunction)getBinding()).isAuto();
}
public boolean isRegister() throws DOMException {
return ((ICPPFunction)getBinding()).isRegister();
}
public boolean takesVarArgs() throws DOMException {
return ((ICPPFunction)getBinding()).takesVarArgs();
}
public boolean isStatic( boolean resolveAll) {
try {
return ASTInternal.isStatic((IFunction) getBinding(), resolveAll);
} catch (DOMException e) {
return false;
}
}
public IBinding resolveParameter( IASTParameterDeclaration param ) {
final IBinding binding = getBinding();
if (binding instanceof ICPPInternalFunction) {
return ((ICPPInternalFunction)binding).resolveParameter( param );
}
return null;
}
}
public static class CPPFunctionProblem extends ProblemBinding implements ICPPFunction {
public CPPFunctionProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
@ -507,13 +451,6 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate( ICPPUsingDeclaration usingDecl ) {
return new CPPFunctionDelegate( usingDecl, this );
}
static public boolean hasStorageClass( ICPPInternalFunction function, int storage){
ICPPASTFunctionDeclarator dtor = (ICPPASTFunctionDeclarator) function.getDefinition();
IASTNode[] ds = function.getDeclarations();

View file

@ -19,13 +19,11 @@ import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ObjectMap;
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
@ -45,13 +43,6 @@ public class CPPFunctionInstance extends CPPInstance implements ICPPFunction, IC
super(scope, orig, argMap, args);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPFunction.CPPFunctionDelegate( usingDecl, this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IFunction#getParameters()
*/
@ -161,7 +152,8 @@ public class CPPFunctionInstance extends CPPInstance implements ICPPFunction, IC
return null;
}
public boolean equals(Object obj) {
@Override
public boolean equals(Object obj) {
if( (obj instanceof ICPPTemplateInstance) && (obj instanceof ICPPFunction)){
try {
ICPPFunctionType ct1= (ICPPFunctionType) ((ICPPFunction)getSpecializedBinding()).getType();

View file

@ -24,14 +24,11 @@ import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.index.IIndexBinding;
import org.eclipse.cdt.core.parser.util.ObjectMap;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunction.CPPFunctionDelegate;
/**
* @author aniefer
@ -154,10 +151,6 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
return false;
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPFunctionDelegate( usingDecl, this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalFunction#resolveParameter(org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration)
*/
@ -193,7 +186,8 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
return null;
}
public void addDefinition(IASTNode node) {
@Override
public void addDefinition(IASTNode node) {
IASTNode n = node;
while( n instanceof IASTName )
n = n.getParent();
@ -202,6 +196,7 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
updateParameterBindings( (ICPPASTFunctionDeclarator) n );
super.addDefinition( n );
}
@Override
public void addDeclaration(IASTNode node) {
IASTNode n = node;
while( n instanceof IASTName )

View file

@ -29,12 +29,10 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
/**
@ -94,29 +92,6 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
throw new DOMException( this );
}
}
public static class CPPFunctionTemplateDelegate extends CPPFunction.CPPFunctionDelegate implements ICPPFunctionTemplate, ICPPInternalTemplate {
public CPPFunctionTemplateDelegate( ICPPUsingDeclaration name, ICPPFunction binding ) {
super( name, binding );
}
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
return ((ICPPFunctionTemplate)getBinding()).getTemplateParameters();
}
public void addSpecialization( IType[] arguments, ICPPSpecialization specialization ) {
final IBinding binding = getBinding();
if (binding instanceof ICPPInternalBinding) {
((ICPPInternalTemplate)getBinding()).addSpecialization( arguments, specialization );
}
}
public IBinding instantiate( IType[] arguments ) {
return ((ICPPInternalTemplateInstantiator)getBinding()).instantiate( arguments );
}
public ICPPSpecialization deferredInstance( IType[] arguments ) {
return ((ICPPInternalTemplateInstantiator)getBinding()).deferredInstance( arguments );
}
public ICPPSpecialization getInstance( IType[] arguments ) {
return ((ICPPInternalTemplateInstantiator)getBinding()).getInstance( arguments );
}
}
protected IFunctionType type = null;
/**
@ -126,6 +101,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
super(name);
}
@Override
public void addDefinition(IASTNode node) {
if( !(node instanceof IASTName) )
return;
@ -136,6 +112,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDeclaration(org.eclipse.cdt.core.dom.ast.IASTNode)
*/
@Override
public void addDeclaration(IASTNode node) {
if( !(node instanceof IASTName) )
return;
@ -300,6 +277,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateDefinition#deferredInstance(org.eclipse.cdt.core.dom.ast.IType[])
*/
@Override
public ICPPSpecialization deferredInstance(IType[] arguments) {
ICPPSpecialization instance = getInstance( arguments );
if( instance == null ){
@ -424,12 +402,4 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
public boolean isStatic( boolean resolveAll ) {
return hasStorageClass( IASTDeclSpecifier.sc_static );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl ) {
return new CPPFunctionTemplateDelegate( usingDecl, this );
}
}

View file

@ -13,13 +13,11 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ObjectMap;
/**
@ -40,11 +38,6 @@ public class CPPFunctionTemplateSpecialization extends CPPFunctionSpecialization
return template.getTemplateParameters();
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
// TODO Auto-generated method stub
return null;
}
public void addSpecialization(IType[] arguments, ICPPSpecialization specialization) {
if( instances == null )
instances = new ObjectMap(2);

View file

@ -15,8 +15,6 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
/**
* The CPPImplicitTypedef is used to represent implicit typedefs that exist on the translation
@ -41,35 +39,40 @@ public class CPPImplicitTypedef extends CPPTypedef implements ITypedef, ICPPInte
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.ITypedef#getType()
*/
public IType getType() {
@Override
public IType getType() {
return type;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
*/
public String getName() {
@Override
public String getName() {
return String.valueOf(name);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getNameCharArray()
*/
public char[] getNameCharArray() {
@Override
public char[] getNameCharArray() {
return name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
*/
public IScope getScope() {
@Override
public IScope getScope() {
return scope;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
*/
public boolean isSameType(IType t) {
@Override
public boolean isSameType(IType t) {
if( t == this )
return true;
if( t instanceof ITypedef ) {
@ -91,7 +94,8 @@ public class CPPImplicitTypedef extends CPPTypedef implements ITypedef, ICPPInte
/* (non-Javadoc)
* @see java.lang.Object#clone()
*/
public Object clone(){
@Override
public Object clone(){
IType t = null;
t = (IType) super.clone();
return t;
@ -100,49 +104,48 @@ public class CPPImplicitTypedef extends CPPTypedef implements ITypedef, ICPPInte
/**
* returns null
*/
public IASTNode[] getDeclarations() {
@Override
public IASTNode[] getDeclarations() {
return null;
}
/**
* returns null
*/
public IASTNode getDefinition() {
@Override
public IASTNode getDefinition() {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPTypedefDelegate( usingDecl, this );
}
/**
* does nothing
*/
public void addDefinition(IASTNode node) {
@Override
public void addDefinition(IASTNode node) {
// do nothing
}
/**
* does nothing
*/
public void addDeclaration(IASTNode node) {
@Override
public void addDeclaration(IASTNode node) {
// do nothing
}
/**
* does nothing
*/
public void removeDeclaration(IASTNode node) {
@Override
public void removeDeclaration(IASTNode node) {
// do nothing
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getFullyQualifiedName()
*/
public String[] getQualifiedName() {
@Override
public String[] getQualifiedName() {
String[] temp = new String[1];
temp[0] = String.valueOf(name);
@ -152,7 +155,8 @@ public class CPPImplicitTypedef extends CPPTypedef implements ITypedef, ICPPInte
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getFullyQualifiedNameCharArray()
*/
public char[][] getQualifiedNameCharArray() {
@Override
public char[][] getQualifiedNameCharArray() {
char[][] temp = new char[1][];
temp[0] = name;
@ -162,7 +166,8 @@ public class CPPImplicitTypedef extends CPPTypedef implements ITypedef, ICPPInte
/**
* returns true
*/
public boolean isGloballyQualified() {
@Override
public boolean isGloballyQualified() {
return true;
}

View file

@ -17,8 +17,6 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.ILabel;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.Linkage;
import org.eclipse.core.runtime.PlatformObject;
@ -116,14 +114,6 @@ public class CPPLabel extends PlatformObject implements ILabel, ICPPInternalBind
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl ) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/

View file

@ -28,9 +28,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisiblityLabel;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
@ -38,35 +36,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
* @author aniefer
*/
public class CPPMethod extends CPPFunction implements ICPPMethod {
public static class CPPMethodDelegate extends CPPFunction.CPPFunctionDelegate implements ICPPMethod {
public CPPMethodDelegate( ICPPUsingDeclaration name, ICPPMethod binding ) {
super( name, binding );
}
public int getVisibility() throws DOMException {
return ((ICPPMethod)getBinding()).getVisibility();
}
public ICPPClassType getClassOwner() throws DOMException {
return ((ICPPMethod)getBinding()).getClassOwner();
}
public boolean isVirtual() throws DOMException {
return ((ICPPMethod)getBinding()).isVirtual();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isDestructor()
*/
public boolean isDestructor() {
char[] name = getNameCharArray();
if (name.length > 1 && name[0] == '~')
return true;
return false;
}
public boolean isImplicit() {
return ((ICPPMethod)getBinding()).isImplicit();
}
}
public static class CPPMethodProblem extends CPPFunctionProblem implements ICPPMethod {
/**
* @param id
@ -189,6 +158,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
return scope.getClassType();
}
@Override
public IScope getScope() {
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : definition;
if( node instanceof IASTDeclarator ){
@ -202,6 +172,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
return CPPVisitor.getContainingScope( node );
}
@Override
public String getName() {
if( definition != null ){
IASTName n = definition.getName();
@ -217,6 +188,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IBinding#getNameCharArray()
*/
@Override
public char[] getNameCharArray() {
if( definition != null ){
IASTName n = definition.getName();
@ -229,13 +201,6 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
return declarations[0].getName().toCharArray();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl ) {
return new CPPMethodDelegate( usingDecl, this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual()
*/
@ -262,7 +227,8 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction#isInline()
*/
public boolean isInline() throws DOMException {
@Override
public boolean isInline() throws DOMException {
IASTDeclaration decl = getPrimaryDeclaration();
if( decl instanceof IASTFunctionDefinition )
return true;
@ -276,7 +242,8 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction#isMutable()
*/
public boolean isMutable() {
@Override
public boolean isMutable() {
return hasStorageClass( this, ICPPASTDeclSpecifier.sc_mutable );
}

View file

@ -30,10 +30,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.core.parser.util.ObjectSet;
@ -46,17 +44,6 @@ import org.eclipse.core.runtime.PlatformObject;
* @author aniefer
*/
public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPInternalBinding {
public static class CPPNamespaceDelegate extends CPPDelegate implements ICPPNamespace {
public CPPNamespaceDelegate( ICPPUsingDeclaration name, ICPPNamespace binding ) {
super( name, binding );
}
public ICPPNamespaceScope getNamespaceScope() throws DOMException {
return ((ICPPNamespace)getBinding()).getNamespaceScope();
}
public IBinding[] getMemberBindings() throws DOMException {
return ((ICPPNamespace)getBinding()).getMemberBindings();
}
}
public static class CPPNamespaceProblem extends ProblemBinding implements ICPPNamespace{
public CPPNamespaceProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
@ -114,7 +101,8 @@ public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPI
this.namespaceDef = ns;
}
public int visit( ICPPASTNamespaceDefinition namespace) {
@Override
public int visit( ICPPASTNamespaceDefinition namespace) {
ICPPASTNamespaceDefinition orig = namespaceDef, candidate = namespace;
while( candidate != null ){
if( !CharArrayUtils.equals( orig.getName().toCharArray(), candidate.getName().toCharArray() ) )
@ -135,7 +123,8 @@ public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPI
return PROCESS_SKIP;
}
public int visit( IASTDeclaration declaration ){
@Override
public int visit( IASTDeclaration declaration ){
if( declaration instanceof ICPPASTLinkageSpecification )
return PROCESS_CONTINUE;
return PROCESS_SKIP;
@ -155,6 +144,7 @@ public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPI
shouldVisitDeclarations = true;
}
@Override
public int visit(IASTDeclarator declarator) {
while( declarator.getNestedDeclarator() != null )
declarator = declarator.getNestedDeclarator();
@ -165,6 +155,7 @@ public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPI
return PROCESS_SKIP;
}
@Override
public int visit(IASTDeclSpecifier declSpec) {
if( declSpec instanceof ICPPASTCompositeTypeSpecifier ){
IBinding binding = ((ICPPASTCompositeTypeSpecifier)declSpec).getName().resolveBinding();
@ -185,12 +176,14 @@ public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPI
}
return PROCESS_SKIP;
}
@Override
public int visit(ICPPASTNamespaceDefinition namespace) {
IBinding binding = namespace.getName().resolveBinding();
if( binding != null && !(binding instanceof IProblemBinding) )
members.put( binding );
return PROCESS_SKIP;
}
@Override
public int visit(IASTDeclaration declaration) {
if( declaration instanceof ICPPASTUsingDeclaration ){
IBinding binding =((ICPPASTUsingDeclaration)declaration).getName().resolveBinding();
@ -300,13 +293,6 @@ public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPI
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl ) {
return new CPPNamespaceDelegate( usingDecl, this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/

View file

@ -18,11 +18,9 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.Linkage;
import org.eclipse.core.runtime.PlatformObject;
@ -49,13 +47,6 @@ public class CPPNamespaceAlias extends PlatformObject implements ICPPNamespaceAl
return namespace.getNamespaceScope();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate#getDelegateType()
*/
public int getDelegateType() {
return ICPPDelegate.NAMESPACE_ALIAS;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate#getBinding()
*/
@ -125,14 +116,6 @@ public class CPPNamespaceAlias extends PlatformObject implements ICPPNamespaceAl
return alias;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl ) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/

View file

@ -21,12 +21,9 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
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;
@ -37,36 +34,6 @@ import org.eclipse.core.runtime.PlatformObject;
* @author aniefer
*/
public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPInternalBinding {
public static class CPPParameterDelegate extends CPPDelegate implements ICPPParameter {
public CPPParameterDelegate( ICPPUsingDeclaration name, IParameter binding ) {
super( name, binding );
}
public IType getType() throws DOMException {
return ((IParameter)getBinding()).getType();
}
public boolean isStatic() throws DOMException {
return ((IParameter)getBinding()).isStatic();
}
public boolean isExtern() {
return false;
}
public boolean isAuto() throws DOMException {
return ((IParameter)getBinding()).isAuto();
}
public boolean isRegister() throws DOMException {
return ((IParameter)getBinding()).isRegister();
}
public boolean isMutable() {
return false;
}
public boolean hasDefaultValue() {
return ((ICPPParameter)getBinding()).hasDefaultValue();
}
public boolean isExternC() {
return false;
}
}
public static class CPPParameterProblem extends ProblemBinding implements ICPPParameter {
public CPPParameterProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
@ -240,13 +207,6 @@ public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPI
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl ) {
return new CPPParameterDelegate( usingDecl, this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/

View file

@ -13,12 +13,9 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ObjectMap;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPParameter.CPPParameterDelegate;
/**
* @author aniefer
@ -88,10 +85,6 @@ public class CPPParameterSpecialization extends CPPSpecialization implements ICP
return getParameter().hasDefaultValue();
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPParameterDelegate( usingDecl, this );
}
public boolean isExternC() {
return false;
}

View file

@ -85,7 +85,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceAlias;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTOperatorName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSwitchStatement;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
@ -103,7 +102,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
@ -1343,9 +1341,6 @@ public class CPPSemantics {
}
IBinding binding = ( n instanceof IBinding) ? (IBinding)n : ((IASTName)n).resolveBinding();
while( binding instanceof ICPPDelegate ){
binding = ((ICPPDelegate)binding).getBinding();
}
Object [] objs = ( names instanceof Object[] ) ? (Object[])names : null;
int idx = ( objs != null && objs.length > 0 ) ? 0 : -1;
Object o = ( idx != -1 ) ? objs[idx++] : names;
@ -1355,9 +1350,6 @@ public class CPPSemantics {
if( b instanceof ICPPUsingDeclaration ){
objs = ArrayUtil.append( Object.class, objs, ((ICPPUsingDeclaration)b).getDelegates() );
} else {
while( b instanceof ICPPDelegate ){
b = ((ICPPDelegate)b).getBinding();
}
if( binding != b )
return true;
@ -2082,12 +2074,6 @@ public class CPPSemantics {
} else if( temp instanceof IType ){
if( type == null ){
type = temp;
} else if( (temp instanceof ICPPDelegate && ((ICPPDelegate)temp).getBinding() == type) ||
(type instanceof ICPPDelegate && ((ICPPDelegate)type).getBinding() == temp) ||
(type instanceof ICPPDelegate && temp instanceof ICPPDelegate &&
((ICPPDelegate)type).getBinding() == ((ICPPDelegate)temp).getBinding()) )
{
//ok, delegates are synonyms
} else if( type instanceof ICPPClassTemplate && temp instanceof ICPPSpecialization &&
((IType) type).isSameType((IType) ((ICPPSpecialization)temp).getSpecializedBinding()))
{
@ -2098,9 +2084,7 @@ public class CPPSemantics {
} else {
if( obj == null)
obj = temp;
else if ( obj == temp ||
(temp instanceof ICPPDelegate && ((ICPPDelegate)temp).getBinding() == obj) ||
(obj instanceof ICPPDelegate && ((ICPPDelegate)obj).getBinding() == temp)) {
else if ( obj == temp ) {
//ok, delegates are synonyms
}
else {
@ -2172,9 +2156,6 @@ public class CPPSemantics {
if (binding instanceof ICPPSpecialization) {
return ((ICPPSpecialization) binding).getSpecializedBinding() instanceof IIndexBinding;
}
if (binding instanceof ICPPDelegate) {
return ((ICPPDelegate) binding).getBinding() instanceof IIndexBinding;
}
return false;
}
@ -2387,52 +2368,39 @@ public class CPPSemantics {
boolean currHasAmbiguousParam = false; //currFn has an ambiguous parameter conversion (ok if not bestFn)
boolean bestHasAmbiguousParam = false; //bestFn has an ambiguous parameter conversion (not ok, ambiguous)
IType [] sourceParameters = getSourceParameterTypes( data.functionParameters ); //the parameters the function is being called with
IType [] targetParameters = null;
boolean sourceVoid = ( data.functionParameters == null || data.functionParameters.length == 0 );
int numSourceParams = 0;
int targetLength = 0;
int numFns = fns.length;
final IType[] sourceParameters = getSourceParameterTypes( data.functionParameters ); //the parameters the function is being called with
final boolean sourceVoid = ( data.functionParameters == null || data.functionParameters.length == 0 );
final IType impliedObjectType = data.getImpliedObjectArgument();
IType impliedObjectType = data.getImpliedObjectArgument();
outer: for( int fnIdx = 0; fnIdx < numFns; fnIdx++ ){
// loop over all functions
function_loop: for( int fnIdx = 0; fnIdx < fns.length; fnIdx++ ){
currFn = (IFunction) fns[fnIdx];
if (currFn == null || bestFn == currFn ||
(bestFn instanceof ICPPDelegate && currFn.equals(((ICPPDelegate)bestFn).getBinding())) ||
(bestFn != null && currFn instanceof ICPPDelegate && bestFn.equals(((ICPPDelegate)currFn).getBinding())) )
{
if (currFn == null || bestFn == currFn) {
continue;
}
targetParameters = getTargetParameterTypes( currFn );
targetLength = targetParameters.length;
boolean useImplicitObj = ( currFn instanceof ICPPMethod && !(currFn instanceof ICPPConstructor) );
numSourceParams = ( useImplicitObj ) ? sourceParameters.length + 1 : sourceParameters.length;
int numTargetParams = 0;
final IType[] targetParameters = getTargetParameterTypes(currFn);
final int useImplicitObj = (currFn instanceof ICPPMethod && !(currFn instanceof ICPPConstructor)) ? 1 : 0;
final int sourceLen= Math.max(sourceParameters.length + useImplicitObj, 1);
final int numTargetParams= Math.max(targetParameters.length, 1+useImplicitObj);
if( currFnCost == null || currFnCost.length != ((numSourceParams == 0) ? 1 : numSourceParams) ){
currFnCost = new Cost [ (numSourceParams == 0) ? 1 : numSourceParams ];
if (currFnCost == null || currFnCost.length != sourceLen) {
currFnCost= new Cost[sourceLen];
}
comparison = 0;
boolean varArgs = false;
for( int j = 0; j < numSourceParams || j == 0; j++ ){
if( useImplicitObj ) {
source = ( j == 0 ) ? impliedObjectType : sourceParameters[j - 1];
numTargetParams = ( targetLength == 1 ) ? 2 : targetLength;
boolean isImpliedObject= false;
for (int j = 0; j < sourceLen; j++) {
if (useImplicitObj > 0) {
isImpliedObject= j==0;
source = isImpliedObject ? impliedObjectType : sourceParameters[j - 1];
} else {
source = sourceParameters[j];
numTargetParams = ( targetLength == 0 ) ? 1 : targetLength;
}
if( j < numTargetParams ){
if( (useImplicitObj && targetLength == 1 && j == 1) ||
(!useImplicitObj && targetLength == 0 && j == 0) )
{
if (j < numTargetParams) {
if (j == targetParameters.length) {
target = VOID_TYPE;
} else {
target = targetParameters[j];
@ -2440,27 +2408,24 @@ public class CPPSemantics {
} else
varArgs = true;
if( useImplicitObj && j == 0 && ASTInternal.isStatic(currFn, false)) {
if (isImpliedObject && ASTInternal.isStatic(currFn, false)) {
//13.3.1-4 for static member functions, the implicit object parameter is considered to match any object
cost = new Cost( source, target );
cost = new Cost(source, target);
cost.rank = Cost.IDENTITY_RANK; //exact match, no cost
} else if( source == null ){
continue outer;
} else if( varArgs ){
cost = new Cost( source, null );
} else if (source == null) {
continue function_loop;
} else if (varArgs) {
cost = new Cost(source, null);
cost.rank = Cost.ELLIPSIS_CONVERSION;
} else if( source.isSameType( target ) ||
( sourceVoid && ((useImplicitObj && j == 1)||(!useImplicitObj && j == 0)) ) )
{
} else if (source.isSameType(target) || (sourceVoid && j == useImplicitObj)) {
cost = new Cost( source, target );
cost.rank = Cost.IDENTITY_RANK; //exact match, no cost
} else {
cost = checkStandardConversionSequence( source, target );
cost = checkStandardConversionSequence( source, target, isImpliedObject);
//12.3-4 At most one user-defined conversion is implicitly applied to
//a single value. (also prevents infinite loop)
if( (cost.rank == Cost.NO_MATCH_RANK || cost.rank == Cost.FUZZY_TEMPLATE_PARAMETERS ) &&
!data.forUserDefinedConversion )
{
if (!data.forUserDefinedConversion && (cost.rank == Cost.NO_MATCH_RANK ||
cost.rank == Cost.FUZZY_TEMPLATE_PARAMETERS)) {
temp = checkUserDefinedConversionSequence( source, target );
if( temp != null ){
cost = temp;
@ -2790,15 +2755,24 @@ public class CPPSemantics {
}
return result;
}
static protected Cost checkStandardConversionSequence( IType source, IType target ) throws DOMException {
/**
* Computes the cost of using the standard conversion sequence from source to target.
* @param ignoreDerivedToBaseConversion handles the special case when members of different
* classes are nominated via using-declarations. In such a situation the derived to
* base conversion does not cause any costs.
* @throws DOMException
*/
static protected Cost checkStandardConversionSequence( IType source, IType target, boolean isImplicitThis) throws DOMException {
Cost cost = lvalue_to_rvalue( source, target );
if( cost.source == null || cost.target == null ){
return cost;
}
if( cost.source.isSameType( cost.target ) ){
if (cost.source.isSameType(cost.target) ||
// 7.3.3.13 for overload resolution the implicit this pointer is treated as if
// it were a pointer to the derived class
(isImplicitThis && cost.source instanceof ICPPClassType && cost.target instanceof ICPPClassType)) {
cost.rank = Cost.IDENTITY_RANK;
return cost;
}
@ -2819,7 +2793,10 @@ public class CPPSemantics {
return cost;
}
if( s.isSameType( t ) ){
if (s.isSameType(t) ||
// 7.3.3.13 for overload resolution the implicit this pointer is treated as if
// it were a pointer to the derived class
(isImplicitThis && s instanceof ICPPClassType && t instanceof ICPPClassType)) {
return cost;
}
@ -2868,7 +2845,7 @@ public class CPPSemantics {
}
}
if( constructor != null && !constructor.isExplicit() ){
constructorCost = checkStandardConversionSequence( t, target );
constructorCost = checkStandardConversionSequence( t, target, false );
}
}
@ -2878,7 +2855,7 @@ public class CPPSemantics {
if( ops.length > 0 && !(ops[0] instanceof IProblemBinding) ){
Cost [] costs = null;
for (int i = 0; i < ops.length; i++) {
cost = checkStandardConversionSequence( ops[i].getType().getReturnType(), target );
cost = checkStandardConversionSequence( ops[i].getType().getReturnType(), target, false );
if( cost.rank != Cost.NO_MATCH_RANK )
costs = (Cost[]) ArrayUtil.append( Cost.class, costs, cost );
}
@ -3483,10 +3460,7 @@ public class CPPSemantics {
if( binding != null )
if( binding instanceof ICPPUsingDeclaration ){
try {
set.addAll( ((ICPPUsingDeclaration)binding).getDelegates() );
} catch (DOMException e) {
}
set.addAll( ((ICPPUsingDeclaration)binding).getDelegates() );
} else if( binding instanceof CPPCompositeBinding ){
set.addAll( ((CPPCompositeBinding)binding).getBindings() );
} else {

View file

@ -18,9 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializerExpression;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
/**
* @author aniefer
@ -94,17 +92,10 @@ public class CPPTemplateNonTypeParameter extends CPPTemplateParameter implements
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/
@Override
public void addDefinition(IASTNode node) {
// TODO Auto-generated method stub
@ -113,6 +104,7 @@ public class CPPTemplateNonTypeParameter extends CPPTemplateParameter implements
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDeclaration(org.eclipse.cdt.core.dom.ast.IASTNode)
*/
@Override
public void addDeclaration(IASTNode node) {
// TODO Auto-generated method stub

View file

@ -16,9 +16,7 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
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;
@ -34,6 +32,7 @@ public class CPPTemplateParameter extends PlatformObject implements ICPPTemplate
declarations = new IASTName[] { name };
}
@Override
public Object clone() {
IType t = null;
try {
@ -106,14 +105,6 @@ public class CPPTemplateParameter extends PlatformObject implements ICPPTemplate
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/
@ -149,6 +140,7 @@ public class CPPTemplateParameter extends PlatformObject implements ICPPTemplate
return Linkage.CPP_LINKAGE;
}
@Override
public String toString() {
return getName();
}

View file

@ -26,14 +26,12 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.core.parser.util.ObjectMap;
@ -216,17 +214,10 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/
@Override
public void addDefinition(IASTNode node) {
// TODO Auto-generated method stub
@ -235,6 +226,7 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDeclaration(org.eclipse.cdt.core.dom.ast.IASTNode)
*/
@Override
public void addDeclaration(IASTNode node) {
// TODO Auto-generated method stub

View file

@ -1,19 +1,16 @@
/*******************************************************************************
* Copyright (c) 2005, 2007 IBM Corporation and others.
* Copyright (c) 2005, 2008 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Bryan Wilkinson (QNX)
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
* IBM - Initial API and implementation
* Bryan Wilkinson (QNX)
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
/*
* Created on Mar 11, 2005
*/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
@ -849,6 +846,7 @@ public class CPPTemplates {
shouldVisitStatements = true;
this.bindings = bindings;
}
@Override
public int visit(IASTName name) {
if (name.getBinding() != null) {
IBinding binding = name.getBinding();
@ -870,6 +868,7 @@ public class CPPTemplates {
}
return PROCESS_CONTINUE;
}
@Override
public int visit(IASTStatement statement) {
return PROCESS_SKIP;
}
@ -1428,15 +1427,19 @@ public class CPPTemplates {
this.functionParameters = functionParameters;
this.templateParameters = templateParameters;
}
@Override
public IParameter[] getParameters() {
return functionParameters;
}
@Override
public ICPPTemplateParameter[] getTemplateParameters() {
return templateParameters;
}
@Override
public IScope getScope() {
return null;
}
@Override
public IFunctionType getType() {
if (type == null) {
type = CPPVisitor.createImplicitFunctionType(new CPPBasicType(IBasicType.t_void, 0), functionParameters);
@ -1532,7 +1535,7 @@ public class CPPTemplates {
pType = e.getProblem();
}
}
Cost cost = CPPSemantics.checkStandardConversionSequence(argument, pType);
Cost cost = CPPSemantics.checkStandardConversionSequence(argument, pType, false);
if (cost == null || cost.rank == Cost.NO_MATCH_RANK) {
return false;

View file

@ -20,8 +20,6 @@ import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
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;
@ -32,20 +30,6 @@ import org.eclipse.core.runtime.PlatformObject;
* @author aniefer
*/
public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContainer, ICPPInternalBinding {
public static class CPPTypedefDelegate extends CPPDelegate implements ITypedef, ITypeContainer {
public CPPTypedefDelegate(ICPPUsingDeclaration name, ITypedef binding) {
super(name, binding);
}
public IType getType() throws DOMException {
return ((ITypedef)getBinding()).getType();
}
public boolean isSameType(IType type) {
return ((ITypedef)getBinding()).isSameType(type);
}
public void setType(IType type) {
((ITypeContainer)getBinding()).setType(type);
}
}
private IASTName[] declarations = null;
private IType type = null;
@ -128,7 +112,8 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
return CPPVisitor.getContainingScope(declarations[0].getParent());
}
public Object clone() {
@Override
public Object clone() {
IType t = null;
try {
t = (IType) super.clone();
@ -164,13 +149,6 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPTypedefDelegate(usingDecl, this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/
@ -207,6 +185,7 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
return Linkage.CPP_LINKAGE;
}
@Override
public String toString() {
return getName();
}

View file

@ -14,12 +14,9 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ObjectMap;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTypedef.CPPTypedefDelegate;
/**
* @author aniefer
@ -54,7 +51,8 @@ public class CPPTypedefSpecialization extends CPPSpecialization implements
/* (non-Javadoc)
* @see java.lang.Object#clone()
*/
public Object clone() {
@Override
public Object clone() {
IType t = null;
try {
t = (IType) super.clone();
@ -90,13 +88,6 @@ public class CPPTypedefSpecialization extends CPPSpecialization implements
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl ) {
return new CPPTypedefDelegate( usingDecl, this );
}
public void setType(IType type) {
this.type = type;
}

View file

@ -19,9 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ObjectMap;
import org.eclipse.cdt.internal.core.dom.Linkage;
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
@ -69,13 +67,6 @@ public class CPPUnknownBinding extends PlatformObject implements ICPPInternalUnk
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl1 ) {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/

View file

@ -9,10 +9,6 @@
* IBM Corporation - initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
/*
* Created on Mar 16, 2005
*/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ILinkage;
@ -24,9 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.Linkage;
import org.eclipse.core.runtime.PlatformObject;
@ -35,7 +29,7 @@ import org.eclipse.core.runtime.PlatformObject;
*/
public class CPPUsingDeclaration extends PlatformObject implements ICPPUsingDeclaration, ICPPInternalBinding{
private IASTName name;
private ICPPDelegate [] delegates;
private IBinding [] delegates;
public CPPUsingDeclaration( IASTName name, IBinding [] bindings ) {
if( name instanceof ICPPASTQualifiedName ){
@ -43,24 +37,13 @@ public class CPPUsingDeclaration extends PlatformObject implements ICPPUsingDecl
name = ns[ ns.length - 1 ];
}
this.name = name;
this.delegates = createDelegates( bindings );
this.delegates= bindings;
}
private ICPPDelegate [] createDelegates( IBinding [] bindings ){
ICPPDelegate [] result = null;
for( int i = 0; i < bindings.length; i++ ){
if( bindings[i] instanceof ICPPDelegateCreator){
ICPPDelegate delegate = ((ICPPDelegateCreator)bindings[i]).createDelegate( this );
result = (ICPPDelegate[]) ArrayUtil.append( ICPPDelegate.class, result, delegate );
}
}
return (ICPPDelegate[]) ArrayUtil.trim( ICPPDelegate.class, result );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration#getDelegates()
*/
public ICPPDelegate[] getDelegates() {
public IBinding[] getDelegates() {
return delegates;
}
@ -130,13 +113,6 @@ public class CPPUsingDeclaration extends PlatformObject implements ICPPUsingDecl
return n;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate( ICPPUsingDeclaration usingDecl ) {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/

View file

@ -25,8 +25,6 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.Linkage;
@ -38,32 +36,6 @@ import org.eclipse.core.runtime.PlatformObject;
* @author aniefer
*/
public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInternalVariable {
public static class CPPVariableDelegate extends CPPDelegate implements ICPPVariable {
public CPPVariableDelegate( ICPPUsingDeclaration name, ICPPVariable binding ) {
super( name, binding );
}
public IType getType() throws DOMException {
return ((ICPPVariable)getBinding()).getType();
}
public boolean isStatic() throws DOMException {
return ((ICPPVariable)getBinding()).isStatic();
}
public boolean isMutable() throws DOMException {
return ((ICPPVariable)getBinding()).isMutable();
}
public boolean isExtern() throws DOMException {
return ((ICPPVariable)getBinding()).isExtern();
}
public boolean isExternC() throws DOMException {
return ((ICPPVariable)getBinding()).isExternC();
}
public boolean isAuto() throws DOMException {
return ((ICPPVariable)getBinding()).isAuto();
}
public boolean isRegister() throws DOMException {
return ((ICPPVariable)getBinding()).isRegister();
}
}
public static class CPPVariableProblem extends ProblemBinding implements ICPPVariable{
public CPPVariableProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
@ -285,13 +257,6 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl ) {
return new CPPVariableDelegate( usingDecl, this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
*/

View file

@ -118,7 +118,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
@ -1066,6 +1065,7 @@ public class CPPVisitor {
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
*/
@Override
public int visit(IASTDeclaration declaration) {
if ( declaration instanceof IASTProblemHolder )
addProblem(((IASTProblemHolder)declaration).getProblem());
@ -1075,6 +1075,7 @@ public class CPPVisitor {
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
@Override
public int visit(IASTExpression expression) {
if ( expression instanceof IASTProblemHolder )
addProblem(((IASTProblemHolder)expression).getProblem());
@ -1085,6 +1086,7 @@ public class CPPVisitor {
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processStatement(org.eclipse.cdt.core.dom.ast.IASTStatement)
*/
@Override
public int visit(IASTStatement statement) {
if ( statement instanceof IASTProblemHolder )
addProblem(((IASTProblemHolder)statement).getProblem());
@ -1095,6 +1097,7 @@ public class CPPVisitor {
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processTypeId(org.eclipse.cdt.core.dom.ast.IASTTypeId)
*/
@Override
public int visit(IASTTypeId typeId) {
if ( typeId instanceof IASTProblemHolder )
addProblem(((IASTProblemHolder)typeId).getProblem());
@ -1124,15 +1127,7 @@ public class CPPVisitor {
this.bindings = new IBinding[] {binding};
if (binding instanceof ICPPUsingDeclaration) {
try {
ICPPDelegate[] delegates= ((ICPPUsingDeclaration) binding).getDelegates();
this.bindings= new IBinding[delegates.length+1];
this.bindings[0]= binding;
for (int i=0; i < delegates.length; i++) {
this.bindings[i+1]= delegates[i].getBinding();
}
} catch (DOMException e) {
}
this.bindings= ((ICPPUsingDeclaration) binding).getDelegates();
kind= KIND_COMPOSITE;
}
else if( binding instanceof ILabel )
@ -1152,6 +1147,7 @@ public class CPPVisitor {
kind = KIND_OBJ_FN;
}
@Override
public int visit( IASTName name ){
if( name instanceof ICPPASTQualifiedName ) return PROCESS_CONTINUE;
@ -1245,11 +1241,8 @@ public class CPPVisitor {
}
// a using declaration is a declaration for the references of its delegates
if (nameBinding instanceof ICPPUsingDeclaration) {
try {
if (ArrayUtil.contains(((ICPPUsingDeclaration) nameBinding).getDelegates(), bindings[i])) {
return true;
}
} catch (DOMException e) {
if (ArrayUtil.contains(((ICPPUsingDeclaration) nameBinding).getDelegates(), bindings[i])) {
return true;
}
}
}
@ -1272,13 +1265,6 @@ public class CPPVisitor {
while(true) {
if (binding instanceof ICPPSpecialization) {
binding= ((ICPPSpecialization) binding).getSpecializedBinding();
} else if (binding instanceof ICPPDelegate) {
ICPPDelegate delegate= (ICPPDelegate) binding;
if (delegate.getDelegateType() == ICPPDelegate.USING_DECLARATION) {
binding= delegate.getBinding();
} else {
break;
}
} else {
break;
}
@ -1308,14 +1294,7 @@ public class CPPVisitor {
this.bindings = new IBinding[] {binding};
if (binding instanceof ICPPUsingDeclaration) {
try {
ICPPDelegate[] delegates= ((ICPPUsingDeclaration) binding).getDelegates();
this.bindings= new IBinding[delegates.length];
for (int i = 0; i < delegates.length; i++) {
binding= this.bindings[i]= delegates[i].getBinding();
}
} catch (DOMException e) {
}
this.bindings= ((ICPPUsingDeclaration) binding).getDelegates();
kind= KIND_COMPOSITE;
} else if( binding instanceof ILabel ) {
kind = KIND_LABEL;
@ -1332,6 +1311,7 @@ public class CPPVisitor {
}
}
@Override
public int visit( IASTName name ){
if( name instanceof ICPPASTQualifiedName || name instanceof ICPPASTTemplateId ) return PROCESS_CONTINUE;
@ -1417,15 +1397,12 @@ public class CPPVisitor {
}
}
if (nameBinding instanceof ICPPUsingDeclaration) {
try {
ICPPDelegate[] delegates= ((ICPPUsingDeclaration) nameBinding).getDelegates();
for (int i = 0; i < delegates.length; i++) {
ICPPDelegate delegate = delegates[i];
if (isReferenceBinding(delegate.getBinding())) {
return true;
}
IBinding[] delegates= ((ICPPUsingDeclaration) nameBinding).getDelegates();
for (int i = 0; i < delegates.length; i++) {
IBinding delegate = delegates[i];
if (isReferenceBinding(delegate)) {
return true;
}
} catch (DOMException e) {
}
return false;
} else {

View file

@ -1,29 +0,0 @@
/**********************************************************************
* Copyright (c) 2007, 2008 QNX Software Systems 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Markus Schorn (Wind River Systems)
**********************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
/**
* @author Doug Schaefer
*
*/
public interface ICPPDelegateCreator {
/**
* Creates a delegate binding for the using declaration provided.
* @param usingDecl
*/
ICPPDelegate createDelegate( ICPPUsingDeclaration usingDecl );
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2007 IBM Corporation and others.
* Copyright (c) 2004, 2008 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
@ -8,10 +8,6 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
/*
* Created on Jan 24, 2005
*/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.IASTNode;
@ -20,7 +16,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
/**
* @author aniefer
*/
public interface ICPPInternalBinding extends ICPPBinding, ICPPDelegateCreator {
public interface ICPPInternalBinding extends ICPPBinding {
//methods required by the CPPVisitor but not meant for the public interface
//implementors should keep the node with the lowest offset in declarations[0]

View file

@ -27,10 +27,8 @@ import java.util.regex.Pattern;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ILinkage;
import org.eclipse.cdt.core.dom.IName;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.index.IIndexBinding;
@ -42,7 +40,6 @@ import org.eclipse.cdt.core.index.IIndexMacro;
import org.eclipse.cdt.core.index.IIndexName;
import org.eclipse.cdt.core.index.IndexFilter;
import org.eclipse.cdt.internal.core.dom.Linkage;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPDelegate;
import org.eclipse.cdt.internal.core.index.composite.CompositingNotImplementedError;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
import org.eclipse.cdt.internal.core.index.composite.c.CCompositesFactory;
@ -125,12 +122,7 @@ public class CIndex implements IIndex {
public IIndexName[] findNames(IBinding binding, int flags) throws CoreException {
LinkedList<IIndexFragmentName> result= new LinkedList<IIndexFragmentName>();
if (binding instanceof ICPPUsingDeclaration) {
ICPPDelegate[] bindings= null;
try {
bindings = ((ICPPUsingDeclaration)binding).getDelegates();
} catch (DOMException e) {
CCorePlugin.log(e);
}
IBinding[] bindings= ((ICPPUsingDeclaration)binding).getDelegates();
if (bindings == null || bindings.length == 0) {
return new IIndexName[0];
}
@ -143,18 +135,8 @@ public class CIndex implements IIndex {
return multi.toArray(new IIndexName[multi.size()]);
}
binding= bindings[0];
} else if (binding instanceof CPPDelegate) {
CPPDelegate delegate= (CPPDelegate) binding;
if (delegate.getDelegateType() == ICPPDelegate.USING_DECLARATION) {
binding= delegate.getBinding();
IIndexFragmentBinding ib= (IIndexFragmentBinding) delegate.getUsingDeclaration().getAdapter(IIndexFragmentBinding.class);
if (ib != null) {
final IIndexFragmentName[] names= ib.getFragment().findNames(ib, flags);
result.addAll(Arrays.asList(names));
}
}
}
}
int fragCount= 0;
for (int i = 0; i < fPrimaryFragmentCount; i++) {
final IIndexFragmentName[] names = fFragments[i].findNames(binding, flags);

View file

@ -18,15 +18,11 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassTemplate;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplates;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalTemplateInstantiator;
import org.eclipse.cdt.internal.core.index.CIndex;
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
@ -34,7 +30,7 @@ import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
import org.eclipse.core.runtime.CoreException;
public class CompositeCPPClassTemplate extends CompositeCPPClassType implements
ICPPClassTemplate, ICPPDelegateCreator, ICPPInternalTemplateInstantiator {
ICPPClassTemplate, ICPPInternalTemplateInstantiator {
public CompositeCPPClassTemplate(ICompositesFactory cf, ICPPClassType ct) {
super(cf, ct);
@ -91,8 +87,4 @@ ICPPClassTemplate, ICPPDelegateCreator, ICPPInternalTemplateInstantiator {
return CPPTemplates.instantiateTemplate(this, arguments, null);
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPClassTemplate.CPPClassTemplateDelegate(usingDecl, this);
}
}

View file

@ -19,22 +19,19 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBase;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassType.CPPClassTypeDelegate;
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
import org.eclipse.cdt.internal.core.index.IIndexType;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
class CompositeCPPClassType extends CompositeCPPBinding implements ICPPClassType, ICPPDelegateCreator, IIndexType {
class CompositeCPPClassType extends CompositeCPPBinding implements ICPPClassType, IIndexType {
public CompositeCPPClassType(ICompositesFactory cf, ICPPClassType rbinding) {
super(cf, rbinding);
}
@Override
public Object clone() {
fail(); return null;
}
@ -94,7 +91,8 @@ class CompositeCPPClassType extends CompositeCPPBinding implements ICPPClassType
}
}
public Object clone(){
@Override
public Object clone(){
return new CPPBaseDelegate(base, true);
}
}
@ -176,8 +174,4 @@ class CompositeCPPClassType extends CompositeCPPBinding implements ICPPClassType
public boolean isSameType(IType type) {
return ((ICPPClassType)rbinding).isSameType(type);
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPClassTypeDelegate(usingDecl, this);
}
}

View file

@ -15,15 +15,11 @@ import org.eclipse.cdt.core.dom.ast.IEnumeration;
import org.eclipse.cdt.core.dom.ast.IEnumerator;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPEnumeration.CPPEnumerationDelegate;
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
import org.eclipse.cdt.internal.core.index.IIndexType;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
class CompositeCPPEnumeration extends CompositeCPPBinding implements IEnumeration, ICPPDelegateCreator, IIndexType {
class CompositeCPPEnumeration extends CompositeCPPBinding implements IEnumeration, IIndexType {
public CompositeCPPEnumeration(ICompositesFactory cf, IEnumeration rbinding) {
super(cf, (ICPPBinding) rbinding);
}
@ -39,9 +35,6 @@ class CompositeCPPEnumeration extends CompositeCPPBinding implements IEnumeratio
return ((IEnumeration)rbinding).isSameType(type);
}
@Override
public Object clone() { fail(); return null; }
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPEnumerationDelegate(usingDecl, this);
}
}

View file

@ -14,14 +14,10 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IEnumerator;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPEnumerator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.IIndexType;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
class CompositeCPPEnumerator extends CompositeCPPBinding implements IEnumerator, ICPPDelegateCreator {
class CompositeCPPEnumerator extends CompositeCPPBinding implements IEnumerator {
public CompositeCPPEnumerator(ICompositesFactory cf, IEnumerator rbinding) {
super(cf, (ICPPBinding) rbinding);
}
@ -30,8 +26,4 @@ class CompositeCPPEnumerator extends CompositeCPPBinding implements IEnumerator,
IType type = ((IEnumerator)rbinding).getType();
return cf.getCompositeType((IIndexType)type);
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPEnumerator.CPPEnumeratorDelegate(usingDecl, this);
}
}

View file

@ -15,15 +15,11 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.IField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPField;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
class CompositeCPPField extends CompositeCPPVariable implements ICPPField, ICPPDelegateCreator {
class CompositeCPPField extends CompositeCPPVariable implements ICPPField {
public CompositeCPPField(ICompositesFactory cf, ICPPField rbinding) {
super(cf, rbinding);
}
@ -41,8 +37,4 @@ class CompositeCPPField extends CompositeCPPVariable implements ICPPField, ICPPD
IBinding preresult = ((IField)rbinding).getCompositeTypeOwner();
return (ICompositeType) cf.getCompositeBinding((IIndexFragmentBinding) preresult);
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPField.CPPFieldDelegate(usingDecl, this);
}
}

View file

@ -17,16 +17,12 @@ import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunction;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
import org.eclipse.cdt.internal.core.index.IIndexType;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction, ICPPDelegateCreator {
class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction {
public CompositeCPPFunction(ICompositesFactory cf, ICPPFunction rbinding) {
super(cf, rbinding);
@ -81,10 +77,12 @@ class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction,
return ((ICPPFunction)rbinding).takesVarArgs();
}
@Override
public Object clone() {
fail(); return null;
}
@Override
public String toString() {
StringBuffer result = new StringBuffer();
try {
@ -94,8 +92,4 @@ class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction,
}
return result.toString();
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPFunction.CPPFunctionDelegate(usingDecl, this);
}
}

View file

@ -13,19 +13,15 @@ package org.eclipse.cdt.internal.core.index.composite.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionTemplate;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalTemplateInstantiator;
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
public class CompositeCPPFunctionTemplate extends CompositeCPPFunction implements ICPPFunctionTemplate, ICPPInternalTemplateInstantiator, ICPPDelegateCreator {
public class CompositeCPPFunctionTemplate extends CompositeCPPFunction implements ICPPFunctionTemplate, ICPPInternalTemplateInstantiator {
public CompositeCPPFunctionTemplate(ICompositesFactory cf, ICPPFunction rbinding) {
super(cf, rbinding);
@ -50,8 +46,4 @@ public class CompositeCPPFunctionTemplate extends CompositeCPPFunction implement
public IBinding instantiate(IType[] arguments) {
return InternalTemplateInstantiatorUtil.instantiate(arguments, cf, rbinding);
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPFunctionTemplate.CPPFunctionTemplateDelegate(usingDecl, this);
}
}

View file

@ -12,16 +12,12 @@ package org.eclipse.cdt.internal.core.index.composite.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPMethod;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
class CompositeCPPMethod extends CompositeCPPFunction implements ICPPMethod, ICPPDelegateCreator {
class CompositeCPPMethod extends CompositeCPPFunction implements ICPPMethod {
public CompositeCPPMethod(ICompositesFactory cf, ICPPFunction rbinding) {
super(cf, rbinding);
@ -47,8 +43,4 @@ class CompositeCPPMethod extends CompositeCPPFunction implements ICPPMethod, ICP
public int getVisibility() throws DOMException {
return ((ICPPMethod)rbinding).getVisibility();
}
public final ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPMethod.CPPMethodDelegate(usingDecl, this);
}
}

View file

@ -12,16 +12,12 @@ package org.eclipse.cdt.internal.core.index.composite.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPNamespace;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
class CompositeCPPNamespace extends CompositeCPPBinding implements ICPPNamespace, ICPPDelegateCreator {
class CompositeCPPNamespace extends CompositeCPPBinding implements ICPPNamespace {
ICPPNamespace[] namespaces;
public CompositeCPPNamespace(ICompositesFactory cf, ICPPNamespace[] namespaces) {
super(cf, namespaces[0]);
@ -41,8 +37,4 @@ class CompositeCPPNamespace extends CompositeCPPBinding implements ICPPNamespace
public ICPPNamespaceScope getNamespaceScope() throws DOMException {
return new CompositeCPPNamespaceScope(cf, namespaces);
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPNamespace.CPPNamespaceDelegate(usingDecl, this);
}
}

View file

@ -34,8 +34,4 @@ class CompositeCPPNamespaceAlias extends CompositeCPPBinding implements ICPPName
IIndexFragmentBinding ns = (IIndexFragmentBinding) ((ICPPNamespaceAlias)rbinding).getBinding();
return cf.getCompositeBinding(ns);
}
public int getDelegateType() {
return NAMESPACE_ALIAS;
}
}

View file

@ -10,15 +10,11 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPParameter;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
class CompositeCPPParameter extends CompositeCPPVariable implements ICPPParameter, ICPPDelegateCreator {
class CompositeCPPParameter extends CompositeCPPVariable implements ICPPParameter {
public CompositeCPPParameter(ICompositesFactory cf, ICPPVariable rbinding) {
super(cf, rbinding);
}
@ -26,8 +22,4 @@ class CompositeCPPParameter extends CompositeCPPVariable implements ICPPParamete
public boolean hasDefaultValue() {
return ((ICPPParameter)rbinding).hasDefaultValue();
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPParameter.CPPParameterDelegate(usingDecl, this);
}
}

View file

@ -14,10 +14,7 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTypedef;
import org.eclipse.cdt.internal.core.index.CPPTypedefClone;
import org.eclipse.cdt.internal.core.index.IIndexType;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
@ -40,11 +37,8 @@ class CompositeCPPTypedef extends CompositeCPPBinding implements ITypedef, IInde
fail();
}
@Override
public Object clone() {
return new CPPTypedefClone(this);
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPTypedef.CPPTypedefDelegate(usingDecl, this);
}
}

View file

@ -12,10 +12,8 @@ package org.eclipse.cdt.internal.core.index.composite.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
@ -28,19 +26,16 @@ class CompositeCPPUsingDeclaration extends CompositeCPPBinding implements ICPPUs
fail(); return null;
}
public ICPPDelegate[] getDelegates() throws DOMException {
ICPPDelegate[] delegates = ((ICPPUsingDeclaration) rbinding).getDelegates();
ICPPDelegate[] composites = new ICPPDelegate[delegates.length];
public IBinding[] getDelegates() {
IBinding[] delegates = ((ICPPUsingDeclaration) rbinding).getDelegates();
IBinding[] composites = new IBinding[delegates.length];
int j = 0;
for (int i = 0; i < delegates.length; i++) {
IBinding binding = delegates[i].getBinding();
IBinding binding = delegates[i];
if (binding instanceof IIndexFragmentBinding) {
binding = cf.getCompositeBinding((IIndexFragmentBinding) binding);
if (binding instanceof ICPPDelegateCreator) {
composites[j++] = ((ICPPDelegateCreator) binding).createDelegate(this);
}
composites[j++] = cf.getCompositeBinding((IIndexFragmentBinding) binding);
}
}
return (ICPPDelegate[]) ArrayUtil.trim(ICPPDelegate.class, composites);
return (IBinding[]) ArrayUtil.trim(IBinding.class, composites);
}
}

View file

@ -13,15 +13,11 @@ package org.eclipse.cdt.internal.core.index.composite.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVariable;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.IIndexType;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
class CompositeCPPVariable extends CompositeCPPBinding implements ICPPVariable, ICPPDelegateCreator {
class CompositeCPPVariable extends CompositeCPPBinding implements ICPPVariable {
public CompositeCPPVariable(ICompositesFactory cf, ICPPVariable delegate) {
super(cf, delegate);
@ -55,8 +51,4 @@ class CompositeCPPVariable extends CompositeCPPBinding implements ICPPVariable,
public boolean isStatic() throws DOMException {
return ((ICPPVariable)rbinding).isStatic();
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPVariable.CPPVariableDelegate(usingDecl, this);
}
}

View file

@ -28,13 +28,11 @@ import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.index.IIndexBinding;
import org.eclipse.cdt.core.index.IIndexFileSet;
import org.eclipse.cdt.core.index.IIndexName;
@ -42,11 +40,9 @@ import org.eclipse.cdt.core.index.IndexFilter;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassScope;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassTemplate;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPDeferredClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplates;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalTemplateInstantiator;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
import org.eclipse.cdt.internal.core.index.IIndexScope;
@ -62,7 +58,7 @@ import org.eclipse.core.runtime.CoreException;
*/
class PDOMCPPClassTemplate extends PDOMCPPClassType
implements ICPPClassTemplate, ICPPInternalTemplateInstantiator,
ICPPTemplateScope, ICPPDelegateCreator {
ICPPTemplateScope {
private static final int PARAMETERS = PDOMCPPClassType.RECORD_SIZE + 0;
private static final int INSTANCES = PDOMCPPClassType.RECORD_SIZE + 4;
@ -84,10 +80,12 @@ class PDOMCPPClassTemplate extends PDOMCPPClassType
super(pdom, bindingRecord);
}
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
@Override
public int getNodeType() {
return IIndexCPPBindingConstants.CPP_CLASS_TEMPLATE;
}
@ -152,6 +150,7 @@ class PDOMCPPClassTemplate extends PDOMCPPClassType
return null;
}
@Override
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) throws DOMException {
try {
if (getDBName().equals(name.toCharArray())) {
@ -163,9 +162,11 @@ class PDOMCPPClassTemplate extends PDOMCPPClassType
}
IndexFilter filter = new IndexFilter() {
@Override
public boolean acceptBinding(IBinding binding) {
return !(binding instanceof ICPPTemplateParameter || binding instanceof ICPPSpecialization);
}
@Override
public boolean acceptLinkage(ILinkage linkage) {
return linkage.getLinkageID() == ILinkage.CPP_LINKAGE_ID;
}
@ -180,6 +181,7 @@ class PDOMCPPClassTemplate extends PDOMCPPClassType
return null;
}
@Override
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) throws DOMException {
IBinding[] result = null;
try {
@ -190,9 +192,11 @@ class PDOMCPPClassTemplate extends PDOMCPPClassType
result = (IBinding[]) ArrayUtil.append(IBinding.class, result, this);
}
IndexFilter filter = new IndexFilter() {
@Override
public boolean acceptBinding(IBinding binding) {
return !(binding instanceof ICPPTemplateParameter || binding instanceof ICPPSpecialization);
}
@Override
public boolean acceptLinkage(ILinkage linkage) {
return linkage.getLinkageID() == ILinkage.CPP_LINKAGE_ID;
}
@ -268,6 +272,7 @@ class PDOMCPPClassTemplate extends PDOMCPPClassType
private PDOMCPPTemplateScope scope;
@Override
public IIndexScope getParent() {
if (scope == null) {
scope = new PDOMCPPTemplateScope();
@ -275,6 +280,7 @@ class PDOMCPPClassTemplate extends PDOMCPPClassType
return scope;
}
@Override
public void accept(IPDOMVisitor visitor) throws CoreException {
super.accept(visitor);
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + PARAMETERS, getLinkageImpl());
@ -283,6 +289,7 @@ class PDOMCPPClassTemplate extends PDOMCPPClassType
list.accept(visitor);
}
@Override
public void addMember(PDOMNode member) throws CoreException {
if (member instanceof ICPPTemplateParameter) {
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + PARAMETERS, getLinkageImpl());
@ -370,6 +377,7 @@ class PDOMCPPClassTemplate extends PDOMCPPClassType
return CPPTemplates.instantiateTemplate(this, arguments, null);
}
@Override
public boolean isSameType(IType type) {
if (type instanceof ITypedef) {
return type.isSameType(this);
@ -420,8 +428,4 @@ class PDOMCPPClassTemplate extends PDOMCPPClassType
return false;
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPClassTemplate.CPPClassTemplateDelegate(usingDecl, this);
}
}

View file

@ -36,10 +36,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.index.IIndexBinding;
import org.eclipse.cdt.core.index.IIndexFileSet;
import org.eclipse.cdt.core.index.IndexFilter;
@ -47,8 +45,6 @@ import org.eclipse.cdt.internal.core.Util;
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassScope;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassType.CPPClassTypeDelegate;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
import org.eclipse.cdt.internal.core.index.IIndexScope;
import org.eclipse.cdt.internal.core.index.IIndexType;
@ -67,7 +63,7 @@ import org.eclipse.core.runtime.CoreException;
*
*/
class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
ICPPClassScope, IPDOMMemberOwner, IIndexType, IIndexScope, ICPPDelegateCreator {
ICPPClassScope, IPDOMMemberOwner, IIndexType, IIndexScope {
@SuppressWarnings("static-access")
private static final int FIRSTBASE = PDOMCPPBinding.RECORD_SIZE + 0;
@ -90,6 +86,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
super(pdom, bindingRecord);
}
@Override
public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ICPPClassType) {
ICPPClassType ct= (ICPPClassType) newBinding;
@ -111,10 +108,12 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
list.addMember(member);
}
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
@Override
public int getNodeType() {
return IIndexCPPBindingConstants.CPPCLASSTYPE;
}
@ -136,7 +135,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
}
public boolean isSameType(IType type) {
if (type instanceof ITypedef || type instanceof ICPPDelegate) {
if (type instanceof ITypedef) {
return type.isSameType(this);
}
@ -176,6 +175,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
}
}
@Override
public void accept(IPDOMVisitor visitor) throws CoreException {
super.accept(visitor);
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + MEMBERLIST, getLinkageImpl());
@ -304,6 +304,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
}
}
@Override
public boolean isGloballyQualified() throws DOMException {
try {
return getParentNode() instanceof PDOMLinkage;
@ -316,6 +317,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
return this;
}
@Override
public void addChild(PDOMNode member) throws CoreException {
addMember(member);
}
@ -335,6 +337,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
return true;
}
@Override
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) throws DOMException {
try {
final char[] nameChars = name.toCharArray();
@ -354,6 +357,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
return null;
}
@Override
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) throws DOMException {
IBinding[] result = null;
try {
@ -399,10 +403,12 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
// Not implemented
@Override
public Object clone() {fail();return null;}
public IField findField(String name) throws DOMException {fail();return null;}
public IBinding[] getFriends() throws DOMException {fail();return null;}
@Override
public boolean mayHaveChildren() {
return true;
}
@ -433,11 +439,8 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
public IIndexBinding getScopeBinding() {
return this;
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPClassTypeDelegate(usingDecl, this);
}
@Override
public String toString() {
return ASTTypeUtil.getType(this);
}

View file

@ -21,10 +21,6 @@ import org.eclipse.cdt.core.dom.ast.IEnumerator;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPEnumeration.CPPEnumerationDelegate;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
import org.eclipse.cdt.internal.core.index.IIndexType;
import org.eclipse.cdt.internal.core.pdom.PDOM;
@ -38,7 +34,7 @@ import org.eclipse.core.runtime.CoreException;
* @author Doug Schaefer
*/
class PDOMCPPEnumeration extends PDOMCPPBinding
implements IEnumeration, IIndexType, ICPPBinding, ICPPDelegateCreator {
implements IEnumeration, IIndexType, ICPPBinding {
private static final int FIRST_ENUMERATOR = PDOMBinding.RECORD_SIZE + 0;
@ -54,10 +50,12 @@ class PDOMCPPEnumeration extends PDOMCPPBinding
super(pdom, record);
}
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
@Override
public int getNodeType() {
return IIndexCPPBindingConstants.CPPENUMERATION;
}
@ -100,7 +98,7 @@ class PDOMCPPEnumeration extends PDOMCPPBinding
}
public boolean isSameType(IType type) {
if (type instanceof ITypedef || type instanceof ICPPDelegate) {
if (type instanceof ITypedef) {
return type.isSameType(this);
}
@ -131,12 +129,8 @@ class PDOMCPPEnumeration extends PDOMCPPBinding
return false;
}
@Override
public Object clone() {
throw new PDOMNotImplementedError();
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPEnumerationDelegate(usingDecl, this);
}
}

View file

@ -16,10 +16,6 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IEnumerator;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPEnumerator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
import org.eclipse.cdt.internal.core.pdom.PDOM;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
@ -30,7 +26,7 @@ import org.eclipse.core.runtime.CoreException;
* @author Doug Schaefer
*
*/
class PDOMCPPEnumerator extends PDOMCPPBinding implements IEnumerator, ICPPBinding, ICPPDelegateCreator {
class PDOMCPPEnumerator extends PDOMCPPBinding implements IEnumerator, ICPPBinding {
private static final int ENUMERATION = PDOMBinding.RECORD_SIZE + 0;
private static final int NEXT_ENUMERATOR = PDOMBinding.RECORD_SIZE + 4;
@ -49,10 +45,12 @@ class PDOMCPPEnumerator extends PDOMCPPBinding implements IEnumerator, ICPPBindi
super(pdom, record);
}
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
@Override
public int getNodeType() {
return IIndexCPPBindingConstants.CPPENUMERATOR;
}
@ -75,9 +73,4 @@ class PDOMCPPEnumerator extends PDOMCPPBinding implements IEnumerator, ICPPBindi
return null;
}
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPEnumerator.CPPEnumeratorDelegate(usingDecl, this);
}
}

View file

@ -16,11 +16,7 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPField;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
import org.eclipse.cdt.internal.core.pdom.PDOM;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
@ -30,7 +26,7 @@ import org.eclipse.core.runtime.CoreException;
* @author Doug Schaefer
*
*/
class PDOMCPPField extends PDOMCPPVariable implements ICPPField, ICPPDelegateCreator {
class PDOMCPPField extends PDOMCPPVariable implements ICPPField {
public PDOMCPPField(PDOM pdom, PDOMNode parent, ICPPField field)
throws CoreException {
@ -42,11 +38,13 @@ class PDOMCPPField extends PDOMCPPVariable implements ICPPField, ICPPDelegateCre
}
// @Override
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
// @Override
@Override
public int getNodeType() {
return IIndexCPPBindingConstants.CPPFIELD;
}
@ -65,28 +63,33 @@ class PDOMCPPField extends PDOMCPPVariable implements ICPPField, ICPPDelegateCre
}
// @Override
@Override
public boolean isMutable() {
return getBit(getByte(record + ANNOTATIONS), PDOMCPPAnnotation.MUTABLE_OFFSET);
}
// @Override
@Override
public boolean isAuto() {
// ISO/IEC 14882:2003 9.2.6
return false;
}
// @Override
@Override
public boolean isExtern() {
// ISO/IEC 14882:2003 9.2.6
return false;
}
// @Override
@Override
public boolean isExternC() {
return false;
}
// @Override
@Override
public boolean isRegister() {
// ISO/IEC 14882:2003 9.2.6
return false;
@ -95,9 +98,4 @@ class PDOMCPPField extends PDOMCPPVariable implements ICPPField, ICPPDelegateCre
public ICompositeType getCompositeTypeOwner() {
return getClassOwner();
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPField.CPPFieldDelegate(usingDecl, this);
}
}

View file

@ -22,13 +22,9 @@ import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.Util;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunction;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
import org.eclipse.cdt.internal.core.index.IndexCPPSignatureUtil;
import org.eclipse.cdt.internal.core.pdom.PDOM;
@ -45,7 +41,7 @@ import org.eclipse.core.runtime.CoreException;
* @author Doug Schaefer
*
*/
class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverloader, ICPPDelegateCreator {
class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverloader {
/**
* Offset of total number of function parameters (relative to the
@ -108,6 +104,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
setParameters(pft, params);
}
@Override
public void update(final PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ICPPFunction) {
IFunction func= (ICPPFunction) newBinding;
@ -164,10 +161,12 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
super(pdom, bindingRecord);
}
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
@Override
public int getNodeType() {
return IIndexCPPBindingConstants.CPPFUNCTION;
}
@ -248,15 +247,18 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
return getBit(getByte(record + ANNOTATION), PDOMCAnnotation.VARARGS_OFFSET);
}
@Override
public Object clone() {
throw new PDOMNotImplementedError();
}
@Override
public int pdomCompareTo(PDOMBinding other) {
int cmp= super.pdomCompareTo(other);
return cmp==0 ? compareSignatures(this, other) : cmp;
}
@Override
public String toString() {
StringBuffer result = new StringBuffer();
result.append(getName()+" "+ASTTypeUtil.getParameterTypeString(getType())); //$NON-NLS-1$
@ -283,9 +285,4 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
}
return 0;
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPFunction.CPPFunctionDelegate(usingDecl, this);
}
}

View file

@ -21,7 +21,6 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
@ -29,15 +28,12 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.index.IIndexBinding;
import org.eclipse.cdt.core.index.IIndexFileSet;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPDeferredFunctionInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionTemplate;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplates;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalTemplateInstantiator;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
import org.eclipse.cdt.internal.core.index.IIndexScope;
@ -55,7 +51,7 @@ import org.eclipse.core.runtime.CoreException;
*/
class PDOMCPPFunctionTemplate extends PDOMCPPFunction implements
ICPPFunctionTemplate, ICPPInternalTemplateInstantiator,
IPDOMMemberOwner, ICPPTemplateScope, IIndexScope, ICPPDelegateCreator {
IPDOMMemberOwner, ICPPTemplateScope, IIndexScope {
private static final int TEMPLATE_PARAMS = PDOMCPPFunction.RECORD_SIZE + 0;
private static final int INSTANCES = PDOMCPPFunction.RECORD_SIZE + 4;
@ -76,14 +72,17 @@ class PDOMCPPFunctionTemplate extends PDOMCPPFunction implements
super(pdom, bindingRecord);
}
@Override
public void update(PDOMLinkage linkage, IBinding name) {
// no support for updating templates, yet.
}
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
@Override
public int getNodeType() {
return IIndexCPPBindingConstants.CPP_FUNCTION_TEMPLATE;
}
@ -170,6 +169,7 @@ class PDOMCPPFunctionTemplate extends PDOMCPPFunction implements
return CPPTemplates.instantiateTemplate(this, arguments, null);
}
@Override
public void addChild(PDOMNode child) throws CoreException {
addMember(child);
}
@ -187,6 +187,7 @@ class PDOMCPPFunctionTemplate extends PDOMCPPFunction implements
}
}
@Override
public void accept(IPDOMVisitor visitor) throws CoreException {
super.accept(visitor);
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + TEMPLATE_PARAMS, getLinkageImpl());
@ -203,6 +204,7 @@ class PDOMCPPFunctionTemplate extends PDOMCPPFunction implements
return CPPSemantics.findBindings( this, name, false );
}
@Override
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet)
throws DOMException {
try {
@ -217,6 +219,7 @@ class PDOMCPPFunctionTemplate extends PDOMCPPFunction implements
return null;
}
@Override
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet)
throws DOMException {
IBinding[] result = null;
@ -234,9 +237,4 @@ class PDOMCPPFunctionTemplate extends PDOMCPPFunction implements
public IIndexBinding getScopeBinding() {
return this;
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPFunctionTemplate.CPPFunctionTemplateDelegate(usingDecl, this);
}
}

View file

@ -44,7 +44,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDeferredTemplateInstance;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
@ -198,6 +197,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
List<Runnable> postProcesses = new ArrayList<Runnable>();
@Override
public PDOMBinding addBinding(IASTName name) throws CoreException {
if (name == null || name instanceof ICPPASTQualifiedName)
return null;
@ -230,14 +230,13 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
return pdomBinding;
}
@Override
public PDOMBinding addBinding(IBinding binding, IASTName fromName) throws CoreException {
// assign names to anonymous types.
binding= PDOMASTAdapter.getAdapterForAnonymousASTBinding(binding);
if (binding == null) {
return null;
}
// references to the using-declarations delegates are stored with the original binding.
binding = unwrapUsingDelarationDelegates(binding);
PDOMBinding pdomBinding = adaptBinding(binding);
if (pdomBinding != null) {
@ -261,18 +260,6 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
return pdomBinding;
}
private IBinding unwrapUsingDelarationDelegates(IBinding binding) {
while (binding instanceof ICPPDelegate) {
ICPPDelegate d= (ICPPDelegate) binding;
if (d.getDelegateType() == ICPPDelegate.USING_DECLARATION) {
binding= d.getBinding();
} else {
break;
}
}
return binding;
}
private void addConstructors(PDOMBinding pdomBinding, ICPPClassType binding)
throws DOMException, CoreException {
ICPPConstructor[] constructors = binding.getConstructors();
@ -582,9 +569,6 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
*/
@Override
public PDOMBinding doAdaptBinding(IBinding binding) throws CoreException {
// references to using-declarations are stored with the original binding.
binding= unwrapUsingDelarationDelegates(binding);
PDOMNode parent = getAdaptedParent(binding, false);
if (parent == this) {
int localToFileRec= getLocalToFileRec(null, binding);
@ -857,6 +841,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
}
}
@Override
public IBTreeComparator getIndexComparator() {
return new CPPFindBinding.CPPBindingBTreeComparator(pdom);
}

View file

@ -25,13 +25,9 @@ import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.Util;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPMethod;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
import org.eclipse.cdt.internal.core.pdom.PDOM;
import org.eclipse.cdt.internal.core.pdom.db.Database;
@ -46,7 +42,7 @@ import org.eclipse.core.runtime.CoreException;
* @author Doug Schaefer
*
*/
class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod, ICPPDelegateCreator {
class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod {
/**
* Offset of remaining annotation information (relative to the beginning of
@ -82,6 +78,7 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod, ICPPDelegateC
super(pdom, record);
}
@Override
public void update(final PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ICPPMethod) {
ICPPMethod method= (ICPPMethod) newBinding;
@ -94,10 +91,12 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod, ICPPDelegateC
}
}
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
@Override
public int getNodeType() {
return IIndexCPPBindingConstants.CPPMETHOD;
}
@ -110,6 +109,7 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod, ICPPDelegateC
return getBit(getByte(record + ANNOTATION1), PDOMCPPAnnotation.DESTRUCTOR_OFFSET);
}
@Override
public boolean isMutable() throws DOMException {
throw new PDOMNotImplementedError();
}
@ -118,24 +118,29 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod, ICPPDelegateC
return getBit(getByte(record + ANNOTATION1), PDOMCPPAnnotation.IMPLICIT_METHOD_OFFSET);
}
@Override
public IScope getFunctionScope() throws DOMException {
throw new PDOMNotImplementedError();
}
@Override
public boolean isExtern() throws DOMException {
// ISO/IEC 14882:2003 9.2.6
return false;
}
@Override
public boolean isExternC() {
return false;
}
@Override
public boolean isAuto() throws DOMException {
// ISO/IEC 14882:2003 9.2.6
return false;
}
@Override
public boolean isRegister() throws DOMException {
// ISO/IEC 14882:2003 9.2.6
return false;
@ -154,6 +159,7 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod, ICPPDelegateC
}
}
@Override
public Object clone() {
throw new PDOMNotImplementedError();
}
@ -165,11 +171,8 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod, ICPPDelegateC
public boolean isVolatile() {
return getBit(getByte(record + ANNOTATION1), PDOMCAnnotation.VOLATILE_OFFSET + CV_OFFSET);
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPMethod.CPPMethodDelegate(usingDecl, this);
}
@Override
public int getAdditionalNameFlags(int standardFlags, IASTName name) {
if ((standardFlags & PDOMName.IS_REFERENCE) == PDOMName.IS_REFERENCE) {
IASTNode parent= name.getParent();

View file

@ -21,18 +21,14 @@ import org.eclipse.cdt.core.dom.IPDOMVisitor;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDirective;
import org.eclipse.cdt.core.index.IIndexBinding;
import org.eclipse.cdt.core.index.IIndexFileSet;
import org.eclipse.cdt.core.index.IndexFilter;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPNamespace;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
import org.eclipse.cdt.internal.core.index.IIndexScope;
import org.eclipse.cdt.internal.core.pdom.PDOM;
@ -48,7 +44,7 @@ import org.eclipse.core.runtime.CoreException;
*
*/
class PDOMCPPNamespace extends PDOMCPPBinding
implements ICPPNamespace, ICPPNamespaceScope, IIndexScope, ICPPDelegateCreator {
implements ICPPNamespace, ICPPNamespaceScope, IIndexScope {
private static final int INDEX_OFFSET = PDOMBinding.RECORD_SIZE + 0;
@ -63,10 +59,12 @@ class PDOMCPPNamespace extends PDOMCPPBinding
super(pdom, record);
}
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
@Override
public int getNodeType() {
return IIndexCPPBindingConstants.CPPNAMESPACE;
}
@ -75,6 +73,7 @@ class PDOMCPPNamespace extends PDOMCPPBinding
return new BTree(pdom.getDB(), record + INDEX_OFFSET, getLinkageImpl().getIndexComparator());
}
@Override
public void accept(final IPDOMVisitor visitor) throws CoreException {
if (visitor instanceof IBTreeVisitor) {
getIndex().accept((IBTreeVisitor) visitor);
@ -97,6 +96,7 @@ class PDOMCPPNamespace extends PDOMCPPBinding
}
}
@Override
public void addChild(PDOMNode child) throws CoreException {
getIndex().insert(child.getRecord());
}
@ -120,6 +120,7 @@ class PDOMCPPNamespace extends PDOMCPPBinding
return IIndexBinding.EMPTY_INDEX_BINDING_ARRAY;
}
@Override
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) throws DOMException {
try {
IBinding[] bindings= getBindingsViaCache(name.toCharArray());
@ -133,6 +134,7 @@ class PDOMCPPNamespace extends PDOMCPPBinding
return null;
}
@Override
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) throws DOMException {
IBinding[] result = null;
try {
@ -169,6 +171,7 @@ class PDOMCPPNamespace extends PDOMCPPBinding
return true;
}
@Override
public boolean mayHaveChildren() {
return true;
}
@ -198,9 +201,4 @@ class PDOMCPPNamespace extends PDOMCPPBinding
public IIndexBinding getScopeBinding() {
return this;
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPNamespace.CPPNamespaceDelegate(usingDecl, this);
}
}

View file

@ -46,6 +46,7 @@ class PDOMCPPNamespaceAlias extends PDOMCPPBinding implements ICPPNamespaceAlias
super(pdom, record);
}
@Override
public void update(final PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ICPPNamespaceAlias) {
ICPPNamespaceAlias alias= (ICPPNamespaceAlias) newBinding;
@ -64,10 +65,12 @@ class PDOMCPPNamespaceAlias extends PDOMCPPBinding implements ICPPNamespaceAlias
namespace != null ? namespace.getRecord() : 0);
}
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
@Override
public int getNodeType() {
return IIndexCPPBindingConstants.CPPNAMESPACEALIAS;
}
@ -95,10 +98,6 @@ class PDOMCPPNamespaceAlias extends PDOMCPPBinding implements ICPPNamespaceAlias
throw new PDOMNotImplementedError();
}
public int getDelegateType() {
return NAMESPACE_ALIAS;
}
public IBinding getBinding() {
try {
return (IBinding) getLinkageImpl().getNode(getPDOM().getDB().getInt(record + NAMESPACE_BINDING));

View file

@ -17,13 +17,9 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.index.IIndexFile;
import org.eclipse.cdt.internal.core.Util;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPParameter;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
import org.eclipse.cdt.internal.core.index.IIndexFragment;
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
@ -42,7 +38,7 @@ import org.eclipse.core.runtime.CoreException;
* @author Doug Schaefer
*/
class PDOMCPPParameter extends PDOMNamedNode
implements ICPPParameter, IIndexFragmentBinding, ICPPDelegateCreator {
implements ICPPParameter, IIndexFragmentBinding {
/**
* Offset of pointer to the next parameter (relative to the
@ -119,10 +115,12 @@ class PDOMCPPParameter extends PDOMNamedNode
return flags;
}
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
@Override
public int getNodeType() {
return IIndexCPPBindingConstants.CPPPARAMETER;
}
@ -199,6 +197,7 @@ class PDOMCPPParameter extends PDOMNamedNode
return null;
}
@Override
public char[] getNameCharArray() {
try {
return super.getNameCharArray();
@ -243,11 +242,8 @@ class PDOMCPPParameter extends PDOMNamedNode
public int getBindingConstant() {
return getNodeType();
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPParameter.CPPParameterDelegate(usingDecl, this);
}
@Override
public void delete(PDOMLinkage linkage) throws CoreException {
linkage.deleteType(getType(), record);
PDOMCPPParameter next= getNextParameter();

View file

@ -17,13 +17,9 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.internal.core.Util;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTypedef;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.CPPTypedefClone;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
import org.eclipse.cdt.internal.core.index.IIndexType;
@ -37,7 +33,7 @@ import org.eclipse.core.runtime.CoreException;
* @author Doug Schaefer
*/
class PDOMCPPTypedef extends PDOMCPPBinding
implements ITypedef, ITypeContainer, IIndexType, ICPPDelegateCreator {
implements ITypedef, ITypeContainer, IIndexType {
private static final int TYPE = PDOMBinding.RECORD_SIZE + 0;
@ -58,6 +54,7 @@ class PDOMCPPTypedef extends PDOMCPPBinding
super(pdom, record);
}
@Override
public void update(final PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ITypedef) {
ITypedef td= (ITypedef) newBinding;
@ -114,10 +111,12 @@ class PDOMCPPTypedef extends PDOMCPPBinding
}
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
@Override
public int getNodeType() {
return IIndexCPPBindingConstants.CPPTYPEDEF;
}
@ -152,12 +151,8 @@ class PDOMCPPTypedef extends PDOMCPPBinding
public void setType(IType type) { fail(); }
@Override
public Object clone() {
return new CPPTypedefClone(this);
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPTypedef.CPPTypedefDelegate(usingDecl, this);
}
}

View file

@ -11,12 +11,9 @@
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
import org.eclipse.cdt.internal.core.pdom.PDOM;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
@ -40,18 +37,12 @@ class PDOMCPPUsingDeclaration extends PDOMCPPBinding implements ICPPUsingDeclara
private static final int NEXT_DELEGATE = PDOMCPPBinding.RECORD_SIZE + 4;
@SuppressWarnings({ "hiding", "static-access" })
protected static final int RECORD_SIZE = PDOMCPPBinding.RECORD_SIZE + 8;
private ICPPDelegate[] delegates;
private IBinding[] delegates;
public PDOMCPPUsingDeclaration(PDOM pdom, PDOMNode parent, ICPPUsingDeclaration using)
throws CoreException {
super(pdom, parent, using.getNameCharArray());
ICPPDelegate[] delegates;
try {
delegates = using.getDelegates();
} catch (DOMException e) {
CCorePlugin.log(e);
return;
}
IBinding[] delegates= using.getDelegates();
int nextRecord = 0;
for (int i = delegates.length; --i >= 0;) {
PDOMCPPUsingDeclaration simpleUsing = i > 0 ?
@ -70,36 +61,37 @@ class PDOMCPPUsingDeclaration extends PDOMCPPBinding implements ICPPUsingDeclara
super(pdom, parent, name);
}
private void setTargetBinding(PDOMLinkage linkage, ICPPDelegate delegate) throws CoreException {
PDOMBinding target = getLinkageImpl().adaptBinding(delegate.getBinding());
private void setTargetBinding(PDOMLinkage linkage, IBinding delegate) throws CoreException {
PDOMBinding target = getLinkageImpl().adaptBinding(delegate);
pdom.getDB().putInt(record + TARGET_BINDING, target != null ? target.getRecord() : 0);
}
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
@Override
public int getNodeType() {
return IIndexCPPBindingConstants.CPP_USING_DECLARATION;
}
public ICPPDelegate[] getDelegates() {
public IBinding[] getDelegates() {
if (delegates == null) {
delegates = new ICPPDelegate[1];
delegates = new IBinding[1];
int i = 0;
PDOMCPPUsingDeclaration alias = this;
try {
do {
IBinding binding = alias.getBinding();
if (binding instanceof ICPPDelegateCreator) {
ICPPDelegate delegate = ((ICPPDelegateCreator) binding).createDelegate(this);
delegates= (ICPPDelegate[]) ArrayUtil.append(ICPPDelegate.class, delegates, i++, delegate);
}
IBinding delegate = alias.getBinding();
if (delegate != null) {
delegates= (IBinding[]) ArrayUtil.append(IBinding.class, delegates, i++, delegate);
}
} while ((alias = alias.getNext()) != null);
} catch (CoreException e) {
CCorePlugin.log(e);
}
delegates = (ICPPDelegate[]) ArrayUtil.trim(ICPPDelegate.class, delegates);
delegates = (IBinding[]) ArrayUtil.trim(IBinding.class, delegates);
}
return delegates;
}

View file

@ -19,12 +19,8 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IVariable;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
import org.eclipse.cdt.internal.core.Util;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVariable;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDelegateCreator;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
import org.eclipse.cdt.internal.core.pdom.PDOM;
import org.eclipse.cdt.internal.core.pdom.db.Database;
@ -39,7 +35,7 @@ import org.eclipse.core.runtime.CoreException;
* @author Doug Schaefer
*
*/
class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable, ICPPDelegateCreator {
class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable {
/**
* Offset of pointer to type information for this parameter
@ -72,6 +68,7 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable, ICPPDelega
}
}
@Override
public void update(final PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof IVariable) {
IVariable var= (IVariable) newBinding;
@ -103,10 +100,12 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable, ICPPDelega
super(pdom, record);
}
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
@Override
public int getNodeType() {
return IIndexCPPBindingConstants.CPPVARIABLE;
}
@ -145,11 +144,8 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable, ICPPDelega
public boolean isStatic() throws DOMException {
return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.STATIC_OFFSET);
}
public ICPPDelegate createDelegate(ICPPUsingDeclaration usingDecl) {
return new CPPVariable.CPPVariableDelegate(usingDecl, this);
}
@Override
public int getAdditionalNameFlags(int standardFlags, IASTName name) {
if ((standardFlags & PDOMName.IS_REFERENCE) == PDOMName.IS_REFERENCE) {
return CPPVariableReadWriteFlags.getReadWriteFlags(name);

View file

@ -349,7 +349,6 @@ public class BaseUITestCase extends BaseTestCase {
}
runEventQueue(10);
}
runEventQueue(30000);
fail("Timeout expired waiting for tree node " + label + "{" + i0 + "," + i1 + "}");
return null;
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
* Copyright (c) 2006, 2008 Wind River Systems, Inc. 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
@ -8,7 +8,6 @@
* Contributors:
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.ui.tests.callhierarchy;
import java.io.IOException;
@ -659,7 +658,7 @@ public class BasicCallHierarchyTest extends CallHierarchyBaseTest {
i1= checkTreeNode(tree, 0, 0, "gf()"); // sf()[f1] <- gf()
i2= checkTreeNode(tree, 0, 1, "sf()"); // sf()[f1] <- sf()[f1]
checkTreeNode(i0, 2, null);
checkTreeNode(tree, 0, 2, null);
expandTreeItem(i1);
expandTreeItem(i2);

View file

@ -13,6 +13,9 @@
package org.eclipse.cdt.internal.ui.search.actions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@ -92,6 +95,7 @@ public class OpenDeclarationsAction extends SelectionParseAction {
super(CEditorMessages.getString("OpenDeclarations.dialog.title")); //$NON-NLS-1$
}
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
clearStatusLine();
@ -337,45 +341,20 @@ public class OpenDeclarationsAction extends SelectionParseAction {
}
private IName[] findDefinitions(IIndex index, IASTTranslationUnit ast, int isKind, IBinding binding) throws CoreException {
IASTName[] declNames= ast.getDefinitionsInAST(binding);
boolean containsUsingDirectives= false;
for (int i = 0; i < declNames.length; i++) {
IASTName name= declNames[i];
List<IASTName> declNames= new ArrayList<IASTName>();
declNames.addAll(Arrays.asList(ast.getDefinitionsInAST(binding)));
for (Iterator<IASTName> i = declNames.iterator(); i.hasNext();) {
IASTName name= i.next();
if (name.resolveBinding() instanceof ICPPUsingDeclaration) {
containsUsingDirectives= true;
break;
i.remove();
}
}
if (containsUsingDirectives) {
// prevent navigation from using-decl to itself, or prefer using-decls over original defs.
declNames= separateUsingDecls(declNames, isKind != KIND_USING_DECL);
}
if (declNames.length > 0) {
return declNames;
if (!declNames.isEmpty()) {
return declNames.toArray(new IASTName[declNames.size()]);
}
// 2. Try definition in index
IIndexName[] inames= index.findNames(binding, IIndex.FIND_DEFINITIONS | IIndex.SEARCH_ACCROSS_LANGUAGE_BOUNDARIES);
if (isKind != KIND_USING_DECL) {
// prefer using decls
for (int i = 0; i < inames.length; i++) {
if (index.findBinding(inames[i]) instanceof ICPPUsingDeclaration) {
return new IName[]{inames[i]};
}
}
}
return inames;
}
private IASTName[] separateUsingDecls(IASTName[] declNames, boolean keep) {
ArrayList<IASTName> result= new ArrayList<IASTName>(declNames.length);
for (int i = 0; i < declNames.length; i++) {
IASTName name = declNames[i];
if (keep == (name.resolveBinding() instanceof ICPPUsingDeclaration)) {
result.add(name);
}
}
return result.toArray(new IASTName[result.size()]);
return index.findNames(binding, IIndex.FIND_DEFINITIONS | IIndex.SEARCH_ACCROSS_LANGUAGE_BOUNDARIES);
}
private IName[] findDeclarations(IIndex index, IASTTranslationUnit ast,
@ -394,6 +373,7 @@ public class OpenDeclarationsAction extends SelectionParseAction {
}
}
@Override
public void run() {
selNode = getSelectedStringFromEditor();
if (selNode != null) {

View file

@ -1,14 +1,14 @@
/*******************************************************************************
* Copyright (c) 2007 QNX Software Systems and others.
* Copyright (c) 2007, 2008 QNX Software Systems 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Anton Leherbauer (Wind River Systems)
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.text.contentassist;
@ -49,7 +49,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDirective;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
@ -81,11 +80,12 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
public DOMCompletionProposalComputer() {
}
protected List computeCompletionProposals(
@Override
protected List<CCompletionProposal> computeCompletionProposals(
CContentAssistInvocationContext context,
IASTCompletionNode completionNode, String prefix) {
List proposals = new ArrayList();
List<CCompletionProposal> proposals = new ArrayList<CCompletionProposal>();
if(inPreprocessorDirective(context)) {
// add only macros
@ -145,7 +145,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
return false;
}
private void addMacroProposals(CContentAssistInvocationContext context, String prefix, List proposals) {
private void addMacroProposals(CContentAssistInvocationContext context, String prefix, List<CCompletionProposal> proposals) {
char[] prefixChars= prefix.toCharArray();
IASTCompletionNode completionNode = context.getCompletionNode();
IASTPreprocessorMacroDefinition[] macros = completionNode.getTranslationUnit().getMacroDefinitions();
@ -160,7 +160,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
handleMacro(macros[i], context, proposals);
}
private void handleMacro(IASTPreprocessorMacroDefinition macro, CContentAssistInvocationContext context, List proposals) {
private void handleMacro(IASTPreprocessorMacroDefinition macro, CContentAssistInvocationContext context, List<CCompletionProposal> proposals) {
String macroName = macro.getName().toString();
Image image = getImage(CElementImageProvider.getMacroImageDescriptor());
@ -208,7 +208,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
protected void handleBinding(IBinding binding,
CContentAssistInvocationContext cContext,
IASTCompletionContext astContext, List proposals) {
IASTCompletionContext astContext, List<CCompletionProposal> proposals) {
if ((binding instanceof CPPImplicitFunction
|| binding instanceof CPPImplicitFunctionTemplate || binding instanceof CPPImplicitTypedef)
&& !(binding instanceof CPPImplicitMethod)) {
@ -237,7 +237,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
return name.length == 0 || name[0] == '{';
}
private void handleClass(ICPPClassType classType, IASTCompletionContext astContext, CContentAssistInvocationContext context, List proposals) {
private void handleClass(ICPPClassType classType, IASTCompletionContext astContext, CContentAssistInvocationContext context, List<CCompletionProposal> proposals) {
if (context.isContextInformationStyle()) {
try {
ICPPConstructor[] constructors = classType.getConstructors();
@ -257,7 +257,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
}
}
private void handleFunction(IFunction function, CContentAssistInvocationContext context, List proposals) {
private void handleFunction(IFunction function, CContentAssistInvocationContext context, List<CCompletionProposal> proposals) {
Image image = getImage(function);
StringBuffer repStringBuff = new StringBuffer();
@ -341,7 +341,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
proposals.add(proposal);
}
private void handleVariable(IVariable variable, CContentAssistInvocationContext context, List proposals) {
private void handleVariable(IVariable variable, CContentAssistInvocationContext context, List<CCompletionProposal> proposals) {
StringBuffer repStringBuff = new StringBuffer();
repStringBuff.append(variable.getName());
@ -372,7 +372,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
private void handleNamespace(ICPPNamespace namespace,
IASTCompletionContext astContext,
CContentAssistInvocationContext cContext, List proposals) {
CContentAssistInvocationContext cContext, List<CCompletionProposal> proposals) {
if (astContext instanceof ICPPASTQualifiedName) {
IASTCompletionContext parent = ((ICPPASTQualifiedName) astContext)
.getCompletionContext();
@ -464,7 +464,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
} else if (binding instanceof ICPPFunctionTemplate) {
imageDescriptor = CElementImageProvider.getFunctionImageDescriptor();
} else if (binding instanceof ICPPUsingDeclaration) {
ICPPDelegate[] delegates = ((ICPPUsingDeclaration)binding).getDelegates();
IBinding[] delegates = ((ICPPUsingDeclaration)binding).getDelegates();
if (delegates.length > 0)
return getImage(delegates[0]);
}