mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 09:16:02 +02:00
Bug 323723: Reduce usage of DOMExceptions.
This commit is contained in:
parent
d3fcfea8f1
commit
c31e996fc2
234 changed files with 2426 additions and 3449 deletions
|
@ -23,7 +23,6 @@ import junit.framework.AssertionFailedError;
|
|||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTSignatureUtil;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||
|
@ -470,7 +469,7 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
return clazz.cast(o);
|
||||
}
|
||||
|
||||
protected static void assertField(IBinding binding, String fieldName, String ownerName) throws DOMException {
|
||||
protected static void assertField(IBinding binding, String fieldName, String ownerName) {
|
||||
assertInstance(binding, IField.class);
|
||||
assertEquals(fieldName, binding.getName());
|
||||
ICompositeType struct = ((IField) binding).getCompositeTypeOwner();
|
||||
|
|
|
@ -3419,7 +3419,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
IProblemBinding B = (IProblemBinding) col.getName(2).resolveBinding();
|
||||
assertEquals(B.getID(), IProblemBinding.SEMANTIC_NAME_NOT_FOUND);
|
||||
IProblemBinding C = (IProblemBinding) col.getName(3).resolveBinding();
|
||||
assertEquals(C.getID(), IProblemBinding.SEMANTIC_BAD_SCOPE);
|
||||
assertEquals(C.getID(), IProblemBinding.SEMANTIC_NAME_NOT_FOUND);
|
||||
}
|
||||
|
||||
public void testBug88459() throws Exception {
|
||||
|
|
|
@ -1637,23 +1637,19 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
|||
int friends,
|
||||
int constructors,
|
||||
int nestedClasses) {
|
||||
try {
|
||||
assertTrue(type instanceof ICPPClassType);
|
||||
ICPPClassType classType = (ICPPClassType) type;
|
||||
assertQNEquals(qn, classType);
|
||||
assertEquals(key, classType.getKey());
|
||||
assertEquals(bases, classType.getBases().length);
|
||||
assertEquals(fields, classType.getFields().length);
|
||||
assertEquals(declaredFields, classType.getDeclaredFields().length);
|
||||
assertEquals(methods, classType.getMethods().length);
|
||||
assertEquals(declaredMethods, classType.getDeclaredMethods().length);
|
||||
assertEquals(allDeclaredMethods, classType.getAllDeclaredMethods().length);
|
||||
// assertEquals(friends, classType.getFriends().length); (PDOMNotImplementedError)
|
||||
assertEquals(constructors, classType.getConstructors().length);
|
||||
assertEquals(nestedClasses, classType.getNestedClasses().length);
|
||||
} catch (DOMException de) {
|
||||
fail(de.getMessage());
|
||||
}
|
||||
assertTrue(type instanceof ICPPClassType);
|
||||
ICPPClassType classType = (ICPPClassType) type;
|
||||
assertQNEquals(qn, classType);
|
||||
assertEquals(key, classType.getKey());
|
||||
assertEquals(bases, classType.getBases().length);
|
||||
assertEquals(fields, classType.getFields().length);
|
||||
assertEquals(declaredFields, classType.getDeclaredFields().length);
|
||||
assertEquals(methods, classType.getMethods().length);
|
||||
assertEquals(declaredMethods, classType.getDeclaredMethods().length);
|
||||
assertEquals(allDeclaredMethods, classType.getAllDeclaredMethods().length);
|
||||
// assertEquals(friends, classType.getFriends().length); (PDOMNotImplementedError)
|
||||
assertEquals(constructors, classType.getConstructors().length);
|
||||
assertEquals(nestedClasses, classType.getNestedClasses().length);
|
||||
}
|
||||
|
||||
public void assertEnumeration(IBinding binding, String name, String[] enumerators) throws DOMException {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2008 QNX Software Systems and others.
|
||||
* Copyright (c) 2006, 2010 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
|
||||
|
@ -14,7 +14,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.browser;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.EScopeKind;
|
||||
|
@ -49,48 +48,44 @@ public class IndexModelUtil {
|
|||
* @return whether the binding is of any of the specified CElement type constants
|
||||
*/
|
||||
public static boolean bindingHasCElementType(IBinding binding, int[] kinds) {
|
||||
try {
|
||||
for (int kind : kinds) {
|
||||
switch(kind) {
|
||||
case ICElement.C_STRUCT:
|
||||
if (binding instanceof ICompositeType
|
||||
&& ((ICompositeType)binding).getKey() == ICompositeType.k_struct)
|
||||
return true;
|
||||
break;
|
||||
case ICElement.C_UNION:
|
||||
if (binding instanceof ICompositeType
|
||||
&& ((ICompositeType)binding).getKey() == ICompositeType.k_union)
|
||||
return true;
|
||||
break;
|
||||
case ICElement.C_CLASS:
|
||||
if (binding instanceof ICompositeType
|
||||
&& ((ICompositeType)binding).getKey() == ICPPClassType.k_class)
|
||||
return true;
|
||||
break;
|
||||
case ICElement.C_NAMESPACE:
|
||||
if (binding instanceof ICPPNamespace || binding instanceof ICPPNamespaceAlias)
|
||||
return true;
|
||||
break;
|
||||
case ICElement.C_ENUMERATION:
|
||||
if (binding instanceof IEnumeration)
|
||||
return true;
|
||||
break;
|
||||
case ICElement.C_TYPEDEF:
|
||||
if(binding instanceof ITypedef)
|
||||
return true;
|
||||
break;
|
||||
case ICElement.C_FUNCTION:
|
||||
if(binding instanceof IFunction)
|
||||
return true;
|
||||
break;
|
||||
case ICElement.C_VARIABLE:
|
||||
if(binding instanceof IVariable)
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
for (int kind : kinds) {
|
||||
switch(kind) {
|
||||
case ICElement.C_STRUCT:
|
||||
if (binding instanceof ICompositeType
|
||||
&& ((ICompositeType)binding).getKey() == ICompositeType.k_struct)
|
||||
return true;
|
||||
break;
|
||||
case ICElement.C_UNION:
|
||||
if (binding instanceof ICompositeType
|
||||
&& ((ICompositeType)binding).getKey() == ICompositeType.k_union)
|
||||
return true;
|
||||
break;
|
||||
case ICElement.C_CLASS:
|
||||
if (binding instanceof ICompositeType
|
||||
&& ((ICompositeType)binding).getKey() == ICPPClassType.k_class)
|
||||
return true;
|
||||
break;
|
||||
case ICElement.C_NAMESPACE:
|
||||
if (binding instanceof ICPPNamespace || binding instanceof ICPPNamespaceAlias)
|
||||
return true;
|
||||
break;
|
||||
case ICElement.C_ENUMERATION:
|
||||
if (binding instanceof IEnumeration)
|
||||
return true;
|
||||
break;
|
||||
case ICElement.C_TYPEDEF:
|
||||
if(binding instanceof ITypedef)
|
||||
return true;
|
||||
break;
|
||||
case ICElement.C_FUNCTION:
|
||||
if(binding instanceof IFunction)
|
||||
return true;
|
||||
break;
|
||||
case ICElement.C_VARIABLE:
|
||||
if(binding instanceof IVariable)
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
} catch(DOMException de) {
|
||||
CCorePlugin.log(de);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -105,20 +100,16 @@ public class IndexModelUtil {
|
|||
|
||||
if (binding instanceof ICompositeType) {
|
||||
ICompositeType classType = (ICompositeType) binding;
|
||||
try {
|
||||
switch(classType.getKey()) {
|
||||
case ICPPClassType.k_class:
|
||||
elementType = ICElement.C_CLASS;
|
||||
break;
|
||||
case ICompositeType.k_struct:
|
||||
elementType = ICElement.C_STRUCT;
|
||||
break;
|
||||
case ICompositeType.k_union:
|
||||
elementType = ICElement.C_UNION;
|
||||
break;
|
||||
}
|
||||
} catch(DOMException de) {
|
||||
CCorePlugin.log(de);
|
||||
switch(classType.getKey()) {
|
||||
case ICPPClassType.k_class:
|
||||
elementType = ICElement.C_CLASS;
|
||||
break;
|
||||
case ICompositeType.k_struct:
|
||||
elementType = ICElement.C_STRUCT;
|
||||
break;
|
||||
case ICompositeType.k_union:
|
||||
elementType = ICElement.C_UNION;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corp. - Rational Software - initial implementation
|
||||
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Gerhard Schaber (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
@ -37,7 +37,6 @@ import org.eclipse.core.runtime.Path;
|
|||
|
||||
/**
|
||||
* Creates labels for ICElement objects.
|
||||
* @author aniefer
|
||||
*/
|
||||
public class CElementBaseLabels {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 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
|
||||
|
@ -281,17 +281,13 @@ abstract class CElementHandle implements ICElementHandle, ISourceReference {
|
|||
protected ASTAccessVisibility getVisibility(IBinding binding) {
|
||||
if (binding instanceof ICPPMember) {
|
||||
ICPPMember member= (ICPPMember) binding;
|
||||
try {
|
||||
switch (member.getVisibility()) {
|
||||
case ICPPMember.v_private:
|
||||
return ASTAccessVisibility.PRIVATE;
|
||||
case ICPPMember.v_protected:
|
||||
return ASTAccessVisibility.PROTECTED;
|
||||
case ICPPMember.v_public:
|
||||
return ASTAccessVisibility.PUBLIC;
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
CCorePlugin.log(e);
|
||||
switch (member.getVisibility()) {
|
||||
case ICPPMember.v_private:
|
||||
return ASTAccessVisibility.PRIVATE;
|
||||
case ICPPMember.v_protected:
|
||||
return ASTAccessVisibility.PROTECTED;
|
||||
case ICPPMember.v_public:
|
||||
return ASTAccessVisibility.PUBLIC;
|
||||
}
|
||||
}
|
||||
return ASTAccessVisibility.PUBLIC;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 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,11 +8,8 @@
|
|||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.model.ext;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IField;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
|
@ -26,12 +23,7 @@ public class FieldHandle extends CElementHandle implements org.eclipse.cdt.core.
|
|||
public FieldHandle(ICElement parent, IField field) {
|
||||
super(parent, ICElement.C_FIELD, field.getName());
|
||||
fVisibility= getVisibility(field);
|
||||
try {
|
||||
fIsStatic= field.isStatic();
|
||||
} catch (DOMException e) {
|
||||
CCorePlugin.log(e);
|
||||
fIsStatic= false;
|
||||
}
|
||||
fIsStatic= field.isStatic();
|
||||
}
|
||||
|
||||
public ASTAccessVisibility getVisibility() throws CModelException {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 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
|
||||
|
@ -9,10 +9,8 @@
|
|||
* Markus Schorn - initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.model.ext;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
|
@ -32,12 +30,7 @@ public class FunctionDeclarationHandle extends CElementHandle implements org.ecl
|
|||
protected FunctionDeclarationHandle(ICElement parent, int type, IFunction func) throws DOMException {
|
||||
super(parent, type, func.getName());
|
||||
fParameterTypes= extractParameterTypes(func);
|
||||
try {
|
||||
fIsStatic= func.isStatic();
|
||||
} catch (DOMException e) {
|
||||
CCorePlugin.log(e);
|
||||
fIsStatic= false;
|
||||
}
|
||||
fIsStatic= func.isStatic();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 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,10 +8,8 @@
|
|||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.model.ext;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||
|
@ -37,14 +35,10 @@ public class MethodDeclarationHandle extends CElementHandle implements IMethodDe
|
|||
super(parent, type, method.getName());
|
||||
fParameterTypes= extractParameterTypes(method);
|
||||
fVisibility= getVisibility(method);
|
||||
try {
|
||||
fIsStatic= method.isStatic();
|
||||
fIsConstructor= method instanceof ICPPConstructor;
|
||||
if (!fIsConstructor)
|
||||
fIsDestructor= method.isDestructor();
|
||||
} catch (DOMException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
fIsStatic= method.isStatic();
|
||||
fIsConstructor= method instanceof ICPPConstructor;
|
||||
if (!fIsConstructor)
|
||||
fIsDestructor= method.isDestructor();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 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,11 +8,8 @@
|
|||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.model.ext;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
|
@ -22,12 +19,7 @@ public class VariableHandle extends CElementHandle implements org.eclipse.cdt.co
|
|||
|
||||
public VariableHandle(ICElement parent, IVariable var) {
|
||||
super(parent, ICElement.C_VARIABLE, var.getName());
|
||||
try {
|
||||
fIsStatic= var.isStatic();
|
||||
} catch (DOMException e) {
|
||||
CCorePlugin.log(e);
|
||||
fIsStatic= false;
|
||||
}
|
||||
fIsStatic= var.isStatic();
|
||||
}
|
||||
|
||||
public boolean isStatic() throws CModelException {
|
||||
|
|
|
@ -346,12 +346,8 @@ public class ASTTypeUtil {
|
|||
} else if (type instanceof ICompositeType) {
|
||||
// 101114 fix, do not display class, and for consistency don't display struct/union as well
|
||||
if (type instanceof ICPPClassType) {
|
||||
try {
|
||||
String qn = CPPVisitor.renderQualifiedName(getQualifiedNameForAnonymous((ICPPClassType) type, normalize));
|
||||
result.append(qn);
|
||||
} catch (DOMException e) {
|
||||
result.append(getNameForAnonymous((ICompositeType) type));
|
||||
}
|
||||
String qn = CPPVisitor.renderQualifiedName(getQualifiedNameForAnonymous((ICPPClassType) type, normalize));
|
||||
result.append(qn);
|
||||
} else {
|
||||
result.append(getNameForAnonymous((ICompositeType) type));
|
||||
}
|
||||
|
@ -695,7 +691,7 @@ public class ASTTypeUtil {
|
|||
}
|
||||
}
|
||||
|
||||
private static String[] getQualifiedNameForAnonymous(ICPPBinding binding, boolean normalize) throws DOMException {
|
||||
private static String[] getQualifiedNameForAnonymous(ICPPBinding binding, boolean normalize) {
|
||||
LinkedList<String> result= new LinkedList<String>();
|
||||
result.addFirst(getNameForAnonymous(binding));
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public interface IBinding extends IAdaptable {
|
|||
* <br> <code>null</code>: for types, functions, variables, namespaces and using declarations;
|
||||
* @since 5.1
|
||||
*/
|
||||
public IBinding getOwner() throws DOMException;
|
||||
public IBinding getOwner();
|
||||
|
||||
/**
|
||||
* Returns the parent scope for this binding. A binding may have declarations in multiple scopes,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
* IBM - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
|
@ -24,7 +24,7 @@ public interface ICompositeType extends IBinding, IType {
|
|||
/**
|
||||
* what kind of composite type is this?
|
||||
*/
|
||||
public int getKey() throws DOMException;
|
||||
public int getKey();
|
||||
|
||||
/**
|
||||
* Returns whether the type is anonymous or not. A type for which objects or
|
||||
|
@ -36,14 +36,14 @@ public interface ICompositeType extends IBinding, IType {
|
|||
* </pre>
|
||||
* @since 5.1
|
||||
*/
|
||||
boolean isAnonymous() throws DOMException;
|
||||
boolean isAnonymous();
|
||||
|
||||
/**
|
||||
* Returns the fields for this type.
|
||||
*
|
||||
* @return List of IField
|
||||
*/
|
||||
public IField[] getFields() throws DOMException;
|
||||
public IField[] getFields();
|
||||
|
||||
/**
|
||||
* returns the field that matches name,
|
||||
|
@ -51,11 +51,10 @@ public interface ICompositeType extends IBinding, IType {
|
|||
*
|
||||
* @param name
|
||||
*/
|
||||
public IField findField( String name ) throws DOMException;
|
||||
public IField findField(String name);
|
||||
|
||||
/**
|
||||
* get the IScope object that is associated with this composite type
|
||||
* @throws DOMException
|
||||
*/
|
||||
public IScope getCompositeScope() throws DOMException;
|
||||
public IScope getCompositeScope();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -21,9 +21,7 @@ public interface IField extends IVariable {
|
|||
|
||||
/**
|
||||
* Returns the composite type that owns the field.
|
||||
* @throws DOMException
|
||||
* @since 4.0
|
||||
*/
|
||||
ICompositeType getCompositeTypeOwner() throws DOMException;
|
||||
|
||||
ICompositeType getCompositeTypeOwner();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -44,22 +44,19 @@ public interface IFunction extends IBinding {
|
|||
/**
|
||||
* Returns {@code true} if the function has the static storage-class specifier
|
||||
* similarly for extern, auto, register.
|
||||
* @throws DOMException if this is a problem binding.
|
||||
*/
|
||||
public boolean isStatic() throws DOMException;
|
||||
public boolean isExtern() throws DOMException;
|
||||
public boolean isAuto() throws DOMException;
|
||||
public boolean isRegister() throws DOMException;
|
||||
public boolean isStatic();
|
||||
public boolean isExtern();
|
||||
public boolean isAuto();
|
||||
public boolean isRegister();
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the function is inline.
|
||||
* @throws DOMException if this is a problem binding.
|
||||
*/
|
||||
public boolean isInline() throws DOMException;
|
||||
public boolean isInline();
|
||||
|
||||
/**
|
||||
* Returns {@code true} if this function takes variable arguments.
|
||||
* @throws DOMException if this is a problem binding.
|
||||
*/
|
||||
public boolean takesVarArgs() throws DOMException;
|
||||
public boolean takesVarArgs();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -23,6 +23,6 @@ public interface ILabel extends IBinding {
|
|||
* Returns the label statement for this label.
|
||||
*
|
||||
*/
|
||||
public IASTLabelStatement getLabelStatement() throws DOMException;
|
||||
public IASTLabelStatement getLabelStatement();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -33,9 +33,8 @@ public interface IScope {
|
|||
/**
|
||||
* Get the IName for this scope, may be null
|
||||
* @return The name of this scope.
|
||||
* @throws DOMException
|
||||
*/
|
||||
public IName getScopeName() throws DOMException;
|
||||
public IName getScopeName();
|
||||
|
||||
/**
|
||||
* The method returns the first enclosing non-template scope, or <code>null</code> if this
|
||||
|
@ -55,7 +54,7 @@ public interface IScope {
|
|||
* @param name
|
||||
* @return An array of bindings.
|
||||
*/
|
||||
public IBinding[] find(String name) throws DOMException;
|
||||
public IBinding[] find(String name);
|
||||
|
||||
/**
|
||||
* Get the binding in this scope that the given name would resolve to. Could
|
||||
|
@ -68,9 +67,8 @@ public interface IScope {
|
|||
* whether or not to resolve the matching binding if it has not
|
||||
* been so already.
|
||||
* @return : the binding in this scope that matches the name, or null
|
||||
* @throws DOMException
|
||||
*/
|
||||
public IBinding getBinding(IASTName name, boolean resolve) throws DOMException;
|
||||
public IBinding getBinding(IASTName name, boolean resolve);
|
||||
|
||||
/**
|
||||
* Get the binding in this scope that the given name would resolve to. Could
|
||||
|
@ -85,9 +83,8 @@ public interface IScope {
|
|||
* been so already.
|
||||
* @param acceptLocalBindings a set of files for which to accept local bindings.
|
||||
* @return : the binding in this scope that matches the name, or null
|
||||
* @throws DOMException
|
||||
*/
|
||||
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet acceptLocalBindings) throws DOMException;
|
||||
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet acceptLocalBindings);
|
||||
|
||||
/**
|
||||
* Get the bindings in this scope that the given name or prefix could resolve to. Could
|
||||
|
@ -101,9 +98,8 @@ public interface IScope {
|
|||
* been so already.
|
||||
* @param prefixLookup whether the lookup is for a full name or a prefix
|
||||
* @return : the bindings in this scope that match the name or prefix, or null
|
||||
* @throws DOMException
|
||||
*/
|
||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup) throws DOMException;
|
||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup);
|
||||
|
||||
/**
|
||||
* Get the bindings in this scope that the given name or prefix could resolve to. Could
|
||||
|
@ -118,8 +114,7 @@ public interface IScope {
|
|||
* @param prefixLookup whether the lookup is for a full name or a prefix
|
||||
* @param acceptLocalBindings a set of files for which to accept local bindings.
|
||||
* @return : the bindings in this scope that match the name or prefix, or null
|
||||
* @throws DOMException
|
||||
*/
|
||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet acceptLocalBindings) throws DOMException;
|
||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet acceptLocalBindings);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -34,20 +34,20 @@ public interface IVariable extends IBinding {
|
|||
/**
|
||||
* Returns whether this variable is declared static.
|
||||
*/
|
||||
public boolean isStatic() throws DOMException;
|
||||
public boolean isStatic();
|
||||
|
||||
/**
|
||||
* Returns whether this variable is declared extern.
|
||||
*/
|
||||
public boolean isExtern() throws DOMException;
|
||||
public boolean isExtern();
|
||||
|
||||
/**
|
||||
* Returns whether this variable is an automatic variable.
|
||||
*/
|
||||
public boolean isAuto() throws DOMException;
|
||||
public boolean isAuto();
|
||||
|
||||
/**
|
||||
* Returns whether this variable is declared register.
|
||||
*/
|
||||
public boolean isRegister() throws DOMException;
|
||||
public boolean isRegister();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||
|
||||
|
@ -23,11 +22,8 @@ public interface ICCompositeTypeScope extends ICScope {
|
|||
/**
|
||||
* get the binding for the member that has been previous added to this scope
|
||||
* and that matches the given name.
|
||||
*
|
||||
* @param name
|
||||
* @throws DOMException
|
||||
*/
|
||||
public IBinding getBinding(char[] name) throws DOMException;
|
||||
public IBinding getBinding(char[] name);
|
||||
|
||||
/**
|
||||
* Get the type this scope is associated with
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -12,7 +12,6 @@
|
|||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||
|
||||
|
@ -33,7 +32,7 @@ public interface ICPPBase extends Cloneable {
|
|||
* The base class. Generally a ICPPClassType, but may be a ICPPTemplateParameter.
|
||||
* In the case of typedefs, the target type will be returned instead of the typedef itself.
|
||||
*/
|
||||
public IBinding getBaseClass() throws DOMException;
|
||||
public IBinding getBaseClass();
|
||||
|
||||
/**
|
||||
* Returns the name that specifies the base class.
|
||||
|
@ -45,13 +44,13 @@ public interface ICPPBase extends Cloneable {
|
|||
* The visibility qualifier applied to the base class.
|
||||
*
|
||||
*/
|
||||
public int getVisibility() throws DOMException;
|
||||
public int getVisibility();
|
||||
|
||||
|
||||
/**
|
||||
* Whether this is a virtual base class.
|
||||
*/
|
||||
public boolean isVirtual() throws DOMException;
|
||||
public boolean isVirtual();
|
||||
|
||||
/**
|
||||
* @since 5.1
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
|
||||
/**
|
||||
* Interface for class scopes.
|
||||
|
@ -39,5 +38,5 @@ public interface ICPPClassScope extends ICPPScope {
|
|||
* Returns the array of constructors, including implicit ones.
|
||||
* @since 5.1
|
||||
*/
|
||||
public ICPPConstructor[] getConstructors() throws DOMException;
|
||||
public ICPPConstructor[] getConstructors();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -31,7 +31,7 @@ public interface ICPPClassTemplatePartialSpecialization extends ICPPClassTemplat
|
|||
/**
|
||||
* get the ICPPTemplateDefinition which this is a specialization of
|
||||
*/
|
||||
public ICPPClassTemplate getPrimaryClassTemplate() throws DOMException;
|
||||
public ICPPClassTemplate getPrimaryClassTemplate();
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||
import org.eclipse.cdt.core.dom.ast.IField;
|
||||
|
@ -31,13 +30,13 @@ public interface ICPPClassType extends ICompositeType, ICPPBinding {
|
|||
*
|
||||
* @return List of ICPPBase
|
||||
*/
|
||||
public ICPPBase[] getBases() throws DOMException;
|
||||
public ICPPBase[] getBases();
|
||||
|
||||
/**
|
||||
* Get fields is restated here just to point out that this method returns a
|
||||
* list of ICPPField objects representing all fields, declared or inherited.
|
||||
*/
|
||||
public IField[] getFields() throws DOMException;
|
||||
public IField[] getFields();
|
||||
|
||||
/**
|
||||
* findField is restated here to point out that this method looks through
|
||||
|
@ -47,7 +46,7 @@ public interface ICPPClassType extends ICompositeType, ICPPBinding {
|
|||
*
|
||||
* @param name
|
||||
*/
|
||||
public IField findField(String name) throws DOMException;
|
||||
public IField findField(String name);
|
||||
|
||||
/**
|
||||
* Returns a list of ICPPField objects representing fields declared in this
|
||||
|
@ -55,7 +54,7 @@ public interface ICPPClassType extends ICompositeType, ICPPBinding {
|
|||
*
|
||||
* @return List of ICPPField
|
||||
*/
|
||||
public ICPPField[] getDeclaredFields() throws DOMException;
|
||||
public ICPPField[] getDeclaredFields();
|
||||
|
||||
/**
|
||||
* Returns a list of ICPPMethod objects representing all methods defined for
|
||||
|
@ -64,7 +63,7 @@ public interface ICPPClassType extends ICompositeType, ICPPBinding {
|
|||
*
|
||||
* @return List of ICPPMethod
|
||||
*/
|
||||
public ICPPMethod[] getMethods() throws DOMException;
|
||||
public ICPPMethod[] getMethods();
|
||||
|
||||
/**
|
||||
* Returns a list of ICPPMethod objects representing all method explicitly
|
||||
|
@ -73,7 +72,7 @@ public interface ICPPClassType extends ICompositeType, ICPPBinding {
|
|||
*
|
||||
* @return List of ICPPMethod
|
||||
*/
|
||||
public ICPPMethod[] getAllDeclaredMethods() throws DOMException;
|
||||
public ICPPMethod[] getAllDeclaredMethods();
|
||||
|
||||
/**
|
||||
* Returns a list of ICPPMethod objects representing all methods explicitly
|
||||
|
@ -82,7 +81,7 @@ public interface ICPPClassType extends ICompositeType, ICPPBinding {
|
|||
*
|
||||
* @return List of ICPPMethod
|
||||
*/
|
||||
public ICPPMethod[] getDeclaredMethods() throws DOMException;
|
||||
public ICPPMethod[] getDeclaredMethods();
|
||||
|
||||
/**
|
||||
* Returns an array of ICPPConstructor objects representing the constructors
|
||||
|
@ -90,19 +89,16 @@ public interface ICPPClassType extends ICompositeType, ICPPBinding {
|
|||
* constructors.
|
||||
*
|
||||
*/
|
||||
public ICPPConstructor[] getConstructors() throws DOMException;
|
||||
public ICPPConstructor[] getConstructors();
|
||||
|
||||
/**
|
||||
* return an array of bindings for those classes/functions declared as
|
||||
* friends of this class.
|
||||
*
|
||||
* @throws DOMException
|
||||
*/
|
||||
public IBinding[] getFriends() throws DOMException;
|
||||
public IBinding[] getFriends();
|
||||
|
||||
/**
|
||||
* return an array of nested classes/structures
|
||||
* @throws DOMException
|
||||
*/
|
||||
public ICPPClassType[] getNestedClasses() throws DOMException;
|
||||
public ICPPClassType[] getNestedClasses();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
|
||||
/**
|
||||
* @noextend This interface is not intended to be extended by clients.
|
||||
|
@ -20,9 +19,7 @@ public interface ICPPConstructor extends ICPPMethod {
|
|||
public static final ICPPConstructor [] EMPTY_CONSTRUCTOR_ARRAY = new ICPPConstructor[0];
|
||||
/**
|
||||
* Whether or not this constructor was declared as explicit
|
||||
*
|
||||
* @throws DOMException
|
||||
*/
|
||||
boolean isExplicit() throws DOMException;
|
||||
boolean isExplicit();
|
||||
|
||||
}
|
||||
|
|
|
@ -25,27 +25,26 @@ public interface ICPPFunction extends IFunction, ICPPBinding {
|
|||
|
||||
/**
|
||||
* does this function have the mutable storage class specifier
|
||||
* @throws DOMException
|
||||
*/
|
||||
public boolean isMutable() throws DOMException;
|
||||
public boolean isMutable();
|
||||
|
||||
/**
|
||||
* is this an inline function
|
||||
*/
|
||||
public boolean isInline() throws DOMException;
|
||||
public boolean isInline();
|
||||
|
||||
/**
|
||||
* Returns whether this function is declared as extern "C".
|
||||
* @since 5.0
|
||||
*/
|
||||
public boolean isExternC() throws DOMException;
|
||||
public boolean isExternC();
|
||||
|
||||
/**
|
||||
* Returns the exception specification for this function or <code>null</code> if there
|
||||
* is no exception specification.
|
||||
* @since 5.1
|
||||
*/
|
||||
public IType[] getExceptionSpecification() throws DOMException;
|
||||
public IType[] getExceptionSpecification();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -29,19 +29,19 @@ public interface ICPPMember extends ICPPBinding {
|
|||
/**
|
||||
* Returns the accessibility of the member.
|
||||
*/
|
||||
public int getVisibility() throws DOMException;
|
||||
public int getVisibility();
|
||||
|
||||
|
||||
/**
|
||||
* Same as {@link #getOwner()}.
|
||||
*/
|
||||
public ICPPClassType getClassOwner() throws DOMException;
|
||||
public ICPPClassType getClassOwner();
|
||||
|
||||
/**
|
||||
* Returns whether this is a static member or not.
|
||||
* @since 5.1
|
||||
*/
|
||||
public boolean isStatic() throws DOMException;
|
||||
public boolean isStatic();
|
||||
|
||||
/**
|
||||
* Returns the type of the member (function type or type of field)
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
|
||||
/**
|
||||
* Base interface for methods, also used for constructors.
|
||||
|
@ -25,7 +24,7 @@ public interface ICPPMethod extends ICPPFunction, ICPPMember {
|
|||
* Returns whether this method is declared to be virtual. Does not detect whether
|
||||
* the method is virtual because of overriding a virtual method from a base class.
|
||||
*/
|
||||
public boolean isVirtual() throws DOMException;
|
||||
public boolean isVirtual();
|
||||
|
||||
/**
|
||||
* is this a destructor
|
||||
|
@ -44,5 +43,5 @@ public interface ICPPMethod extends ICPPFunction, ICPPMember {
|
|||
* Returns whether this is a pure abstract method
|
||||
* @since 5.1
|
||||
*/
|
||||
public boolean isPureVirtual() throws DOMException;
|
||||
public boolean isPureVirtual();
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
|
||||
/**
|
||||
|
@ -23,16 +22,13 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
|||
public interface ICPPNamespace extends ICPPBinding {
|
||||
/**
|
||||
* get the scope object associated with this namespace
|
||||
*
|
||||
* @throws DOMException
|
||||
*/
|
||||
public ICPPNamespaceScope getNamespaceScope() throws DOMException;
|
||||
public ICPPNamespaceScope getNamespaceScope();
|
||||
|
||||
/**
|
||||
* get an array of the all the bindings declared in this namespace.
|
||||
* @throws DOMException
|
||||
*/
|
||||
public IBinding[] getMemberBindings() throws DOMException;
|
||||
public IBinding[] getMemberBindings();
|
||||
|
||||
/**
|
||||
* Returns whether this is an inline namespace.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||
|
||||
/**
|
||||
|
@ -22,12 +21,11 @@ public interface ICPPVariable extends IVariable, ICPPBinding {
|
|||
|
||||
/**
|
||||
* does this variable have the mutable storage class specifier
|
||||
* @throws DOMException
|
||||
*/
|
||||
public boolean isMutable() throws DOMException;
|
||||
public boolean isMutable();
|
||||
|
||||
/**
|
||||
* Returns whether this variable is declared as extern "C".
|
||||
*/
|
||||
public boolean isExternC() throws DOMException;
|
||||
public boolean isExternC();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 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
|
||||
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.index;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
|
@ -48,5 +47,5 @@ public interface IIndexBinding extends IBinding {
|
|||
* {@inheritDoc}
|
||||
* @since 5.1
|
||||
*/
|
||||
IIndexBinding getOwner() throws DOMException;
|
||||
IIndexBinding getOwner();
|
||||
}
|
||||
|
|
|
@ -1,25 +1,18 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2008 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* Created on Jul 21, 2004
|
||||
*/
|
||||
package org.eclipse.cdt.core.parser.util;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*/
|
||||
public class CharArraySet extends CharTable {
|
||||
|
||||
public static final CharArraySet EMPTY_SET = new CharArraySet( 0 ){
|
||||
|
|
|
@ -1,27 +1,19 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2008 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* cloned from CharArrayMap & CharArrayObjectMap
|
||||
* Created on Jul 14, 2004
|
||||
*/
|
||||
package org.eclipse.cdt.core.parser.util;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*/
|
||||
public class ObjectMap extends ObjectTable<Object> {
|
||||
public static final ObjectMap EMPTY_MAP = new ObjectMap(0) {
|
||||
@Override
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.util;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*/
|
||||
public class ObjectSet<T> extends ObjectTable<T> {
|
||||
/**
|
||||
* Represents the empty ObjectSet
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2008 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* For use by the Parser Symbol Table
|
||||
* Created on Jul 15, 2004
|
||||
*/
|
||||
package org.eclipse.cdt.core.parser.util;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
|
@ -20,9 +15,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*/
|
||||
public abstract class ObjectTable<T> extends HashTable {
|
||||
protected T[] keyTable;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 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
|
||||
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
|
@ -35,14 +34,14 @@ public class ASTInternal {
|
|||
return IASTNode.EMPTY_NODE_ARRAY;
|
||||
}
|
||||
|
||||
public static IASTNode getPhysicalNodeOfScope(IScope scope) throws DOMException {
|
||||
public static IASTNode getPhysicalNodeOfScope(IScope scope) {
|
||||
if (scope instanceof IASTInternalScope) {
|
||||
return ((IASTInternalScope) scope).getPhysicalNode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void addBinding(IScope scope, IBinding binding) throws DOMException {
|
||||
public static void addBinding(IScope scope, IBinding binding) {
|
||||
if (scope instanceof IASTInternalScope) {
|
||||
((IASTInternalScope) scope).addBinding(binding);
|
||||
}
|
||||
|
@ -50,15 +49,11 @@ public class ASTInternal {
|
|||
|
||||
public static void addName(IScope scope, IASTName name) {
|
||||
if (scope instanceof IASTInternalScope) {
|
||||
try {
|
||||
((IASTInternalScope) scope).addName(name);
|
||||
} catch (DOMException e) {
|
||||
// name is not cached in scope
|
||||
}
|
||||
((IASTInternalScope) scope).addName(name);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isStatic(IFunction func, boolean resolveAll) throws DOMException {
|
||||
public static boolean isStatic(IFunction func, boolean resolveAll) {
|
||||
if (func instanceof ICPPInternalFunction) {
|
||||
return ((ICPPInternalFunction)func).isStatic(resolveAll);
|
||||
}
|
||||
|
@ -100,8 +95,7 @@ public class ASTInternal {
|
|||
}
|
||||
}
|
||||
if (decls != null) {
|
||||
for (int i = 0; i < decls.length; i++) {
|
||||
final IASTNode node= decls[i];
|
||||
for (final IASTNode node : decls) {
|
||||
if (node != null) {
|
||||
if ( (filePath= isPartOfSource(filePath, node)) == null) {
|
||||
return null;
|
||||
|
@ -153,8 +147,7 @@ public class ASTInternal {
|
|||
filePath= def.getContainingFilename();
|
||||
}
|
||||
if (decls != null) {
|
||||
for (int i = 0; i < decls.length; i++) {
|
||||
final IASTNode node= decls[i];
|
||||
for (final IASTNode node : decls) {
|
||||
if (node != null) {
|
||||
final String fn = node.getContainingFilename();
|
||||
if (filePath == null) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 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
|
||||
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
|
@ -28,19 +27,13 @@ public interface IASTInternalScope extends IScope {
|
|||
/**
|
||||
* This adds an IBinding to the scope. It is primarily used by the parser to add
|
||||
* implicit IBindings to the scope (such as GCC built-in functions).
|
||||
*
|
||||
* @param binding
|
||||
* @throws DOMException
|
||||
*/
|
||||
public void addBinding(IBinding binding) throws DOMException;
|
||||
public void addBinding(IBinding binding);
|
||||
|
||||
/**
|
||||
* Add an IASTName to be cached in this scope
|
||||
*
|
||||
* @param name
|
||||
* @throws DOMException
|
||||
*/
|
||||
public void addName(IASTName name) throws DOMException;
|
||||
public void addName(IASTName name);
|
||||
|
||||
/**
|
||||
* Can be called during ambiguity resolution to populate a scope without considering
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
|
@ -26,6 +24,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
|||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||
import org.eclipse.cdt.core.index.IIndexFileSet;
|
||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||
import org.eclipse.cdt.internal.core.dom.Linkage;
|
||||
|
@ -34,6 +33,8 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
|||
import org.eclipse.cdt.internal.core.parser.ParserMessages;
|
||||
import org.eclipse.core.runtime.PlatformObject;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* Implementation of problem bindings
|
||||
*/
|
||||
|
@ -172,8 +173,8 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
|
||||
*/
|
||||
public IBinding[] find(String name) throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public IBinding[] find(String name) {
|
||||
return IBinding.EMPTY_BINDING_ARRAY;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -186,34 +187,32 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IScope#addName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||
*/
|
||||
public void addName(IASTName name) throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public void addName(IASTName name) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean)
|
||||
*/
|
||||
public IBinding getBinding(IASTName name, boolean resolve) throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public IBinding getBinding(IASTName name, boolean resolve) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix)
|
||||
throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public final IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix) {
|
||||
return IBinding.EMPTY_BINDING_ARRAY;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean)
|
||||
*/
|
||||
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean)
|
||||
*/
|
||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) {
|
||||
return IBinding.EMPTY_BINDING_ARRAY;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -239,8 +238,7 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
|||
return -1;
|
||||
}
|
||||
|
||||
public void addBinding(IBinding binding) throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public void addBinding(IBinding binding) {
|
||||
}
|
||||
|
||||
public ILinkage getLinkage() {
|
||||
|
@ -252,7 +250,7 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
|||
return getMessage();
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
return node instanceof IASTName ? CPPVisitor.findNameOwner((IASTName) node, true) : null;
|
||||
}
|
||||
|
||||
|
@ -265,4 +263,73 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
|||
|
||||
public void populateCache() {
|
||||
}
|
||||
|
||||
|
||||
// Dummy methods for derived classes
|
||||
public IType getType() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isStatic() {
|
||||
return false;
|
||||
}
|
||||
public String[] getQualifiedName() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isGloballyQualified() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isMutable() {
|
||||
return false;
|
||||
}
|
||||
public boolean isExtern() {
|
||||
return false;
|
||||
}
|
||||
public boolean isExternC() {
|
||||
return false;
|
||||
}
|
||||
public boolean isAuto() {
|
||||
return false;
|
||||
}
|
||||
public boolean isRegister() {
|
||||
return false;
|
||||
}
|
||||
public IValue getInitialValue() {
|
||||
return null;
|
||||
}
|
||||
public boolean isAnonymous() {
|
||||
return false;
|
||||
}
|
||||
public boolean isDeleted() {
|
||||
return false;
|
||||
}
|
||||
public boolean isInline() {
|
||||
return false;
|
||||
}
|
||||
public boolean takesVarArgs() {
|
||||
return false;
|
||||
}
|
||||
public IType[] getExceptionSpecification() {
|
||||
return null;
|
||||
}
|
||||
public boolean hasParameterPack() {
|
||||
return false;
|
||||
}
|
||||
public boolean isVirtual() {
|
||||
return false;
|
||||
}
|
||||
public boolean isPureVirtual() {
|
||||
return false;
|
||||
}
|
||||
public boolean isImplicit() {
|
||||
return false;
|
||||
}
|
||||
public boolean hasDefaultValue() {
|
||||
return false;
|
||||
}
|
||||
public boolean isParameterPack() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2009 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2008, 2010 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
|
||||
|
@ -16,7 +16,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
||||
|
@ -862,13 +861,9 @@ public class Value implements IValue {
|
|||
* Computes a signature for an unknown binding.
|
||||
*/
|
||||
private static String getSignatureForUnknown(ICPPUnknownBinding binding) {
|
||||
try {
|
||||
IBinding owner= binding.getOwner();
|
||||
if (owner instanceof IType) {
|
||||
return ASTTypeUtil.getType((IType) owner, true) + SCOPE_OP + binding.getName();
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
// ignore qualification
|
||||
IBinding owner= binding.getOwner();
|
||||
if (owner instanceof IType) {
|
||||
return ASTTypeUtil.getType((IType) owner, true) + SCOPE_OP + binding.getName();
|
||||
}
|
||||
return binding.getName();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -13,7 +13,6 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompletionContext;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
|
@ -122,19 +121,15 @@ public class CASTElaboratedTypeSpecifier extends CASTBaseDeclSpecifier implement
|
|||
IBinding b= result[i];
|
||||
if (b instanceof ICompositeType) {
|
||||
ICompositeType ct= (ICompositeType) b;
|
||||
try {
|
||||
switch (ct.getKey()) {
|
||||
case ICompositeType.k_struct:
|
||||
if (getKind() != k_struct)
|
||||
b= null;
|
||||
break;
|
||||
case ICompositeType.k_union:
|
||||
if (getKind() != k_union)
|
||||
b= null;
|
||||
break;
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
// ignore and propose binding
|
||||
switch (ct.getKey()) {
|
||||
case ICompositeType.k_struct:
|
||||
if (getKind() != k_struct)
|
||||
b= null;
|
||||
break;
|
||||
case ICompositeType.k_union:
|
||||
if (getKind() != k_union)
|
||||
b= null;
|
||||
break;
|
||||
}
|
||||
} else if (b instanceof IEnumeration) {
|
||||
if (getKind() != k_enum)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2008 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -13,10 +13,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompletionContext;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
|
@ -223,22 +221,17 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
if (bindings[i] instanceof ICompositeType) {
|
||||
ICompositeType type = (ICompositeType) bindings[i];
|
||||
|
||||
try {
|
||||
switch (type.getKey()) {
|
||||
case ICompositeType.k_struct:
|
||||
if (kind != IASTElaboratedTypeSpecifier.k_struct) {
|
||||
bindings[i] = null;
|
||||
}
|
||||
break;
|
||||
case ICompositeType.k_union:
|
||||
if (kind != IASTElaboratedTypeSpecifier.k_union) {
|
||||
bindings[i] = null;
|
||||
}
|
||||
break;
|
||||
switch (type.getKey()) {
|
||||
case ICompositeType.k_struct:
|
||||
if (kind != IASTElaboratedTypeSpecifier.k_struct) {
|
||||
bindings[i] = null;
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
bindings[i] = null;
|
||||
CCorePlugin.log(e);
|
||||
break;
|
||||
case ICompositeType.k_union:
|
||||
if (kind != IASTElaboratedTypeSpecifier.k_union) {
|
||||
bindings[i] = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
bindings[i]= null;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems Inc. and others.
|
||||
* Copyright (c) 2008, 2010 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
|
||||
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
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;
|
||||
|
@ -72,7 +71,7 @@ public class CBuiltinVariable extends CVariable {
|
|||
|
||||
|
||||
@Override
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.dom.parser.c;
|
|||
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
|
||||
|
@ -176,7 +175,7 @@ public class CEnumeration extends PlatformObject implements IEnumeration, ICInte
|
|||
return definition;
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
IASTNode node= definition;
|
||||
if (node == null && declarations != null && declarations.length > 0) {
|
||||
node= declarations[0];
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
|
@ -35,9 +34,6 @@ public class CEnumerator extends PlatformObject implements IEnumerator {
|
|||
public static class CEnumeratorProblem extends ProblemBinding implements IEnumerator {
|
||||
public CEnumeratorProblem(IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
}
|
||||
public IType getType() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public IValue getValue() {
|
||||
return Value.UNKNOWN;
|
||||
|
|
|
@ -1,47 +1,42 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2007 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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 Rational Software - Initial API and implementation
|
||||
* Andrew Niefer (IBM Rational Software) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||
import org.eclipse.cdt.core.dom.ast.IField;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICCompositeTypeScope;
|
||||
|
||||
/**
|
||||
* Created on Nov 8, 2004
|
||||
* @author aniefer
|
||||
*/
|
||||
public class CField extends CVariable implements IField {
|
||||
public static class CFieldProblem extends CVariable.CVariableProblem implements IField {
|
||||
public CFieldProblem(IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
}
|
||||
public static class CFieldProblem extends CVariable.CVariableProblem implements IField {
|
||||
private ICompositeType fOwner;
|
||||
|
||||
public ICompositeType getCompositeTypeOwner() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public CFieldProblem(ICompositeType owner, IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
fOwner = owner;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public ICompositeType getCompositeTypeOwner() {
|
||||
return fOwner;
|
||||
}
|
||||
}
|
||||
|
||||
public CField(IASTName name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public ICompositeType getCompositeTypeOwner() throws DOMException {
|
||||
|
||||
public ICompositeType getCompositeTypeOwner() {
|
||||
ICCompositeTypeScope scope = (ICCompositeTypeScope) getScope();
|
||||
return scope.getCompositeType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -12,7 +12,6 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
|
@ -472,7 +471,7 @@ public class CFunction extends PlatformObject implements IFunction, ICInternalFu
|
|||
return definition;
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2008 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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 Rational Software - Initial API and implementation
|
||||
* Andrew Niefer (IBM Rational Software) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.EScopeKind;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||
|
@ -20,14 +20,9 @@ import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
|||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.ILabel;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICFunctionScope;
|
||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||
|
||||
/**
|
||||
* Created on Nov 8, 2004
|
||||
* @author aniefer
|
||||
*/
|
||||
public class CFunctionScope extends CScope implements ICFunctionScope {
|
||||
public CFunctionScope( IASTFunctionDefinition function ){
|
||||
super( function, EScopeKind.eLocal);
|
||||
|
@ -67,7 +62,7 @@ public class CFunctionScope extends CScope implements ICFunctionScope {
|
|||
return (ILabel[]) ArrayUtil.trim( ILabel.class, result );
|
||||
}
|
||||
|
||||
static private class FindLabelsAction extends CASTVisitor {
|
||||
static private class FindLabelsAction extends ASTVisitor {
|
||||
public IASTLabelStatement [] labels = null;
|
||||
|
||||
public FindLabelsAction(){
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2008 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -12,7 +12,6 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
|
||||
|
@ -123,7 +122,7 @@ public class CKnRParameter extends PlatformObject implements IParameter {
|
|||
return Linkage.C_LINKAGE;
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
return CVisitor.findEnclosingFunction(declaration);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2008 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -12,7 +12,6 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTLabelStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
|
@ -20,65 +19,60 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
|||
import org.eclipse.cdt.core.dom.ast.ILabel;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.internal.core.dom.Linkage;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||
import org.eclipse.core.runtime.PlatformObject;
|
||||
|
||||
/**
|
||||
* Represents a label.
|
||||
*/
|
||||
public class CLabel extends PlatformObject implements ILabel {
|
||||
|
||||
public static class CLabelProblem extends ProblemBinding implements ILabel {
|
||||
public CLabelProblem(IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
}
|
||||
|
||||
public IASTLabelStatement getLabelStatement() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
}
|
||||
|
||||
private final IASTName labelStatement;
|
||||
|
||||
public CLabel(IASTName statement) {
|
||||
labelStatement = statement;
|
||||
statement.setBinding(this);
|
||||
}
|
||||
private final IASTName labelStatement;
|
||||
|
||||
public IASTNode getPhysicalNode() {
|
||||
return labelStatement;
|
||||
}
|
||||
public CLabel(IASTName statement) {
|
||||
labelStatement = statement;
|
||||
statement.setBinding(this);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.ILabel#getLabelStatement()
|
||||
*/
|
||||
public IASTLabelStatement getLabelStatement() {
|
||||
return (IASTLabelStatement) labelStatement.getParent();
|
||||
}
|
||||
public IASTNode getPhysicalNode() {
|
||||
return labelStatement;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
return labelStatement.toString();
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.ILabel#getLabelStatement()
|
||||
*/
|
||||
public IASTLabelStatement getLabelStatement() {
|
||||
return (IASTLabelStatement) labelStatement.getParent();
|
||||
}
|
||||
|
||||
public char[] getNameCharArray() {
|
||||
return labelStatement.toCharArray();
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
return labelStatement.toString();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
|
||||
*/
|
||||
public IScope getScope() {
|
||||
return CVisitor.getContainingScope(labelStatement.getParent());
|
||||
}
|
||||
public char[] getNameCharArray() {
|
||||
return labelStatement.toCharArray();
|
||||
}
|
||||
|
||||
public ILinkage getLinkage() {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
|
||||
*/
|
||||
public IScope getScope() {
|
||||
return CVisitor.getContainingScope(labelStatement.getParent());
|
||||
}
|
||||
|
||||
public ILinkage getLinkage() {
|
||||
return Linkage.C_LINKAGE;
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
|
||||
public IBinding getOwner() {
|
||||
return CVisitor.findEnclosingFunction(labelStatement);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -12,7 +12,6 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
|
@ -38,151 +37,147 @@ import org.eclipse.core.runtime.PlatformObject;
|
|||
* Represents the parameter of a function.
|
||||
*/
|
||||
public class CParameter extends PlatformObject implements IParameter {
|
||||
public static class CParameterProblem extends ProblemBinding implements IParameter {
|
||||
public CParameterProblem(IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
}
|
||||
public IType getType() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isStatic() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isExtern() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isAuto() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isRegister() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public IValue getInitialValue() {
|
||||
return null;
|
||||
public static class CParameterProblem extends ProblemBinding implements IParameter {
|
||||
public CParameterProblem(IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private IASTName[] declarations;
|
||||
private IType type = null;
|
||||
|
||||
|
||||
public CParameter(IASTName parameterName) {
|
||||
this.declarations = new IASTName[] { parameterName };
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#getType()
|
||||
*/
|
||||
|
||||
public IType getType() {
|
||||
|
||||
public IType getType() {
|
||||
if (type == null && declarations[0].getParent() instanceof IASTDeclarator)
|
||||
type = CVisitor.createType((IASTDeclarator)declarations[0].getParent());
|
||||
|
||||
type = CVisitor.createType((IASTDeclarator) declarations[0].getParent());
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
private IASTName getPrimaryDeclaration() {
|
||||
if (declarations != null) {
|
||||
for (int i = 0; i < declarations.length && declarations[i] != null; i++) {
|
||||
IASTNode node = declarations[i].getParent();
|
||||
while (!(node instanceof IASTDeclaration))
|
||||
node = node.getParent();
|
||||
|
||||
if (node.getPropertyInParent() == ICASTKnRFunctionDeclarator.FUNCTION_PARAMETER ||
|
||||
node instanceof IASTFunctionDefinition) {
|
||||
return declarations[i];
|
||||
}
|
||||
}
|
||||
return declarations[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
IASTName name = getPrimaryDeclaration();
|
||||
if (name != null)
|
||||
return name.toString();
|
||||
return CVisitor.EMPTY_STRING;
|
||||
}
|
||||
private IASTName getPrimaryDeclaration() {
|
||||
if (declarations != null) {
|
||||
for (int i = 0; i < declarations.length && declarations[i] != null; i++) {
|
||||
IASTNode node = declarations[i].getParent();
|
||||
while (!(node instanceof IASTDeclaration))
|
||||
node = node.getParent();
|
||||
|
||||
public char[] getNameCharArray() {
|
||||
IASTName name = getPrimaryDeclaration();
|
||||
if (name != null)
|
||||
return name.toCharArray();
|
||||
return CVisitor.EMPTY_CHAR_ARRAY;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
|
||||
*/
|
||||
public IScope getScope() {
|
||||
//IASTParameterDeclaration or IASTSimpleDeclaration
|
||||
for (int i = 0; i < declarations.length; i++) {
|
||||
IASTNode parent = declarations[i].getParent();
|
||||
if (parent instanceof ICASTKnRFunctionDeclarator) {
|
||||
parent = parent.getParent();
|
||||
return ((IASTCompoundStatement)((IASTFunctionDefinition) parent).getBody()).getScope();
|
||||
}
|
||||
|
||||
IASTNode fdtorNode = parent.getParent().getParent();
|
||||
if (fdtorNode instanceof IASTFunctionDeclarator) {
|
||||
IASTFunctionDeclarator fdtor = (IASTFunctionDeclarator) fdtorNode;
|
||||
parent = fdtor.getParent();
|
||||
if (parent instanceof IASTFunctionDefinition) {
|
||||
return ((IASTCompoundStatement)((IASTFunctionDefinition) parent).getBody()).getScope();
|
||||
if (node.getPropertyInParent() == ICASTKnRFunctionDeclarator.FUNCTION_PARAMETER
|
||||
|| node instanceof IASTFunctionDefinition) {
|
||||
return declarations[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
//TODO: if not definition, find definition
|
||||
}
|
||||
return declarations[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
IASTName name = getPrimaryDeclaration();
|
||||
if (name != null)
|
||||
return name.toString();
|
||||
return CVisitor.EMPTY_STRING;
|
||||
}
|
||||
|
||||
public char[] getNameCharArray() {
|
||||
IASTName name = getPrimaryDeclaration();
|
||||
if (name != null)
|
||||
return name.toCharArray();
|
||||
return CVisitor.EMPTY_CHAR_ARRAY;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
|
||||
*/
|
||||
public IScope getScope() {
|
||||
// IASTParameterDeclaration or IASTSimpleDeclaration
|
||||
for (IASTName declaration : declarations) {
|
||||
IASTNode parent = declaration.getParent();
|
||||
if (parent instanceof ICASTKnRFunctionDeclarator) {
|
||||
parent = parent.getParent();
|
||||
return ((IASTCompoundStatement) ((IASTFunctionDefinition) parent).getBody()).getScope();
|
||||
}
|
||||
|
||||
IASTNode fdtorNode = parent.getParent().getParent();
|
||||
if (fdtorNode instanceof IASTFunctionDeclarator) {
|
||||
IASTFunctionDeclarator fdtor = (IASTFunctionDeclarator) fdtorNode;
|
||||
parent = fdtor.getParent();
|
||||
if (parent instanceof IASTFunctionDefinition) {
|
||||
return ((IASTCompoundStatement) ((IASTFunctionDefinition) parent).getBody()).getScope();
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: if not definition, find definition
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public void addDeclaration(IASTName name) {
|
||||
if (name != null && name.isActive())
|
||||
declarations = (IASTName[]) ArrayUtil.append(IASTName.class, declarations, name);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isStatic()
|
||||
*/
|
||||
public boolean isStatic() {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isStatic()
|
||||
*/
|
||||
public boolean isStatic() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isExtern()
|
||||
*/
|
||||
public boolean isExtern() {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isExtern()
|
||||
*/
|
||||
public boolean isExtern() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto()
|
||||
*/
|
||||
public boolean isAuto() {
|
||||
return hasStorageClass(IASTDeclSpecifier.sc_auto);
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto()
|
||||
*/
|
||||
public boolean isAuto() {
|
||||
return hasStorageClass(IASTDeclSpecifier.sc_auto);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isRegister()
|
||||
*/
|
||||
public boolean isRegister() {
|
||||
return hasStorageClass(IASTDeclSpecifier.sc_register);
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isRegister()
|
||||
*/
|
||||
public boolean isRegister() {
|
||||
return hasStorageClass(IASTDeclSpecifier.sc_register);
|
||||
}
|
||||
|
||||
public boolean hasStorageClass(int storage) {
|
||||
public boolean hasStorageClass(int storage) {
|
||||
if (declarations == null)
|
||||
return false;
|
||||
|
||||
|
||||
for (int i = 0; i < declarations.length && declarations[i] != null; i++) {
|
||||
IASTNode parent= declarations[i].getParent();
|
||||
IASTNode parent = declarations[i].getParent();
|
||||
while (!(parent instanceof IASTParameterDeclaration) && !(parent instanceof IASTDeclaration))
|
||||
parent= parent.getParent();
|
||||
parent = parent.getParent();
|
||||
|
||||
IASTDeclSpecifier declSpec = null;
|
||||
if (parent instanceof IASTSimpleDeclaration) {
|
||||
|
@ -195,15 +190,15 @@ public class CParameter extends PlatformObject implements IParameter {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public ILinkage getLinkage() {
|
||||
return Linkage.C_LINKAGE;
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
|
||||
public IBinding getOwner() {
|
||||
if (declarations == null || declarations.length == 0)
|
||||
return null;
|
||||
|
||||
|
||||
return CVisitor.findEnclosingFunction(declarations[0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ 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.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.EScopeKind;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
|
@ -27,6 +27,7 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTForStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||
|
@ -44,8 +45,6 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
|||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
||||
import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTEnumerationSpecifier;
|
||||
|
@ -129,7 +128,7 @@ public class CScope implements ICScope, IASTInternalScope {
|
|||
return CVisitor.getContainingScope( physicalNode );
|
||||
}
|
||||
|
||||
protected static class CollectNamesAction extends CASTVisitor {
|
||||
protected static class CollectNamesAction extends ASTVisitor {
|
||||
private char [] name;
|
||||
private IASTName [] result = null;
|
||||
CollectNamesAction( char [] n ){
|
||||
|
@ -163,7 +162,7 @@ public class CScope implements ICScope, IASTInternalScope {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
|
||||
*/
|
||||
public IBinding[] find(String name) throws DOMException {
|
||||
public IBinding[] find(String name) {
|
||||
return CVisitor.findBindings(this, name);
|
||||
}
|
||||
|
||||
|
@ -235,7 +234,7 @@ public class CScope implements ICScope, IASTInternalScope {
|
|||
return getBinding(name, resolve, IIndexFileSet.EMPTY);
|
||||
}
|
||||
|
||||
public final IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix) throws DOMException {
|
||||
public final IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix) {
|
||||
return getBindings(name, resolve, prefix, IIndexFileSet.EMPTY);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -45,25 +45,26 @@ import org.eclipse.core.runtime.PlatformObject;
|
|||
* Represents structs and unions.
|
||||
*/
|
||||
public class CStructure extends PlatformObject implements ICompositeType, ICInternalBinding {
|
||||
|
||||
|
||||
public static class CStructureProblem extends ProblemBinding implements ICompositeType {
|
||||
public CStructureProblem(IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
}
|
||||
public IField findField(String name) throws DOMException {
|
||||
throw new DOMException(this);
|
||||
|
||||
public IField findField(String name) {
|
||||
return null;
|
||||
}
|
||||
public IScope getCompositeScope() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
|
||||
public IScope getCompositeScope() {
|
||||
return this;
|
||||
}
|
||||
public IField[] getFields() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
|
||||
public IField[] getFields() {
|
||||
return IField.EMPTY_FIELD_ARRAY;
|
||||
}
|
||||
public int getKey() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isAnonymous() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
|
||||
public int getKey() {
|
||||
return k_struct;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,20 +72,20 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
|
|||
private IASTName definition;
|
||||
private boolean checked;
|
||||
private ICompositeType typeInIndex;
|
||||
|
||||
|
||||
public CStructure(IASTName name) {
|
||||
if (name.getPropertyInParent() == IASTCompositeTypeSpecifier.TYPE_NAME) {
|
||||
definition = name;
|
||||
} else {
|
||||
declarations = new IASTName[] { name };
|
||||
}
|
||||
name.setBinding(this);
|
||||
if (name.getPropertyInParent() == IASTCompositeTypeSpecifier.TYPE_NAME) {
|
||||
definition = name;
|
||||
} else {
|
||||
declarations = new IASTName[] { name };
|
||||
}
|
||||
name.setBinding(this);
|
||||
}
|
||||
|
||||
public IASTNode getPhysicalNode() {
|
||||
return (definition != null) ? (IASTNode)definition : (IASTNode)declarations[0];
|
||||
}
|
||||
|
||||
|
||||
public IASTNode getPhysicalNode() {
|
||||
return (definition != null) ? (IASTNode) definition : (IASTNode) declarations[0];
|
||||
}
|
||||
|
||||
private void checkForDefinition() {
|
||||
if (!checked && definition == null) {
|
||||
IASTNode declSpec = declarations[0].getParent();
|
||||
|
@ -92,23 +93,25 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
|
|||
IASTDeclSpecifier spec = CVisitor.findDefinition((ICASTElaboratedTypeSpecifier) declSpec);
|
||||
if (spec instanceof ICASTCompositeTypeSpecifier) {
|
||||
ICASTCompositeTypeSpecifier compTypeSpec = (ICASTCompositeTypeSpecifier) spec;
|
||||
definition= compTypeSpec.getName();
|
||||
definition = compTypeSpec.getName();
|
||||
definition.setBinding(this);
|
||||
}
|
||||
}
|
||||
|
||||
if (definition == null && typeInIndex == null) {
|
||||
final IASTTranslationUnit translationUnit = declSpec.getTranslationUnit();
|
||||
IIndex index= translationUnit.getIndex();
|
||||
IIndex index = translationUnit.getIndex();
|
||||
if (index != null) {
|
||||
typeInIndex= (ICompositeType) index.adaptBinding(this);
|
||||
typeInIndex = (ICompositeType) index.adaptBinding(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
checked = true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
|
@ -117,6 +120,7 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
|
|||
|
||||
return declarations[0].toString();
|
||||
}
|
||||
|
||||
public char[] getNameCharArray() {
|
||||
if (definition != null)
|
||||
return definition.toCharArray();
|
||||
|
@ -124,29 +128,33 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
|
|||
return declarations[0].toCharArray();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
|
||||
*/
|
||||
public IScope getScope() throws DOMException {
|
||||
IASTDeclSpecifier declSpec = (IASTDeclSpecifier) ((definition != null) ? (IASTNode)definition.getParent() : declarations[0].getParent());
|
||||
IASTDeclSpecifier declSpec = (IASTDeclSpecifier) ((definition != null) ? (IASTNode) definition
|
||||
.getParent() : declarations[0].getParent());
|
||||
IScope scope = CVisitor.getContainingScope(declSpec);
|
||||
while(scope instanceof ICCompositeTypeScope) {
|
||||
while (scope instanceof ICCompositeTypeScope) {
|
||||
scope = scope.getParent();
|
||||
}
|
||||
return scope;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getFields()
|
||||
*/
|
||||
public IField[] getFields() throws DOMException {
|
||||
public IField[] getFields() {
|
||||
checkForDefinition();
|
||||
if (definition == null) {
|
||||
return new IField[] {
|
||||
new CField.CFieldProblem(declarations[0], IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray())
|
||||
};
|
||||
return new IField[] { new CField.CFieldProblem(this, declarations[0],
|
||||
IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray()) };
|
||||
}
|
||||
ICASTCompositeTypeSpecifier compSpec = (ICASTCompositeTypeSpecifier) definition.getParent();
|
||||
ICASTCompositeTypeSpecifier compSpec = (ICASTCompositeTypeSpecifier) definition.getParent();
|
||||
IField[] fields = collectFields(compSpec, null);
|
||||
return (IField[]) ArrayUtil.trim(IField.class, fields);
|
||||
}
|
||||
|
@ -162,7 +170,7 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
|
|||
if (declarators.length == 0) {
|
||||
IASTDeclSpecifier declspec = ((IASTSimpleDeclaration) node).getDeclSpecifier();
|
||||
if (declspec instanceof ICASTCompositeTypeSpecifier) {
|
||||
fields= collectFields((ICASTCompositeTypeSpecifier) declspec, fields);
|
||||
fields = collectFields((ICASTCompositeTypeSpecifier) declspec, fields);
|
||||
}
|
||||
} else {
|
||||
for (IASTDeclarator declarator : declarators) {
|
||||
|
@ -178,10 +186,11 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
|
|||
return fields;
|
||||
}
|
||||
|
||||
public IField findField(String name) throws DOMException {
|
||||
public IField findField(String name) {
|
||||
IScope scope = getCompositeScope();
|
||||
if (scope == null) {
|
||||
return new CField.CFieldProblem(declarations[0], IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray());
|
||||
return new CField.CFieldProblem(this, declarations[0],
|
||||
IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray());
|
||||
}
|
||||
|
||||
final CASTName astName = new CASTName(name.toCharArray());
|
||||
|
@ -189,49 +198,49 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
|
|||
IBinding binding = scope.getBinding(astName, true);
|
||||
if (binding instanceof IField)
|
||||
return (IField) binding;
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getKey()
|
||||
*/
|
||||
public int getKey() {
|
||||
return (definition != null) ? ((IASTCompositeTypeSpecifier)definition.getParent()).getKey()
|
||||
: ((IASTElaboratedTypeSpecifier)declarations[0].getParent()).getKind();
|
||||
return (definition != null) ? ((IASTCompositeTypeSpecifier) definition.getParent()).getKey()
|
||||
: ((IASTElaboratedTypeSpecifier) declarations[0].getParent()).getKind();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getCompositeScope()
|
||||
*/
|
||||
public IScope getCompositeScope() {
|
||||
checkForDefinition();
|
||||
if (definition != null) {
|
||||
return ((IASTCompositeTypeSpecifier)definition.getParent()).getScope();
|
||||
return ((IASTCompositeTypeSpecifier) definition.getParent()).getScope();
|
||||
}
|
||||
// fwd-declarations must be backed up from the index
|
||||
if (typeInIndex != null) {
|
||||
try {
|
||||
IScope scope = typeInIndex.getCompositeScope();
|
||||
if (scope instanceof ICCompositeTypeScope)
|
||||
return scope;
|
||||
} catch (DOMException e) {
|
||||
// index bindings don't throw DOMExeptions.
|
||||
}
|
||||
IScope scope = typeInIndex.getCompositeScope();
|
||||
if (scope instanceof ICCompositeTypeScope)
|
||||
return scope;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
IType t = null;
|
||||
try {
|
||||
t = (IType) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
//not going to happen
|
||||
}
|
||||
return t;
|
||||
}
|
||||
IType t = null;
|
||||
try {
|
||||
t = (IType) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
// not going to happen
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
public void addDefinition(ICASTCompositeTypeSpecifier compositeTypeSpec) {
|
||||
if (compositeTypeSpec.isActive()) {
|
||||
|
@ -239,7 +248,7 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
|
|||
compositeTypeSpec.getName().setBinding(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addDeclaration(IASTName decl) {
|
||||
if (!decl.isActive() || decl.getPropertyInParent() != IASTElaboratedTypeSpecifier.TYPE_NAME)
|
||||
return;
|
||||
|
@ -249,18 +258,19 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
|
|||
declarations = new IASTName[] { decl };
|
||||
return;
|
||||
}
|
||||
IASTName first= declarations[0];
|
||||
IASTName first = declarations[0];
|
||||
if (((ASTNode) first).getOffset() > ((ASTNode) decl).getOffset()) {
|
||||
declarations[0]= decl;
|
||||
decl= first;
|
||||
declarations[0] = decl;
|
||||
decl = first;
|
||||
}
|
||||
declarations= (IASTName[]) ArrayUtil.append(IASTName.class, declarations, decl);
|
||||
declarations = (IASTName[]) ArrayUtil.append(IASTName.class, declarations, decl);
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
|
||||
*/
|
||||
public boolean isSameType(IType type) {
|
||||
if (type == this)
|
||||
return true;
|
||||
|
@ -268,7 +278,7 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
|
|||
return type.isSameType(this);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public ILinkage getLinkage() {
|
||||
return Linkage.C_LINKAGE;
|
||||
}
|
||||
|
@ -280,31 +290,31 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
|
|||
public IASTNode getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
IASTNode node= definition;
|
||||
|
||||
public IBinding getOwner() {
|
||||
IASTNode node = definition;
|
||||
if (node == null) {
|
||||
if (declarations != null && declarations.length > 0) {
|
||||
node= declarations[0];
|
||||
if (declarations != null && declarations.length > 0) {
|
||||
node = declarations[0];
|
||||
}
|
||||
}
|
||||
IBinding result= CVisitor.findEnclosingFunction(node); // local or global
|
||||
IBinding result = CVisitor.findEnclosingFunction(node); // local or global
|
||||
if (result != null)
|
||||
return result;
|
||||
|
||||
|
||||
if (definition != null && isAnonymous()) {
|
||||
return CVisitor.findDeclarationOwner(definition, false);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isAnonymous() throws DOMException {
|
||||
if (getNameCharArray().length > 0 || definition == null)
|
||||
|
||||
public boolean isAnonymous() {
|
||||
if (getNameCharArray().length > 0 || definition == null)
|
||||
return false;
|
||||
|
||||
IASTCompositeTypeSpecifier spec= ((IASTCompositeTypeSpecifier)definition.getParent());
|
||||
|
||||
IASTCompositeTypeSpecifier spec = ((IASTCompositeTypeSpecifier) definition.getParent());
|
||||
if (spec != null) {
|
||||
IASTNode node= spec.getParent();
|
||||
IASTNode node = spec.getParent();
|
||||
if (node instanceof IASTSimpleDeclaration) {
|
||||
if (((IASTSimpleDeclaration) node).getDeclarators().length == 0) {
|
||||
return true;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -12,7 +12,6 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
|
@ -111,7 +110,7 @@ public class CTypedef extends PlatformObject implements ITypedef, ITypeContainer
|
|||
return name;
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
return CVisitor.findEnclosingFunction(name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
|
@ -40,39 +39,22 @@ import org.eclipse.core.runtime.PlatformObject;
|
|||
* Binding for a global or a local variable, serves as base class for fields.
|
||||
*/
|
||||
public class CVariable extends PlatformObject implements IInternalVariable, ICInternalBinding {
|
||||
public static class CVariableProblem extends ProblemBinding implements IVariable {
|
||||
public CVariableProblem(IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
}
|
||||
|
||||
public IType getType() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isStatic() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isExtern() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isAuto() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isRegister() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public IValue getInitialValue() {
|
||||
return null;
|
||||
public static class CVariableProblem extends ProblemBinding implements IVariable {
|
||||
public CVariableProblem(IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IASTName[] declarations = null;
|
||||
private IType type = null;
|
||||
|
||||
|
||||
public CVariable(IASTName name) {
|
||||
declarations = new IASTName[] { name };
|
||||
}
|
||||
public IASTNode getPhysicalNode() {
|
||||
return declarations[0];
|
||||
}
|
||||
|
||||
public IASTNode getPhysicalNode() {
|
||||
return declarations[0];
|
||||
}
|
||||
|
||||
public void addDeclaration(IASTName name) {
|
||||
if (name != null && name.isActive()) {
|
||||
|
@ -80,16 +62,20 @@ public class CVariable extends PlatformObject implements IInternalVariable, ICIn
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#getType()
|
||||
*/
|
||||
public IType getType() {
|
||||
if (type == null && declarations[0].getParent() instanceof IASTDeclarator)
|
||||
type = CVisitor.createType((IASTDeclarator)declarations[0].getParent());
|
||||
type = CVisitor.createType((IASTDeclarator) declarations[0].getParent());
|
||||
return type;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
|
@ -97,10 +83,12 @@ public class CVariable extends PlatformObject implements IInternalVariable, ICIn
|
|||
}
|
||||
|
||||
public char[] getNameCharArray() {
|
||||
return declarations[0].toCharArray();
|
||||
return declarations[0].toCharArray();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
|
||||
*/
|
||||
public IScope getScope() {
|
||||
|
@ -108,109 +96,116 @@ public class CVariable extends PlatformObject implements IInternalVariable, ICIn
|
|||
return CVisitor.getContainingScope(declarator.getParent());
|
||||
}
|
||||
|
||||
public boolean isStatic() {
|
||||
public boolean isStatic() {
|
||||
return hasStorageClass(IASTDeclSpecifier.sc_static);
|
||||
}
|
||||
|
||||
public boolean hasStorageClass(int storage) {
|
||||
if (declarations == null)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < declarations.length && declarations[i] != null; i++) {
|
||||
final IASTName name = declarations[i];
|
||||
public boolean hasStorageClass(int storage) {
|
||||
if (declarations == null)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < declarations.length && declarations[i] != null; i++) {
|
||||
final IASTName name = declarations[i];
|
||||
|
||||
IASTNode parent = name.getParent();
|
||||
while (!(parent instanceof IASTDeclaration))
|
||||
parent = parent.getParent();
|
||||
|
||||
if (parent instanceof IASTSimpleDeclaration) {
|
||||
IASTDeclSpecifier declSpec = ((IASTSimpleDeclaration) parent).getDeclSpecifier();
|
||||
if (declSpec.getStorageClass() == storage) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
while (!(parent instanceof IASTDeclaration))
|
||||
parent = parent.getParent();
|
||||
|
||||
if (parent instanceof IASTSimpleDeclaration) {
|
||||
IASTDeclSpecifier declSpec = ((IASTSimpleDeclaration) parent).getDeclSpecifier();
|
||||
if (declSpec.getStorageClass() == storage) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isExtern()
|
||||
*/
|
||||
public boolean isExtern() {
|
||||
return hasStorageClass(IASTDeclSpecifier.sc_extern);
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isExtern()
|
||||
*/
|
||||
public boolean isExtern() {
|
||||
return hasStorageClass(IASTDeclSpecifier.sc_extern);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto()
|
||||
*/
|
||||
public boolean isAuto() {
|
||||
return hasStorageClass(IASTDeclSpecifier.sc_auto);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isRegister()
|
||||
*/
|
||||
public boolean isRegister() {
|
||||
return hasStorageClass(IASTDeclSpecifier.sc_register);
|
||||
}
|
||||
|
||||
public ILinkage getLinkage() {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto()
|
||||
*/
|
||||
public boolean isAuto() {
|
||||
return hasStorageClass(IASTDeclSpecifier.sc_auto);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isRegister()
|
||||
*/
|
||||
public boolean isRegister() {
|
||||
return hasStorageClass(IASTDeclSpecifier.sc_register);
|
||||
}
|
||||
|
||||
public ILinkage getLinkage() {
|
||||
return Linkage.C_LINKAGE;
|
||||
}
|
||||
|
||||
public IASTNode[] getDeclarations() {
|
||||
public IASTNode[] getDeclarations() {
|
||||
return declarations;
|
||||
}
|
||||
|
||||
public IASTNode getDefinition() {
|
||||
public IASTNode getDefinition() {
|
||||
return getPhysicalNode();
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
if (declarations == null || declarations.length == 0)
|
||||
return null;
|
||||
|
||||
|
||||
return CVisitor.findDeclarationOwner(declarations[0], true);
|
||||
}
|
||||
|
||||
|
||||
public IValue getInitialValue() {
|
||||
return getInitialValue(Value.MAX_RECURSION_DEPTH);
|
||||
}
|
||||
|
||||
|
||||
public IValue getInitialValue(int maxDepth) {
|
||||
if (declarations != null) {
|
||||
for (IASTName decl : declarations) {
|
||||
if (decl == null)
|
||||
break;
|
||||
final IValue val= getInitialValue(decl, maxDepth);
|
||||
final IValue val = getInitialValue(decl, maxDepth);
|
||||
if (val != null)
|
||||
return val;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private IValue getInitialValue(IASTName name, int maxDepth) {
|
||||
IASTDeclarator dtor= findDeclarator(name);
|
||||
IASTDeclarator dtor = findDeclarator(name);
|
||||
if (dtor != null) {
|
||||
IASTInitializer init= dtor.getInitializer();
|
||||
IASTInitializer init = dtor.getInitializer();
|
||||
if (init instanceof IASTEqualsInitializer) {
|
||||
final IASTInitializerClause initClause = ((IASTEqualsInitializer) init).getInitializerClause();
|
||||
final IASTInitializerClause initClause = ((IASTEqualsInitializer) init)
|
||||
.getInitializerClause();
|
||||
if (initClause instanceof IASTExpression) {
|
||||
return Value.create((IASTExpression) initClause, maxDepth);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (init != null)
|
||||
return Value.UNKNOWN;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private IASTDeclarator findDeclarator(IASTName name) {
|
||||
IASTNode node = name.getParent();
|
||||
if (!(node instanceof IASTDeclarator))
|
||||
return null;
|
||||
|
||||
return ASTQueries.findOutermostDeclarator((IASTDeclarator) node);
|
||||
}
|
||||
private IASTDeclarator findDeclarator(IASTName name) {
|
||||
IASTNode node = name.getParent();
|
||||
if (!(node instanceof IASTDeclarator))
|
||||
return null;
|
||||
|
||||
return ASTQueries.findOutermostDeclarator((IASTDeclarator) node);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||
|
@ -69,7 +70,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.IVariable;
|
||||
import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier;
|
||||
|
@ -99,7 +99,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
|||
* Collection of methods to find information in an AST.
|
||||
*/
|
||||
public class CVisitor extends ASTQueries {
|
||||
public static class CollectProblemsAction extends CASTVisitor {
|
||||
public static class CollectProblemsAction extends ASTVisitor {
|
||||
{
|
||||
shouldVisitDeclarations = true;
|
||||
shouldVisitExpressions = true;
|
||||
|
@ -188,7 +188,7 @@ public class CVisitor extends ASTQueries {
|
|||
}
|
||||
}
|
||||
|
||||
public static class CollectDeclarationsAction extends CASTVisitor {
|
||||
public static class CollectDeclarationsAction extends ASTVisitor {
|
||||
{
|
||||
shouldVisitDeclarators = true;
|
||||
shouldVisitDeclSpecifiers = true;
|
||||
|
@ -341,7 +341,7 @@ public class CVisitor extends ASTQueries {
|
|||
}
|
||||
}
|
||||
|
||||
public static class CollectReferencesAction extends CASTVisitor {
|
||||
public static class CollectReferencesAction extends ASTVisitor {
|
||||
private static final int DEFAULT_LIST_SIZE = 8;
|
||||
private IASTName[] refs;
|
||||
private IBinding binding;
|
||||
|
@ -476,10 +476,7 @@ public class CVisitor extends ASTQueries {
|
|||
IScope scope = getContainingScope(enumeration);
|
||||
IBinding binding= null;
|
||||
if (scope != null) {
|
||||
try {
|
||||
binding = scope.getBinding(name, false);
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
binding = scope.getBinding(name, false);
|
||||
}
|
||||
if (binding != null && !(binding instanceof IIndexBinding) && name.isActive()) {
|
||||
if (binding instanceof IEnumeration) {
|
||||
|
@ -516,7 +513,7 @@ public class CVisitor extends ASTQueries {
|
|||
}
|
||||
}
|
||||
//label not found
|
||||
return new CLabel.CLabelProblem(((IASTGotoStatement)statement).getName(), IProblemBinding.SEMANTIC_LABEL_STATEMENT_NOT_FOUND, gotoName);
|
||||
return new ProblemBinding(((IASTGotoStatement)statement).getName(), IProblemBinding.SEMANTIC_LABEL_STATEMENT_NOT_FOUND, gotoName);
|
||||
}
|
||||
} else if (statement instanceof IASTLabelStatement) {
|
||||
IASTName name = ((IASTLabelStatement)statement).getName();
|
||||
|
@ -558,16 +555,13 @@ public class CVisitor extends ASTQueries {
|
|||
binding= resolveBinding(elabTypeSpec);
|
||||
if (binding == null) {
|
||||
insertIntoScope= elabTypeSpec.getTranslationUnit().getScope();
|
||||
try {
|
||||
binding= insertIntoScope.getBinding(name, false);
|
||||
if (binding != null && name.isActive()) {
|
||||
if (binding instanceof CEnumeration) {
|
||||
((CEnumeration)binding).addDeclaration(name);
|
||||
} else if (binding instanceof CStructure) {
|
||||
((CStructure) binding).addDeclaration(name);
|
||||
}
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
binding= insertIntoScope.getBinding(name, false);
|
||||
if (binding != null && name.isActive()) {
|
||||
if (binding instanceof CEnumeration) {
|
||||
((CEnumeration)binding).addDeclaration(name);
|
||||
} else if (binding instanceof CStructure) {
|
||||
((CStructure) binding).addDeclaration(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -612,41 +606,30 @@ public class CVisitor extends ASTQueries {
|
|||
}
|
||||
if (prefix) {
|
||||
IBinding[] result = null;
|
||||
try {
|
||||
char[] p = fieldReference.getFieldName().toCharArray();
|
||||
IField[] fields = ((ICompositeType) type).getFields();
|
||||
for (IField field : fields) {
|
||||
if (CharArrayUtils.equals(field.getNameCharArray(), 0, p.length, p, true)) {
|
||||
result = (IBinding[]) ArrayUtil.append(IBinding.class, result, field);
|
||||
}
|
||||
}
|
||||
return ArrayUtil.trim(IBinding.class, result);
|
||||
} catch (DOMException e) {
|
||||
return new IBinding[] { e.getProblem() };
|
||||
}
|
||||
char[] p = fieldReference.getFieldName().toCharArray();
|
||||
IField[] fields = ((ICompositeType) type).getFields();
|
||||
for (IField field : fields) {
|
||||
if (CharArrayUtils.equals(field.getNameCharArray(), 0, p.length, p, true)) {
|
||||
result = (IBinding[]) ArrayUtil.append(IBinding.class, result, field);
|
||||
}
|
||||
}
|
||||
return ArrayUtil.trim(IBinding.class, result);
|
||||
}
|
||||
try {
|
||||
return ((ICompositeType) type).findField(fieldReference.getFieldName().toString());
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
}
|
||||
return ((ICompositeType) type).findField(fieldReference.getFieldName().toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static IType getPtrDiffType(IASTBinaryExpression expr) {
|
||||
IScope scope = getContainingScope(expr);
|
||||
try {
|
||||
IBinding[] bs = scope.find(PTRDIFF_T);
|
||||
for (IBinding b : bs) {
|
||||
if (b instanceof IType) {
|
||||
if (b instanceof ICInternalBinding == false ||
|
||||
CVisitor.declaredBefore(((ICInternalBinding) b).getPhysicalNode(), expr)) {
|
||||
return (IType) b;
|
||||
}
|
||||
IBinding[] bs = scope.find(PTRDIFF_T);
|
||||
for (IBinding b : bs) {
|
||||
if (b instanceof IType) {
|
||||
if (b instanceof ICInternalBinding == false ||
|
||||
CVisitor.declaredBefore(((ICInternalBinding) b).getPhysicalNode(), expr)) {
|
||||
return (IType) b;
|
||||
}
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
|
||||
return new CBasicType(Kind.eInt, 0, expr);
|
||||
|
@ -654,17 +637,14 @@ public class CVisitor extends ASTQueries {
|
|||
|
||||
static IType getSize_T(IASTExpression expr) {
|
||||
IScope scope = getContainingScope(expr);
|
||||
try {
|
||||
IBinding[] bs = scope.find(SIZE_T);
|
||||
for (IBinding b : bs) {
|
||||
if (b instanceof IType) {
|
||||
if (b instanceof ICInternalBinding == false ||
|
||||
CVisitor.declaredBefore(((ICInternalBinding) b).getPhysicalNode(), expr)) {
|
||||
return (IType) b;
|
||||
}
|
||||
IBinding[] bs = scope.find(SIZE_T);
|
||||
for (IBinding b : bs) {
|
||||
if (b instanceof IType) {
|
||||
if (b instanceof ICInternalBinding == false ||
|
||||
CVisitor.declaredBefore(((ICInternalBinding) b).getPhysicalNode(), expr)) {
|
||||
return (IType) b;
|
||||
}
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
return new CBasicType(Kind.eInt, IBasicType.IS_LONG | IBasicType.IS_UNSIGNED);
|
||||
}
|
||||
|
@ -685,10 +665,7 @@ public class CVisitor extends ASTQueries {
|
|||
if (declarator instanceof ICASTKnRFunctionDeclarator) {
|
||||
if (CharArrayUtils.equals(declarator.getName().toCharArray(), name.toCharArray())) {
|
||||
IScope scope= CVisitor.getContainingScope(declarator);
|
||||
try {
|
||||
binding = scope.getBinding(name, false);
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
binding = scope.getBinding(name, false);
|
||||
if (binding != null && !(binding instanceof IIndexBinding) && name.isActive()) {
|
||||
if (binding instanceof ICInternalFunction)
|
||||
((ICInternalFunction)binding).addDeclarator(declarator);
|
||||
|
@ -725,11 +702,7 @@ public class CVisitor extends ASTQueries {
|
|||
|
||||
IASTName name = declarator.getName();
|
||||
|
||||
IBinding binding = null;
|
||||
try {
|
||||
binding = (scope != null) ? scope.getBinding(name, false) : null;
|
||||
} catch (DOMException e1) {
|
||||
}
|
||||
IBinding binding = (scope != null) ? scope.getBinding(name, false) : null;
|
||||
|
||||
boolean isFunction= false;
|
||||
if (parent instanceof IASTParameterDeclaration || parent.getPropertyInParent() == ICASTKnRFunctionDeclarator.FUNCTION_PARAMETER) {
|
||||
|
@ -830,51 +803,31 @@ public class CVisitor extends ASTQueries {
|
|||
IASTFunctionDeclarator functionDeclartor = functionDef.getDeclarator();
|
||||
IASTName name = findInnermostDeclarator(functionDeclartor).getName();
|
||||
IScope scope = getContainingScope(node);
|
||||
try {
|
||||
return lookup(scope, name);
|
||||
} catch (DOMException e) {
|
||||
return null;
|
||||
}
|
||||
return lookup(scope, name);
|
||||
} else if (node instanceof IASTIdExpression) {
|
||||
IScope scope = getContainingScope(node);
|
||||
try {
|
||||
IBinding binding = lookup(scope, ((IASTIdExpression) node).getName());
|
||||
if (binding instanceof IType && !(binding instanceof IProblemBinding) ) {
|
||||
return new ProblemBinding(node, IProblemBinding.SEMANTIC_INVALID_TYPE,
|
||||
binding.getNameCharArray(), new IBinding[] { binding });
|
||||
}
|
||||
return binding;
|
||||
} catch (DOMException e) {
|
||||
return null;
|
||||
}
|
||||
IBinding binding = lookup(scope, ((IASTIdExpression) node).getName());
|
||||
if (binding instanceof IType && !(binding instanceof IProblemBinding) ) {
|
||||
return new ProblemBinding(node, IProblemBinding.SEMANTIC_INVALID_TYPE,
|
||||
binding.getNameCharArray(), new IBinding[] { binding });
|
||||
}
|
||||
return binding;
|
||||
} else if (node instanceof ICASTTypedefNameSpecifier) {
|
||||
IScope scope = getContainingScope(node);
|
||||
try {
|
||||
IASTName name= ((ICASTTypedefNameSpecifier) node).getName();
|
||||
IBinding binding = lookup(scope, name);
|
||||
if (binding == null)
|
||||
return new ProblemBinding(node, IProblemBinding.SEMANTIC_NAME_NOT_FOUND, name.toCharArray());
|
||||
if (binding instanceof IType)
|
||||
return binding;
|
||||
return new ProblemBinding(node, IProblemBinding.SEMANTIC_INVALID_TYPE, binding.getNameCharArray(),
|
||||
new IBinding[] { binding });
|
||||
} catch (DOMException e) {
|
||||
return null;
|
||||
}
|
||||
IASTName name= ((ICASTTypedefNameSpecifier) node).getName();
|
||||
IBinding binding = lookup(scope, name);
|
||||
if (binding == null)
|
||||
return new ProblemBinding(node, IProblemBinding.SEMANTIC_NAME_NOT_FOUND, name.toCharArray());
|
||||
if (binding instanceof IType)
|
||||
return binding;
|
||||
return new ProblemBinding(node, IProblemBinding.SEMANTIC_INVALID_TYPE, binding.getNameCharArray(),
|
||||
new IBinding[] { binding });
|
||||
} else if (node instanceof ICASTElaboratedTypeSpecifier) {
|
||||
IScope scope = getContainingScope(node);
|
||||
try {
|
||||
return lookup(scope, ((ICASTElaboratedTypeSpecifier) node).getName());
|
||||
} catch (DOMException e) {
|
||||
return null;
|
||||
}
|
||||
return lookup(scope, ((ICASTElaboratedTypeSpecifier) node).getName());
|
||||
} else if (node instanceof ICASTCompositeTypeSpecifier) {
|
||||
IScope scope = getContainingScope(node);
|
||||
try {
|
||||
return lookup(scope, ((ICASTCompositeTypeSpecifier)node).getName());
|
||||
} catch (DOMException e) {
|
||||
return null;
|
||||
}
|
||||
return lookup(scope, ((ICASTCompositeTypeSpecifier)node).getName());
|
||||
} else if (node instanceof IASTTypeId) {
|
||||
IASTTypeId typeId = (IASTTypeId) node;
|
||||
IASTDeclSpecifier declSpec = typeId.getDeclSpecifier();
|
||||
|
@ -919,11 +872,7 @@ public class CVisitor extends ASTQueries {
|
|||
struct = ((IASTCompositeTypeSpecifier)simpleDecl.getDeclSpecifier()).getName().resolveBinding();
|
||||
|
||||
if (struct instanceof CStructure) {
|
||||
try {
|
||||
return ((CStructure)struct).findField(((ICASTFieldDesignator)node).getName().toString());
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
}
|
||||
return ((CStructure)struct).findField(((ICASTFieldDesignator)node).getName().toString());
|
||||
} else if (struct instanceof ITypeContainer) {
|
||||
IType type;
|
||||
type = ((ITypeContainer)struct).getType();
|
||||
|
@ -933,11 +882,7 @@ public class CVisitor extends ASTQueries {
|
|||
|
||||
|
||||
if (type instanceof CStructure)
|
||||
try {
|
||||
return ((CStructure)type).findField(((ICASTFieldDesignator)node).getName().toString());
|
||||
} catch (DOMException e1) {
|
||||
return e1.getProblem();
|
||||
}
|
||||
return ((CStructure)type).findField(((ICASTFieldDesignator)node).getName().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1069,7 +1014,7 @@ public class CVisitor extends ASTQueries {
|
|||
/**
|
||||
* Lookup for a name starting from the given scope.
|
||||
*/
|
||||
protected static IBinding lookup(IScope scope, IASTName name) throws DOMException{
|
||||
protected static IBinding lookup(IScope scope, IASTName name) {
|
||||
if (scope == null)
|
||||
return null;
|
||||
|
||||
|
@ -1086,15 +1031,16 @@ public class CVisitor extends ASTQueries {
|
|||
}
|
||||
|
||||
while (scope != null) {
|
||||
try {
|
||||
if (!(scope instanceof ICCompositeTypeScope)) {
|
||||
IBinding binding = scope.getBinding(name, true, fileSet);
|
||||
if (binding != null)
|
||||
return binding;
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
if (!(scope instanceof ICCompositeTypeScope)) {
|
||||
IBinding binding = scope.getBinding(name, true, fileSet);
|
||||
if (binding != null)
|
||||
return binding;
|
||||
}
|
||||
try {
|
||||
scope= scope.getParent();
|
||||
} catch (DOMException e) {
|
||||
scope= null;
|
||||
}
|
||||
scope= scope.getParent();
|
||||
}
|
||||
|
||||
return externalBinding(tu, name);
|
||||
|
@ -1123,23 +1069,20 @@ public class CVisitor extends ASTQueries {
|
|||
IBinding[] result = null;
|
||||
CharArraySet handled= new CharArraySet(1);
|
||||
while (scope != null) {
|
||||
try {
|
||||
if (!(scope instanceof ICCompositeTypeScope)) {
|
||||
IBinding[] bindings= scope.getBindings(name, true, true, fileSet);
|
||||
for (IBinding b : bindings) {
|
||||
final char[] n= b.getNameCharArray();
|
||||
// consider binding only if no binding with the same name was found in another scope.
|
||||
if (!handled.containsKey(n)) {
|
||||
result= (IBinding[]) ArrayUtil.append(IBinding.class, result, b);
|
||||
}
|
||||
}
|
||||
// store names of bindings
|
||||
for (IBinding b : bindings) {
|
||||
final char[] n= b.getNameCharArray();
|
||||
handled.put(n);
|
||||
if (!(scope instanceof ICCompositeTypeScope)) {
|
||||
IBinding[] bindings= scope.getBindings(name, true, true, fileSet);
|
||||
for (IBinding b : bindings) {
|
||||
final char[] n= b.getNameCharArray();
|
||||
// consider binding only if no binding with the same name was found in another scope.
|
||||
if (!handled.containsKey(n)) {
|
||||
result= (IBinding[]) ArrayUtil.append(IBinding.class, result, b);
|
||||
}
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
// store names of bindings
|
||||
for (IBinding b : bindings) {
|
||||
final char[] n= b.getNameCharArray();
|
||||
handled.put(n);
|
||||
}
|
||||
}
|
||||
scope= scope.getParent();
|
||||
}
|
||||
|
@ -1534,7 +1477,7 @@ public class CVisitor extends ASTQueries {
|
|||
return (IBinding[]) ArrayUtil.trim(IBinding.class, result);
|
||||
}
|
||||
|
||||
public static IBinding[] findBindings(IScope scope, String name) throws DOMException {
|
||||
public static IBinding[] findBindings(IScope scope, String name) {
|
||||
CASTName astName = new CASTName(name.toCharArray());
|
||||
|
||||
//normal names
|
||||
|
@ -1573,7 +1516,11 @@ public class CVisitor extends ASTQueries {
|
|||
}
|
||||
break;
|
||||
}
|
||||
scope = scope.getParent();
|
||||
try {
|
||||
scope = scope.getParent();
|
||||
} catch (DOMException e) {
|
||||
scope= null;
|
||||
}
|
||||
} while (scope != null);
|
||||
|
||||
int c = (b1 == null ? 0 : b1.length) + (b2 == null ? 0 : b2.length) + b3.size();
|
||||
|
|
|
@ -1,26 +1,21 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2008 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
* Andrew Niefer (IBM Rational Software) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* Created on Jan 24, 2005
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
* Methods needed by CVisitor but not meant for public interface
|
||||
*/
|
||||
public interface ICInternalBinding {
|
||||
//methods needed by CVisitor but not meant for public interface
|
||||
public IASTNode getPhysicalNode();
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,15 +54,15 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
|
|||
return specialClass.getSpecializedBinding();
|
||||
}
|
||||
|
||||
public final IBinding getBinding(IASTName name, boolean resolve) throws DOMException {
|
||||
public final IBinding getBinding(IASTName name, boolean resolve) {
|
||||
return getBinding(name, resolve, IIndexFileSet.EMPTY);
|
||||
}
|
||||
|
||||
public final IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix) throws DOMException {
|
||||
public final IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix) {
|
||||
return getBindings(name, resolve, prefix, IIndexFileSet.EMPTY);
|
||||
}
|
||||
|
||||
public IBinding getBinding(IASTName name, boolean forceResolve, IIndexFileSet fileSet) throws DOMException {
|
||||
public IBinding getBinding(IASTName name, boolean forceResolve, IIndexFileSet fileSet) {
|
||||
char[] c = name.getLookupKey();
|
||||
|
||||
if (CharArrayUtils.equals(c, specialClass.getNameCharArray())
|
||||
|
@ -86,12 +86,12 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
|
|||
}
|
||||
|
||||
final public IBinding[] getBindings(IASTName name, boolean forceResolve, boolean prefixLookup,
|
||||
IIndexFileSet fileSet) throws DOMException {
|
||||
IIndexFileSet fileSet) {
|
||||
return getBindings(name, forceResolve, prefixLookup, fileSet, true);
|
||||
}
|
||||
|
||||
public IBinding[] getBindings(IASTName name, boolean forceResolve, boolean prefixLookup,
|
||||
IIndexFileSet fileSet, boolean checkPointOfDecl) throws DOMException {
|
||||
IIndexFileSet fileSet, boolean checkPointOfDecl) {
|
||||
ICPPClassType specialized = specialClass.getSpecializedBinding();
|
||||
IScope classScope = specialized.getCompositeScope();
|
||||
if (classScope == null)
|
||||
|
@ -119,7 +119,7 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
|
|||
return specialClass;
|
||||
}
|
||||
|
||||
public ICPPBase[] getBases() throws DOMException {
|
||||
public ICPPBase[] getBases() {
|
||||
if (fBases == null) {
|
||||
ICPPBase[] result = null;
|
||||
ICPPBase[] bases = specialClass.getSpecializedBinding().getBases();
|
||||
|
@ -175,22 +175,18 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
|
|||
return newArray;
|
||||
}
|
||||
|
||||
public ICPPField[] getDeclaredFields() throws DOMException {
|
||||
public ICPPField[] getDeclaredFields() {
|
||||
ICPPField[] fields= specialClass.getSpecializedBinding().getDeclaredFields();
|
||||
return specializeMembers(fields);
|
||||
}
|
||||
|
||||
public ICPPMethod[] getImplicitMethods() {
|
||||
try {
|
||||
ICPPClassScope origClassScope= (ICPPClassScope) specialClass.getSpecializedBinding().getCompositeScope();
|
||||
if (origClassScope == null) {
|
||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||
}
|
||||
ICPPMethod[] methods= origClassScope.getImplicitMethods();
|
||||
return specializeMembers(methods);
|
||||
} catch (DOMException e) {
|
||||
ICPPClassScope origClassScope= (ICPPClassScope) specialClass.getSpecializedBinding().getCompositeScope();
|
||||
if (origClassScope == null) {
|
||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||
}
|
||||
ICPPMethod[] methods= origClassScope.getImplicitMethods();
|
||||
return specializeMembers(methods);
|
||||
}
|
||||
|
||||
public IName getScopeName() {
|
||||
|
@ -199,22 +195,22 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
|
|||
return null;
|
||||
}
|
||||
|
||||
public ICPPConstructor[] getConstructors() throws DOMException {
|
||||
public ICPPConstructor[] getConstructors() {
|
||||
ICPPConstructor[] ctors= specialClass.getSpecializedBinding().getConstructors();
|
||||
return specializeMembers(ctors);
|
||||
}
|
||||
|
||||
public ICPPMethod[] getDeclaredMethods() throws DOMException {
|
||||
public ICPPMethod[] getDeclaredMethods() {
|
||||
ICPPMethod[] bindings = specialClass.getSpecializedBinding().getDeclaredMethods();
|
||||
return specializeMembers(bindings);
|
||||
}
|
||||
|
||||
public ICPPClassType[] getNestedClasses() throws DOMException {
|
||||
public ICPPClassType[] getNestedClasses() {
|
||||
ICPPClassType[] bindings = specialClass.getSpecializedBinding().getNestedClasses();
|
||||
return specializeMembers(bindings);
|
||||
}
|
||||
|
||||
public IBinding[] getFriends() throws DOMException {
|
||||
public IBinding[] getFriends() {
|
||||
// not yet supported
|
||||
return IBinding.EMPTY_BINDING_ARRAY;
|
||||
}
|
||||
|
@ -230,7 +226,7 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
|
|||
return getOriginalClassType().getScope();
|
||||
}
|
||||
|
||||
public IBinding[] find(String name) throws DOMException {
|
||||
public IBinding[] find(String name) {
|
||||
return CPPSemantics.findBindings(this, name, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
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.ICPPASTCompletionContext;
|
||||
|
@ -129,13 +128,10 @@ public class CPPASTBaseSpecifier extends ASTNode implements ICPPASTBaseSpecifier
|
|||
for (IBinding binding : bindings) {
|
||||
if (binding instanceof ICPPClassType) {
|
||||
ICPPClassType base = (ICPPClassType) binding;
|
||||
try {
|
||||
int key = base.getKey();
|
||||
if (key == ICPPClassType.k_class &&
|
||||
(classType == null || !base.isSameType(classType))) {
|
||||
filtered.add(base);
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
int key = base.getKey();
|
||||
if (key == ICPPClassType.k_class &&
|
||||
(classType == null || !base.isSameType(classType))) {
|
||||
filtered.add(base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompletionContext;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
|
@ -106,27 +104,22 @@ public class CPPASTName extends CPPASTNameBase implements ICPPASTCompletionConte
|
|||
if (bindings[i] instanceof ICPPNamespace) {
|
||||
} else if (bindings[i] instanceof ICPPClassType) {
|
||||
ICPPClassType type = (ICPPClassType) bindings[i];
|
||||
try {
|
||||
switch (type.getKey()) {
|
||||
case ICompositeType.k_struct:
|
||||
if (kind != ICompositeType.k_struct) {
|
||||
bindings[i] = null;
|
||||
}
|
||||
break;
|
||||
case ICompositeType.k_union:
|
||||
if (kind != ICompositeType.k_union) {
|
||||
bindings[i] = null;
|
||||
}
|
||||
break;
|
||||
case ICPPClassType.k_class:
|
||||
if (kind != ICPPASTElaboratedTypeSpecifier.k_class) {
|
||||
bindings[i] = null;
|
||||
}
|
||||
break;
|
||||
switch (type.getKey()) {
|
||||
case ICompositeType.k_struct:
|
||||
if (kind != ICompositeType.k_struct) {
|
||||
bindings[i] = null;
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
bindings[i] = null;
|
||||
CCorePlugin.log(e);
|
||||
break;
|
||||
case ICompositeType.k_union:
|
||||
if (kind != ICompositeType.k_union) {
|
||||
bindings[i] = null;
|
||||
}
|
||||
break;
|
||||
case ICPPClassType.k_class:
|
||||
if (kind != ICPPASTElaboratedTypeSpecifier.k_class) {
|
||||
bindings[i] = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
bindings[i]= null;
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
|
@ -101,11 +100,7 @@ public class CPPASTNamespaceDefinition extends ASTNode implements
|
|||
}
|
||||
|
||||
public IScope getScope() {
|
||||
try {
|
||||
return ((ICPPNamespace) fName.resolveBinding()).getNamespaceScope();
|
||||
} catch ( DOMException e ) {
|
||||
return e.getProblem();
|
||||
}
|
||||
return ((ICPPNamespace) fName.resolveBinding()).getNamespaceScope();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -257,14 +257,11 @@ public class CPPASTQualifiedName extends CPPASTNameBase
|
|||
List<IBinding> filtered = filterClassScopeBindings(classType, bindings, isDeclaration);
|
||||
if (isDeclaration && nameMatches(classType.getNameCharArray(),
|
||||
n.getLookupKey(), isPrefix)) {
|
||||
try {
|
||||
ICPPConstructor[] constructors = classType.getConstructors();
|
||||
for (int i = 0; i < constructors.length; i++) {
|
||||
if (!constructors[i].isImplicit()) {
|
||||
filtered.add(constructors[i]);
|
||||
}
|
||||
ICPPConstructor[] constructors = classType.getConstructors();
|
||||
for (int i = 0; i < constructors.length; i++) {
|
||||
if (!constructors[i].isImplicit()) {
|
||||
filtered.add(constructors[i]);
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
}
|
||||
return filtered.toArray(new IBinding[filtered.size()]);
|
||||
|
@ -302,32 +299,29 @@ public class CPPASTQualifiedName extends CPPASTNameBase
|
|||
List<IBinding> filtered = new ArrayList<IBinding>();
|
||||
final boolean canBeFieldAccess= canBeFieldAccess(classType);
|
||||
|
||||
try {
|
||||
for (final IBinding binding : bindings) {
|
||||
if (binding instanceof IField) {
|
||||
IField field = (IField) binding;
|
||||
if (!canBeFieldAccess && !field.isStatic())
|
||||
for (final IBinding binding : bindings) {
|
||||
if (binding instanceof IField) {
|
||||
IField field = (IField) binding;
|
||||
if (!canBeFieldAccess && !field.isStatic())
|
||||
continue;
|
||||
} else if (binding instanceof ICPPMethod) {
|
||||
ICPPMethod method = (ICPPMethod) binding;
|
||||
if (method.isImplicit())
|
||||
continue;
|
||||
if (!isDeclaration) {
|
||||
if (method.isDestructor() || method instanceof ICPPConstructor
|
||||
|| (!canBeFieldAccess && !method.isStatic()))
|
||||
continue;
|
||||
} else if (binding instanceof ICPPMethod) {
|
||||
ICPPMethod method = (ICPPMethod) binding;
|
||||
if (method.isImplicit())
|
||||
continue;
|
||||
if (!isDeclaration) {
|
||||
if (method.isDestructor() || method instanceof ICPPConstructor
|
||||
|| (!canBeFieldAccess && !method.isStatic()))
|
||||
continue;
|
||||
}
|
||||
} else if (binding instanceof IEnumerator || binding instanceof IEnumeration) {
|
||||
if (isDeclaration)
|
||||
continue;
|
||||
} else if (binding instanceof IType) {
|
||||
IType type = (IType) binding;
|
||||
if (type.isSameType(classType))
|
||||
continue;
|
||||
}
|
||||
filtered.add(binding);
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
} else if (binding instanceof IEnumerator || binding instanceof IEnumeration) {
|
||||
if (isDeclaration)
|
||||
continue;
|
||||
} else if (binding instanceof IType) {
|
||||
IType type = (IType) binding;
|
||||
if (type.isSameType(classType))
|
||||
continue;
|
||||
}
|
||||
filtered.add(binding);
|
||||
}
|
||||
|
||||
return filtered;
|
||||
|
|
|
@ -6,64 +6,23 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Andrew Niefer (IBM Corporation) - initial API and implementation
|
||||
* Bryan Wilkinson (QNX)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
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.IProblemBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||
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.ICPPTemplateParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*/
|
||||
public class CPPBaseClause implements ICPPBase, ICPPInternalBase {
|
||||
static public class CPPBaseProblem extends ProblemBinding implements ICPPBase, ICPPInternalBase {
|
||||
private ICPPClassType classProblem;
|
||||
|
||||
public CPPBaseProblem(IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
}
|
||||
|
||||
public IBinding getBaseClass() {
|
||||
if (classProblem == null) {
|
||||
classProblem = new CPPClassType.CPPClassTypeProblem(node, id, arg);
|
||||
}
|
||||
return classProblem;
|
||||
}
|
||||
|
||||
public int getVisibility() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
|
||||
public boolean isVirtual() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
|
||||
public IName getBaseClassSpecifierName() {
|
||||
return (IName) node;
|
||||
}
|
||||
|
||||
public void setBaseClass(IBinding binding) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPBase clone() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private ICPPASTBaseSpecifier base;
|
||||
private IBinding baseClass;
|
||||
|
||||
|
@ -74,7 +33,7 @@ public class CPPBaseClause implements ICPPBase, ICPPInternalBase {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBase#getBaseClass()
|
||||
*/
|
||||
public IBinding getBaseClass() throws DOMException {
|
||||
public IBinding getBaseClass() {
|
||||
if (baseClass == null) {
|
||||
IBinding b = base.getName().resolveBinding();
|
||||
while (b instanceof ITypedef && ((ITypedef) b).getType() instanceof IBinding) {
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2008 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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)
|
||||
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* Created on Nov 29, 2004
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
|
@ -22,11 +18,8 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*/
|
||||
public class CPPBlockScope extends CPPNamespaceScope implements ICPPBlockScope {
|
||||
public CPPBlockScope( IASTNode physicalNode ){
|
||||
super( physicalNode );
|
||||
|
@ -44,7 +37,7 @@ public class CPPBlockScope extends CPPNamespaceScope implements ICPPBlockScope {
|
|||
final IASTNode parent= node.getParent();
|
||||
if (parent instanceof IASTFunctionDefinition) {
|
||||
IASTDeclarator dtor= ((IASTFunctionDefinition)parent).getDeclarator();
|
||||
dtor = CPPVisitor.findInnermostDeclarator(dtor);
|
||||
dtor = ASTQueries.findInnermostDeclarator(dtor);
|
||||
return dtor.getName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2009 Wind River Systems Inc. and others.
|
||||
* Copyright (c) 2008, 2010 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
|
||||
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
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;
|
||||
|
@ -112,7 +111,7 @@ public class CPPBuiltinVariable extends CPPVariable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
|
@ -47,11 +46,7 @@ public class CPPClassInstance extends CPPClassSpecialization implements ICPPTemp
|
|||
}
|
||||
|
||||
public boolean isExplicitSpecialization() {
|
||||
try {
|
||||
return !(getCompositeScope() instanceof ICPPClassSpecializationScope);
|
||||
} catch (DOMException e) {
|
||||
return false;
|
||||
}
|
||||
return !(getCompositeScope() instanceof ICPPClassSpecializationScope);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
|
|
@ -31,11 +31,11 @@ import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier;
|
||||
|
@ -161,7 +161,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addName(IASTName name) throws DOMException {
|
||||
public void addName(IASTName name) {
|
||||
// don't add names from inactive code branches
|
||||
if (!name.isActive())
|
||||
return;
|
||||
|
@ -213,7 +213,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
|||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getBinding(int, char[])
|
||||
*/
|
||||
@Override
|
||||
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) throws DOMException {
|
||||
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) {
|
||||
char[] c = name.getLookupKey();
|
||||
|
||||
ICPPASTCompositeTypeSpecifier compType = (ICPPASTCompositeTypeSpecifier) getPhysicalNode();
|
||||
|
@ -230,7 +230,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
|||
|
||||
@Override
|
||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet,
|
||||
boolean checkPointOfDecl) throws DOMException {
|
||||
boolean checkPointOfDecl) {
|
||||
char[] c = name.getLookupKey();
|
||||
|
||||
ICPPASTCompositeTypeSpecifier compType = (ICPPASTCompositeTypeSpecifier) getPhysicalNode();
|
||||
|
@ -314,7 +314,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
|||
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public IBinding[] find(String name) throws DOMException {
|
||||
public IBinding[] find(String name) {
|
||||
char[] n = name.toCharArray();
|
||||
ICPPASTCompositeTypeSpecifier compType = (ICPPASTCompositeTypeSpecifier) getPhysicalNode();
|
||||
IASTName compName = compType.getName().getLastName();
|
||||
|
@ -374,7 +374,8 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
|||
*/
|
||||
public ICPPMethod[] getImplicitMethods() {
|
||||
if (implicits == null)
|
||||
implicits = new ICPPMethod[] { new CPPMethod.CPPMethodProblem(null, IProblemBinding.SEMANTIC_INVALID_TYPE, CharArrayUtils.EMPTY) };
|
||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||
|
||||
return implicits;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -12,7 +12,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
|
@ -25,7 +25,6 @@ import org.eclipse.cdt.core.dom.ast.IField;
|
|||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
||||
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.ICPPASTTemplateDeclaration;
|
||||
|
@ -84,7 +83,7 @@ public class CPPClassSpecialization extends CPPSpecialization
|
|||
}
|
||||
}
|
||||
|
||||
private class FindDefinitionAction extends CPPASTVisitor {
|
||||
private class FindDefinitionAction extends ASTVisitor {
|
||||
private char [] nameArray = CPPClassSpecialization.this.getNameCharArray();
|
||||
public IASTName result = null;
|
||||
|
||||
|
@ -177,7 +176,7 @@ public class CPPClassSpecialization extends CPPSpecialization
|
|||
return null;
|
||||
}
|
||||
|
||||
public ICPPBase[] getBases() throws DOMException {
|
||||
public ICPPBase[] getBases() {
|
||||
ICPPClassSpecializationScope scope= getSpecializationScope();
|
||||
if (scope == null)
|
||||
return ClassTypeHelper.getBases(this);
|
||||
|
@ -185,7 +184,7 @@ public class CPPClassSpecialization extends CPPSpecialization
|
|||
return scope.getBases();
|
||||
}
|
||||
|
||||
public ICPPField[] getDeclaredFields() throws DOMException {
|
||||
public ICPPField[] getDeclaredFields() {
|
||||
ICPPClassSpecializationScope scope= getSpecializationScope();
|
||||
if (scope == null)
|
||||
return ClassTypeHelper.getDeclaredFields(this);
|
||||
|
@ -193,7 +192,7 @@ public class CPPClassSpecialization extends CPPSpecialization
|
|||
return scope.getDeclaredFields();
|
||||
}
|
||||
|
||||
public ICPPMethod[] getDeclaredMethods() throws DOMException {
|
||||
public ICPPMethod[] getDeclaredMethods() {
|
||||
ICPPClassSpecializationScope scope= getSpecializationScope();
|
||||
if (scope == null)
|
||||
return ClassTypeHelper.getDeclaredMethods(this);
|
||||
|
@ -201,7 +200,7 @@ public class CPPClassSpecialization extends CPPSpecialization
|
|||
return scope.getDeclaredMethods();
|
||||
}
|
||||
|
||||
public ICPPConstructor[] getConstructors() throws DOMException {
|
||||
public ICPPConstructor[] getConstructors() {
|
||||
ICPPClassSpecializationScope scope= getSpecializationScope();
|
||||
if (scope == null)
|
||||
return ClassTypeHelper.getConstructors(this);
|
||||
|
@ -209,7 +208,7 @@ public class CPPClassSpecialization extends CPPSpecialization
|
|||
return scope.getConstructors();
|
||||
}
|
||||
|
||||
public IBinding[] getFriends() throws DOMException {
|
||||
public IBinding[] getFriends() {
|
||||
ICPPClassSpecializationScope scope= getSpecializationScope();
|
||||
if (scope == null)
|
||||
return ClassTypeHelper.getFriends(this);
|
||||
|
@ -217,7 +216,7 @@ public class CPPClassSpecialization extends CPPSpecialization
|
|||
return scope.getFriends();
|
||||
}
|
||||
|
||||
public ICPPClassType[] getNestedClasses() throws DOMException {
|
||||
public ICPPClassType[] getNestedClasses() {
|
||||
ICPPClassSpecializationScope scope= getSpecializationScope();
|
||||
if (scope == null)
|
||||
return ClassTypeHelper.getNestedClasses(this);
|
||||
|
@ -226,19 +225,19 @@ public class CPPClassSpecialization extends CPPSpecialization
|
|||
}
|
||||
|
||||
|
||||
public IField[] getFields() throws DOMException {
|
||||
public IField[] getFields() {
|
||||
return ClassTypeHelper.getFields(this);
|
||||
}
|
||||
|
||||
public IField findField(String name) throws DOMException {
|
||||
public IField findField(String name) {
|
||||
return ClassTypeHelper.findField(this, name);
|
||||
}
|
||||
|
||||
public ICPPMethod[] getMethods() throws DOMException {
|
||||
public ICPPMethod[] getMethods() {
|
||||
return ClassTypeHelper.getMethods(this);
|
||||
}
|
||||
|
||||
public ICPPMethod[] getAllDeclaredMethods() throws DOMException {
|
||||
public ICPPMethod[] getAllDeclaredMethods() {
|
||||
return ClassTypeHelper.getAllDeclaredMethods(this);
|
||||
}
|
||||
|
||||
|
@ -246,7 +245,7 @@ public class CPPClassSpecialization extends CPPSpecialization
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getKey()
|
||||
*/
|
||||
public int getKey() throws DOMException {
|
||||
public int getKey() {
|
||||
if (getDefinition() != null)
|
||||
return getCompositeTypeSpecifier().getKey();
|
||||
|
||||
|
@ -256,7 +255,7 @@ public class CPPClassSpecialization extends CPPSpecialization
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getCompositeScope()
|
||||
*/
|
||||
public ICPPClassScope getCompositeScope() throws DOMException {
|
||||
public ICPPClassScope getCompositeScope() {
|
||||
final ICPPClassScope specScope= getSpecializationScope();
|
||||
if (specScope != null)
|
||||
return specScope;
|
||||
|
@ -297,7 +296,7 @@ public class CPPClassSpecialization extends CPPSpecialization
|
|||
return this;
|
||||
}
|
||||
|
||||
public boolean isAnonymous() throws DOMException {
|
||||
public boolean isAnonymous() {
|
||||
if (getNameCharArray().length > 0)
|
||||
return false;
|
||||
|
||||
|
@ -322,26 +321,22 @@ public class CPPClassSpecialization extends CPPSpecialization
|
|||
t2 instanceof IProblemBinding)
|
||||
return false;
|
||||
|
||||
try {
|
||||
if (t1.getKey() != t2.getKey())
|
||||
return false;
|
||||
|
||||
if (!CharArrayUtils.equals(t1.getNameCharArray(), t2.getNameCharArray()))
|
||||
return false;
|
||||
|
||||
// the argument map is not significant for comparing specializations, the map is
|
||||
// determined by the owner of the specialization. This is different for instances,
|
||||
// which have a separate implementation for isSameType().
|
||||
final IBinding owner1= t1.getOwner();
|
||||
final IBinding owner2= t2.getOwner();
|
||||
|
||||
// for a specialization that is not an instance the owner has to be a class-type
|
||||
if (owner1 instanceof ICPPClassType == false || owner2 instanceof ICPPClassType == false)
|
||||
return false;
|
||||
|
||||
return ((ICPPClassType) owner1).isSameType((ICPPClassType) owner2);
|
||||
} catch (DOMException e) {
|
||||
if (t1.getKey() != t2.getKey())
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CharArrayUtils.equals(t1.getNameCharArray(), t2.getNameCharArray()))
|
||||
return false;
|
||||
|
||||
// the argument map is not significant for comparing specializations, the map is
|
||||
// determined by the owner of the specialization. This is different for instances,
|
||||
// which have a separate implementation for isSameType().
|
||||
final IBinding owner1= t1.getOwner();
|
||||
final IBinding owner2= t2.getOwner();
|
||||
|
||||
// for a specialization that is not an instance the owner has to be a class-type
|
||||
if (owner1 instanceof ICPPClassType == false || owner2 instanceof ICPPClassType == false)
|
||||
return false;
|
||||
|
||||
return ((ICPPClassType) owner1).isSameType((ICPPClassType) owner2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -14,6 +14,7 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
|
@ -27,7 +28,6 @@ import org.eclipse.cdt.core.dom.ast.IField;
|
|||
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.CPPASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||
|
@ -60,7 +60,7 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
|
|||
private boolean checkedIndex= false;
|
||||
private boolean checkedDefinition= false;
|
||||
|
||||
private class FindDefinitionAction extends CPPASTVisitor {
|
||||
private class FindDefinitionAction extends ASTVisitor {
|
||||
private char[] nameArray = CPPClassTemplate.this.getNameCharArray();
|
||||
public IASTName result = null;
|
||||
|
||||
|
@ -170,13 +170,9 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
|
|||
// Forward declarations must be backed up from the index.
|
||||
checkForIndexBinding();
|
||||
if (fIndexBinding != null) {
|
||||
try {
|
||||
IScope scope = fIndexBinding.getCompositeScope();
|
||||
if (scope instanceof ICPPClassScope)
|
||||
return (ICPPClassScope) scope;
|
||||
} catch (DOMException e) {
|
||||
// index bindings don't throw DOMExeptions.
|
||||
}
|
||||
IScope scope = fIndexBinding.getCompositeScope();
|
||||
if (scope instanceof ICPPClassScope)
|
||||
return (ICPPClassScope) scope;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -220,27 +216,27 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
|
|||
return ClassTypeHelper.getBases(this);
|
||||
}
|
||||
|
||||
public IField[] getFields() throws DOMException {
|
||||
public IField[] getFields() {
|
||||
return ClassTypeHelper.getFields(this);
|
||||
}
|
||||
|
||||
public ICPPField[] getDeclaredFields() throws DOMException {
|
||||
public ICPPField[] getDeclaredFields() {
|
||||
return ClassTypeHelper.getDeclaredFields(this);
|
||||
}
|
||||
|
||||
public ICPPMethod[] getMethods() throws DOMException {
|
||||
public ICPPMethod[] getMethods() {
|
||||
return ClassTypeHelper.getMethods(this);
|
||||
}
|
||||
|
||||
public ICPPMethod[] getAllDeclaredMethods() throws DOMException {
|
||||
public ICPPMethod[] getAllDeclaredMethods() {
|
||||
return ClassTypeHelper.getAllDeclaredMethods(this);
|
||||
}
|
||||
|
||||
public ICPPMethod[] getDeclaredMethods() throws DOMException {
|
||||
public ICPPMethod[] getDeclaredMethods() {
|
||||
return ClassTypeHelper.getDeclaredMethods(this);
|
||||
}
|
||||
|
||||
public ICPPConstructor[] getConstructors() throws DOMException {
|
||||
public ICPPConstructor[] getConstructors() {
|
||||
return ClassTypeHelper.getConstructors(this);
|
||||
}
|
||||
|
||||
|
@ -252,7 +248,7 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
|
|||
return ClassTypeHelper.getNestedClasses(this);
|
||||
}
|
||||
|
||||
public IField findField(String name) throws DOMException {
|
||||
public IField findField(String name) {
|
||||
return ClassTypeHelper.findField(this, name);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -15,6 +15,7 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
|
@ -29,7 +30,6 @@ import org.eclipse.cdt.core.dom.ast.IField;
|
|||
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.CPPASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||
|
@ -65,60 +65,48 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
|
|||
public CPPClassTypeProblem(IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
}
|
||||
public ICPPBase[] getBases() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public ICPPBase[] getBases() {
|
||||
return ICPPBase.EMPTY_BASE_ARRAY;
|
||||
}
|
||||
public IField[] getFields() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public IField[] getFields() {
|
||||
return IField.EMPTY_FIELD_ARRAY;
|
||||
}
|
||||
public ICPPField[] getDeclaredFields() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public ICPPField[] getDeclaredFields() {
|
||||
return ICPPField.EMPTY_CPPFIELD_ARRAY;
|
||||
}
|
||||
public ICPPMethod[] getMethods() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public ICPPMethod[] getMethods() {
|
||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||
}
|
||||
public ICPPMethod[] getAllDeclaredMethods() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public ICPPMethod[] getAllDeclaredMethods() {
|
||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||
}
|
||||
public ICPPMethod[] getDeclaredMethods() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public ICPPMethod[] getDeclaredMethods() {
|
||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||
}
|
||||
public ICPPConstructor[] getConstructors() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public ICPPConstructor[] getConstructors() {
|
||||
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
|
||||
}
|
||||
public ICPPMethod[] getDeclaredConversionOperators() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public int getKey() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public int getKey() {
|
||||
return k_class;
|
||||
}
|
||||
public IField findField(String name) throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public IField findField(String name) {
|
||||
return null;
|
||||
}
|
||||
public IScope getCompositeScope() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public IScope getCompositeScope() {
|
||||
return this;
|
||||
}
|
||||
public IBinding[] getFriends() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public IBinding[] getFriends() {
|
||||
return IBinding.EMPTY_BINDING_ARRAY;
|
||||
}
|
||||
public String[] getQualifiedName() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isGloballyQualified() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public ICPPClassType[] getNestedClasses() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isAnonymous() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public ICPPClassType[] getNestedClasses() {
|
||||
return ICPPClassType.EMPTY_CLASS_ARRAY;
|
||||
}
|
||||
}
|
||||
|
||||
private class FindDefinitionAction extends CPPASTVisitor {
|
||||
private class FindDefinitionAction extends ASTVisitor {
|
||||
private char[] nameArray = CPPClassType.this.getNameCharArray();
|
||||
public IASTName result = null;
|
||||
|
||||
|
@ -287,13 +275,9 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
|
|||
}
|
||||
// fwd-declarations must be backed up from the index
|
||||
if (typeInIndex != null) {
|
||||
try {
|
||||
IScope scope = typeInIndex.getCompositeScope();
|
||||
if (scope instanceof ICPPClassScope)
|
||||
return (ICPPClassScope) scope;
|
||||
} catch (DOMException e) {
|
||||
// index bindings don't throw DOMExeptions.
|
||||
}
|
||||
IScope scope = typeInIndex.getCompositeScope();
|
||||
if (scope instanceof ICPPClassScope)
|
||||
return (ICPPClassScope) scope;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -367,27 +351,27 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
|
|||
return ClassTypeHelper.getBases(this);
|
||||
}
|
||||
|
||||
public IField[] getFields() throws DOMException {
|
||||
public IField[] getFields() {
|
||||
return ClassTypeHelper.getFields(this);
|
||||
}
|
||||
|
||||
public ICPPField[] getDeclaredFields() throws DOMException {
|
||||
public ICPPField[] getDeclaredFields() {
|
||||
return ClassTypeHelper.getDeclaredFields(this);
|
||||
}
|
||||
|
||||
public ICPPMethod[] getMethods() throws DOMException {
|
||||
public ICPPMethod[] getMethods() {
|
||||
return ClassTypeHelper.getMethods(this);
|
||||
}
|
||||
|
||||
public ICPPMethod[] getAllDeclaredMethods() throws DOMException {
|
||||
public ICPPMethod[] getAllDeclaredMethods() {
|
||||
return ClassTypeHelper.getAllDeclaredMethods(this);
|
||||
}
|
||||
|
||||
public ICPPMethod[] getDeclaredMethods() throws DOMException {
|
||||
public ICPPMethod[] getDeclaredMethods() {
|
||||
return ClassTypeHelper.getDeclaredMethods(this);
|
||||
}
|
||||
|
||||
public ICPPConstructor[] getConstructors() throws DOMException {
|
||||
public ICPPConstructor[] getConstructors() {
|
||||
return ClassTypeHelper.getConstructors(this);
|
||||
}
|
||||
|
||||
|
@ -399,7 +383,7 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
|
|||
return ClassTypeHelper.getNestedClasses(this);
|
||||
}
|
||||
|
||||
public IField findField(String name) throws DOMException {
|
||||
public IField findField(String name) {
|
||||
return ClassTypeHelper.findField(this, name);
|
||||
}
|
||||
|
||||
|
@ -420,14 +404,14 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
|
|||
return getName();
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
if (definition != null) {
|
||||
return CPPVisitor.findNameOwner(definition, true);
|
||||
}
|
||||
return CPPVisitor.findDeclarationOwner(declarations[0], true);
|
||||
}
|
||||
|
||||
public boolean isAnonymous() throws DOMException {
|
||||
public boolean isAnonymous() {
|
||||
if (getNameCharArray().length > 0)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2008 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
* Andrew Niefer (IBM Corporation) - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* Created on Dec 16, 2004
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
|
@ -23,9 +20,6 @@ import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
|||
import org.eclipse.cdt.internal.core.dom.Linkage;
|
||||
import org.eclipse.core.runtime.PlatformObject;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*/
|
||||
public class CPPCompositeBinding extends PlatformObject implements IBinding {
|
||||
|
||||
IBinding [] bindings = null;
|
||||
|
@ -55,7 +49,7 @@ public class CPPCompositeBinding extends PlatformObject implements IBinding {
|
|||
return bindings[0].getScope();
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
return bindings[0].getOwner();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,38 +1,32 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
* Andrew Niefer (IBM Corporation) - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* Created on Dec 21, 2004
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
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.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*/
|
||||
public class CPPConstructor extends CPPMethod implements ICPPConstructor {
|
||||
|
||||
static public class CPPConstructorProblem extends CPPMethod.CPPMethodProblem implements ICPPConstructor {
|
||||
public CPPConstructorProblem(IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
public CPPConstructorProblem(ICPPClassType owner, IASTNode node, int id, char[] arg) {
|
||||
super(owner, node, id, arg);
|
||||
}
|
||||
|
||||
public boolean isExplicit() throws DOMException{
|
||||
throw new DOMException( this );
|
||||
public boolean isExplicit() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +40,7 @@ public class CPPConstructor extends CPPMethod implements ICPPConstructor {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor#isExplicit()
|
||||
*/
|
||||
public boolean isExplicit() throws DOMException {
|
||||
public boolean isExplicit() {
|
||||
IASTDeclaration decl= getPrimaryDeclaration();
|
||||
if (decl != null) {
|
||||
ICPPASTDeclSpecifier declspec= getDeclSpec(decl);
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.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.ICPPConstructor;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||
|
@ -26,7 +25,7 @@ public class CPPConstructorInstance extends CPPMethodInstance implements ICPPCon
|
|||
super(orig, owner, tpmap, args);
|
||||
}
|
||||
|
||||
public boolean isExplicit() throws DOMException {
|
||||
public boolean isExplicit() {
|
||||
return ((ICPPConstructor) getTemplateDefinition()).isExplicit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.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.ICPPConstructor;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||
|
@ -30,7 +29,7 @@ public class CPPConstructorSpecialization extends CPPMethodSpecialization
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor#isExplicit()
|
||||
*/
|
||||
public boolean isExplicit() throws DOMException {
|
||||
public boolean isExplicit() {
|
||||
return ((ICPPConstructor)getSpecializedBinding()).isExplicit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,39 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* Created on Mar 31, 2005
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*/
|
||||
public class CPPConstructorTemplate extends CPPMethodTemplate implements
|
||||
ICPPConstructor {
|
||||
public class CPPConstructorTemplate extends CPPMethodTemplate implements ICPPConstructor {
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public CPPConstructorTemplate(IASTName name) {
|
||||
super(name);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor#isExplicit()
|
||||
*/
|
||||
public boolean isExplicit() {
|
||||
// mstodo fix that
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.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.ICPPConstructor;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||
|
@ -30,7 +29,7 @@ public class CPPConstructorTemplateSpecialization extends CPPMethodTemplateSpeci
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor#isExplicit()
|
||||
*/
|
||||
public boolean isExplicit() throws DOMException {
|
||||
public boolean isExplicit() {
|
||||
return ((ICPPConstructor)getSpecializedBinding()).isExplicit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,11 +51,7 @@ public class CPPDeferredClassInstance extends CPPUnknownClass implements ICPPDef
|
|||
|
||||
@Override
|
||||
public IBinding getOwner() {
|
||||
try {
|
||||
return fClassTemplate.getOwner();
|
||||
} catch (DOMException e) {
|
||||
return e.getProblem();
|
||||
}
|
||||
return fClassTemplate.getOwner();
|
||||
}
|
||||
|
||||
public ICPPClassTemplate getClassTemplate() {
|
||||
|
@ -93,7 +89,7 @@ public class CPPDeferredClassInstance extends CPPUnknownClass implements ICPPDef
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getKey() throws DOMException {
|
||||
public int getKey() {
|
||||
return getClassTemplate().getKey();
|
||||
}
|
||||
|
||||
|
@ -138,7 +134,7 @@ public class CPPDeferredClassInstance extends CPPUnknownClass implements ICPPDef
|
|||
}
|
||||
|
||||
@Override
|
||||
public ICPPScope asScope() throws DOMException {
|
||||
public ICPPScope asScope() {
|
||||
if (fLookupScope != null)
|
||||
return fLookupScope;
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
|
@ -29,7 +30,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.IValue;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTEnumerationSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
|
||||
|
@ -78,7 +78,7 @@ public class CPPEnumeration extends PlatformObject implements ICPPEnumeration, I
|
|||
return fDeclarations;
|
||||
}
|
||||
|
||||
private class FindDefinitionAction extends CPPASTVisitor {
|
||||
private class FindDefinitionAction extends ASTVisitor {
|
||||
private char[] nameArray = CPPEnumeration.this.getNameCharArray();
|
||||
public IASTName result = null;
|
||||
|
||||
|
@ -197,7 +197,7 @@ public class CPPEnumeration extends PlatformObject implements ICPPEnumeration, I
|
|||
return Linkage.CPP_LINKAGE;
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
return CPPVisitor.findDeclarationOwner(getADeclaration(), true);
|
||||
}
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ public class CPPEnumerator extends PlatformObject implements IEnumerator, ICPPIn
|
|||
return Linkage.CPP_LINKAGE;
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
return CPPVisitor.findDeclarationOwner(enumName, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2008 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -11,8 +11,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
|
@ -20,7 +20,6 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||
|
@ -34,26 +33,19 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
|||
*/
|
||||
public class CPPField extends CPPVariable implements ICPPField {
|
||||
public static class CPPFieldProblem extends CPPVariable.CPPVariableProblem implements ICPPField {
|
||||
/**
|
||||
* @param id
|
||||
* @param arg
|
||||
*/
|
||||
public CPPFieldProblem( IASTNode node, int id, char[] arg ) {
|
||||
private ICPPClassType fOwner;
|
||||
|
||||
public CPPFieldProblem(ICPPClassType owner, IASTNode node, int id, char[] arg ) {
|
||||
super( node, id, arg );
|
||||
fOwner= owner;
|
||||
}
|
||||
|
||||
public int getVisibility() throws DOMException {
|
||||
throw new DOMException( this );
|
||||
public int getVisibility() {
|
||||
return v_private;
|
||||
}
|
||||
public ICPPClassType getClassOwner() throws DOMException {
|
||||
throw new DOMException( this );
|
||||
public ICPPClassType getClassOwner() {
|
||||
return fOwner;
|
||||
}
|
||||
@Override
|
||||
public boolean isStatic() throws DOMException {
|
||||
throw new DOMException( this );
|
||||
}
|
||||
|
||||
public ICompositeType getCompositeTypeOwner() throws DOMException {
|
||||
public ICompositeType getCompositeTypeOwner() {
|
||||
return getClassOwner();
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +54,7 @@ public class CPPField extends CPPVariable implements ICPPField {
|
|||
super( name );
|
||||
}
|
||||
|
||||
public IASTDeclaration getPrimaryDeclaration() throws DOMException{
|
||||
public IASTDeclaration getPrimaryDeclaration() {
|
||||
//first check if we already know it
|
||||
IASTDeclaration decl= findDeclaration(getDefinition());
|
||||
if (decl != null) {
|
||||
|
@ -108,7 +100,7 @@ public class CPPField extends CPPVariable implements ICPPField {
|
|||
return null;
|
||||
}
|
||||
|
||||
public int getVisibility() throws DOMException {
|
||||
public int getVisibility() {
|
||||
ICPPASTVisibilityLabel vis = null;
|
||||
IASTDeclaration decl = getPrimaryDeclaration();
|
||||
if( decl != null ) {
|
||||
|
@ -131,7 +123,7 @@ public class CPPField extends CPPVariable implements ICPPField {
|
|||
return ICPPASTVisibilityLabel.v_public;
|
||||
}
|
||||
|
||||
public ICPPClassType getClassOwner() throws DOMException {
|
||||
public ICPPClassType getClassOwner() {
|
||||
ICPPClassScope scope = (ICPPClassScope) getScope();
|
||||
return scope.getClassType();
|
||||
}
|
||||
|
@ -151,7 +143,7 @@ public class CPPField extends CPPVariable implements ICPPField {
|
|||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return hasStorageClass( ICPPASTDeclSpecifier.sc_mutable);
|
||||
return hasStorageClass( IASTDeclSpecifier.sc_mutable);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,7 +152,7 @@ public class CPPField extends CPPVariable implements ICPPField {
|
|||
return false;
|
||||
}
|
||||
|
||||
public ICompositeType getCompositeTypeOwner() throws DOMException {
|
||||
public ICompositeType getCompositeTypeOwner() {
|
||||
return getClassOwner();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2008 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -37,11 +37,11 @@ public class CPPFieldSpecialization extends CPPSpecialization implements ICPPFie
|
|||
return (ICPPField) getSpecializedBinding();
|
||||
}
|
||||
|
||||
public int getVisibility() throws DOMException {
|
||||
public int getVisibility() {
|
||||
return getField().getVisibility();
|
||||
}
|
||||
|
||||
public ICPPClassType getClassOwner() throws DOMException {
|
||||
public ICPPClassType getClassOwner() {
|
||||
return getField().getClassOwner();
|
||||
}
|
||||
|
||||
|
@ -52,23 +52,23 @@ public class CPPFieldSpecialization extends CPPSpecialization implements ICPPFie
|
|||
return type;
|
||||
}
|
||||
|
||||
public boolean isStatic() throws DOMException {
|
||||
public boolean isStatic() {
|
||||
return getField().isStatic();
|
||||
}
|
||||
|
||||
public boolean isExtern() throws DOMException {
|
||||
public boolean isExtern() {
|
||||
return getField().isExtern();
|
||||
}
|
||||
|
||||
public boolean isAuto() throws DOMException {
|
||||
public boolean isAuto() {
|
||||
return getField().isAuto();
|
||||
}
|
||||
|
||||
public boolean isRegister() throws DOMException {
|
||||
public boolean isRegister() {
|
||||
return getField().isRegister();
|
||||
}
|
||||
|
||||
public boolean isMutable() throws DOMException {
|
||||
public boolean isMutable() {
|
||||
return getField().isMutable();
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ public class CPPFieldSpecialization extends CPPSpecialization implements ICPPFie
|
|||
return false;
|
||||
}
|
||||
|
||||
public ICompositeType getCompositeTypeOwner() throws DOMException {
|
||||
public ICompositeType getCompositeTypeOwner() {
|
||||
return getClassOwner();
|
||||
}
|
||||
|
||||
|
|
|
@ -61,63 +61,19 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
|
|||
public CPPFunctionProblem(IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPFunctionType getType() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public ICPPParameter[] getParameters() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
|
||||
public IScope getFunctionScope() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
|
||||
public ICPPFunctionType getType() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isStatic() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public String[] getQualifiedName() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isGloballyQualified() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isDeleted() {
|
||||
return false;
|
||||
}
|
||||
public boolean isMutable() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isInline() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isExternC() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isExtern() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isAuto() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isRegister() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean takesVarArgs() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public IType[] getExceptionSpecification() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public int getRequiredArgumentCount() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean hasParameterPack() {
|
||||
return false;
|
||||
}
|
||||
public boolean hasSameFunctionParameterTypeList(ICPPFunction function) {
|
||||
return false;
|
||||
}
|
||||
|
@ -158,13 +114,10 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
|
|||
} else {
|
||||
//implicit binding
|
||||
IScope scope = getScope();
|
||||
try {
|
||||
IASTNode node = ASTInternal.getPhysicalNodeOfScope(scope);
|
||||
if (node != null) {
|
||||
tu = node.getTranslationUnit();
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
IASTNode node = ASTInternal.getPhysicalNodeOfScope(scope);
|
||||
if (node != null) {
|
||||
tu = node.getTranslationUnit();
|
||||
}
|
||||
}
|
||||
if (tu != null) {
|
||||
CPPVisitor.getDeclarations(tu, this);
|
||||
|
@ -493,7 +446,7 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isInline() throws DOMException {
|
||||
public boolean isInline() {
|
||||
IASTDeclarator dtor = getDefinition();
|
||||
IASTDeclarator[] ds = getDeclarations();
|
||||
int i = -1;
|
||||
|
@ -520,7 +473,7 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isExternC() throws DOMException {
|
||||
public boolean isExternC() {
|
||||
if (CPPVisitor.isExternC(getDefinition())) {
|
||||
return true;
|
||||
}
|
||||
|
@ -565,11 +518,11 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
|
|||
return result.toString();
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
return CPPVisitor.findNameOwner(getASTName(), false);
|
||||
}
|
||||
|
||||
public IType[] getExceptionSpecification() throws DOMException {
|
||||
public IType[] getExceptionSpecification() {
|
||||
ICPPASTFunctionDeclarator declarator = getPreferredDtor();
|
||||
if (declarator != null) {
|
||||
IASTTypeId[] astTypeIds= declarator.getExceptionSpecification();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -77,7 +77,7 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
|
|||
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public IBinding[] find(String name) throws DOMException {
|
||||
public IBinding[] find(String name) {
|
||||
char[] n = name.toCharArray();
|
||||
List<IBinding> bindings = new ArrayList<IBinding>();
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isInline() throws DOMException {
|
||||
public boolean isInline() {
|
||||
if (getDefinition() != null) {
|
||||
IASTNode def = getDefinition();
|
||||
while (!(def instanceof IASTFunctionDefinition))
|
||||
|
@ -123,7 +123,7 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
|
|||
return getFunction().isInline();
|
||||
}
|
||||
|
||||
public boolean isExternC() throws DOMException {
|
||||
public boolean isExternC() {
|
||||
if (CPPVisitor.isExternC(getDefinition())) {
|
||||
return true;
|
||||
}
|
||||
|
@ -139,35 +139,33 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
|
|||
if (f instanceof ICPPInternalFunction)
|
||||
return ((ICPPInternalFunction)f).isStatic(resolveAll);
|
||||
if (f instanceof IIndexBinding && f instanceof ICPPFunction) {
|
||||
try {
|
||||
return ((ICPPFunction) f).isStatic();
|
||||
} catch(DOMException de) { /* cannot occur as we query the index */}
|
||||
return ((ICPPFunction) f).isStatic();
|
||||
}
|
||||
return CPPFunction.hasStorageClass(this, IASTDeclSpecifier.sc_static);
|
||||
}
|
||||
|
||||
public boolean isExtern() throws DOMException {
|
||||
public boolean isExtern() {
|
||||
ICPPFunction f = (ICPPFunction) getSpecializedBinding();
|
||||
if (f != null)
|
||||
return f.isExtern();
|
||||
return CPPFunction.hasStorageClass(this, IASTDeclSpecifier.sc_extern);
|
||||
}
|
||||
|
||||
public boolean isAuto() throws DOMException {
|
||||
public boolean isAuto() {
|
||||
ICPPFunction f = (ICPPFunction) getSpecializedBinding();
|
||||
if (f != null)
|
||||
return f.isAuto();
|
||||
return CPPFunction.hasStorageClass(this, IASTDeclSpecifier.sc_auto);
|
||||
}
|
||||
|
||||
public boolean isRegister() throws DOMException {
|
||||
public boolean isRegister() {
|
||||
ICPPFunction f = (ICPPFunction) getSpecializedBinding();
|
||||
if (f != null)
|
||||
return f.isRegister();
|
||||
return CPPFunction.hasStorageClass(this, IASTDeclSpecifier.sc_register);
|
||||
}
|
||||
|
||||
public boolean takesVarArgs() throws DOMException {
|
||||
public boolean takesVarArgs() {
|
||||
ICPPFunction f = (ICPPFunction) getSpecializedBinding();
|
||||
if (f != null)
|
||||
return f.takesVarArgs();
|
||||
|
@ -295,7 +293,7 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
|
|||
return result.toString();
|
||||
}
|
||||
|
||||
public IType[] getExceptionSpecification() throws DOMException {
|
||||
public IType[] getExceptionSpecification() {
|
||||
if (specializedExceptionSpec == null) {
|
||||
ICPPFunction function = (ICPPFunction) getSpecializedBinding();
|
||||
IType[] types = function.getExceptionSpecification();
|
||||
|
|
|
@ -57,60 +57,19 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
|||
public ICPPClassTemplatePartialSpecialization[] getTemplateSpecializations() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public String[] getQualifiedName() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isGloballyQualified() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isDeleted() {
|
||||
return false;
|
||||
}
|
||||
public boolean isMutable() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isInline() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isExternC() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public ICPPParameter[] getParameters() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public IScope getFunctionScope() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
@Override
|
||||
public ICPPFunctionType getType() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isStatic() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isExtern() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isAuto() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isRegister() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean takesVarArgs() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public IType[] getExceptionSpecification() throws DOMException {
|
||||
throw new DOMException( this );
|
||||
}
|
||||
public int getRequiredArgumentCount() throws DOMException {
|
||||
throw new DOMException( this );
|
||||
}
|
||||
public boolean hasParameterPack() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected ICPPFunctionType type = null;
|
||||
|
@ -316,7 +275,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
|||
return hasStorageClass(IASTDeclSpecifier.sc_mutable);
|
||||
}
|
||||
|
||||
public boolean isInline() throws DOMException {
|
||||
public boolean isInline() {
|
||||
IASTName name = (IASTName) getDefinition();
|
||||
IASTNode[] ns = getDeclarations();
|
||||
int i = -1;
|
||||
|
@ -344,7 +303,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isExternC() throws DOMException {
|
||||
public boolean isExternC() {
|
||||
if (CPPVisitor.isExternC(getDefinition())) {
|
||||
return true;
|
||||
}
|
||||
|
@ -407,7 +366,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
|||
return result.toString();
|
||||
}
|
||||
|
||||
public IType[] getExceptionSpecification() throws DOMException {
|
||||
public IType[] getExceptionSpecification() {
|
||||
ICPPASTFunctionDeclarator declarator = getFirstFunctionDtor();
|
||||
if (declarator != null) {
|
||||
IASTTypeId[] astTypeIds = declarator.getExceptionSpecification();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
|
@ -46,7 +45,7 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
|
|||
super(name, scope, type, params, false);
|
||||
}
|
||||
|
||||
public int getVisibility() throws DOMException {
|
||||
public int getVisibility() {
|
||||
IASTDeclaration decl= getPrimaryDeclaration();
|
||||
if (decl == null) {
|
||||
// 12.1-5, 12.8-10 Implicit constructors and assignment operators are public
|
||||
|
@ -82,7 +81,7 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
|
|||
return scope.getClassType();
|
||||
}
|
||||
|
||||
public IASTDeclaration getPrimaryDeclaration() throws DOMException {
|
||||
public IASTDeclaration getPrimaryDeclaration() {
|
||||
// first check if we already know it
|
||||
if (declarations != null) {
|
||||
for (IASTDeclarator dtor : declarations) {
|
||||
|
@ -170,11 +169,7 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
|
|||
}
|
||||
|
||||
public boolean isImplicit() {
|
||||
try {
|
||||
return getPrimaryDeclaration() == null;
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
return true;
|
||||
return getPrimaryDeclaration() == null;
|
||||
}
|
||||
|
||||
public boolean isPureVirtual() {
|
||||
|
@ -187,7 +182,7 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
|
|||
}
|
||||
|
||||
@Override
|
||||
public IType[] getExceptionSpecification() throws DOMException {
|
||||
public IType[] getExceptionSpecification() {
|
||||
return ClassTypeHelper.getInheritedExceptionSpecification(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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)
|
||||
* Andrew Niefer (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.IASTLabelStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
|
@ -23,9 +22,6 @@ import org.eclipse.cdt.internal.core.dom.Linkage;
|
|||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||
import org.eclipse.core.runtime.PlatformObject;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*/
|
||||
public class CPPLabel extends PlatformObject implements ILabel, ICPPInternalBinding {
|
||||
private IASTName statement;
|
||||
|
||||
|
@ -93,7 +89,7 @@ public class CPPLabel extends PlatformObject implements ILabel, ICPPInternalBind
|
|||
return Linkage.CPP_LINKAGE;
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
return CPPVisitor.findEnclosingFunction(statement);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2010 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
|
||||
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
|
@ -29,6 +28,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel;
|
||||
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.ICPPMember;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
||||
|
@ -40,21 +40,13 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
|||
*/
|
||||
public class CPPMethod extends CPPFunction implements ICPPMethod {
|
||||
public static class CPPMethodProblem extends CPPFunctionProblem implements ICPPMethod {
|
||||
public CPPMethodProblem(IASTNode node, int id, char[] arg) {
|
||||
private ICPPClassType fOwner;
|
||||
public CPPMethodProblem(ICPPClassType owner, IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
fOwner= owner;
|
||||
}
|
||||
|
||||
public int getVisibility() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public ICPPClassType getClassOwner() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isVirtual() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isPureVirtual() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public ICPPClassType getClassOwner() {
|
||||
return fOwner;
|
||||
}
|
||||
public boolean isDestructor() {
|
||||
char[] name = getNameCharArray();
|
||||
|
@ -63,8 +55,8 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
|
||||
return false;
|
||||
}
|
||||
public boolean isImplicit() {
|
||||
return false;
|
||||
public int getVisibility() {
|
||||
return ICPPMember.v_private;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +64,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
super(declarator);
|
||||
}
|
||||
|
||||
public IASTDeclaration getPrimaryDeclaration() throws DOMException{
|
||||
public IASTDeclaration getPrimaryDeclaration() {
|
||||
//first check if we already know it
|
||||
if (declarations != null) {
|
||||
for (IASTDeclarator dtor : declarations) {
|
||||
|
@ -120,7 +112,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMember#getVisibility()
|
||||
*/
|
||||
public int getVisibility() throws DOMException {
|
||||
public int getVisibility() {
|
||||
IASTDeclaration decl = getPrimaryDeclaration();
|
||||
if( decl == null ){
|
||||
IScope scope = getScope();
|
||||
|
@ -149,7 +141,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
return ICPPASTVisibilityLabel.v_public;
|
||||
}
|
||||
|
||||
public ICPPClassType getClassOwner() throws DOMException {
|
||||
public ICPPClassType getClassOwner() {
|
||||
ICPPClassScope scope = (ICPPClassScope)getScope();
|
||||
return scope.getClassType();
|
||||
}
|
||||
|
@ -174,7 +166,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual()
|
||||
*/
|
||||
public boolean isVirtual() throws DOMException {
|
||||
public boolean isVirtual() {
|
||||
IASTDeclaration decl = getPrimaryDeclaration();
|
||||
if( decl != null ){
|
||||
ICPPASTDeclSpecifier declSpec = getDeclSpec(decl);
|
||||
|
@ -198,7 +190,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction#isInline()
|
||||
*/
|
||||
@Override
|
||||
public boolean isInline() throws DOMException {
|
||||
public boolean isInline() {
|
||||
IASTDeclaration decl = getPrimaryDeclaration();
|
||||
if( decl instanceof IASTFunctionDefinition )
|
||||
return true;
|
||||
|
@ -214,7 +206,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
*/
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return hasStorageClass( this, ICPPASTDeclSpecifier.sc_mutable );
|
||||
return hasStorageClass( this, IASTDeclSpecifier.sc_mutable );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -235,7 +227,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isPureVirtual()
|
||||
*/
|
||||
public boolean isPureVirtual() throws DOMException {
|
||||
public boolean isPureVirtual() {
|
||||
if (declarations != null) {
|
||||
for (IASTDeclarator dtor : declarations) {
|
||||
if (dtor == null)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.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.ICPPMethod;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||
|
@ -28,25 +27,25 @@ public class CPPMethodInstance extends CPPFunctionInstance implements ICPPMethod
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMember#getVisibility()
|
||||
*/
|
||||
public int getVisibility() throws DOMException {
|
||||
public int getVisibility() {
|
||||
return ((ICPPMethod)getTemplateDefinition()).getVisibility();
|
||||
}
|
||||
|
||||
public ICPPClassType getClassOwner() throws DOMException {
|
||||
public ICPPClassType getClassOwner() {
|
||||
return (ICPPClassType) getOwner();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual()
|
||||
*/
|
||||
public boolean isVirtual() throws DOMException {
|
||||
public boolean isVirtual() {
|
||||
return ((ICPPMethod)getTemplateDefinition()).isVirtual();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isPureVirtual()
|
||||
*/
|
||||
public boolean isPureVirtual() throws DOMException {
|
||||
public boolean isPureVirtual() {
|
||||
return ((ICPPMethod)getTemplateDefinition()).isPureVirtual();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
|
@ -32,7 +31,7 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
|
|||
super(orig, owner, argMap );
|
||||
}
|
||||
|
||||
public boolean isVirtual() throws DOMException {
|
||||
public boolean isVirtual() {
|
||||
ICPPMethod f = (ICPPMethod) getSpecializedBinding();
|
||||
if( f != null )
|
||||
return f.isVirtual();
|
||||
|
@ -55,14 +54,14 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
|
|||
return false;
|
||||
}
|
||||
|
||||
public int getVisibility() throws DOMException {
|
||||
public int getVisibility() {
|
||||
ICPPMethod f = (ICPPMethod) getSpecializedBinding();
|
||||
if( f != null )
|
||||
return f.getVisibility();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public ICPPClassType getClassOwner() throws DOMException {
|
||||
public ICPPClassType getClassOwner() {
|
||||
return (ICPPClassType) getOwner();
|
||||
}
|
||||
|
||||
|
@ -78,7 +77,7 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
|
|||
return ((ICPPMethod) getSpecializedBinding()).isImplicit();
|
||||
}
|
||||
|
||||
public boolean isPureVirtual() throws DOMException {
|
||||
public boolean isPureVirtual() {
|
||||
ICPPMethod f = (ICPPMethod) getSpecializedBinding();
|
||||
if (f != null)
|
||||
return f.isPureVirtual();
|
||||
|
@ -87,7 +86,7 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
|
|||
}
|
||||
|
||||
@Override
|
||||
public IType[] getExceptionSpecification() throws DOMException {
|
||||
public IType[] getExceptionSpecification() {
|
||||
if (isImplicit()) {
|
||||
return ClassTypeHelper.getInheritedExceptionSpecification(this);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -40,7 +40,7 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements ICPPMethod
|
|||
super(name);
|
||||
}
|
||||
|
||||
public IASTDeclaration getPrimaryDeclaration() throws DOMException{
|
||||
public IASTDeclaration getPrimaryDeclaration() {
|
||||
//first check if we already know it
|
||||
if (declarations != null) {
|
||||
for (IASTName declaration : declarations) {
|
||||
|
@ -65,8 +65,13 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements ICPPMethod
|
|||
|
||||
final char[] myName = getTemplateName().getLookupKey();
|
||||
IScope scope = getScope();
|
||||
if (scope instanceof ICPPTemplateScope)
|
||||
scope = scope.getParent();
|
||||
if (scope instanceof ICPPTemplateScope) {
|
||||
try {
|
||||
scope = scope.getParent();
|
||||
} catch (DOMException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
ICPPClassScope clsScope = (ICPPClassScope) scope;
|
||||
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) ASTInternal.getPhysicalNodeOfScope(clsScope);
|
||||
IASTDeclaration[] members = compSpec.getMembers();
|
||||
|
@ -92,7 +97,7 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements ICPPMethod
|
|||
return null;
|
||||
}
|
||||
|
||||
public int getVisibility() throws DOMException {
|
||||
public int getVisibility() {
|
||||
IASTDeclaration decl = getPrimaryDeclaration();
|
||||
if( decl == null ){
|
||||
ICPPClassType cls = getClassOwner();
|
||||
|
@ -118,10 +123,14 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements ICPPMethod
|
|||
return ICPPASTVisibilityLabel.v_public;
|
||||
}
|
||||
|
||||
public ICPPClassType getClassOwner() throws DOMException {
|
||||
public ICPPClassType getClassOwner() {
|
||||
IScope scope= getScope();
|
||||
if (scope instanceof ICPPTemplateScope) {
|
||||
scope= scope.getParent();
|
||||
try {
|
||||
scope= scope.getParent();
|
||||
} catch (DOMException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if( scope instanceof ICPPClassScope ){
|
||||
return ((ICPPClassScope)scope).getClassType();
|
||||
|
@ -135,7 +144,7 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements ICPPMethod
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isInline() throws DOMException {
|
||||
public boolean isInline() {
|
||||
IASTDeclaration decl = getPrimaryDeclaration();
|
||||
if( decl instanceof ICPPASTTemplateDeclaration && ((ICPPASTTemplateDeclaration)decl).getDeclaration() instanceof IASTFunctionDefinition )
|
||||
return true;
|
||||
|
@ -155,7 +164,7 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements ICPPMethod
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isPureVirtual() throws DOMException {
|
||||
public boolean isPureVirtual() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
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.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||
|
@ -33,14 +32,14 @@ public class CPPMethodTemplateSpecialization extends CPPFunctionTemplateSpeciali
|
|||
return false;
|
||||
}
|
||||
|
||||
public int getVisibility() throws DOMException {
|
||||
public int getVisibility() {
|
||||
IBinding m = getSpecializedBinding();
|
||||
if( m instanceof ICPPMethod )
|
||||
return ((ICPPMethod)m).getVisibility();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public ICPPClassType getClassOwner() throws DOMException {
|
||||
public ICPPClassType getClassOwner() {
|
||||
return (ICPPClassType) getOwner();
|
||||
}
|
||||
|
||||
|
@ -56,7 +55,7 @@ public class CPPMethodTemplateSpecialization extends CPPFunctionTemplateSpeciali
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isPureVirtual() throws DOMException {
|
||||
public boolean isPureVirtual() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Niefer (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.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
|
@ -23,7 +23,6 @@ import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
|||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification;
|
||||
|
@ -32,6 +31,7 @@ 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.ICPPNamespace;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDirective;
|
||||
import org.eclipse.cdt.core.parser.Keywords;
|
||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||
|
@ -43,31 +43,24 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
|||
import org.eclipse.cdt.internal.core.model.ASTStringUtil;
|
||||
import org.eclipse.core.runtime.PlatformObject;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*/
|
||||
public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPInternalBinding {
|
||||
public static class CPPNamespaceProblem extends ProblemBinding implements ICPPNamespace{
|
||||
public static class CPPNamespaceProblem extends ProblemBinding implements ICPPNamespace, ICPPNamespaceScope{
|
||||
public CPPNamespaceProblem(IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
}
|
||||
public ICPPNamespaceScope getNamespaceScope() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public ICPPNamespaceScope getNamespaceScope() {
|
||||
return this;
|
||||
}
|
||||
public IBinding[] getMemberBindings() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public IBinding[] getMemberBindings() {
|
||||
return IBinding.EMPTY_BINDING_ARRAY;
|
||||
}
|
||||
public String[] getQualifiedName() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public void addUsingDirective(ICPPUsingDirective usingDirective) {
|
||||
}
|
||||
public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
public ICPPUsingDirective[] getUsingDirectives() {
|
||||
return ICPPUsingDirective.EMPTY_ARRAY;
|
||||
}
|
||||
public boolean isGloballyQualified() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isInline() {
|
||||
return false;
|
||||
public ICPPNamespaceScope[] getInlineNamespaces() {
|
||||
return ICPPNamespaceScope.EMPTY_NAMESPACE_SCOPE_ARRAY;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +91,7 @@ public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPI
|
|||
return (tu != null) ? tu : (IASTNode) namespaceDefinitions[0];
|
||||
}
|
||||
|
||||
static private class NamespaceCollector extends CPPASTVisitor {
|
||||
static private class NamespaceCollector extends ASTVisitor {
|
||||
private ICPPASTNamespaceDefinition namespaceDef = null;
|
||||
private IASTName[] namespaces = null;
|
||||
|
||||
|
@ -142,7 +135,7 @@ public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPI
|
|||
}
|
||||
}
|
||||
|
||||
static private class NamespaceMemberCollector extends CPPASTVisitor {
|
||||
static private class NamespaceMemberCollector extends ASTVisitor {
|
||||
public ObjectSet<IBinding> members = new ObjectSet<IBinding>(8);
|
||||
public NamespaceMemberCollector() {
|
||||
shouldVisitNamespaces = true;
|
||||
|
@ -365,7 +358,7 @@ public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPI
|
|||
return ASTStringUtil.join(names, String.valueOf(Keywords.cpCOLONCOLON));
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
if (namespaceDefinitions != null && namespaceDefinitions.length > 0) {
|
||||
return CPPVisitor.findDeclarationOwner(namespaceDefinitions[0], false);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class CPPNamespaceAlias extends PlatformObject implements ICPPNamespaceAl
|
|||
this.alias = aliasName;
|
||||
}
|
||||
|
||||
public ICPPNamespaceScope getNamespaceScope() throws DOMException {
|
||||
public ICPPNamespaceScope getNamespaceScope() {
|
||||
return namespace.getNamespaceScope();
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class CPPNamespaceAlias extends PlatformObject implements ICPPNamespaceAl
|
|||
public void addDeclaration(IASTNode node) {
|
||||
}
|
||||
|
||||
public IBinding[] getMemberBindings() throws DOMException {
|
||||
public IBinding[] getMemberBindings() {
|
||||
return namespace.getMemberBindings();
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class CPPNamespaceAlias extends PlatformObject implements ICPPNamespaceAl
|
|||
return Linkage.CPP_LINKAGE;
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
return CPPVisitor.findDeclarationOwner(alias, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,13 +18,13 @@ import java.util.Set;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.EScopeKind;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
||||
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.ICPPNamespace;
|
||||
|
@ -106,7 +106,7 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace
|
|||
public IScope findNamespaceScope(IIndexScope scope) {
|
||||
final String[] qname= scope.getScopeBinding().getQualifiedName();
|
||||
final IScope[] result= {null};
|
||||
final CPPASTVisitor visitor= new CPPASTVisitor () {
|
||||
final ASTVisitor visitor= new ASTVisitor () {
|
||||
private int depth= 0;
|
||||
{
|
||||
shouldVisitNamespaces= shouldVisitDeclarations= true;
|
||||
|
@ -242,7 +242,6 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace
|
|||
} else if (getKind() == EScopeKind.eGlobal) {
|
||||
inlineScopes= index.getInlineNamespaces();
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
if (inlineScopes != null) {
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
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.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
|
@ -46,45 +45,6 @@ public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPI
|
|||
public CPPParameterProblem(IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
}
|
||||
public IType getType() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isStatic() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isExtern() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isAuto() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isRegister() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean hasDefaultValue() {
|
||||
return false;
|
||||
}
|
||||
public boolean isMutable() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public String[] getQualifiedName() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isGloballyQualified() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isExternC() {
|
||||
return false;
|
||||
}
|
||||
public IValue getInitialValue() {
|
||||
return null;
|
||||
}
|
||||
public boolean isParameterPack() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private IType fType = null;
|
||||
|
@ -315,7 +275,7 @@ public class CPPParameter extends PlatformObject implements ICPPParameter, ICPPI
|
|||
return name.length() != 0 ? name : "<unnamed>"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
return CPPVisitor.findEnclosingFunction(fDeclarations[0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
|
@ -68,14 +68,14 @@ public class CPPParameterSpecialization extends CPPSpecialization implements ICP
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto()
|
||||
*/
|
||||
public boolean isAuto() throws DOMException {
|
||||
public boolean isAuto() {
|
||||
return getParameter().isAuto();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isRegister()
|
||||
*/
|
||||
public boolean isRegister() throws DOMException {
|
||||
public boolean isRegister() {
|
||||
return getParameter().isRegister();
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ abstract public class CPPScope implements ICPPASTInternalScope {
|
|||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
public void addName(IASTName name) throws DOMException {
|
||||
public void addName(IASTName name) {
|
||||
// don't add inactive names to the scope
|
||||
if (!name.isActive())
|
||||
return;
|
||||
|
@ -141,7 +141,7 @@ abstract public class CPPScope implements ICPPASTInternalScope {
|
|||
}
|
||||
}
|
||||
|
||||
public IBinding getBinding(IASTName name, boolean forceResolve, IIndexFileSet fileSet) throws DOMException {
|
||||
public IBinding getBinding(IASTName name, boolean forceResolve, IIndexFileSet fileSet) {
|
||||
IBinding binding= getBindingInAST(name, forceResolve);
|
||||
if (binding == null && forceResolve) {
|
||||
final IASTTranslationUnit tu = name.getTranslationUnit();
|
||||
|
@ -190,17 +190,17 @@ abstract public class CPPScope implements ICPPASTInternalScope {
|
|||
return fIndexNamespace;
|
||||
}
|
||||
|
||||
public IBinding getBindingInAST(IASTName name, boolean forceResolve) throws DOMException {
|
||||
public IBinding getBindingInAST(IASTName name, boolean forceResolve) {
|
||||
IBinding[] bs= getBindingsInAST(name, forceResolve, false, false, true);
|
||||
return CPPSemantics.resolveAmbiguities(name, bs);
|
||||
}
|
||||
|
||||
public final IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) throws DOMException {
|
||||
public final IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) {
|
||||
return getBindings(name, resolve, prefixLookup, fileSet, true);
|
||||
}
|
||||
|
||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet,
|
||||
boolean checkPointOfDecl) throws DOMException {
|
||||
boolean checkPointOfDecl) {
|
||||
IBinding[] result = getBindingsInAST(name, resolve, prefixLookup, checkPointOfDecl, true);
|
||||
final IASTTranslationUnit tu = name.getTranslationUnit();
|
||||
if (tu != null) {
|
||||
|
@ -243,7 +243,7 @@ abstract public class CPPScope implements ICPPASTInternalScope {
|
|||
}
|
||||
|
||||
public IBinding[] getBindingsInAST(IASTName name, boolean forceResolve, boolean prefixLookup,
|
||||
boolean checkPointOfDecl, boolean expandUsingDirectives) throws DOMException {
|
||||
boolean checkPointOfDecl, boolean expandUsingDirectives) {
|
||||
populateCache();
|
||||
final char[] c = name.getLookupKey();
|
||||
IBinding[] result = null;
|
||||
|
@ -327,7 +327,7 @@ abstract public class CPPScope implements ICPPASTInternalScope {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
|
||||
*/
|
||||
public IBinding[] find(String name) throws DOMException {
|
||||
public IBinding[] find(String name) {
|
||||
return CPPSemantics.findBindings(this, name, false);
|
||||
}
|
||||
|
||||
|
@ -354,26 +354,21 @@ abstract public class CPPScope implements ICPPASTInternalScope {
|
|||
}
|
||||
}
|
||||
|
||||
public final IBinding getBinding(IASTName name, boolean resolve) throws DOMException {
|
||||
public final IBinding getBinding(IASTName name, boolean resolve) {
|
||||
return getBinding(name, resolve, IIndexFileSet.EMPTY);
|
||||
}
|
||||
|
||||
public final IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix) throws DOMException {
|
||||
public final IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix) {
|
||||
return getBindings(name, resolve, prefix, IIndexFileSet.EMPTY, true);
|
||||
}
|
||||
|
||||
public IName getScopeName() throws DOMException {
|
||||
public IName getScopeName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
IName name = null;
|
||||
try {
|
||||
name = getScopeName();
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
|
||||
IName name = getScopeName();
|
||||
final String n= name != null ? name.toString() : "<unnamed scope>"; //$NON-NLS-1$
|
||||
return getKind().toString() + ' ' + n + ' ' + '(' + super.toString() + ')';
|
||||
}
|
||||
|
|
|
@ -88,19 +88,19 @@ public class CPPScopeMapper {
|
|||
return fScope.getKind();
|
||||
}
|
||||
|
||||
public IBinding[] find(String name) throws DOMException {
|
||||
public IBinding[] find(String name) {
|
||||
return fScope.find(name);
|
||||
}
|
||||
public IBinding getBinding(IASTName name, boolean resolve) throws DOMException {
|
||||
public IBinding getBinding(IASTName name, boolean resolve) {
|
||||
return fScope.getBinding(name, resolve);
|
||||
}
|
||||
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet acceptLocalBindings) throws DOMException {
|
||||
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet acceptLocalBindings) {
|
||||
return fScope.getBinding(name, resolve, acceptLocalBindings);
|
||||
}
|
||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup) throws DOMException {
|
||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup) {
|
||||
return fScope.getBindings(name, resolve, prefixLookup);
|
||||
}
|
||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet acceptLocalBindings) throws DOMException {
|
||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet acceptLocalBindings) {
|
||||
return fScope.getBindings(name, resolve, prefixLookup, acceptLocalBindings);
|
||||
}
|
||||
public IScope getParent() throws DOMException {
|
||||
|
@ -111,7 +111,7 @@ public class CPPScopeMapper {
|
|||
return fTu.getScope();
|
||||
}
|
||||
|
||||
public IName getScopeName() throws DOMException {
|
||||
public IName getScopeName() {
|
||||
return fScope.getScopeName();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2010 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
|
||||
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
@ -43,9 +43,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
|||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||
import org.eclipse.core.runtime.PlatformObject;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
*/
|
||||
public abstract class CPPTemplateDefinition extends PlatformObject implements ICPPTemplateDefinition, ICPPInternalTemplate {
|
||||
public static final class CPPTemplateProblem extends ProblemBinding implements ICPPTemplateDefinition {
|
||||
public CPPTemplateProblem(IASTNode node, int id, char[] arg) {
|
||||
|
@ -57,15 +54,6 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
|||
public ICPPClassTemplatePartialSpecialization[] getTemplateSpecializations() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public String[] getQualifiedName() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isGloballyQualified() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected IASTName[] declarations;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
|
@ -115,16 +114,16 @@ public class CPPTemplateNonTypeParameter extends CPPTemplateParameter implements
|
|||
return getType() instanceof ICPPParameterPackType;
|
||||
}
|
||||
|
||||
public boolean isStatic() throws DOMException {
|
||||
public boolean isStatic() {
|
||||
return false;
|
||||
}
|
||||
public boolean isExtern() throws DOMException {
|
||||
public boolean isExtern() {
|
||||
return false;
|
||||
}
|
||||
public boolean isAuto() throws DOMException {
|
||||
public boolean isAuto() {
|
||||
return false;
|
||||
}
|
||||
public boolean isRegister() throws DOMException {
|
||||
public boolean isRegister() {
|
||||
return false;
|
||||
}
|
||||
public IValue getInitialValue() {
|
||||
|
|
|
@ -218,7 +218,7 @@ public abstract class CPPTemplateParameter extends PlatformObject
|
|||
return getName();
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
public IBinding getOwner() {
|
||||
if (declarations == null || declarations.length == 0)
|
||||
return null;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue