1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Bug 323723: Reduce usage of DOMExceptions.

This commit is contained in:
Markus Schorn 2010-08-27 09:01:29 +00:00
parent d3fcfea8f1
commit c31e996fc2
234 changed files with 2426 additions and 3449 deletions

View file

@ -23,7 +23,6 @@ import junit.framework.AssertionFailedError;
import org.eclipse.cdt.core.dom.ast.ASTSignatureUtil; import org.eclipse.cdt.core.dom.ast.ASTSignatureUtil;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; 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.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTCastExpression; import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
@ -470,7 +469,7 @@ public class AST2BaseTest extends BaseTestCase {
return clazz.cast(o); 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); assertInstance(binding, IField.class);
assertEquals(fieldName, binding.getName()); assertEquals(fieldName, binding.getName());
ICompositeType struct = ((IField) binding).getCompositeTypeOwner(); ICompositeType struct = ((IField) binding).getCompositeTypeOwner();

View file

@ -3419,7 +3419,7 @@ public class AST2CPPTests extends AST2BaseTest {
IProblemBinding B = (IProblemBinding) col.getName(2).resolveBinding(); IProblemBinding B = (IProblemBinding) col.getName(2).resolveBinding();
assertEquals(B.getID(), IProblemBinding.SEMANTIC_NAME_NOT_FOUND); assertEquals(B.getID(), IProblemBinding.SEMANTIC_NAME_NOT_FOUND);
IProblemBinding C = (IProblemBinding) col.getName(3).resolveBinding(); 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 { public void testBug88459() throws Exception {

View file

@ -1637,7 +1637,6 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
int friends, int friends,
int constructors, int constructors,
int nestedClasses) { int nestedClasses) {
try {
assertTrue(type instanceof ICPPClassType); assertTrue(type instanceof ICPPClassType);
ICPPClassType classType = (ICPPClassType) type; ICPPClassType classType = (ICPPClassType) type;
assertQNEquals(qn, classType); assertQNEquals(qn, classType);
@ -1651,9 +1650,6 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
// assertEquals(friends, classType.getFriends().length); (PDOMNotImplementedError) // assertEquals(friends, classType.getFriends().length); (PDOMNotImplementedError)
assertEquals(constructors, classType.getConstructors().length); assertEquals(constructors, classType.getConstructors().length);
assertEquals(nestedClasses, classType.getNestedClasses().length); assertEquals(nestedClasses, classType.getNestedClasses().length);
} catch (DOMException de) {
fail(de.getMessage());
}
} }
public void assertEnumeration(IBinding binding, String name, String[] enumerators) throws DOMException { public void assertEnumeration(IBinding binding, String name, String[] enumerators) throws DOMException {

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -14,7 +14,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.browser; 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.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.EScopeKind; import org.eclipse.cdt.core.dom.ast.EScopeKind;
@ -49,7 +48,6 @@ public class IndexModelUtil {
* @return whether the binding is of any of the specified CElement type constants * @return whether the binding is of any of the specified CElement type constants
*/ */
public static boolean bindingHasCElementType(IBinding binding, int[] kinds) { public static boolean bindingHasCElementType(IBinding binding, int[] kinds) {
try {
for (int kind : kinds) { for (int kind : kinds) {
switch(kind) { switch(kind) {
case ICElement.C_STRUCT: case ICElement.C_STRUCT:
@ -89,9 +87,6 @@ public class IndexModelUtil {
break; break;
} }
} }
} catch(DOMException de) {
CCorePlugin.log(de);
}
return false; return false;
} }
@ -105,7 +100,6 @@ public class IndexModelUtil {
if (binding instanceof ICompositeType) { if (binding instanceof ICompositeType) {
ICompositeType classType = (ICompositeType) binding; ICompositeType classType = (ICompositeType) binding;
try {
switch(classType.getKey()) { switch(classType.getKey()) {
case ICPPClassType.k_class: case ICPPClassType.k_class:
elementType = ICElement.C_CLASS; elementType = ICElement.C_CLASS;
@ -117,9 +111,6 @@ public class IndexModelUtil {
elementType = ICElement.C_UNION; elementType = ICElement.C_UNION;
break; break;
} }
} catch(DOMException de) {
CCorePlugin.log(de);
}
} }
if (binding instanceof ICPPNamespace || binding instanceof ICPPNamespaceAlias) { if (binding instanceof ICPPNamespace || binding instanceof ICPPNamespaceAlias) {

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Corp. - Rational Software - initial implementation * Andrew Niefer (IBM Corporation) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Gerhard Schaber (Wind River Systems) * Gerhard Schaber (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
@ -37,7 +37,6 @@ import org.eclipse.core.runtime.Path;
/** /**
* Creates labels for ICElement objects. * Creates labels for ICElement objects.
* @author aniefer
*/ */
public class CElementBaseLabels { public class CElementBaseLabels {

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -281,7 +281,6 @@ abstract class CElementHandle implements ICElementHandle, ISourceReference {
protected ASTAccessVisibility getVisibility(IBinding binding) { protected ASTAccessVisibility getVisibility(IBinding binding) {
if (binding instanceof ICPPMember) { if (binding instanceof ICPPMember) {
ICPPMember member= (ICPPMember) binding; ICPPMember member= (ICPPMember) binding;
try {
switch (member.getVisibility()) { switch (member.getVisibility()) {
case ICPPMember.v_private: case ICPPMember.v_private:
return ASTAccessVisibility.PRIVATE; return ASTAccessVisibility.PRIVATE;
@ -290,9 +289,6 @@ abstract class CElementHandle implements ICElementHandle, ISourceReference {
case ICPPMember.v_public: case ICPPMember.v_public:
return ASTAccessVisibility.PUBLIC; return ASTAccessVisibility.PUBLIC;
} }
} catch (DOMException e) {
CCorePlugin.log(e);
}
} }
return ASTAccessVisibility.PUBLIC; return ASTAccessVisibility.PUBLIC;
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,11 +8,8 @@
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.model.ext; 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.dom.ast.IField;
import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement; 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) { public FieldHandle(ICElement parent, IField field) {
super(parent, ICElement.C_FIELD, field.getName()); super(parent, ICElement.C_FIELD, field.getName());
fVisibility= getVisibility(field); fVisibility= getVisibility(field);
try {
fIsStatic= field.isStatic(); fIsStatic= field.isStatic();
} catch (DOMException e) {
CCorePlugin.log(e);
fIsStatic= false;
}
} }
public ASTAccessVisibility getVisibility() throws CModelException { public ASTAccessVisibility getVisibility() throws CModelException {

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -9,10 +9,8 @@
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* Anton Leherbauer (Wind River Systems) * Anton Leherbauer (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.model.ext; 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.DOMException;
import org.eclipse.cdt.core.dom.ast.IFunction; import org.eclipse.cdt.core.dom.ast.IFunction;
import org.eclipse.cdt.core.model.CModelException; 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 { protected FunctionDeclarationHandle(ICElement parent, int type, IFunction func) throws DOMException {
super(parent, type, func.getName()); super(parent, type, func.getName());
fParameterTypes= extractParameterTypes(func); fParameterTypes= extractParameterTypes(func);
try {
fIsStatic= func.isStatic(); fIsStatic= func.isStatic();
} catch (DOMException e) {
CCorePlugin.log(e);
fIsStatic= false;
}
} }
@Override @Override

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,10 +8,8 @@
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.model.ext; 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.DOMException;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; 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()); super(parent, type, method.getName());
fParameterTypes= extractParameterTypes(method); fParameterTypes= extractParameterTypes(method);
fVisibility= getVisibility(method); fVisibility= getVisibility(method);
try {
fIsStatic= method.isStatic(); fIsStatic= method.isStatic();
fIsConstructor= method instanceof ICPPConstructor; fIsConstructor= method instanceof ICPPConstructor;
if (!fIsConstructor) if (!fIsConstructor)
fIsDestructor= method.isDestructor(); fIsDestructor= method.isDestructor();
} catch (DOMException e) {
CCorePlugin.log(e);
}
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,11 +8,8 @@
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.model.ext; 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.dom.ast.IVariable;
import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement; 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) { public VariableHandle(ICElement parent, IVariable var) {
super(parent, ICElement.C_VARIABLE, var.getName()); super(parent, ICElement.C_VARIABLE, var.getName());
try {
fIsStatic= var.isStatic(); fIsStatic= var.isStatic();
} catch (DOMException e) {
CCorePlugin.log(e);
fIsStatic= false;
}
} }
public boolean isStatic() throws CModelException { public boolean isStatic() throws CModelException {

View file

@ -346,12 +346,8 @@ public class ASTTypeUtil {
} else if (type instanceof ICompositeType) { } else if (type instanceof ICompositeType) {
// 101114 fix, do not display class, and for consistency don't display struct/union as well // 101114 fix, do not display class, and for consistency don't display struct/union as well
if (type instanceof ICPPClassType) { if (type instanceof ICPPClassType) {
try {
String qn = CPPVisitor.renderQualifiedName(getQualifiedNameForAnonymous((ICPPClassType) type, normalize)); String qn = CPPVisitor.renderQualifiedName(getQualifiedNameForAnonymous((ICPPClassType) type, normalize));
result.append(qn); result.append(qn);
} catch (DOMException e) {
result.append(getNameForAnonymous((ICompositeType) type));
}
} else { } else {
result.append(getNameForAnonymous((ICompositeType) type)); 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>(); LinkedList<String> result= new LinkedList<String>();
result.addFirst(getNameForAnonymous(binding)); result.addFirst(getNameForAnonymous(binding));

View file

@ -65,7 +65,7 @@ public interface IBinding extends IAdaptable {
* <br> <code>null</code>: for types, functions, variables, namespaces and using declarations; * <br> <code>null</code>: for types, functions, variables, namespaces and using declarations;
* @since 5.1 * @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, * Returns the parent scope for this binding. A binding may have declarations in multiple scopes,

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -24,7 +24,7 @@ public interface ICompositeType extends IBinding, IType {
/** /**
* what kind of composite type is this? * 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 * 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> * </pre>
* @since 5.1 * @since 5.1
*/ */
boolean isAnonymous() throws DOMException; boolean isAnonymous();
/** /**
* Returns the fields for this type. * Returns the fields for this type.
* *
* @return List of IField * @return List of IField
*/ */
public IField[] getFields() throws DOMException; public IField[] getFields();
/** /**
* returns the field that matches name, * returns the field that matches name,
@ -51,11 +51,10 @@ public interface ICompositeType extends IBinding, IType {
* *
* @param name * @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 * get the IScope object that is associated with this composite type
* @throws DOMException
*/ */
public IScope getCompositeScope() throws DOMException; public IScope getCompositeScope();
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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. * Returns the composite type that owns the field.
* @throws DOMException
* @since 4.0 * @since 4.0
*/ */
ICompositeType getCompositeTypeOwner() throws DOMException; ICompositeType getCompositeTypeOwner();
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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 * Returns {@code true} if the function has the static storage-class specifier
* similarly for extern, auto, register. * similarly for extern, auto, register.
* @throws DOMException if this is a problem binding.
*/ */
public boolean isStatic() throws DOMException; public boolean isStatic();
public boolean isExtern() throws DOMException; public boolean isExtern();
public boolean isAuto() throws DOMException; public boolean isAuto();
public boolean isRegister() throws DOMException; public boolean isRegister();
/** /**
* Returns {@code true} if the function is inline. * 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. * 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();
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -23,6 +23,6 @@ public interface ILabel extends IBinding {
* Returns the label statement for this label. * Returns the label statement for this label.
* *
*/ */
public IASTLabelStatement getLabelStatement() throws DOMException; public IASTLabelStatement getLabelStatement();
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -33,9 +33,8 @@ public interface IScope {
/** /**
* Get the IName for this scope, may be null * Get the IName for this scope, may be null
* @return The name of this scope. * @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 * The method returns the first enclosing non-template scope, or <code>null</code> if this
@ -55,7 +54,7 @@ public interface IScope {
* @param name * @param name
* @return An array of bindings. * @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 * 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 * whether or not to resolve the matching binding if it has not
* been so already. * been so already.
* @return : the binding in this scope that matches the name, or null * @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 * Get the binding in this scope that the given name would resolve to. Could
@ -85,9 +83,8 @@ public interface IScope {
* been so already. * been so already.
* @param acceptLocalBindings a set of files for which to accept local bindings. * @param acceptLocalBindings a set of files for which to accept local bindings.
* @return : the binding in this scope that matches the name, or null * @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 * 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. * been so already.
* @param prefixLookup whether the lookup is for a full name or a prefix * @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 * @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 * 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 prefixLookup whether the lookup is for a full name or a prefix
* @param acceptLocalBindings a set of files for which to accept local bindings. * @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 * @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);
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -34,20 +34,20 @@ public interface IVariable extends IBinding {
/** /**
* Returns whether this variable is declared static. * Returns whether this variable is declared static.
*/ */
public boolean isStatic() throws DOMException; public boolean isStatic();
/** /**
* Returns whether this variable is declared extern. * Returns whether this variable is declared extern.
*/ */
public boolean isExtern() throws DOMException; public boolean isExtern();
/** /**
* Returns whether this variable is an automatic variable. * Returns whether this variable is an automatic variable.
*/ */
public boolean isAuto() throws DOMException; public boolean isAuto();
/** /**
* Returns whether this variable is declared register. * Returns whether this variable is declared register.
*/ */
public boolean isRegister() throws DOMException; public boolean isRegister();
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast.c; 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.IBinding;
import org.eclipse.cdt.core.dom.ast.ICompositeType; 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 * get the binding for the member that has been previous added to this scope
* and that matches the given name. * 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 * Get the type this scope is associated with

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,7 +12,6 @@
package org.eclipse.cdt.core.dom.ast.cpp; package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.IName; 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.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier; 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. * 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. * 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. * 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. * The visibility qualifier applied to the base class.
* *
*/ */
public int getVisibility() throws DOMException; public int getVisibility();
/** /**
* Whether this is a virtual base class. * Whether this is a virtual base class.
*/ */
public boolean isVirtual() throws DOMException; public boolean isVirtual();
/** /**
* @since 5.1 * @since 5.1

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp; package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
/** /**
* Interface for class scopes. * Interface for class scopes.
@ -39,5 +38,5 @@ public interface ICPPClassScope extends ICPPScope {
* Returns the array of constructors, including implicit ones. * Returns the array of constructors, including implicit ones.
* @since 5.1 * @since 5.1
*/ */
public ICPPConstructor[] getConstructors() throws DOMException; public ICPPConstructor[] getConstructors();
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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 * get the ICPPTemplateDefinition which this is a specialization of
*/ */
public ICPPClassTemplate getPrimaryClassTemplate() throws DOMException; public ICPPClassTemplate getPrimaryClassTemplate();
/** /**

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,7 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp; 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.IBinding;
import org.eclipse.cdt.core.dom.ast.ICompositeType; import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.IField; import org.eclipse.cdt.core.dom.ast.IField;
@ -31,13 +30,13 @@ public interface ICPPClassType extends ICompositeType, ICPPBinding {
* *
* @return List of ICPPBase * @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 * Get fields is restated here just to point out that this method returns a
* list of ICPPField objects representing all fields, declared or inherited. * 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 * findField is restated here to point out that this method looks through
@ -47,7 +46,7 @@ public interface ICPPClassType extends ICompositeType, ICPPBinding {
* *
* @param name * @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 * 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 * @return List of ICPPField
*/ */
public ICPPField[] getDeclaredFields() throws DOMException; public ICPPField[] getDeclaredFields();
/** /**
* Returns a list of ICPPMethod objects representing all methods defined for * 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 * @return List of ICPPMethod
*/ */
public ICPPMethod[] getMethods() throws DOMException; public ICPPMethod[] getMethods();
/** /**
* Returns a list of ICPPMethod objects representing all method explicitly * Returns a list of ICPPMethod objects representing all method explicitly
@ -73,7 +72,7 @@ public interface ICPPClassType extends ICompositeType, ICPPBinding {
* *
* @return List of ICPPMethod * @return List of ICPPMethod
*/ */
public ICPPMethod[] getAllDeclaredMethods() throws DOMException; public ICPPMethod[] getAllDeclaredMethods();
/** /**
* Returns a list of ICPPMethod objects representing all methods explicitly * Returns a list of ICPPMethod objects representing all methods explicitly
@ -82,7 +81,7 @@ public interface ICPPClassType extends ICompositeType, ICPPBinding {
* *
* @return List of ICPPMethod * @return List of ICPPMethod
*/ */
public ICPPMethod[] getDeclaredMethods() throws DOMException; public ICPPMethod[] getDeclaredMethods();
/** /**
* Returns an array of ICPPConstructor objects representing the constructors * Returns an array of ICPPConstructor objects representing the constructors
@ -90,19 +89,16 @@ public interface ICPPClassType extends ICompositeType, ICPPBinding {
* constructors. * constructors.
* *
*/ */
public ICPPConstructor[] getConstructors() throws DOMException; public ICPPConstructor[] getConstructors();
/** /**
* return an array of bindings for those classes/functions declared as * return an array of bindings for those classes/functions declared as
* friends of this class. * friends of this class.
*
* @throws DOMException
*/ */
public IBinding[] getFriends() throws DOMException; public IBinding[] getFriends();
/** /**
* return an array of nested classes/structures * return an array of nested classes/structures
* @throws DOMException
*/ */
public ICPPClassType[] getNestedClasses() throws DOMException; public ICPPClassType[] getNestedClasses();
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,7 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp; 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. * @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]; public static final ICPPConstructor [] EMPTY_CONSTRUCTOR_ARRAY = new ICPPConstructor[0];
/** /**
* Whether or not this constructor was declared as explicit * Whether or not this constructor was declared as explicit
*
* @throws DOMException
*/ */
boolean isExplicit() throws DOMException; boolean isExplicit();
} }

View file

@ -25,27 +25,26 @@ public interface ICPPFunction extends IFunction, ICPPBinding {
/** /**
* does this function have the mutable storage class specifier * does this function have the mutable storage class specifier
* @throws DOMException
*/ */
public boolean isMutable() throws DOMException; public boolean isMutable();
/** /**
* is this an inline function * is this an inline function
*/ */
public boolean isInline() throws DOMException; public boolean isInline();
/** /**
* Returns whether this function is declared as extern "C". * Returns whether this function is declared as extern "C".
* @since 5.0 * @since 5.0
*/ */
public boolean isExternC() throws DOMException; public boolean isExternC();
/** /**
* Returns the exception specification for this function or <code>null</code> if there * Returns the exception specification for this function or <code>null</code> if there
* is no exception specification. * is no exception specification.
* @since 5.1 * @since 5.1
*/ */
public IType[] getExceptionSpecification() throws DOMException; public IType[] getExceptionSpecification();
/** /**
* {@inheritDoc} * {@inheritDoc}

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -29,19 +29,19 @@ public interface ICPPMember extends ICPPBinding {
/** /**
* Returns the accessibility of the member. * Returns the accessibility of the member.
*/ */
public int getVisibility() throws DOMException; public int getVisibility();
/** /**
* Same as {@link #getOwner()}. * Same as {@link #getOwner()}.
*/ */
public ICPPClassType getClassOwner() throws DOMException; public ICPPClassType getClassOwner();
/** /**
* Returns whether this is a static member or not. * Returns whether this is a static member or not.
* @since 5.1 * @since 5.1
*/ */
public boolean isStatic() throws DOMException; public boolean isStatic();
/** /**
* Returns the type of the member (function type or type of field) * Returns the type of the member (function type or type of field)

View file

@ -10,7 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp; package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
/** /**
* Base interface for methods, also used for constructors. * 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 * 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. * 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 * is this a destructor
@ -44,5 +43,5 @@ public interface ICPPMethod extends ICPPFunction, ICPPMember {
* Returns whether this is a pure abstract method * Returns whether this is a pure abstract method
* @since 5.1 * @since 5.1
*/ */
public boolean isPureVirtual() throws DOMException; public boolean isPureVirtual();
} }

View file

@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp; 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.IBinding;
/** /**
@ -23,16 +22,13 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
public interface ICPPNamespace extends ICPPBinding { public interface ICPPNamespace extends ICPPBinding {
/** /**
* get the scope object associated with this namespace * 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. * 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. * Returns whether this is an inline namespace.

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp; package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IVariable; 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 * 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". * Returns whether this variable is declared as extern "C".
*/ */
public boolean isExternC() throws DOMException; public boolean isExternC();
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,7 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.index; 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.cdt.core.dom.ast.IBinding;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
@ -48,5 +47,5 @@ public interface IIndexBinding extends IBinding {
* {@inheritDoc} * {@inheritDoc}
* @since 5.1 * @since 5.1
*/ */
IIndexBinding getOwner() throws DOMException; IIndexBinding getOwner();
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * 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; package org.eclipse.cdt.core.parser.util;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
/**
* @author aniefer
*/
public class CharArraySet extends CharTable { public class CharArraySet extends CharTable {
public static final CharArraySet EMPTY_SET = new CharArraySet( 0 ){ public static final CharArraySet EMPTY_SET = new CharArraySet( 0 ){

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * 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; package org.eclipse.cdt.core.parser.util;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
/**
* @author aniefer
*/
public class ObjectMap extends ObjectTable<Object> { public class ObjectMap extends ObjectTable<Object> {
public static final ObjectMap EMPTY_MAP = new ObjectMap(0) { public static final ObjectMap EMPTY_MAP = new ObjectMap(0) {
@Override @Override

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * Andrew Niefer (IBM Corporation) - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.parser.util; package org.eclipse.cdt.core.parser.util;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
/**
* @author aniefer
*/
public class ObjectSet<T> extends ObjectTable<T> { public class ObjectSet<T> extends ObjectTable<T> {
/** /**
* Represents the empty ObjectSet * Represents the empty ObjectSet

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * 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; package org.eclipse.cdt.core.parser.util;
import java.lang.reflect.Array; import java.lang.reflect.Array;
@ -20,9 +15,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
* @author aniefer
*/
public abstract class ObjectTable<T> extends HashTable { public abstract class ObjectTable<T> extends HashTable {
protected T[] keyTable; protected T[] keyTable;

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,7 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser; 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.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
@ -35,14 +34,14 @@ public class ASTInternal {
return IASTNode.EMPTY_NODE_ARRAY; return IASTNode.EMPTY_NODE_ARRAY;
} }
public static IASTNode getPhysicalNodeOfScope(IScope scope) throws DOMException { public static IASTNode getPhysicalNodeOfScope(IScope scope) {
if (scope instanceof IASTInternalScope) { if (scope instanceof IASTInternalScope) {
return ((IASTInternalScope) scope).getPhysicalNode(); return ((IASTInternalScope) scope).getPhysicalNode();
} }
return null; return null;
} }
public static void addBinding(IScope scope, IBinding binding) throws DOMException { public static void addBinding(IScope scope, IBinding binding) {
if (scope instanceof IASTInternalScope) { if (scope instanceof IASTInternalScope) {
((IASTInternalScope) scope).addBinding(binding); ((IASTInternalScope) scope).addBinding(binding);
} }
@ -50,15 +49,11 @@ public class ASTInternal {
public static void addName(IScope scope, IASTName name) { public static void addName(IScope scope, IASTName name) {
if (scope instanceof IASTInternalScope) { if (scope instanceof IASTInternalScope) {
try {
((IASTInternalScope) scope).addName(name); ((IASTInternalScope) scope).addName(name);
} catch (DOMException e) {
// name is not cached in scope
}
} }
} }
public static boolean isStatic(IFunction func, boolean resolveAll) throws DOMException { public static boolean isStatic(IFunction func, boolean resolveAll) {
if (func instanceof ICPPInternalFunction) { if (func instanceof ICPPInternalFunction) {
return ((ICPPInternalFunction)func).isStatic(resolveAll); return ((ICPPInternalFunction)func).isStatic(resolveAll);
} }
@ -100,8 +95,7 @@ public class ASTInternal {
} }
} }
if (decls != null) { if (decls != null) {
for (int i = 0; i < decls.length; i++) { for (final IASTNode node : decls) {
final IASTNode node= decls[i];
if (node != null) { if (node != null) {
if ( (filePath= isPartOfSource(filePath, node)) == null) { if ( (filePath= isPartOfSource(filePath, node)) == null) {
return null; return null;
@ -153,8 +147,7 @@ public class ASTInternal {
filePath= def.getContainingFilename(); filePath= def.getContainingFilename();
} }
if (decls != null) { if (decls != null) {
for (int i = 0; i < decls.length; i++) { for (final IASTNode node : decls) {
final IASTNode node= decls[i];
if (node != null) { if (node != null) {
final String fn = node.getContainingFilename(); final String fn = node.getContainingFilename();
if (filePath == null) { if (filePath == null) {

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,7 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser; 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.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding; 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 * 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). * 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 * 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 * Can be called during ambiguity resolution to populate a scope without considering

View file

@ -13,8 +13,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser; 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.ILinkage;
import org.eclipse.cdt.core.dom.IName; import org.eclipse.cdt.core.dom.IName;
import org.eclipse.cdt.core.dom.ast.DOMException; 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.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IScope; import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType; 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.index.IIndexFileSet;
import org.eclipse.cdt.core.parser.util.CharArrayUtils; import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.internal.core.dom.Linkage; 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.cdt.internal.core.parser.ParserMessages;
import org.eclipse.core.runtime.PlatformObject; import org.eclipse.core.runtime.PlatformObject;
import com.ibm.icu.text.MessageFormat;
/** /**
* Implementation of problem bindings * Implementation of problem bindings
*/ */
@ -172,8 +173,8 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String) * @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
*/ */
public IBinding[] find(String name) throws DOMException { public IBinding[] find(String name) {
throw new DOMException(this); return IBinding.EMPTY_BINDING_ARRAY;
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -186,34 +187,32 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IScope#addName(org.eclipse.cdt.core.dom.ast.IASTName) * @see org.eclipse.cdt.core.dom.ast.IScope#addName(org.eclipse.cdt.core.dom.ast.IASTName)
*/ */
public void addName(IASTName name) throws DOMException { public void addName(IASTName name) {
throw new DOMException(this);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean) * @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 { public IBinding getBinding(IASTName name, boolean resolve) {
throw new DOMException(this); return null;
} }
public final IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix) public final IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix) {
throws DOMException { return IBinding.EMPTY_BINDING_ARRAY;
throw new DOMException(this);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean) * @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 { public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) {
throw new DOMException(this); return null;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean) * @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 { public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) {
throw new DOMException(this); return IBinding.EMPTY_BINDING_ARRAY;
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -239,8 +238,7 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
return -1; return -1;
} }
public void addBinding(IBinding binding) throws DOMException { public void addBinding(IBinding binding) {
throw new DOMException(this);
} }
public ILinkage getLinkage() { public ILinkage getLinkage() {
@ -252,7 +250,7 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
return getMessage(); return getMessage();
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
return node instanceof IASTName ? CPPVisitor.findNameOwner((IASTName) node, true) : null; 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() { 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;
}
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -16,7 +16,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; 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.IASTArraySubscriptExpression;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression; import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTCastExpression; import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
@ -862,14 +861,10 @@ public class Value implements IValue {
* Computes a signature for an unknown binding. * Computes a signature for an unknown binding.
*/ */
private static String getSignatureForUnknown(ICPPUnknownBinding binding) { private static String getSignatureForUnknown(ICPPUnknownBinding binding) {
try {
IBinding owner= binding.getOwner(); IBinding owner= binding.getOwner();
if (owner instanceof IType) { if (owner instanceof IType) {
return ASTTypeUtil.getType((IType) owner, true) + SCOPE_OP + binding.getName(); return ASTTypeUtil.getType((IType) owner, true) + SCOPE_OP + binding.getName();
} }
} catch (DOMException e) {
// ignore qualification
}
return binding.getName(); return binding.getName();
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,7 +13,6 @@
package org.eclipse.cdt.internal.core.dom.parser.c; package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor; 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.IASTCompletionContext;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator; import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
@ -122,7 +121,6 @@ public class CASTElaboratedTypeSpecifier extends CASTBaseDeclSpecifier implement
IBinding b= result[i]; IBinding b= result[i];
if (b instanceof ICompositeType) { if (b instanceof ICompositeType) {
ICompositeType ct= (ICompositeType) b; ICompositeType ct= (ICompositeType) b;
try {
switch (ct.getKey()) { switch (ct.getKey()) {
case ICompositeType.k_struct: case ICompositeType.k_struct:
if (getKind() != k_struct) if (getKind() != k_struct)
@ -133,9 +131,6 @@ public class CASTElaboratedTypeSpecifier extends CASTBaseDeclSpecifier implement
b= null; b= null;
break; break;
} }
} catch (DOMException e) {
// ignore and propose binding
}
} else if (b instanceof IEnumeration) { } else if (b instanceof IEnumeration) {
if (getKind() != k_enum) if (getKind() != k_enum)
b= null; b= null;

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,10 +13,8 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c; 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.ILinkage;
import org.eclipse.cdt.core.dom.ast.ASTVisitor; 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.IASTCompletionContext;
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
@ -223,7 +221,6 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
if (bindings[i] instanceof ICompositeType) { if (bindings[i] instanceof ICompositeType) {
ICompositeType type = (ICompositeType) bindings[i]; ICompositeType type = (ICompositeType) bindings[i];
try {
switch (type.getKey()) { switch (type.getKey()) {
case ICompositeType.k_struct: case ICompositeType.k_struct:
if (kind != IASTElaboratedTypeSpecifier.k_struct) { if (kind != IASTElaboratedTypeSpecifier.k_struct) {
@ -236,10 +233,6 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
} }
break; break;
} }
} catch (DOMException e) {
bindings[i] = null;
CCorePlugin.log(e);
}
} else { } else {
bindings[i]= null; bindings[i]= null;
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,7 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c; 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.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IScope; import org.eclipse.cdt.core.dom.ast.IScope;
@ -72,7 +71,7 @@ public class CBuiltinVariable extends CVariable {
@Override @Override
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
return null; return null;
} }
} }

View file

@ -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.ILinkage;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty; 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.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier; import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
@ -176,7 +175,7 @@ public class CEnumeration extends PlatformObject implements IEnumeration, ICInte
return definition; return definition;
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
IASTNode node= definition; IASTNode node= definition;
if (node == null && declarations != null && declarations.length > 0) { if (node == null && declarations != null && declarations.length > 0) {
node= declarations[0]; node= declarations[0];

View file

@ -12,7 +12,6 @@
package org.eclipse.cdt.internal.core.dom.parser.c; package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ILinkage; 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;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator; import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
import org.eclipse.cdt.core.dom.ast.IASTName; 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 static class CEnumeratorProblem extends ProblemBinding implements IEnumerator {
public CEnumeratorProblem(IASTNode node, int id, char[] arg) { public CEnumeratorProblem(IASTNode node, int id, char[] arg) {
super(node, id, arg); super(node, id, arg);
}
public IType getType() throws DOMException {
throw new DOMException(this);
} }
public IValue getValue() { public IValue getValue() {
return Value.UNKNOWN; return Value.UNKNOWN;

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * 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; 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.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.ICompositeType; import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.IField; import org.eclipse.cdt.core.dom.ast.IField;
import org.eclipse.cdt.core.dom.ast.c.ICCompositeTypeScope; import org.eclipse.cdt.core.dom.ast.c.ICCompositeTypeScope;
/**
* Created on Nov 8, 2004
* @author aniefer
*/
public class CField extends CVariable implements IField { public class CField extends CVariable implements IField {
public static class CFieldProblem extends CVariable.CVariableProblem implements IField { public static class CFieldProblem extends CVariable.CVariableProblem implements IField {
public CFieldProblem(IASTNode node, int id, char[] arg) { private ICompositeType fOwner;
public CFieldProblem(ICompositeType owner, IASTNode node, int id, char[] arg) {
super(node, id, arg); super(node, id, arg);
fOwner = owner;
} }
public ICompositeType getCompositeTypeOwner() throws DOMException { public ICompositeType getCompositeTypeOwner() {
throw new DOMException(this); return fOwner;
} }
} }
/**
* @param name
*/
public CField(IASTName name) { public CField(IASTName name) {
super(name); super(name);
} }
public ICompositeType getCompositeTypeOwner() throws DOMException { public ICompositeType getCompositeTypeOwner() {
ICCompositeTypeScope scope = (ICCompositeTypeScope) getScope(); ICCompositeTypeScope scope = (ICCompositeTypeScope) getScope();
return scope.getCompositeType(); return scope.getCompositeType();
} }
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,7 +12,6 @@
package org.eclipse.cdt.internal.core.dom.parser.c; package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ILinkage; 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.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator; import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
@ -472,7 +471,7 @@ public class CFunction extends PlatformObject implements IFunction, ICInternalFu
return definition; return definition;
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
return null; return null;
} }
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * 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; 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.EScopeKind;
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement; import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition; 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.IBinding;
import org.eclipse.cdt.core.dom.ast.ILabel; import org.eclipse.cdt.core.dom.ast.ILabel;
import org.eclipse.cdt.core.dom.ast.IScope; 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.dom.ast.c.ICFunctionScope;
import org.eclipse.cdt.core.parser.util.ArrayUtil; import org.eclipse.cdt.core.parser.util.ArrayUtil;
/**
* Created on Nov 8, 2004
* @author aniefer
*/
public class CFunctionScope extends CScope implements ICFunctionScope { public class CFunctionScope extends CScope implements ICFunctionScope {
public CFunctionScope( IASTFunctionDefinition function ){ public CFunctionScope( IASTFunctionDefinition function ){
super( function, EScopeKind.eLocal); super( function, EScopeKind.eLocal);
@ -67,7 +62,7 @@ public class CFunctionScope extends CScope implements ICFunctionScope {
return (ILabel[]) ArrayUtil.trim( ILabel.class, result ); return (ILabel[]) ArrayUtil.trim( ILabel.class, result );
} }
static private class FindLabelsAction extends CASTVisitor { static private class FindLabelsAction extends ASTVisitor {
public IASTLabelStatement [] labels = null; public IASTLabelStatement [] labels = null;
public FindLabelsAction(){ public FindLabelsAction(){

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,7 +12,6 @@
package org.eclipse.cdt.internal.core.dom.parser.c; package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ILinkage; 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.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
@ -123,7 +122,7 @@ public class CKnRParameter extends PlatformObject implements IParameter {
return Linkage.C_LINKAGE; return Linkage.C_LINKAGE;
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
return CVisitor.findEnclosingFunction(declaration); return CVisitor.findEnclosingFunction(declaration);
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,7 +12,6 @@
package org.eclipse.cdt.internal.core.dom.parser.c; package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ILinkage; 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.IASTLabelStatement;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
@ -20,7 +19,6 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ILabel; import org.eclipse.cdt.core.dom.ast.ILabel;
import org.eclipse.cdt.core.dom.ast.IScope; import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.internal.core.dom.Linkage; import org.eclipse.cdt.internal.core.dom.Linkage;
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
import org.eclipse.core.runtime.PlatformObject; import org.eclipse.core.runtime.PlatformObject;
/** /**
@ -28,16 +26,6 @@ import org.eclipse.core.runtime.PlatformObject;
*/ */
public class CLabel extends PlatformObject implements ILabel { 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; private final IASTName labelStatement;
public CLabel(IASTName statement) { public CLabel(IASTName statement) {
@ -49,14 +37,18 @@ public class CLabel extends PlatformObject implements ILabel {
return labelStatement; return labelStatement;
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.ILabel#getLabelStatement() * @see org.eclipse.cdt.core.dom.ast.ILabel#getLabelStatement()
*/ */
public IASTLabelStatement getLabelStatement() { public IASTLabelStatement getLabelStatement() {
return (IASTLabelStatement) labelStatement.getParent(); return (IASTLabelStatement) labelStatement.getParent();
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName() * @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
*/ */
public String getName() { public String getName() {
@ -67,7 +59,9 @@ public class CLabel extends PlatformObject implements ILabel {
return labelStatement.toCharArray(); return labelStatement.toCharArray();
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope() * @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
*/ */
public IScope getScope() { public IScope getScope() {
@ -78,7 +72,7 @@ public class CLabel extends PlatformObject implements ILabel {
return Linkage.C_LINKAGE; return Linkage.C_LINKAGE;
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
return CVisitor.findEnclosingFunction(labelStatement); return CVisitor.findEnclosingFunction(labelStatement);
} }
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,7 +12,6 @@
package org.eclipse.cdt.internal.core.dom.parser.c; package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ILinkage; 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.IASTCompoundStatement;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
@ -42,24 +41,6 @@ public class CParameter extends PlatformObject implements IParameter {
public CParameterProblem(IASTNode node, int id, char[] arg) { public CParameterProblem(IASTNode node, int id, char[] arg) {
super(node, id, 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;
}
} }
private IASTName[] declarations; private IASTName[] declarations;
@ -69,7 +50,9 @@ public class CParameter extends PlatformObject implements IParameter {
this.declarations = new IASTName[] { parameterName }; this.declarations = new IASTName[] { parameterName };
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IVariable#getType() * @see org.eclipse.cdt.core.dom.ast.IVariable#getType()
*/ */
@ -87,8 +70,8 @@ public class CParameter extends PlatformObject implements IParameter {
while (!(node instanceof IASTDeclaration)) while (!(node instanceof IASTDeclaration))
node = node.getParent(); node = node.getParent();
if (node.getPropertyInParent() == ICASTKnRFunctionDeclarator.FUNCTION_PARAMETER || if (node.getPropertyInParent() == ICASTKnRFunctionDeclarator.FUNCTION_PARAMETER
node instanceof IASTFunctionDefinition) { || node instanceof IASTFunctionDefinition) {
return declarations[i]; return declarations[i];
} }
} }
@ -97,7 +80,9 @@ public class CParameter extends PlatformObject implements IParameter {
return null; return null;
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName() * @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
*/ */
public String getName() { public String getName() {
@ -114,13 +99,15 @@ public class CParameter extends PlatformObject implements IParameter {
return CVisitor.EMPTY_CHAR_ARRAY; return CVisitor.EMPTY_CHAR_ARRAY;
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope() * @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
*/ */
public IScope getScope() { public IScope getScope() {
// IASTParameterDeclaration or IASTSimpleDeclaration // IASTParameterDeclaration or IASTSimpleDeclaration
for (int i = 0; i < declarations.length; i++) { for (IASTName declaration : declarations) {
IASTNode parent = declarations[i].getParent(); IASTNode parent = declaration.getParent();
if (parent instanceof ICASTKnRFunctionDeclarator) { if (parent instanceof ICASTKnRFunctionDeclarator) {
parent = parent.getParent(); parent = parent.getParent();
return ((IASTCompoundStatement) ((IASTFunctionDefinition) parent).getBody()).getScope(); return ((IASTCompoundStatement) ((IASTFunctionDefinition) parent).getBody()).getScope();
@ -147,28 +134,36 @@ public class CParameter extends PlatformObject implements IParameter {
declarations = (IASTName[]) ArrayUtil.append(IASTName.class, declarations, name); declarations = (IASTName[]) ArrayUtil.append(IASTName.class, declarations, name);
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IVariable#isStatic() * @see org.eclipse.cdt.core.dom.ast.IVariable#isStatic()
*/ */
public boolean isStatic() { public boolean isStatic() {
return false; return false;
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IVariable#isExtern() * @see org.eclipse.cdt.core.dom.ast.IVariable#isExtern()
*/ */
public boolean isExtern() { public boolean isExtern() {
return false; return false;
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto() * @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto()
*/ */
public boolean isAuto() { public boolean isAuto() {
return hasStorageClass(IASTDeclSpecifier.sc_auto); return hasStorageClass(IASTDeclSpecifier.sc_auto);
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IVariable#isRegister() * @see org.eclipse.cdt.core.dom.ast.IVariable#isRegister()
*/ */
public boolean isRegister() { public boolean isRegister() {
@ -200,7 +195,7 @@ public class CParameter extends PlatformObject implements IParameter {
return Linkage.C_LINKAGE; return Linkage.C_LINKAGE;
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
if (declarations == null || declarations.length == 0) if (declarations == null || declarations.length == 0)
return null; return null;

View file

@ -17,7 +17,7 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ILinkage; import org.eclipse.cdt.core.dom.ILinkage;
import org.eclipse.cdt.core.dom.IName; import org.eclipse.cdt.core.dom.IName;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty; 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.EScopeKind;
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement; 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.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier; 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.IASTForStatement;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition; 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.ICompositeType;
import org.eclipse.cdt.core.dom.ast.IEnumeration; import org.eclipse.cdt.core.dom.ast.IEnumeration;
import org.eclipse.cdt.core.dom.ast.IScope; 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.ICASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTEnumerationSpecifier; import org.eclipse.cdt.core.dom.ast.c.ICASTEnumerationSpecifier;
@ -129,7 +128,7 @@ public class CScope implements ICScope, IASTInternalScope {
return CVisitor.getContainingScope( physicalNode ); return CVisitor.getContainingScope( physicalNode );
} }
protected static class CollectNamesAction extends CASTVisitor { protected static class CollectNamesAction extends ASTVisitor {
private char [] name; private char [] name;
private IASTName [] result = null; private IASTName [] result = null;
CollectNamesAction( char [] n ){ CollectNamesAction( char [] n ){
@ -163,7 +162,7 @@ public class CScope implements ICScope, IASTInternalScope {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String) * @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); return CVisitor.findBindings(this, name);
} }
@ -235,7 +234,7 @@ public class CScope implements ICScope, IASTInternalScope {
return getBinding(name, resolve, IIndexFileSet.EMPTY); 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); return getBindings(name, resolve, prefix, IIndexFileSet.EMPTY);
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -50,20 +50,21 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
public CStructureProblem(IASTNode node, int id, char[] arg) { public CStructureProblem(IASTNode node, int id, char[] arg) {
super(node, id, 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 int getKey() {
} return k_struct;
public boolean isAnonymous() throws DOMException {
throw new DOMException(this);
} }
} }
@ -108,7 +109,9 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
checked = true; checked = true;
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName() * @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
*/ */
public String getName() { public String getName() {
@ -117,6 +120,7 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
return declarations[0].toString(); return declarations[0].toString();
} }
public char[] getNameCharArray() { public char[] getNameCharArray() {
if (definition != null) if (definition != null)
return definition.toCharArray(); return definition.toCharArray();
@ -124,11 +128,14 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
return declarations[0].toCharArray(); return declarations[0].toCharArray();
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope() * @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
*/ */
public IScope getScope() throws DOMException { 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); IScope scope = CVisitor.getContainingScope(declSpec);
while (scope instanceof ICCompositeTypeScope) { while (scope instanceof ICCompositeTypeScope) {
scope = scope.getParent(); scope = scope.getParent();
@ -136,15 +143,16 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
return scope; return scope;
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getFields() * @see org.eclipse.cdt.core.dom.ast.ICompositeType#getFields()
*/ */
public IField[] getFields() throws DOMException { public IField[] getFields() {
checkForDefinition(); checkForDefinition();
if (definition == null) { if (definition == null) {
return new IField[] { return new IField[] { new CField.CFieldProblem(this, declarations[0],
new CField.CFieldProblem(declarations[0], IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray()) IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray()) };
};
} }
ICASTCompositeTypeSpecifier compSpec = (ICASTCompositeTypeSpecifier) definition.getParent(); ICASTCompositeTypeSpecifier compSpec = (ICASTCompositeTypeSpecifier) definition.getParent();
IField[] fields = collectFields(compSpec, null); IField[] fields = collectFields(compSpec, null);
@ -178,10 +186,11 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
return fields; return fields;
} }
public IField findField(String name) throws DOMException { public IField findField(String name) {
IScope scope = getCompositeScope(); IScope scope = getCompositeScope();
if (scope == null) { 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()); final CASTName astName = new CASTName(name.toCharArray());
@ -193,7 +202,9 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
return null; return null;
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getKey() * @see org.eclipse.cdt.core.dom.ast.ICompositeType#getKey()
*/ */
public int getKey() { public int getKey() {
@ -201,7 +212,9 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
: ((IASTElaboratedTypeSpecifier) declarations[0].getParent()).getKind(); : ((IASTElaboratedTypeSpecifier) declarations[0].getParent()).getKind();
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getCompositeScope() * @see org.eclipse.cdt.core.dom.ast.ICompositeType#getCompositeScope()
*/ */
public IScope getCompositeScope() { public IScope getCompositeScope() {
@ -211,13 +224,9 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
} }
// fwd-declarations must be backed up from the index // fwd-declarations must be backed up from the index
if (typeInIndex != null) { if (typeInIndex != null) {
try {
IScope scope = typeInIndex.getCompositeScope(); IScope scope = typeInIndex.getCompositeScope();
if (scope instanceof ICCompositeTypeScope) if (scope instanceof ICCompositeTypeScope)
return scope; return scope;
} catch (DOMException e) {
// index bindings don't throw DOMExeptions.
}
} }
return null; return null;
} }
@ -257,8 +266,9 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
declarations = (IASTName[]) ArrayUtil.append(IASTName.class, declarations, decl); declarations = (IASTName[]) ArrayUtil.append(IASTName.class, declarations, decl);
} }
/*
/* (non-Javadoc) * (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType) * @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
*/ */
public boolean isSameType(IType type) { public boolean isSameType(IType type) {
@ -281,7 +291,7 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
return definition; return definition;
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
IASTNode node = definition; IASTNode node = definition;
if (node == null) { if (node == null) {
if (declarations != null && declarations.length > 0) { if (declarations != null && declarations.length > 0) {
@ -298,7 +308,7 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
return null; return null;
} }
public boolean isAnonymous() throws DOMException { public boolean isAnonymous() {
if (getNameCharArray().length > 0 || definition == null) if (getNameCharArray().length > 0 || definition == null)
return false; return false;

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,7 +12,6 @@
package org.eclipse.cdt.internal.core.dom.parser.c; package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ILinkage; 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.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
@ -111,7 +110,7 @@ public class CTypedef extends PlatformObject implements ITypedef, ITypeContainer
return name; return name;
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
return CVisitor.findEnclosingFunction(name); return CVisitor.findEnclosingFunction(name);
} }
} }

View file

@ -12,7 +12,6 @@
package org.eclipse.cdt.internal.core.dom.parser.c; package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ILinkage; 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.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator; import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
@ -44,32 +43,15 @@ public class CVariable extends PlatformObject implements IInternalVariable, ICIn
public CVariableProblem(IASTNode node, int id, char[] arg) { public CVariableProblem(IASTNode node, int id, char[] arg) {
super(node, id, 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;
}
}
private IASTName[] declarations = null; private IASTName[] declarations = null;
private IType type = null; private IType type = null;
public CVariable(IASTName name) { public CVariable(IASTName name) {
declarations = new IASTName[] { name }; declarations = new IASTName[] { name };
} }
public IASTNode getPhysicalNode() { public IASTNode getPhysicalNode() {
return declarations[0]; return declarations[0];
} }
@ -80,7 +62,9 @@ public class CVariable extends PlatformObject implements IInternalVariable, ICIn
} }
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IVariable#getType() * @see org.eclipse.cdt.core.dom.ast.IVariable#getType()
*/ */
public IType getType() { public IType getType() {
@ -89,7 +73,9 @@ public class CVariable extends PlatformObject implements IInternalVariable, ICIn
return type; return type;
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName() * @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
*/ */
public String getName() { public String getName() {
@ -100,7 +86,9 @@ public class CVariable extends PlatformObject implements IInternalVariable, ICIn
return declarations[0].toCharArray(); return declarations[0].toCharArray();
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope() * @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
*/ */
public IScope getScope() { public IScope getScope() {
@ -133,21 +121,27 @@ public class CVariable extends PlatformObject implements IInternalVariable, ICIn
return false; return false;
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IVariable#isExtern() * @see org.eclipse.cdt.core.dom.ast.IVariable#isExtern()
*/ */
public boolean isExtern() { public boolean isExtern() {
return hasStorageClass(IASTDeclSpecifier.sc_extern); return hasStorageClass(IASTDeclSpecifier.sc_extern);
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto() * @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto()
*/ */
public boolean isAuto() { public boolean isAuto() {
return hasStorageClass(IASTDeclSpecifier.sc_auto); return hasStorageClass(IASTDeclSpecifier.sc_auto);
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IVariable#isRegister() * @see org.eclipse.cdt.core.dom.ast.IVariable#isRegister()
*/ */
public boolean isRegister() { public boolean isRegister() {
@ -166,7 +160,7 @@ public class CVariable extends PlatformObject implements IInternalVariable, ICIn
return getPhysicalNode(); return getPhysicalNode();
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
if (declarations == null || declarations.length == 0) if (declarations == null || declarations.length == 0)
return null; return null;
@ -195,7 +189,8 @@ public class CVariable extends PlatformObject implements IInternalVariable, ICIn
if (dtor != null) { if (dtor != null) {
IASTInitializer init = dtor.getInitializer(); IASTInitializer init = dtor.getInitializer();
if (init instanceof IASTEqualsInitializer) { if (init instanceof IASTEqualsInitializer) {
final IASTInitializerClause initClause = ((IASTEqualsInitializer) init).getInitializerClause(); final IASTInitializerClause initClause = ((IASTEqualsInitializer) init)
.getInitializerClause();
if (initClause instanceof IASTExpression) { if (initClause instanceof IASTExpression) {
return Value.create((IASTExpression) initClause, maxDepth); return Value.create((IASTExpression) initClause, maxDepth);
} }

View file

@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty; 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.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator; import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier; 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.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.IVariable; 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.ICASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier; import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier; 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. * Collection of methods to find information in an AST.
*/ */
public class CVisitor extends ASTQueries { public class CVisitor extends ASTQueries {
public static class CollectProblemsAction extends CASTVisitor { public static class CollectProblemsAction extends ASTVisitor {
{ {
shouldVisitDeclarations = true; shouldVisitDeclarations = true;
shouldVisitExpressions = 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; shouldVisitDeclarators = true;
shouldVisitDeclSpecifiers = 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 static final int DEFAULT_LIST_SIZE = 8;
private IASTName[] refs; private IASTName[] refs;
private IBinding binding; private IBinding binding;
@ -476,10 +476,7 @@ public class CVisitor extends ASTQueries {
IScope scope = getContainingScope(enumeration); IScope scope = getContainingScope(enumeration);
IBinding binding= null; IBinding binding= null;
if (scope != null) { if (scope != null) {
try {
binding = scope.getBinding(name, false); binding = scope.getBinding(name, false);
} catch (DOMException e) {
}
} }
if (binding != null && !(binding instanceof IIndexBinding) && name.isActive()) { if (binding != null && !(binding instanceof IIndexBinding) && name.isActive()) {
if (binding instanceof IEnumeration) { if (binding instanceof IEnumeration) {
@ -516,7 +513,7 @@ public class CVisitor extends ASTQueries {
} }
} }
//label not found //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) { } else if (statement instanceof IASTLabelStatement) {
IASTName name = ((IASTLabelStatement)statement).getName(); IASTName name = ((IASTLabelStatement)statement).getName();
@ -558,7 +555,6 @@ public class CVisitor extends ASTQueries {
binding= resolveBinding(elabTypeSpec); binding= resolveBinding(elabTypeSpec);
if (binding == null) { if (binding == null) {
insertIntoScope= elabTypeSpec.getTranslationUnit().getScope(); insertIntoScope= elabTypeSpec.getTranslationUnit().getScope();
try {
binding= insertIntoScope.getBinding(name, false); binding= insertIntoScope.getBinding(name, false);
if (binding != null && name.isActive()) { if (binding != null && name.isActive()) {
if (binding instanceof CEnumeration) { if (binding instanceof CEnumeration) {
@ -567,8 +563,6 @@ public class CVisitor extends ASTQueries {
((CStructure) binding).addDeclaration(name); ((CStructure) binding).addDeclaration(name);
} }
} }
} catch (DOMException e) {
}
} }
} }
if (binding == null) { if (binding == null) {
@ -612,7 +606,6 @@ public class CVisitor extends ASTQueries {
} }
if (prefix) { if (prefix) {
IBinding[] result = null; IBinding[] result = null;
try {
char[] p = fieldReference.getFieldName().toCharArray(); char[] p = fieldReference.getFieldName().toCharArray();
IField[] fields = ((ICompositeType) type).getFields(); IField[] fields = ((ICompositeType) type).getFields();
for (IField field : fields) { for (IField field : fields) {
@ -621,22 +614,14 @@ public class CVisitor extends ASTQueries {
} }
} }
return ArrayUtil.trim(IBinding.class, result); return ArrayUtil.trim(IBinding.class, result);
} catch (DOMException e) {
return new IBinding[] { e.getProblem() };
} }
}
try {
return ((ICompositeType) type).findField(fieldReference.getFieldName().toString()); return ((ICompositeType) type).findField(fieldReference.getFieldName().toString());
} catch (DOMException e) {
return e.getProblem();
}
} }
return null; return null;
} }
static IType getPtrDiffType(IASTBinaryExpression expr) { static IType getPtrDiffType(IASTBinaryExpression expr) {
IScope scope = getContainingScope(expr); IScope scope = getContainingScope(expr);
try {
IBinding[] bs = scope.find(PTRDIFF_T); IBinding[] bs = scope.find(PTRDIFF_T);
for (IBinding b : bs) { for (IBinding b : bs) {
if (b instanceof IType) { if (b instanceof IType) {
@ -646,15 +631,12 @@ public class CVisitor extends ASTQueries {
} }
} }
} }
} catch (DOMException e) {
}
return new CBasicType(Kind.eInt, 0, expr); return new CBasicType(Kind.eInt, 0, expr);
} }
static IType getSize_T(IASTExpression expr) { static IType getSize_T(IASTExpression expr) {
IScope scope = getContainingScope(expr); IScope scope = getContainingScope(expr);
try {
IBinding[] bs = scope.find(SIZE_T); IBinding[] bs = scope.find(SIZE_T);
for (IBinding b : bs) { for (IBinding b : bs) {
if (b instanceof IType) { if (b instanceof IType) {
@ -664,8 +646,6 @@ public class CVisitor extends ASTQueries {
} }
} }
} }
} catch (DOMException e) {
}
return new CBasicType(Kind.eInt, IBasicType.IS_LONG | IBasicType.IS_UNSIGNED); 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 (declarator instanceof ICASTKnRFunctionDeclarator) {
if (CharArrayUtils.equals(declarator.getName().toCharArray(), name.toCharArray())) { if (CharArrayUtils.equals(declarator.getName().toCharArray(), name.toCharArray())) {
IScope scope= CVisitor.getContainingScope(declarator); IScope scope= CVisitor.getContainingScope(declarator);
try {
binding = scope.getBinding(name, false); binding = scope.getBinding(name, false);
} catch (DOMException e) {
}
if (binding != null && !(binding instanceof IIndexBinding) && name.isActive()) { if (binding != null && !(binding instanceof IIndexBinding) && name.isActive()) {
if (binding instanceof ICInternalFunction) if (binding instanceof ICInternalFunction)
((ICInternalFunction)binding).addDeclarator(declarator); ((ICInternalFunction)binding).addDeclarator(declarator);
@ -725,11 +702,7 @@ public class CVisitor extends ASTQueries {
IASTName name = declarator.getName(); IASTName name = declarator.getName();
IBinding binding = null; IBinding binding = (scope != null) ? scope.getBinding(name, false) : null;
try {
binding = (scope != null) ? scope.getBinding(name, false) : null;
} catch (DOMException e1) {
}
boolean isFunction= false; boolean isFunction= false;
if (parent instanceof IASTParameterDeclaration || parent.getPropertyInParent() == ICASTKnRFunctionDeclarator.FUNCTION_PARAMETER) { if (parent instanceof IASTParameterDeclaration || parent.getPropertyInParent() == ICASTKnRFunctionDeclarator.FUNCTION_PARAMETER) {
@ -830,26 +803,17 @@ public class CVisitor extends ASTQueries {
IASTFunctionDeclarator functionDeclartor = functionDef.getDeclarator(); IASTFunctionDeclarator functionDeclartor = functionDef.getDeclarator();
IASTName name = findInnermostDeclarator(functionDeclartor).getName(); IASTName name = findInnermostDeclarator(functionDeclartor).getName();
IScope scope = getContainingScope(node); IScope scope = getContainingScope(node);
try {
return lookup(scope, name); return lookup(scope, name);
} catch (DOMException e) {
return null;
}
} else if (node instanceof IASTIdExpression) { } else if (node instanceof IASTIdExpression) {
IScope scope = getContainingScope(node); IScope scope = getContainingScope(node);
try {
IBinding binding = lookup(scope, ((IASTIdExpression) node).getName()); IBinding binding = lookup(scope, ((IASTIdExpression) node).getName());
if (binding instanceof IType && !(binding instanceof IProblemBinding) ) { if (binding instanceof IType && !(binding instanceof IProblemBinding) ) {
return new ProblemBinding(node, IProblemBinding.SEMANTIC_INVALID_TYPE, return new ProblemBinding(node, IProblemBinding.SEMANTIC_INVALID_TYPE,
binding.getNameCharArray(), new IBinding[] { binding }); binding.getNameCharArray(), new IBinding[] { binding });
} }
return binding; return binding;
} catch (DOMException e) {
return null;
}
} else if (node instanceof ICASTTypedefNameSpecifier) { } else if (node instanceof ICASTTypedefNameSpecifier) {
IScope scope = getContainingScope(node); IScope scope = getContainingScope(node);
try {
IASTName name= ((ICASTTypedefNameSpecifier) node).getName(); IASTName name= ((ICASTTypedefNameSpecifier) node).getName();
IBinding binding = lookup(scope, name); IBinding binding = lookup(scope, name);
if (binding == null) if (binding == null)
@ -858,23 +822,12 @@ public class CVisitor extends ASTQueries {
return binding; return binding;
return new ProblemBinding(node, IProblemBinding.SEMANTIC_INVALID_TYPE, binding.getNameCharArray(), return new ProblemBinding(node, IProblemBinding.SEMANTIC_INVALID_TYPE, binding.getNameCharArray(),
new IBinding[] { binding }); new IBinding[] { binding });
} catch (DOMException e) {
return null;
}
} else if (node instanceof ICASTElaboratedTypeSpecifier) { } else if (node instanceof ICASTElaboratedTypeSpecifier) {
IScope scope = getContainingScope(node); IScope scope = getContainingScope(node);
try {
return lookup(scope, ((ICASTElaboratedTypeSpecifier) node).getName()); return lookup(scope, ((ICASTElaboratedTypeSpecifier) node).getName());
} catch (DOMException e) {
return null;
}
} else if (node instanceof ICASTCompositeTypeSpecifier) { } else if (node instanceof ICASTCompositeTypeSpecifier) {
IScope scope = getContainingScope(node); IScope scope = getContainingScope(node);
try {
return lookup(scope, ((ICASTCompositeTypeSpecifier)node).getName()); return lookup(scope, ((ICASTCompositeTypeSpecifier)node).getName());
} catch (DOMException e) {
return null;
}
} else if (node instanceof IASTTypeId) { } else if (node instanceof IASTTypeId) {
IASTTypeId typeId = (IASTTypeId) node; IASTTypeId typeId = (IASTTypeId) node;
IASTDeclSpecifier declSpec = typeId.getDeclSpecifier(); IASTDeclSpecifier declSpec = typeId.getDeclSpecifier();
@ -919,11 +872,7 @@ public class CVisitor extends ASTQueries {
struct = ((IASTCompositeTypeSpecifier)simpleDecl.getDeclSpecifier()).getName().resolveBinding(); struct = ((IASTCompositeTypeSpecifier)simpleDecl.getDeclSpecifier()).getName().resolveBinding();
if (struct instanceof CStructure) { if (struct instanceof CStructure) {
try {
return ((CStructure)struct).findField(((ICASTFieldDesignator)node).getName().toString()); return ((CStructure)struct).findField(((ICASTFieldDesignator)node).getName().toString());
} catch (DOMException e) {
return e.getProblem();
}
} else if (struct instanceof ITypeContainer) { } else if (struct instanceof ITypeContainer) {
IType type; IType type;
type = ((ITypeContainer)struct).getType(); type = ((ITypeContainer)struct).getType();
@ -933,11 +882,7 @@ public class CVisitor extends ASTQueries {
if (type instanceof CStructure) if (type instanceof CStructure)
try {
return ((CStructure)type).findField(((ICASTFieldDesignator)node).getName().toString()); return ((CStructure)type).findField(((ICASTFieldDesignator)node).getName().toString());
} catch (DOMException e1) {
return e1.getProblem();
}
} }
} }
} }
@ -1069,7 +1014,7 @@ public class CVisitor extends ASTQueries {
/** /**
* Lookup for a name starting from the given scope. * 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) if (scope == null)
return null; return null;
@ -1086,15 +1031,16 @@ public class CVisitor extends ASTQueries {
} }
while (scope != null) { while (scope != null) {
try {
if (!(scope instanceof ICCompositeTypeScope)) { if (!(scope instanceof ICCompositeTypeScope)) {
IBinding binding = scope.getBinding(name, true, fileSet); IBinding binding = scope.getBinding(name, true, fileSet);
if (binding != null) if (binding != null)
return binding; return binding;
} }
} catch (DOMException e) { try {
}
scope= scope.getParent(); scope= scope.getParent();
} catch (DOMException e) {
scope= null;
}
} }
return externalBinding(tu, name); return externalBinding(tu, name);
@ -1123,7 +1069,6 @@ public class CVisitor extends ASTQueries {
IBinding[] result = null; IBinding[] result = null;
CharArraySet handled= new CharArraySet(1); CharArraySet handled= new CharArraySet(1);
while (scope != null) { while (scope != null) {
try {
if (!(scope instanceof ICCompositeTypeScope)) { if (!(scope instanceof ICCompositeTypeScope)) {
IBinding[] bindings= scope.getBindings(name, true, true, fileSet); IBinding[] bindings= scope.getBindings(name, true, true, fileSet);
for (IBinding b : bindings) { for (IBinding b : bindings) {
@ -1139,8 +1084,6 @@ public class CVisitor extends ASTQueries {
handled.put(n); handled.put(n);
} }
} }
} catch (DOMException e) {
}
scope= scope.getParent(); scope= scope.getParent();
} }
@ -1534,7 +1477,7 @@ public class CVisitor extends ASTQueries {
return (IBinding[]) ArrayUtil.trim(IBinding.class, result); 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()); CASTName astName = new CASTName(name.toCharArray());
//normal names //normal names
@ -1573,7 +1516,11 @@ public class CVisitor extends ASTQueries {
} }
break; break;
} }
try {
scope = scope.getParent(); scope = scope.getParent();
} catch (DOMException e) {
scope= null;
}
} while (scope != null); } while (scope != null);
int c = (b1 == null ? 0 : b1.length) + (b2 == null ? 0 : b2.length) + b3.size(); int c = (b1 == null ? 0 : b1.length) + (b2 == null ? 0 : b2.length) + b3.size();

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * 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; package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
/** /**
* @author aniefer * Methods needed by CVisitor but not meant for public interface
*/ */
public interface ICInternalBinding { public interface ICInternalBinding {
//methods needed by CVisitor but not meant for public interface
public IASTNode getPhysicalNode(); public IASTNode getPhysicalNode();
/** /**

View file

@ -54,15 +54,15 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
return specialClass.getSpecializedBinding(); 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); 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); 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(); char[] c = name.getLookupKey();
if (CharArrayUtils.equals(c, specialClass.getNameCharArray()) 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, final public IBinding[] getBindings(IASTName name, boolean forceResolve, boolean prefixLookup,
IIndexFileSet fileSet) throws DOMException { IIndexFileSet fileSet) {
return getBindings(name, forceResolve, prefixLookup, fileSet, true); return getBindings(name, forceResolve, prefixLookup, fileSet, true);
} }
public IBinding[] getBindings(IASTName name, boolean forceResolve, boolean prefixLookup, public IBinding[] getBindings(IASTName name, boolean forceResolve, boolean prefixLookup,
IIndexFileSet fileSet, boolean checkPointOfDecl) throws DOMException { IIndexFileSet fileSet, boolean checkPointOfDecl) {
ICPPClassType specialized = specialClass.getSpecializedBinding(); ICPPClassType specialized = specialClass.getSpecializedBinding();
IScope classScope = specialized.getCompositeScope(); IScope classScope = specialized.getCompositeScope();
if (classScope == null) if (classScope == null)
@ -119,7 +119,7 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
return specialClass; return specialClass;
} }
public ICPPBase[] getBases() throws DOMException { public ICPPBase[] getBases() {
if (fBases == null) { if (fBases == null) {
ICPPBase[] result = null; ICPPBase[] result = null;
ICPPBase[] bases = specialClass.getSpecializedBinding().getBases(); ICPPBase[] bases = specialClass.getSpecializedBinding().getBases();
@ -175,22 +175,18 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
return newArray; return newArray;
} }
public ICPPField[] getDeclaredFields() throws DOMException { public ICPPField[] getDeclaredFields() {
ICPPField[] fields= specialClass.getSpecializedBinding().getDeclaredFields(); ICPPField[] fields= specialClass.getSpecializedBinding().getDeclaredFields();
return specializeMembers(fields); return specializeMembers(fields);
} }
public ICPPMethod[] getImplicitMethods() { public ICPPMethod[] getImplicitMethods() {
try {
ICPPClassScope origClassScope= (ICPPClassScope) specialClass.getSpecializedBinding().getCompositeScope(); ICPPClassScope origClassScope= (ICPPClassScope) specialClass.getSpecializedBinding().getCompositeScope();
if (origClassScope == null) { if (origClassScope == null) {
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY; return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
} }
ICPPMethod[] methods= origClassScope.getImplicitMethods(); ICPPMethod[] methods= origClassScope.getImplicitMethods();
return specializeMembers(methods); return specializeMembers(methods);
} catch (DOMException e) {
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
}
} }
public IName getScopeName() { public IName getScopeName() {
@ -199,22 +195,22 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
return null; return null;
} }
public ICPPConstructor[] getConstructors() throws DOMException { public ICPPConstructor[] getConstructors() {
ICPPConstructor[] ctors= specialClass.getSpecializedBinding().getConstructors(); ICPPConstructor[] ctors= specialClass.getSpecializedBinding().getConstructors();
return specializeMembers(ctors); return specializeMembers(ctors);
} }
public ICPPMethod[] getDeclaredMethods() throws DOMException { public ICPPMethod[] getDeclaredMethods() {
ICPPMethod[] bindings = specialClass.getSpecializedBinding().getDeclaredMethods(); ICPPMethod[] bindings = specialClass.getSpecializedBinding().getDeclaredMethods();
return specializeMembers(bindings); return specializeMembers(bindings);
} }
public ICPPClassType[] getNestedClasses() throws DOMException { public ICPPClassType[] getNestedClasses() {
ICPPClassType[] bindings = specialClass.getSpecializedBinding().getNestedClasses(); ICPPClassType[] bindings = specialClass.getSpecializedBinding().getNestedClasses();
return specializeMembers(bindings); return specializeMembers(bindings);
} }
public IBinding[] getFriends() throws DOMException { public IBinding[] getFriends() {
// not yet supported // not yet supported
return IBinding.EMPTY_BINDING_ARRAY; return IBinding.EMPTY_BINDING_ARRAY;
} }
@ -230,7 +226,7 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
return getOriginalClassType().getScope(); return getOriginalClassType().getScope();
} }
public IBinding[] find(String name) throws DOMException { public IBinding[] find(String name) {
return CPPSemantics.findBindings(this, name, false); return CPPSemantics.findBindings(this, name, false);
} }

View file

@ -16,7 +16,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.eclipse.cdt.core.dom.ast.ASTVisitor; 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.IASTName;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICPPASTCompletionContext; import org.eclipse.cdt.core.dom.ast.ICPPASTCompletionContext;
@ -129,14 +128,11 @@ public class CPPASTBaseSpecifier extends ASTNode implements ICPPASTBaseSpecifier
for (IBinding binding : bindings) { for (IBinding binding : bindings) {
if (binding instanceof ICPPClassType) { if (binding instanceof ICPPClassType) {
ICPPClassType base = (ICPPClassType) binding; ICPPClassType base = (ICPPClassType) binding;
try {
int key = base.getKey(); int key = base.getKey();
if (key == ICPPClassType.k_class && if (key == ICPPClassType.k_class &&
(classType == null || !base.isSameType(classType))) { (classType == null || !base.isSameType(classType))) {
filtered.add(base); filtered.add(base);
} }
} catch (DOMException e) {
}
} }
} }

View file

@ -13,9 +13,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTCompletionContext; import org.eclipse.cdt.core.dom.ast.IASTCompletionContext;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator; import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
@ -106,7 +104,6 @@ public class CPPASTName extends CPPASTNameBase implements ICPPASTCompletionConte
if (bindings[i] instanceof ICPPNamespace) { if (bindings[i] instanceof ICPPNamespace) {
} else if (bindings[i] instanceof ICPPClassType) { } else if (bindings[i] instanceof ICPPClassType) {
ICPPClassType type = (ICPPClassType) bindings[i]; ICPPClassType type = (ICPPClassType) bindings[i];
try {
switch (type.getKey()) { switch (type.getKey()) {
case ICompositeType.k_struct: case ICompositeType.k_struct:
if (kind != ICompositeType.k_struct) { if (kind != ICompositeType.k_struct) {
@ -124,10 +121,6 @@ public class CPPASTName extends CPPASTNameBase implements ICPPASTCompletionConte
} }
break; break;
} }
} catch (DOMException e) {
bindings[i] = null;
CCorePlugin.log(e);
}
} else { } else {
bindings[i]= null; bindings[i]= null;
} }

View file

@ -12,7 +12,6 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor; 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.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
@ -101,11 +100,7 @@ public class CPPASTNamespaceDefinition extends ASTNode implements
} }
public IScope getScope() { public IScope getScope() {
try {
return ((ICPPNamespace) fName.resolveBinding()).getNamespaceScope(); return ((ICPPNamespace) fName.resolveBinding()).getNamespaceScope();
} catch ( DOMException e ) {
return e.getProblem();
}
} }
@Override @Override

View file

@ -257,15 +257,12 @@ public class CPPASTQualifiedName extends CPPASTNameBase
List<IBinding> filtered = filterClassScopeBindings(classType, bindings, isDeclaration); List<IBinding> filtered = filterClassScopeBindings(classType, bindings, isDeclaration);
if (isDeclaration && nameMatches(classType.getNameCharArray(), if (isDeclaration && nameMatches(classType.getNameCharArray(),
n.getLookupKey(), isPrefix)) { n.getLookupKey(), isPrefix)) {
try {
ICPPConstructor[] constructors = classType.getConstructors(); ICPPConstructor[] constructors = classType.getConstructors();
for (int i = 0; i < constructors.length; i++) { for (int i = 0; i < constructors.length; i++) {
if (!constructors[i].isImplicit()) { if (!constructors[i].isImplicit()) {
filtered.add(constructors[i]); filtered.add(constructors[i]);
} }
} }
} catch (DOMException e) {
}
} }
return filtered.toArray(new IBinding[filtered.size()]); return filtered.toArray(new IBinding[filtered.size()]);
} }
@ -302,7 +299,6 @@ public class CPPASTQualifiedName extends CPPASTNameBase
List<IBinding> filtered = new ArrayList<IBinding>(); List<IBinding> filtered = new ArrayList<IBinding>();
final boolean canBeFieldAccess= canBeFieldAccess(classType); final boolean canBeFieldAccess= canBeFieldAccess(classType);
try {
for (final IBinding binding : bindings) { for (final IBinding binding : bindings) {
if (binding instanceof IField) { if (binding instanceof IField) {
IField field = (IField) binding; IField field = (IField) binding;
@ -327,8 +323,6 @@ public class CPPASTQualifiedName extends CPPASTNameBase
} }
filtered.add(binding); filtered.add(binding);
} }
} catch (DOMException e) {
}
return filtered; return filtered;
} }

View file

@ -6,64 +6,23 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * Andrew Niefer (IBM Corporation) - initial API and implementation
* Bryan Wilkinson (QNX) * Bryan Wilkinson (QNX)
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.IName; 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.IBinding;
import org.eclipse.cdt.core.dom.ast.IProblemBinding; import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.ITypedef; 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;
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.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; 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.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 { 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 ICPPASTBaseSpecifier base;
private IBinding baseClass; private IBinding baseClass;
@ -74,7 +33,7 @@ public class CPPBaseClause implements ICPPBase, ICPPInternalBase {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBase#getBaseClass() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBase#getBaseClass()
*/ */
public IBinding getBaseClass() throws DOMException { public IBinding getBaseClass() {
if (baseClass == null) { if (baseClass == null) {
IBinding b = base.getName().resolveBinding(); IBinding b = base.getName().resolveBinding();
while (b instanceof ITypedef && ((ITypedef) b).getType() instanceof IBinding) { while (b instanceof ITypedef && ((ITypedef) b).getType() instanceof IBinding) {

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * Andrew Niefer (IBM Corporation) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
/*
* Created on Nov 29, 2004
*/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.IName; 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.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope; 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 class CPPBlockScope extends CPPNamespaceScope implements ICPPBlockScope {
public CPPBlockScope( IASTNode physicalNode ){ public CPPBlockScope( IASTNode physicalNode ){
super( physicalNode ); super( physicalNode );
@ -44,7 +37,7 @@ public class CPPBlockScope extends CPPNamespaceScope implements ICPPBlockScope {
final IASTNode parent= node.getParent(); final IASTNode parent= node.getParent();
if (parent instanceof IASTFunctionDefinition) { if (parent instanceof IASTFunctionDefinition) {
IASTDeclarator dtor= ((IASTFunctionDefinition)parent).getDeclarator(); IASTDeclarator dtor= ((IASTFunctionDefinition)parent).getDeclarator();
dtor = CPPVisitor.findInnermostDeclarator(dtor); dtor = ASTQueries.findInnermostDeclarator(dtor);
return dtor.getName(); return dtor.getName();
} }
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,7 +10,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IScope; import org.eclipse.cdt.core.dom.ast.IScope;
@ -112,7 +111,7 @@ public class CPPBuiltinVariable extends CPPVariable {
} }
@Override @Override
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
return null; return null;
} }
} }

View file

@ -15,7 +15,6 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; 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.IBinding;
import org.eclipse.cdt.core.dom.ast.IProblemBinding; import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
@ -47,11 +46,7 @@ public class CPPClassInstance extends CPPClassSpecialization implements ICPPTemp
} }
public boolean isExplicitSpecialization() { public boolean isExplicitSpecialization() {
try {
return !(getCompositeScope() instanceof ICPPClassSpecializationScope); return !(getCompositeScope() instanceof ICPPClassSpecializationScope);
} catch (DOMException e) {
return false;
}
} }
@Deprecated @Deprecated

View file

@ -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.IASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration; import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTTypeId; 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.IBinding;
import org.eclipse.cdt.core.dom.ast.IProblemBinding; import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IScope; import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType; 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.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier;
@ -161,7 +161,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
} }
@Override @Override
public void addName(IASTName name) throws DOMException { public void addName(IASTName name) {
// don't add names from inactive code branches // don't add names from inactive code branches
if (!name.isActive()) if (!name.isActive())
return; return;
@ -213,7 +213,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getBinding(int, char[]) * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getBinding(int, char[])
*/ */
@Override @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(); char[] c = name.getLookupKey();
ICPPASTCompositeTypeSpecifier compType = (ICPPASTCompositeTypeSpecifier) getPhysicalNode(); ICPPASTCompositeTypeSpecifier compType = (ICPPASTCompositeTypeSpecifier) getPhysicalNode();
@ -230,7 +230,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
@Override @Override
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet, public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet,
boolean checkPointOfDecl) throws DOMException { boolean checkPointOfDecl) {
char[] c = name.getLookupKey(); char[] c = name.getLookupKey();
ICPPASTCompositeTypeSpecifier compType = (ICPPASTCompositeTypeSpecifier) getPhysicalNode(); 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) * @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
*/ */
@Override @Override
public IBinding[] find(String name) throws DOMException { public IBinding[] find(String name) {
char[] n = name.toCharArray(); char[] n = name.toCharArray();
ICPPASTCompositeTypeSpecifier compType = (ICPPASTCompositeTypeSpecifier) getPhysicalNode(); ICPPASTCompositeTypeSpecifier compType = (ICPPASTCompositeTypeSpecifier) getPhysicalNode();
IASTName compName = compType.getName().getLastName(); IASTName compName = compType.getName().getLastName();
@ -374,7 +374,8 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
*/ */
public ICPPMethod[] getImplicitMethods() { public ICPPMethod[] getImplicitMethods() {
if (implicits == null) if (implicits == null)
implicits = new ICPPMethod[] { new CPPMethod.CPPMethodProblem(null, IProblemBinding.SEMANTIC_INVALID_TYPE, CharArrayUtils.EMPTY) }; return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
return implicits; return implicits;
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,7 +12,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator; 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.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; 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.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration; 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(); private char [] nameArray = CPPClassSpecialization.this.getNameCharArray();
public IASTName result = null; public IASTName result = null;
@ -177,7 +176,7 @@ public class CPPClassSpecialization extends CPPSpecialization
return null; return null;
} }
public ICPPBase[] getBases() throws DOMException { public ICPPBase[] getBases() {
ICPPClassSpecializationScope scope= getSpecializationScope(); ICPPClassSpecializationScope scope= getSpecializationScope();
if (scope == null) if (scope == null)
return ClassTypeHelper.getBases(this); return ClassTypeHelper.getBases(this);
@ -185,7 +184,7 @@ public class CPPClassSpecialization extends CPPSpecialization
return scope.getBases(); return scope.getBases();
} }
public ICPPField[] getDeclaredFields() throws DOMException { public ICPPField[] getDeclaredFields() {
ICPPClassSpecializationScope scope= getSpecializationScope(); ICPPClassSpecializationScope scope= getSpecializationScope();
if (scope == null) if (scope == null)
return ClassTypeHelper.getDeclaredFields(this); return ClassTypeHelper.getDeclaredFields(this);
@ -193,7 +192,7 @@ public class CPPClassSpecialization extends CPPSpecialization
return scope.getDeclaredFields(); return scope.getDeclaredFields();
} }
public ICPPMethod[] getDeclaredMethods() throws DOMException { public ICPPMethod[] getDeclaredMethods() {
ICPPClassSpecializationScope scope= getSpecializationScope(); ICPPClassSpecializationScope scope= getSpecializationScope();
if (scope == null) if (scope == null)
return ClassTypeHelper.getDeclaredMethods(this); return ClassTypeHelper.getDeclaredMethods(this);
@ -201,7 +200,7 @@ public class CPPClassSpecialization extends CPPSpecialization
return scope.getDeclaredMethods(); return scope.getDeclaredMethods();
} }
public ICPPConstructor[] getConstructors() throws DOMException { public ICPPConstructor[] getConstructors() {
ICPPClassSpecializationScope scope= getSpecializationScope(); ICPPClassSpecializationScope scope= getSpecializationScope();
if (scope == null) if (scope == null)
return ClassTypeHelper.getConstructors(this); return ClassTypeHelper.getConstructors(this);
@ -209,7 +208,7 @@ public class CPPClassSpecialization extends CPPSpecialization
return scope.getConstructors(); return scope.getConstructors();
} }
public IBinding[] getFriends() throws DOMException { public IBinding[] getFriends() {
ICPPClassSpecializationScope scope= getSpecializationScope(); ICPPClassSpecializationScope scope= getSpecializationScope();
if (scope == null) if (scope == null)
return ClassTypeHelper.getFriends(this); return ClassTypeHelper.getFriends(this);
@ -217,7 +216,7 @@ public class CPPClassSpecialization extends CPPSpecialization
return scope.getFriends(); return scope.getFriends();
} }
public ICPPClassType[] getNestedClasses() throws DOMException { public ICPPClassType[] getNestedClasses() {
ICPPClassSpecializationScope scope= getSpecializationScope(); ICPPClassSpecializationScope scope= getSpecializationScope();
if (scope == null) if (scope == null)
return ClassTypeHelper.getNestedClasses(this); 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); return ClassTypeHelper.getFields(this);
} }
public IField findField(String name) throws DOMException { public IField findField(String name) {
return ClassTypeHelper.findField(this, name); return ClassTypeHelper.findField(this, name);
} }
public ICPPMethod[] getMethods() throws DOMException { public ICPPMethod[] getMethods() {
return ClassTypeHelper.getMethods(this); return ClassTypeHelper.getMethods(this);
} }
public ICPPMethod[] getAllDeclaredMethods() throws DOMException { public ICPPMethod[] getAllDeclaredMethods() {
return ClassTypeHelper.getAllDeclaredMethods(this); return ClassTypeHelper.getAllDeclaredMethods(this);
} }
@ -246,7 +245,7 @@ public class CPPClassSpecialization extends CPPSpecialization
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getKey() * @see org.eclipse.cdt.core.dom.ast.ICompositeType#getKey()
*/ */
public int getKey() throws DOMException { public int getKey() {
if (getDefinition() != null) if (getDefinition() != null)
return getCompositeTypeSpecifier().getKey(); return getCompositeTypeSpecifier().getKey();
@ -256,7 +255,7 @@ public class CPPClassSpecialization extends CPPSpecialization
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getCompositeScope() * @see org.eclipse.cdt.core.dom.ast.ICompositeType#getCompositeScope()
*/ */
public ICPPClassScope getCompositeScope() throws DOMException { public ICPPClassScope getCompositeScope() {
final ICPPClassScope specScope= getSpecializationScope(); final ICPPClassScope specScope= getSpecializationScope();
if (specScope != null) if (specScope != null)
return specScope; return specScope;
@ -297,7 +296,7 @@ public class CPPClassSpecialization extends CPPSpecialization
return this; return this;
} }
public boolean isAnonymous() throws DOMException { public boolean isAnonymous() {
if (getNameCharArray().length > 0) if (getNameCharArray().length > 0)
return false; return false;
@ -322,7 +321,6 @@ public class CPPClassSpecialization extends CPPSpecialization
t2 instanceof IProblemBinding) t2 instanceof IProblemBinding)
return false; return false;
try {
if (t1.getKey() != t2.getKey()) if (t1.getKey() != t2.getKey())
return false; return false;
@ -340,8 +338,5 @@ public class CPPClassSpecialization extends CPPSpecialization
return false; return false;
return ((ICPPClassType) owner1).isSameType((ICPPClassType) owner2); return ((ICPPClassType) owner1).isSameType((ICPPClassType) owner2);
} catch (DOMException e) {
return false;
}
} }
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -14,6 +14,7 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; 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.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; 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.IScope;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; 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.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName; 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 checkedIndex= false;
private boolean checkedDefinition= false; private boolean checkedDefinition= false;
private class FindDefinitionAction extends CPPASTVisitor { private class FindDefinitionAction extends ASTVisitor {
private char[] nameArray = CPPClassTemplate.this.getNameCharArray(); private char[] nameArray = CPPClassTemplate.this.getNameCharArray();
public IASTName result = null; public IASTName result = null;
@ -170,13 +170,9 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
// Forward declarations must be backed up from the index. // Forward declarations must be backed up from the index.
checkForIndexBinding(); checkForIndexBinding();
if (fIndexBinding != null) { if (fIndexBinding != null) {
try {
IScope scope = fIndexBinding.getCompositeScope(); IScope scope = fIndexBinding.getCompositeScope();
if (scope instanceof ICPPClassScope) if (scope instanceof ICPPClassScope)
return (ICPPClassScope) scope; return (ICPPClassScope) scope;
} catch (DOMException e) {
// index bindings don't throw DOMExeptions.
}
} }
return null; return null;
} }
@ -220,27 +216,27 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
return ClassTypeHelper.getBases(this); return ClassTypeHelper.getBases(this);
} }
public IField[] getFields() throws DOMException { public IField[] getFields() {
return ClassTypeHelper.getFields(this); return ClassTypeHelper.getFields(this);
} }
public ICPPField[] getDeclaredFields() throws DOMException { public ICPPField[] getDeclaredFields() {
return ClassTypeHelper.getDeclaredFields(this); return ClassTypeHelper.getDeclaredFields(this);
} }
public ICPPMethod[] getMethods() throws DOMException { public ICPPMethod[] getMethods() {
return ClassTypeHelper.getMethods(this); return ClassTypeHelper.getMethods(this);
} }
public ICPPMethod[] getAllDeclaredMethods() throws DOMException { public ICPPMethod[] getAllDeclaredMethods() {
return ClassTypeHelper.getAllDeclaredMethods(this); return ClassTypeHelper.getAllDeclaredMethods(this);
} }
public ICPPMethod[] getDeclaredMethods() throws DOMException { public ICPPMethod[] getDeclaredMethods() {
return ClassTypeHelper.getDeclaredMethods(this); return ClassTypeHelper.getDeclaredMethods(this);
} }
public ICPPConstructor[] getConstructors() throws DOMException { public ICPPConstructor[] getConstructors() {
return ClassTypeHelper.getConstructors(this); return ClassTypeHelper.getConstructors(this);
} }
@ -252,7 +248,7 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
return ClassTypeHelper.getNestedClasses(this); return ClassTypeHelper.getNestedClasses(this);
} }
public IField findField(String name) throws DOMException { public IField findField(String name) {
return ClassTypeHelper.findField(this, name); return ClassTypeHelper.findField(this, name);
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -15,6 +15,7 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ILinkage; 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.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; 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.IScope;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; 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.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName; 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) { public CPPClassTypeProblem(IASTNode node, int id, char[] arg) {
super(node, id, arg); super(node, id, arg);
} }
public ICPPBase[] getBases() throws DOMException { public ICPPBase[] getBases() {
throw new DOMException(this); return ICPPBase.EMPTY_BASE_ARRAY;
} }
public IField[] getFields() throws DOMException { public IField[] getFields() {
throw new DOMException(this); return IField.EMPTY_FIELD_ARRAY;
} }
public ICPPField[] getDeclaredFields() throws DOMException { public ICPPField[] getDeclaredFields() {
throw new DOMException(this); return ICPPField.EMPTY_CPPFIELD_ARRAY;
} }
public ICPPMethod[] getMethods() throws DOMException { public ICPPMethod[] getMethods() {
throw new DOMException(this); return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
} }
public ICPPMethod[] getAllDeclaredMethods() throws DOMException { public ICPPMethod[] getAllDeclaredMethods() {
throw new DOMException(this); return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
} }
public ICPPMethod[] getDeclaredMethods() throws DOMException { public ICPPMethod[] getDeclaredMethods() {
throw new DOMException(this); return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
} }
public ICPPConstructor[] getConstructors() throws DOMException { public ICPPConstructor[] getConstructors() {
throw new DOMException(this); return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
} }
public ICPPMethod[] getDeclaredConversionOperators() throws DOMException { public ICPPMethod[] getDeclaredConversionOperators() throws DOMException {
throw new DOMException(this); throw new DOMException(this);
} }
public int getKey() throws DOMException { public int getKey() {
throw new DOMException(this); return k_class;
} }
public IField findField(String name) throws DOMException { public IField findField(String name) {
throw new DOMException(this); return null;
} }
public IScope getCompositeScope() throws DOMException { public IScope getCompositeScope() {
throw new DOMException(this); return this;
} }
public IBinding[] getFriends() throws DOMException { public IBinding[] getFriends() {
throw new DOMException(this); return IBinding.EMPTY_BINDING_ARRAY;
} }
public String[] getQualifiedName() throws DOMException { public ICPPClassType[] getNestedClasses() {
throw new DOMException(this); return ICPPClassType.EMPTY_CLASS_ARRAY;
}
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);
} }
} }
private class FindDefinitionAction extends CPPASTVisitor { private class FindDefinitionAction extends ASTVisitor {
private char[] nameArray = CPPClassType.this.getNameCharArray(); private char[] nameArray = CPPClassType.this.getNameCharArray();
public IASTName result = null; public IASTName result = null;
@ -287,13 +275,9 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
} }
// fwd-declarations must be backed up from the index // fwd-declarations must be backed up from the index
if (typeInIndex != null) { if (typeInIndex != null) {
try {
IScope scope = typeInIndex.getCompositeScope(); IScope scope = typeInIndex.getCompositeScope();
if (scope instanceof ICPPClassScope) if (scope instanceof ICPPClassScope)
return (ICPPClassScope) scope; return (ICPPClassScope) scope;
} catch (DOMException e) {
// index bindings don't throw DOMExeptions.
}
} }
return null; return null;
} }
@ -367,27 +351,27 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
return ClassTypeHelper.getBases(this); return ClassTypeHelper.getBases(this);
} }
public IField[] getFields() throws DOMException { public IField[] getFields() {
return ClassTypeHelper.getFields(this); return ClassTypeHelper.getFields(this);
} }
public ICPPField[] getDeclaredFields() throws DOMException { public ICPPField[] getDeclaredFields() {
return ClassTypeHelper.getDeclaredFields(this); return ClassTypeHelper.getDeclaredFields(this);
} }
public ICPPMethod[] getMethods() throws DOMException { public ICPPMethod[] getMethods() {
return ClassTypeHelper.getMethods(this); return ClassTypeHelper.getMethods(this);
} }
public ICPPMethod[] getAllDeclaredMethods() throws DOMException { public ICPPMethod[] getAllDeclaredMethods() {
return ClassTypeHelper.getAllDeclaredMethods(this); return ClassTypeHelper.getAllDeclaredMethods(this);
} }
public ICPPMethod[] getDeclaredMethods() throws DOMException { public ICPPMethod[] getDeclaredMethods() {
return ClassTypeHelper.getDeclaredMethods(this); return ClassTypeHelper.getDeclaredMethods(this);
} }
public ICPPConstructor[] getConstructors() throws DOMException { public ICPPConstructor[] getConstructors() {
return ClassTypeHelper.getConstructors(this); return ClassTypeHelper.getConstructors(this);
} }
@ -399,7 +383,7 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
return ClassTypeHelper.getNestedClasses(this); return ClassTypeHelper.getNestedClasses(this);
} }
public IField findField(String name) throws DOMException { public IField findField(String name) {
return ClassTypeHelper.findField(this, name); return ClassTypeHelper.findField(this, name);
} }
@ -420,14 +404,14 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
return getName(); return getName();
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
if (definition != null) { if (definition != null) {
return CPPVisitor.findNameOwner(definition, true); return CPPVisitor.findNameOwner(definition, true);
} }
return CPPVisitor.findDeclarationOwner(declarations[0], true); return CPPVisitor.findDeclarationOwner(declarations[0], true);
} }
public boolean isAnonymous() throws DOMException { public boolean isAnonymous() {
if (getNameCharArray().length > 0) if (getNameCharArray().length > 0)
return false; return false;

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * Andrew Niefer (IBM Corporation) - initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
/*
* Created on Dec 16, 2004
*/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ILinkage; 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.cdt.internal.core.dom.Linkage;
import org.eclipse.core.runtime.PlatformObject; import org.eclipse.core.runtime.PlatformObject;
/**
* @author aniefer
*/
public class CPPCompositeBinding extends PlatformObject implements IBinding { public class CPPCompositeBinding extends PlatformObject implements IBinding {
IBinding [] bindings = null; IBinding [] bindings = null;
@ -55,7 +49,7 @@ public class CPPCompositeBinding extends PlatformObject implements IBinding {
return bindings[0].getScope(); return bindings[0].getScope();
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
return bindings[0].getOwner(); return bindings[0].getOwner();
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * Andrew Niefer (IBM Corporation) - initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
/*
* Created on Dec 21, 2004
*/
package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTNode; 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.ICPPASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator; 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; import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
/**
* @author aniefer
*/
public class CPPConstructor extends CPPMethod implements ICPPConstructor { public class CPPConstructor extends CPPMethod implements ICPPConstructor {
static public class CPPConstructorProblem extends CPPMethod.CPPMethodProblem implements ICPPConstructor { static public class CPPConstructorProblem extends CPPMethod.CPPMethodProblem implements ICPPConstructor {
public CPPConstructorProblem(IASTNode node, int id, char[] arg) { public CPPConstructorProblem(ICPPClassType owner, IASTNode node, int id, char[] arg) {
super(node, id, arg); super(owner, node, id, arg);
} }
public boolean isExplicit() throws DOMException{ public boolean isExplicit() {
throw new DOMException( this ); return false;
} }
} }
@ -46,7 +40,7 @@ public class CPPConstructor extends CPPMethod implements ICPPConstructor {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor#isExplicit() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor#isExplicit()
*/ */
public boolean isExplicit() throws DOMException { public boolean isExplicit() {
IASTDeclaration decl= getPrimaryDeclaration(); IASTDeclaration decl= getPrimaryDeclaration();
if (decl != null) { if (decl != null) {
ICPPASTDeclSpecifier declspec= getDeclSpec(decl); ICPPASTDeclSpecifier declspec= getDeclSpec(decl);

View file

@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument; 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); super(orig, owner, tpmap, args);
} }
public boolean isExplicit() throws DOMException { public boolean isExplicit() {
return ((ICPPConstructor) getTemplateDefinition()).isExplicit(); return ((ICPPConstructor) getTemplateDefinition()).isExplicit();
} }
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
@ -30,7 +29,7 @@ public class CPPConstructorSpecialization extends CPPMethodSpecialization
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor#isExplicit() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor#isExplicit()
*/ */
public boolean isExplicit() throws DOMException { public boolean isExplicit() {
return ((ICPPConstructor)getSpecializedBinding()).isExplicit(); return ((ICPPConstructor)getSpecializedBinding()).isExplicit();
} }
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * 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; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
/** public class CPPConstructorTemplate extends CPPMethodTemplate implements ICPPConstructor {
* @author aniefer
*/
public class CPPConstructorTemplate extends CPPMethodTemplate implements
ICPPConstructor {
/**
* @param name
*/
public CPPConstructorTemplate(IASTName name) { public CPPConstructorTemplate(IASTName name) {
super(name); super(name);
// TODO Auto-generated constructor stub
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor#isExplicit() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor#isExplicit()
*/ */
public boolean isExplicit() { public boolean isExplicit() {
// mstodo fix that
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return false;
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
@ -30,7 +29,7 @@ public class CPPConstructorTemplateSpecialization extends CPPMethodTemplateSpeci
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor#isExplicit() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor#isExplicit()
*/ */
public boolean isExplicit() throws DOMException { public boolean isExplicit() {
return ((ICPPConstructor)getSpecializedBinding()).isExplicit(); return ((ICPPConstructor)getSpecializedBinding()).isExplicit();
} }
} }

View file

@ -51,11 +51,7 @@ public class CPPDeferredClassInstance extends CPPUnknownClass implements ICPPDef
@Override @Override
public IBinding getOwner() { public IBinding getOwner() {
try {
return fClassTemplate.getOwner(); return fClassTemplate.getOwner();
} catch (DOMException e) {
return e.getProblem();
}
} }
public ICPPClassTemplate getClassTemplate() { public ICPPClassTemplate getClassTemplate() {
@ -93,7 +89,7 @@ public class CPPDeferredClassInstance extends CPPUnknownClass implements ICPPDef
} }
@Override @Override
public int getKey() throws DOMException { public int getKey() {
return getClassTemplate().getKey(); return getClassTemplate().getKey();
} }
@ -138,7 +134,7 @@ public class CPPDeferredClassInstance extends CPPUnknownClass implements ICPPDef
} }
@Override @Override
public ICPPScope asScope() throws DOMException { public ICPPScope asScope() {
if (fLookupScope != null) if (fLookupScope != null)
return fLookupScope; return fLookupScope;

View file

@ -13,6 +13,7 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ILinkage; 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.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; 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.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.IValue; 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.ICPPASTEnumerationSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
@ -78,7 +78,7 @@ public class CPPEnumeration extends PlatformObject implements ICPPEnumeration, I
return fDeclarations; return fDeclarations;
} }
private class FindDefinitionAction extends CPPASTVisitor { private class FindDefinitionAction extends ASTVisitor {
private char[] nameArray = CPPEnumeration.this.getNameCharArray(); private char[] nameArray = CPPEnumeration.this.getNameCharArray();
public IASTName result = null; public IASTName result = null;
@ -197,7 +197,7 @@ public class CPPEnumeration extends PlatformObject implements ICPPEnumeration, I
return Linkage.CPP_LINKAGE; return Linkage.CPP_LINKAGE;
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
return CPPVisitor.findDeclarationOwner(getADeclaration(), true); return CPPVisitor.findDeclarationOwner(getADeclaration(), true);
} }

View file

@ -131,7 +131,7 @@ public class CPPEnumerator extends PlatformObject implements IEnumerator, ICPPIn
return Linkage.CPP_LINKAGE; return Linkage.CPP_LINKAGE;
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
return CPPVisitor.findDeclarationOwner(enumName, true); return CPPVisitor.findDeclarationOwner(enumName, true);
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -11,8 +11,8 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.IASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator; import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTName; 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.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.ICompositeType; 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.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.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel; 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.ICPPClassScope;
@ -34,26 +33,19 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
*/ */
public class CPPField extends CPPVariable implements ICPPField { public class CPPField extends CPPVariable implements ICPPField {
public static class CPPFieldProblem extends CPPVariable.CPPVariableProblem implements ICPPField { public static class CPPFieldProblem extends CPPVariable.CPPVariableProblem implements ICPPField {
/** private ICPPClassType fOwner;
* @param id
* @param arg public CPPFieldProblem(ICPPClassType owner, IASTNode node, int id, char[] arg ) {
*/
public CPPFieldProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg ); super( node, id, arg );
fOwner= owner;
} }
public int getVisibility() {
public int getVisibility() throws DOMException { return v_private;
throw new DOMException( this );
} }
public ICPPClassType getClassOwner() throws DOMException { public ICPPClassType getClassOwner() {
throw new DOMException( this ); return fOwner;
} }
@Override public ICompositeType getCompositeTypeOwner() {
public boolean isStatic() throws DOMException {
throw new DOMException( this );
}
public ICompositeType getCompositeTypeOwner() throws DOMException {
return getClassOwner(); return getClassOwner();
} }
} }
@ -62,7 +54,7 @@ public class CPPField extends CPPVariable implements ICPPField {
super( name ); super( name );
} }
public IASTDeclaration getPrimaryDeclaration() throws DOMException{ public IASTDeclaration getPrimaryDeclaration() {
//first check if we already know it //first check if we already know it
IASTDeclaration decl= findDeclaration(getDefinition()); IASTDeclaration decl= findDeclaration(getDefinition());
if (decl != null) { if (decl != null) {
@ -108,7 +100,7 @@ public class CPPField extends CPPVariable implements ICPPField {
return null; return null;
} }
public int getVisibility() throws DOMException { public int getVisibility() {
ICPPASTVisibilityLabel vis = null; ICPPASTVisibilityLabel vis = null;
IASTDeclaration decl = getPrimaryDeclaration(); IASTDeclaration decl = getPrimaryDeclaration();
if( decl != null ) { if( decl != null ) {
@ -131,7 +123,7 @@ public class CPPField extends CPPVariable implements ICPPField {
return ICPPASTVisibilityLabel.v_public; return ICPPASTVisibilityLabel.v_public;
} }
public ICPPClassType getClassOwner() throws DOMException { public ICPPClassType getClassOwner() {
ICPPClassScope scope = (ICPPClassScope) getScope(); ICPPClassScope scope = (ICPPClassScope) getScope();
return scope.getClassType(); return scope.getClassType();
} }
@ -151,7 +143,7 @@ public class CPPField extends CPPVariable implements ICPPField {
@Override @Override
public boolean isMutable() { public boolean isMutable() {
return hasStorageClass( ICPPASTDeclSpecifier.sc_mutable); return hasStorageClass( IASTDeclSpecifier.sc_mutable);
} }
@Override @Override
@ -160,7 +152,7 @@ public class CPPField extends CPPVariable implements ICPPField {
return false; return false;
} }
public ICompositeType getCompositeTypeOwner() throws DOMException { public ICompositeType getCompositeTypeOwner() {
return getClassOwner(); return getClassOwner();
} }
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -37,11 +37,11 @@ public class CPPFieldSpecialization extends CPPSpecialization implements ICPPFie
return (ICPPField) getSpecializedBinding(); return (ICPPField) getSpecializedBinding();
} }
public int getVisibility() throws DOMException { public int getVisibility() {
return getField().getVisibility(); return getField().getVisibility();
} }
public ICPPClassType getClassOwner() throws DOMException { public ICPPClassType getClassOwner() {
return getField().getClassOwner(); return getField().getClassOwner();
} }
@ -52,23 +52,23 @@ public class CPPFieldSpecialization extends CPPSpecialization implements ICPPFie
return type; return type;
} }
public boolean isStatic() throws DOMException { public boolean isStatic() {
return getField().isStatic(); return getField().isStatic();
} }
public boolean isExtern() throws DOMException { public boolean isExtern() {
return getField().isExtern(); return getField().isExtern();
} }
public boolean isAuto() throws DOMException { public boolean isAuto() {
return getField().isAuto(); return getField().isAuto();
} }
public boolean isRegister() throws DOMException { public boolean isRegister() {
return getField().isRegister(); return getField().isRegister();
} }
public boolean isMutable() throws DOMException { public boolean isMutable() {
return getField().isMutable(); return getField().isMutable();
} }
@ -76,7 +76,7 @@ public class CPPFieldSpecialization extends CPPSpecialization implements ICPPFie
return false; return false;
} }
public ICompositeType getCompositeTypeOwner() throws DOMException { public ICompositeType getCompositeTypeOwner() {
return getClassOwner(); return getClassOwner();
} }

View file

@ -61,63 +61,19 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
public CPPFunctionProblem(IASTNode node, int id, char[] arg) { public CPPFunctionProblem(IASTNode node, int id, char[] arg) {
super(node, id, arg); super(node, id, arg);
} }
@Override
public ICPPParameter[] getParameters() throws DOMException {
throw new DOMException(this);
}
public IScope getFunctionScope() throws DOMException {
throw new DOMException(this);
}
public ICPPFunctionType getType() throws DOMException { public ICPPFunctionType getType() throws DOMException {
throw new DOMException(this); throw new DOMException(this);
} }
public boolean isStatic() throws DOMException { public ICPPParameter[] getParameters() throws DOMException {
throw new DOMException(this); throw new DOMException(this);
} }
public String[] getQualifiedName() throws DOMException { public IScope getFunctionScope() 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); throw new DOMException(this);
} }
public int getRequiredArgumentCount() throws DOMException { public int getRequiredArgumentCount() throws DOMException {
throw new DOMException(this); throw new DOMException(this);
} }
public boolean hasParameterPack() {
return false;
}
public boolean hasSameFunctionParameterTypeList(ICPPFunction function) { public boolean hasSameFunctionParameterTypeList(ICPPFunction function) {
return false; return false;
} }
@ -158,13 +114,10 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
} else { } else {
//implicit binding //implicit binding
IScope scope = getScope(); IScope scope = getScope();
try {
IASTNode node = ASTInternal.getPhysicalNodeOfScope(scope); IASTNode node = ASTInternal.getPhysicalNodeOfScope(scope);
if (node != null) { if (node != null) {
tu = node.getTranslationUnit(); tu = node.getTranslationUnit();
} }
} catch (DOMException e) {
}
} }
if (tu != null) { if (tu != null) {
CPPVisitor.getDeclarations(tu, this); CPPVisitor.getDeclarations(tu, this);
@ -493,7 +446,7 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
return false; return false;
} }
public boolean isInline() throws DOMException { public boolean isInline() {
IASTDeclarator dtor = getDefinition(); IASTDeclarator dtor = getDefinition();
IASTDeclarator[] ds = getDeclarations(); IASTDeclarator[] ds = getDeclarations();
int i = -1; int i = -1;
@ -520,7 +473,7 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
return false; return false;
} }
public boolean isExternC() throws DOMException { public boolean isExternC() {
if (CPPVisitor.isExternC(getDefinition())) { if (CPPVisitor.isExternC(getDefinition())) {
return true; return true;
} }
@ -565,11 +518,11 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
return result.toString(); return result.toString();
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
return CPPVisitor.findNameOwner(getASTName(), false); return CPPVisitor.findNameOwner(getASTName(), false);
} }
public IType[] getExceptionSpecification() throws DOMException { public IType[] getExceptionSpecification() {
ICPPASTFunctionDeclarator declarator = getPreferredDtor(); ICPPASTFunctionDeclarator declarator = getPreferredDtor();
if (declarator != null) { if (declarator != null) {
IASTTypeId[] astTypeIds= declarator.getExceptionSpecification(); IASTTypeId[] astTypeIds= declarator.getExceptionSpecification();

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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) * @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
*/ */
@Override @Override
public IBinding[] find(String name) throws DOMException { public IBinding[] find(String name) {
char[] n = name.toCharArray(); char[] n = name.toCharArray();
List<IBinding> bindings = new ArrayList<IBinding>(); List<IBinding> bindings = new ArrayList<IBinding>();

View file

@ -113,7 +113,7 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
return false; return false;
} }
public boolean isInline() throws DOMException { public boolean isInline() {
if (getDefinition() != null) { if (getDefinition() != null) {
IASTNode def = getDefinition(); IASTNode def = getDefinition();
while (!(def instanceof IASTFunctionDefinition)) while (!(def instanceof IASTFunctionDefinition))
@ -123,7 +123,7 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
return getFunction().isInline(); return getFunction().isInline();
} }
public boolean isExternC() throws DOMException { public boolean isExternC() {
if (CPPVisitor.isExternC(getDefinition())) { if (CPPVisitor.isExternC(getDefinition())) {
return true; return true;
} }
@ -139,35 +139,33 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
if (f instanceof ICPPInternalFunction) if (f instanceof ICPPInternalFunction)
return ((ICPPInternalFunction)f).isStatic(resolveAll); return ((ICPPInternalFunction)f).isStatic(resolveAll);
if (f instanceof IIndexBinding && f instanceof ICPPFunction) { if (f instanceof IIndexBinding && f instanceof ICPPFunction) {
try {
return ((ICPPFunction) f).isStatic(); return ((ICPPFunction) f).isStatic();
} catch(DOMException de) { /* cannot occur as we query the index */}
} }
return CPPFunction.hasStorageClass(this, IASTDeclSpecifier.sc_static); return CPPFunction.hasStorageClass(this, IASTDeclSpecifier.sc_static);
} }
public boolean isExtern() throws DOMException { public boolean isExtern() {
ICPPFunction f = (ICPPFunction) getSpecializedBinding(); ICPPFunction f = (ICPPFunction) getSpecializedBinding();
if (f != null) if (f != null)
return f.isExtern(); return f.isExtern();
return CPPFunction.hasStorageClass(this, IASTDeclSpecifier.sc_extern); return CPPFunction.hasStorageClass(this, IASTDeclSpecifier.sc_extern);
} }
public boolean isAuto() throws DOMException { public boolean isAuto() {
ICPPFunction f = (ICPPFunction) getSpecializedBinding(); ICPPFunction f = (ICPPFunction) getSpecializedBinding();
if (f != null) if (f != null)
return f.isAuto(); return f.isAuto();
return CPPFunction.hasStorageClass(this, IASTDeclSpecifier.sc_auto); return CPPFunction.hasStorageClass(this, IASTDeclSpecifier.sc_auto);
} }
public boolean isRegister() throws DOMException { public boolean isRegister() {
ICPPFunction f = (ICPPFunction) getSpecializedBinding(); ICPPFunction f = (ICPPFunction) getSpecializedBinding();
if (f != null) if (f != null)
return f.isRegister(); return f.isRegister();
return CPPFunction.hasStorageClass(this, IASTDeclSpecifier.sc_register); return CPPFunction.hasStorageClass(this, IASTDeclSpecifier.sc_register);
} }
public boolean takesVarArgs() throws DOMException { public boolean takesVarArgs() {
ICPPFunction f = (ICPPFunction) getSpecializedBinding(); ICPPFunction f = (ICPPFunction) getSpecializedBinding();
if (f != null) if (f != null)
return f.takesVarArgs(); return f.takesVarArgs();
@ -295,7 +293,7 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
return result.toString(); return result.toString();
} }
public IType[] getExceptionSpecification() throws DOMException { public IType[] getExceptionSpecification() {
if (specializedExceptionSpec == null) { if (specializedExceptionSpec == null) {
ICPPFunction function = (ICPPFunction) getSpecializedBinding(); ICPPFunction function = (ICPPFunction) getSpecializedBinding();
IType[] types = function.getExceptionSpecification(); IType[] types = function.getExceptionSpecification();

View file

@ -57,60 +57,19 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
public ICPPClassTemplatePartialSpecialization[] getTemplateSpecializations() throws DOMException { public ICPPClassTemplatePartialSpecialization[] getTemplateSpecializations() throws DOMException {
throw new DOMException(this); 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 { public ICPPParameter[] getParameters() throws DOMException {
throw new DOMException(this); throw new DOMException(this);
} }
public IScope getFunctionScope() throws DOMException { public IScope getFunctionScope() throws DOMException {
throw new DOMException(this); throw new DOMException(this);
} }
@Override
public ICPPFunctionType getType() throws DOMException { public ICPPFunctionType getType() throws DOMException {
throw new DOMException(this); 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 { public int getRequiredArgumentCount() throws DOMException {
throw new DOMException( this ); throw new DOMException( this );
} }
public boolean hasParameterPack() {
return false;
}
} }
protected ICPPFunctionType type = null; protected ICPPFunctionType type = null;
@ -316,7 +275,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
return hasStorageClass(IASTDeclSpecifier.sc_mutable); return hasStorageClass(IASTDeclSpecifier.sc_mutable);
} }
public boolean isInline() throws DOMException { public boolean isInline() {
IASTName name = (IASTName) getDefinition(); IASTName name = (IASTName) getDefinition();
IASTNode[] ns = getDeclarations(); IASTNode[] ns = getDeclarations();
int i = -1; int i = -1;
@ -344,7 +303,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
return false; return false;
} }
public boolean isExternC() throws DOMException { public boolean isExternC() {
if (CPPVisitor.isExternC(getDefinition())) { if (CPPVisitor.isExternC(getDefinition())) {
return true; return true;
} }
@ -407,7 +366,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
return result.toString(); return result.toString();
} }
public IType[] getExceptionSpecification() throws DOMException { public IType[] getExceptionSpecification() {
ICPPASTFunctionDeclarator declarator = getFirstFunctionDtor(); ICPPASTFunctionDeclarator declarator = getFirstFunctionDtor();
if (declarator != null) { if (declarator != null) {
IASTTypeId[] astTypeIds = declarator.getExceptionSpecification(); IASTTypeId[] astTypeIds = declarator.getExceptionSpecification();

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.IASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator; 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); super(name, scope, type, params, false);
} }
public int getVisibility() throws DOMException { public int getVisibility() {
IASTDeclaration decl= getPrimaryDeclaration(); IASTDeclaration decl= getPrimaryDeclaration();
if (decl == null) { if (decl == null) {
// 12.1-5, 12.8-10 Implicit constructors and assignment operators are public // 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(); return scope.getClassType();
} }
public IASTDeclaration getPrimaryDeclaration() throws DOMException { public IASTDeclaration getPrimaryDeclaration() {
// first check if we already know it // first check if we already know it
if (declarations != null) { if (declarations != null) {
for (IASTDeclarator dtor : declarations) { for (IASTDeclarator dtor : declarations) {
@ -170,11 +169,7 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
} }
public boolean isImplicit() { public boolean isImplicit() {
try {
return getPrimaryDeclaration() == null; return getPrimaryDeclaration() == null;
} catch (DOMException e) {
}
return true;
} }
public boolean isPureVirtual() { public boolean isPureVirtual() {
@ -187,7 +182,7 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
} }
@Override @Override
public IType[] getExceptionSpecification() throws DOMException { public IType[] getExceptionSpecification() {
return ClassTypeHelper.getInheritedExceptionSpecification(this); return ClassTypeHelper.getInheritedExceptionSpecification(this);
} }
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * Andrew Niefer (IBM Corporation) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ILinkage; 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.IASTLabelStatement;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode; 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.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.core.runtime.PlatformObject; import org.eclipse.core.runtime.PlatformObject;
/**
* @author aniefer
*/
public class CPPLabel extends PlatformObject implements ILabel, ICPPInternalBinding { public class CPPLabel extends PlatformObject implements ILabel, ICPPInternalBinding {
private IASTName statement; private IASTName statement;
@ -93,7 +89,7 @@ public class CPPLabel extends PlatformObject implements ILabel, ICPPInternalBind
return Linkage.CPP_LINKAGE; return Linkage.CPP_LINKAGE;
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
return CPPVisitor.findEnclosingFunction(statement); return CPPVisitor.findEnclosingFunction(statement);
} }
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.IASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; 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.ICPPASTVisibilityLabel;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope; 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.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.parser.util.CharArrayUtils; import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal; 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 class CPPMethod extends CPPFunction implements ICPPMethod {
public static class CPPMethodProblem extends CPPFunctionProblem 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); super(node, id, arg);
fOwner= owner;
} }
public ICPPClassType getClassOwner() {
public int getVisibility() throws DOMException { return fOwner;
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 boolean isDestructor() { public boolean isDestructor() {
char[] name = getNameCharArray(); char[] name = getNameCharArray();
@ -63,8 +55,8 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
return false; return false;
} }
public boolean isImplicit() { public int getVisibility() {
return false; return ICPPMember.v_private;
} }
} }
@ -72,7 +64,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
super(declarator); super(declarator);
} }
public IASTDeclaration getPrimaryDeclaration() throws DOMException{ public IASTDeclaration getPrimaryDeclaration() {
//first check if we already know it //first check if we already know it
if (declarations != null) { if (declarations != null) {
for (IASTDeclarator dtor : declarations) { for (IASTDeclarator dtor : declarations) {
@ -120,7 +112,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMember#getVisibility() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMember#getVisibility()
*/ */
public int getVisibility() throws DOMException { public int getVisibility() {
IASTDeclaration decl = getPrimaryDeclaration(); IASTDeclaration decl = getPrimaryDeclaration();
if( decl == null ){ if( decl == null ){
IScope scope = getScope(); IScope scope = getScope();
@ -149,7 +141,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
return ICPPASTVisibilityLabel.v_public; return ICPPASTVisibilityLabel.v_public;
} }
public ICPPClassType getClassOwner() throws DOMException { public ICPPClassType getClassOwner() {
ICPPClassScope scope = (ICPPClassScope)getScope(); ICPPClassScope scope = (ICPPClassScope)getScope();
return scope.getClassType(); return scope.getClassType();
} }
@ -174,7 +166,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual()
*/ */
public boolean isVirtual() throws DOMException { public boolean isVirtual() {
IASTDeclaration decl = getPrimaryDeclaration(); IASTDeclaration decl = getPrimaryDeclaration();
if( decl != null ){ if( decl != null ){
ICPPASTDeclSpecifier declSpec = getDeclSpec(decl); 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() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction#isInline()
*/ */
@Override @Override
public boolean isInline() throws DOMException { public boolean isInline() {
IASTDeclaration decl = getPrimaryDeclaration(); IASTDeclaration decl = getPrimaryDeclaration();
if( decl instanceof IASTFunctionDefinition ) if( decl instanceof IASTFunctionDefinition )
return true; return true;
@ -214,7 +206,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
*/ */
@Override @Override
public boolean isMutable() { public boolean isMutable() {
return hasStorageClass( this, ICPPASTDeclSpecifier.sc_mutable ); return hasStorageClass( this, IASTDeclSpecifier.sc_mutable );
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -235,7 +227,7 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isPureVirtual() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isPureVirtual()
*/ */
public boolean isPureVirtual() throws DOMException { public boolean isPureVirtual() {
if (declarations != null) { if (declarations != null) {
for (IASTDeclarator dtor : declarations) { for (IASTDeclarator dtor : declarations) {
if (dtor == null) if (dtor == null)

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
@ -28,25 +27,25 @@ public class CPPMethodInstance extends CPPFunctionInstance implements ICPPMethod
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMember#getVisibility() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMember#getVisibility()
*/ */
public int getVisibility() throws DOMException { public int getVisibility() {
return ((ICPPMethod)getTemplateDefinition()).getVisibility(); return ((ICPPMethod)getTemplateDefinition()).getVisibility();
} }
public ICPPClassType getClassOwner() throws DOMException { public ICPPClassType getClassOwner() {
return (ICPPClassType) getOwner(); return (ICPPClassType) getOwner();
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isVirtual()
*/ */
public boolean isVirtual() throws DOMException { public boolean isVirtual() {
return ((ICPPMethod)getTemplateDefinition()).isVirtual(); return ((ICPPMethod)getTemplateDefinition()).isVirtual();
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isPureVirtual() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod#isPureVirtual()
*/ */
public boolean isPureVirtual() throws DOMException { public boolean isPureVirtual() {
return ((ICPPMethod)getTemplateDefinition()).isPureVirtual(); return ((ICPPMethod)getTemplateDefinition()).isPureVirtual();
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition; import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
@ -32,7 +31,7 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
super(orig, owner, argMap ); super(orig, owner, argMap );
} }
public boolean isVirtual() throws DOMException { public boolean isVirtual() {
ICPPMethod f = (ICPPMethod) getSpecializedBinding(); ICPPMethod f = (ICPPMethod) getSpecializedBinding();
if( f != null ) if( f != null )
return f.isVirtual(); return f.isVirtual();
@ -55,14 +54,14 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
return false; return false;
} }
public int getVisibility() throws DOMException { public int getVisibility() {
ICPPMethod f = (ICPPMethod) getSpecializedBinding(); ICPPMethod f = (ICPPMethod) getSpecializedBinding();
if( f != null ) if( f != null )
return f.getVisibility(); return f.getVisibility();
return 0; return 0;
} }
public ICPPClassType getClassOwner() throws DOMException { public ICPPClassType getClassOwner() {
return (ICPPClassType) getOwner(); return (ICPPClassType) getOwner();
} }
@ -78,7 +77,7 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
return ((ICPPMethod) getSpecializedBinding()).isImplicit(); return ((ICPPMethod) getSpecializedBinding()).isImplicit();
} }
public boolean isPureVirtual() throws DOMException { public boolean isPureVirtual() {
ICPPMethod f = (ICPPMethod) getSpecializedBinding(); ICPPMethod f = (ICPPMethod) getSpecializedBinding();
if (f != null) if (f != null)
return f.isPureVirtual(); return f.isPureVirtual();
@ -87,7 +86,7 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
} }
@Override @Override
public IType[] getExceptionSpecification() throws DOMException { public IType[] getExceptionSpecification() {
if (isImplicit()) { if (isImplicit()) {
return ClassTypeHelper.getInheritedExceptionSpecification(this); return ClassTypeHelper.getInheritedExceptionSpecification(this);
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -40,7 +40,7 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements ICPPMethod
super(name); super(name);
} }
public IASTDeclaration getPrimaryDeclaration() throws DOMException{ public IASTDeclaration getPrimaryDeclaration() {
//first check if we already know it //first check if we already know it
if (declarations != null) { if (declarations != null) {
for (IASTName declaration : declarations) { for (IASTName declaration : declarations) {
@ -65,8 +65,13 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements ICPPMethod
final char[] myName = getTemplateName().getLookupKey(); final char[] myName = getTemplateName().getLookupKey();
IScope scope = getScope(); IScope scope = getScope();
if (scope instanceof ICPPTemplateScope) if (scope instanceof ICPPTemplateScope) {
try {
scope = scope.getParent(); scope = scope.getParent();
} catch (DOMException e) {
return null;
}
}
ICPPClassScope clsScope = (ICPPClassScope) scope; ICPPClassScope clsScope = (ICPPClassScope) scope;
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) ASTInternal.getPhysicalNodeOfScope(clsScope); ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) ASTInternal.getPhysicalNodeOfScope(clsScope);
IASTDeclaration[] members = compSpec.getMembers(); IASTDeclaration[] members = compSpec.getMembers();
@ -92,7 +97,7 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements ICPPMethod
return null; return null;
} }
public int getVisibility() throws DOMException { public int getVisibility() {
IASTDeclaration decl = getPrimaryDeclaration(); IASTDeclaration decl = getPrimaryDeclaration();
if( decl == null ){ if( decl == null ){
ICPPClassType cls = getClassOwner(); ICPPClassType cls = getClassOwner();
@ -118,10 +123,14 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements ICPPMethod
return ICPPASTVisibilityLabel.v_public; return ICPPASTVisibilityLabel.v_public;
} }
public ICPPClassType getClassOwner() throws DOMException { public ICPPClassType getClassOwner() {
IScope scope= getScope(); IScope scope= getScope();
if (scope instanceof ICPPTemplateScope) { if (scope instanceof ICPPTemplateScope) {
try {
scope= scope.getParent(); scope= scope.getParent();
} catch (DOMException e) {
return null;
}
} }
if( scope instanceof ICPPClassScope ){ if( scope instanceof ICPPClassScope ){
return ((ICPPClassScope)scope).getClassType(); return ((ICPPClassScope)scope).getClassType();
@ -135,7 +144,7 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements ICPPMethod
} }
@Override @Override
public boolean isInline() throws DOMException { public boolean isInline() {
IASTDeclaration decl = getPrimaryDeclaration(); IASTDeclaration decl = getPrimaryDeclaration();
if( decl instanceof ICPPASTTemplateDeclaration && ((ICPPASTTemplateDeclaration)decl).getDeclaration() instanceof IASTFunctionDefinition ) if( decl instanceof ICPPASTTemplateDeclaration && ((ICPPASTTemplateDeclaration)decl).getDeclaration() instanceof IASTFunctionDefinition )
return true; return true;
@ -155,7 +164,7 @@ public class CPPMethodTemplate extends CPPFunctionTemplate implements ICPPMethod
return false; return false;
} }
public boolean isPureVirtual() throws DOMException { public boolean isPureVirtual() {
return false; return false;
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; 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.ICPPMethod;
@ -33,14 +32,14 @@ public class CPPMethodTemplateSpecialization extends CPPFunctionTemplateSpeciali
return false; return false;
} }
public int getVisibility() throws DOMException { public int getVisibility() {
IBinding m = getSpecializedBinding(); IBinding m = getSpecializedBinding();
if( m instanceof ICPPMethod ) if( m instanceof ICPPMethod )
return ((ICPPMethod)m).getVisibility(); return ((ICPPMethod)m).getVisibility();
return 0; return 0;
} }
public ICPPClassType getClassOwner() throws DOMException { public ICPPClassType getClassOwner() {
return (ICPPClassType) getOwner(); return (ICPPClassType) getOwner();
} }
@ -56,7 +55,7 @@ public class CPPMethodTemplateSpecialization extends CPPFunctionTemplateSpeciali
return false; return false;
} }
public boolean isPureVirtual() throws DOMException { public boolean isPureVirtual() {
return false; return false;
} }

View file

@ -6,13 +6,13 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * Andrew Niefer (IBM Corporation) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ILinkage; 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.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator; 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.IBinding;
import org.eclipse.cdt.core.dom.ast.IProblemBinding; import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IScope; 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.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification; 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.ICPPASTUsingDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace; 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.ICPPNamespaceScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDirective;
import org.eclipse.cdt.core.parser.Keywords; import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.core.parser.util.ArrayUtil; import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.core.parser.util.CharArrayUtils; 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.cdt.internal.core.model.ASTStringUtil;
import org.eclipse.core.runtime.PlatformObject; import org.eclipse.core.runtime.PlatformObject;
/**
* @author aniefer
*/
public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPInternalBinding { 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) { public CPPNamespaceProblem(IASTNode node, int id, char[] arg) {
super(node, id, arg); super(node, id, arg);
} }
public ICPPNamespaceScope getNamespaceScope() throws DOMException { public ICPPNamespaceScope getNamespaceScope() {
throw new DOMException(this); return this;
} }
public IBinding[] getMemberBindings() throws DOMException { public IBinding[] getMemberBindings() {
throw new DOMException(this); return IBinding.EMPTY_BINDING_ARRAY;
} }
public String[] getQualifiedName() throws DOMException { public void addUsingDirective(ICPPUsingDirective usingDirective) {
throw new DOMException(this);
} }
public char[][] getQualifiedNameCharArray() throws DOMException { public ICPPUsingDirective[] getUsingDirectives() {
throw new DOMException(this); return ICPPUsingDirective.EMPTY_ARRAY;
} }
public boolean isGloballyQualified() throws DOMException { public ICPPNamespaceScope[] getInlineNamespaces() {
throw new DOMException(this); return ICPPNamespaceScope.EMPTY_NAMESPACE_SCOPE_ARRAY;
}
public boolean isInline() {
return false;
} }
} }
@ -98,7 +91,7 @@ public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPI
return (tu != null) ? tu : (IASTNode) namespaceDefinitions[0]; return (tu != null) ? tu : (IASTNode) namespaceDefinitions[0];
} }
static private class NamespaceCollector extends CPPASTVisitor { static private class NamespaceCollector extends ASTVisitor {
private ICPPASTNamespaceDefinition namespaceDef = null; private ICPPASTNamespaceDefinition namespaceDef = null;
private IASTName[] namespaces = 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 ObjectSet<IBinding> members = new ObjectSet<IBinding>(8);
public NamespaceMemberCollector() { public NamespaceMemberCollector() {
shouldVisitNamespaces = true; shouldVisitNamespaces = true;
@ -365,7 +358,7 @@ public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPI
return ASTStringUtil.join(names, String.valueOf(Keywords.cpCOLONCOLON)); return ASTStringUtil.join(names, String.valueOf(Keywords.cpCOLONCOLON));
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
if (namespaceDefinitions != null && namespaceDefinitions.length > 0) { if (namespaceDefinitions != null && namespaceDefinitions.length > 0) {
return CPPVisitor.findDeclarationOwner(namespaceDefinitions[0], false); return CPPVisitor.findDeclarationOwner(namespaceDefinitions[0], false);
} }

View file

@ -36,7 +36,7 @@ public class CPPNamespaceAlias extends PlatformObject implements ICPPNamespaceAl
this.alias = aliasName; this.alias = aliasName;
} }
public ICPPNamespaceScope getNamespaceScope() throws DOMException { public ICPPNamespaceScope getNamespaceScope() {
return namespace.getNamespaceScope(); return namespace.getNamespaceScope();
} }
@ -88,7 +88,7 @@ public class CPPNamespaceAlias extends PlatformObject implements ICPPNamespaceAl
public void addDeclaration(IASTNode node) { public void addDeclaration(IASTNode node) {
} }
public IBinding[] getMemberBindings() throws DOMException { public IBinding[] getMemberBindings() {
return namespace.getMemberBindings(); return namespace.getMemberBindings();
} }
@ -96,7 +96,7 @@ public class CPPNamespaceAlias extends PlatformObject implements ICPPNamespaceAl
return Linkage.CPP_LINKAGE; return Linkage.CPP_LINKAGE;
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
return CPPVisitor.findDeclarationOwner(alias, false); return CPPVisitor.findDeclarationOwner(alias, false);
} }

View file

@ -18,13 +18,13 @@ import java.util.Set;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IName; 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.DOMException;
import org.eclipse.cdt.core.dom.ast.EScopeKind; import org.eclipse.cdt.core.dom.ast.EScopeKind;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IScope; 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.ICPPASTLinkageSpecification;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace; 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) { public IScope findNamespaceScope(IIndexScope scope) {
final String[] qname= scope.getScopeBinding().getQualifiedName(); final String[] qname= scope.getScopeBinding().getQualifiedName();
final IScope[] result= {null}; final IScope[] result= {null};
final CPPASTVisitor visitor= new CPPASTVisitor () { final ASTVisitor visitor= new ASTVisitor () {
private int depth= 0; private int depth= 0;
{ {
shouldVisitNamespaces= shouldVisitDeclarations= true; shouldVisitNamespaces= shouldVisitDeclarations= true;
@ -242,7 +242,6 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace
} else if (getKind() == EScopeKind.eGlobal) { } else if (getKind() == EScopeKind.eGlobal) {
inlineScopes= index.getInlineNamespaces(); inlineScopes= index.getInlineNamespaces();
} }
} catch (DOMException e) {
} catch (CoreException e) { } catch (CoreException e) {
} }
if (inlineScopes != null) { if (inlineScopes != null) {

View file

@ -12,7 +12,6 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ILinkage; 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.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator; 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) { public CPPParameterProblem(IASTNode node, int id, char[] arg) {
super(node, id, 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; 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$ return name.length() != 0 ? name : "<unnamed>"; //$NON-NLS-1$
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
return CPPVisitor.findEnclosingFunction(fDeclarations[0]); return CPPVisitor.findEnclosingFunction(fDeclarations[0]);
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -68,14 +68,14 @@ public class CPPParameterSpecialization extends CPPSpecialization implements ICP
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto() * @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto()
*/ */
public boolean isAuto() throws DOMException { public boolean isAuto() {
return getParameter().isAuto(); return getParameter().isAuto();
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IVariable#isRegister() * @see org.eclipse.cdt.core.dom.ast.IVariable#isRegister()
*/ */
public boolean isRegister() throws DOMException { public boolean isRegister() {
return getParameter().isRegister(); return getParameter().isRegister();
} }

View file

@ -82,7 +82,7 @@ abstract public class CPPScope implements ICPPASTInternalScope {
} }
@SuppressWarnings({ "unchecked" }) @SuppressWarnings({ "unchecked" })
public void addName(IASTName name) throws DOMException { public void addName(IASTName name) {
// don't add inactive names to the scope // don't add inactive names to the scope
if (!name.isActive()) if (!name.isActive())
return; 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); IBinding binding= getBindingInAST(name, forceResolve);
if (binding == null && forceResolve) { if (binding == null && forceResolve) {
final IASTTranslationUnit tu = name.getTranslationUnit(); final IASTTranslationUnit tu = name.getTranslationUnit();
@ -190,17 +190,17 @@ abstract public class CPPScope implements ICPPASTInternalScope {
return fIndexNamespace; 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); IBinding[] bs= getBindingsInAST(name, forceResolve, false, false, true);
return CPPSemantics.resolveAmbiguities(name, bs); 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); return getBindings(name, resolve, prefixLookup, fileSet, true);
} }
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet, 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); IBinding[] result = getBindingsInAST(name, resolve, prefixLookup, checkPointOfDecl, true);
final IASTTranslationUnit tu = name.getTranslationUnit(); final IASTTranslationUnit tu = name.getTranslationUnit();
if (tu != null) { if (tu != null) {
@ -243,7 +243,7 @@ abstract public class CPPScope implements ICPPASTInternalScope {
} }
public IBinding[] getBindingsInAST(IASTName name, boolean forceResolve, boolean prefixLookup, public IBinding[] getBindingsInAST(IASTName name, boolean forceResolve, boolean prefixLookup,
boolean checkPointOfDecl, boolean expandUsingDirectives) throws DOMException { boolean checkPointOfDecl, boolean expandUsingDirectives) {
populateCache(); populateCache();
final char[] c = name.getLookupKey(); final char[] c = name.getLookupKey();
IBinding[] result = null; IBinding[] result = null;
@ -327,7 +327,7 @@ abstract public class CPPScope implements ICPPASTInternalScope {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String) * @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); 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); 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); return getBindings(name, resolve, prefix, IIndexFileSet.EMPTY, true);
} }
public IName getScopeName() throws DOMException { public IName getScopeName() {
return null; return null;
} }
@Override @Override
public String toString() { public String toString() {
IName name = null; IName name = getScopeName();
try {
name = getScopeName();
} catch (DOMException e) {
}
final String n= name != null ? name.toString() : "<unnamed scope>"; //$NON-NLS-1$ final String n= name != null ? name.toString() : "<unnamed scope>"; //$NON-NLS-1$
return getKind().toString() + ' ' + n + ' ' + '(' + super.toString() + ')'; return getKind().toString() + ' ' + n + ' ' + '(' + super.toString() + ')';
} }

View file

@ -88,19 +88,19 @@ public class CPPScopeMapper {
return fScope.getKind(); return fScope.getKind();
} }
public IBinding[] find(String name) throws DOMException { public IBinding[] find(String name) {
return fScope.find(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); 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); 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); 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); return fScope.getBindings(name, resolve, prefixLookup, acceptLocalBindings);
} }
public IScope getParent() throws DOMException { public IScope getParent() throws DOMException {
@ -111,7 +111,7 @@ public class CPPScopeMapper {
return fTu.getScope(); return fTu.getScope();
} }
public IName getScopeName() throws DOMException { public IName getScopeName() {
return fScope.getScopeName(); return fScope.getScopeName();
} }

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM - Initial API and implementation * Andrew Niefer (IBM Corporation) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.core.runtime.PlatformObject; import org.eclipse.core.runtime.PlatformObject;
/**
* @author aniefer
*/
public abstract class CPPTemplateDefinition extends PlatformObject implements ICPPTemplateDefinition, ICPPInternalTemplate { public abstract class CPPTemplateDefinition extends PlatformObject implements ICPPTemplateDefinition, ICPPInternalTemplate {
public static final class CPPTemplateProblem extends ProblemBinding implements ICPPTemplateDefinition { public static final class CPPTemplateProblem extends ProblemBinding implements ICPPTemplateDefinition {
public CPPTemplateProblem(IASTNode node, int id, char[] arg) { 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 { public ICPPClassTemplatePartialSpecialization[] getTemplateSpecializations() throws DOMException {
throw new DOMException(this); 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; protected IASTName[] declarations;

View file

@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer; import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer;
import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression;
@ -115,16 +114,16 @@ public class CPPTemplateNonTypeParameter extends CPPTemplateParameter implements
return getType() instanceof ICPPParameterPackType; return getType() instanceof ICPPParameterPackType;
} }
public boolean isStatic() throws DOMException { public boolean isStatic() {
return false; return false;
} }
public boolean isExtern() throws DOMException { public boolean isExtern() {
return false; return false;
} }
public boolean isAuto() throws DOMException { public boolean isAuto() {
return false; return false;
} }
public boolean isRegister() throws DOMException { public boolean isRegister() {
return false; return false;
} }
public IValue getInitialValue() { public IValue getInitialValue() {

View file

@ -218,7 +218,7 @@ public abstract class CPPTemplateParameter extends PlatformObject
return getName(); return getName();
} }
public IBinding getOwner() throws DOMException { public IBinding getOwner() {
if (declarations == null || declarations.length == 0) if (declarations == null || declarations.length == 0)
return null; return null;

Some files were not shown because too many files have changed in this diff Show more