diff options
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom')
43 files changed, 392 insertions, 529 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java index c28a028d1b4..bad20c7d793 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java @@ -33,7 +33,6 @@ import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.ILinkage; import org.eclipse.cdt.core.dom.IPDOMNode; import org.eclipse.cdt.core.dom.IPDOMVisitor; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement; import org.eclipse.cdt.core.dom.ast.IBinding; @@ -1295,39 +1294,36 @@ public class PDOM extends PlatformObject implements IPDOM { if (c == null) { return PDOMBinding.EMPTY_PDOMBINDING_ARRAY; } - try { - if (binding instanceof ICPPFunction) { - ICPPFunction func = (ICPPFunction) binding; - if (func.isExternC()) { - result = FindBinding.findBinding(c.getIndex(), c, - func.getNameCharArray(), new int[] { IIndexCBindingConstants.CFUNCTION }, 0); - } - } else if (binding instanceof ICPPVariable) { - ICPPVariable var = (ICPPVariable) binding; - if (var.isExternC()) { - result = FindBinding.findBinding(c.getIndex(), c, - var.getNameCharArray(), new int[] { IIndexCBindingConstants.CVARIABLE }, 0); - } - } else if (binding instanceof IEnumeration) { - result= FindBinding.findBinding(c.getIndex(), c, - binding.getNameCharArray(), new int[] {IIndexCBindingConstants.CENUMERATION }, 0); - } else if (binding instanceof IEnumerator) { - result= FindBinding.findBinding(c.getIndex(), c, - binding.getNameCharArray(), new int[] {IIndexCBindingConstants.CENUMERATOR }, 0); - } else if (binding instanceof ITypedef) { - result= FindBinding.findBinding(c.getIndex(), c, - binding.getNameCharArray(), new int[] {IIndexCBindingConstants.CTYPEDEF }, 0); - } else if (binding instanceof ICompositeType) { - final int key= ((ICompositeType) binding).getKey(); - if (key == ICompositeType.k_struct || key == ICompositeType.k_union) { - result= FindBinding.findBinding(c.getIndex(), c, - binding.getNameCharArray(), new int[] {IIndexCBindingConstants.CSTRUCTURE }, 0); - if (result instanceof ICompositeType && ((ICompositeType) result).getKey() != key) { - result= null; - } + if (binding instanceof ICPPFunction) { + ICPPFunction func = (ICPPFunction) binding; + if (func.isExternC()) { + result = FindBinding.findBinding(c.getIndex(), c, + func.getNameCharArray(), new int[] { IIndexCBindingConstants.CFUNCTION }, 0); + } + } else if (binding instanceof ICPPVariable) { + ICPPVariable var = (ICPPVariable) binding; + if (var.isExternC()) { + result = FindBinding.findBinding(c.getIndex(), c, + var.getNameCharArray(), new int[] { IIndexCBindingConstants.CVARIABLE }, 0); + } + } else if (binding instanceof IEnumeration) { + result= FindBinding.findBinding(c.getIndex(), c, + binding.getNameCharArray(), new int[] {IIndexCBindingConstants.CENUMERATION }, 0); + } else if (binding instanceof IEnumerator) { + result= FindBinding.findBinding(c.getIndex(), c, + binding.getNameCharArray(), new int[] {IIndexCBindingConstants.CENUMERATOR }, 0); + } else if (binding instanceof ITypedef) { + result= FindBinding.findBinding(c.getIndex(), c, + binding.getNameCharArray(), new int[] {IIndexCBindingConstants.CTYPEDEF }, 0); + } else if (binding instanceof ICompositeType) { + final int key= ((ICompositeType) binding).getKey(); + if (key == ICompositeType.k_struct || key == ICompositeType.k_union) { + result= FindBinding.findBinding(c.getIndex(), c, + binding.getNameCharArray(), new int[] {IIndexCBindingConstants.CSTRUCTURE }, 0); + if (result instanceof ICompositeType && ((ICompositeType) result).getKey() != key) { + result= null; } - } - } catch (DOMException e) { + } } return result == null ? PDOMBinding.EMPTY_PDOMBINDING_ARRAY : new PDOMBinding[] {result}; } @@ -1342,11 +1338,8 @@ public class PDOM extends PlatformObject implements IPDOM { filter= new IndexFilter() { @Override public boolean acceptBinding(IBinding binding) { - try { - if (binding instanceof ICPPFunction) { - return ((ICPPFunction) binding).isExternC(); - } - } catch (DOMException e) { + if (binding instanceof ICPPFunction) { + return ((ICPPFunction) binding).isExternC(); } return false; } @@ -1356,11 +1349,8 @@ public class PDOM extends PlatformObject implements IPDOM { filter= new IndexFilter() { @Override public boolean acceptBinding(IBinding binding) { - try { - if (binding instanceof ICPPVariable) { - return ((ICPPVariable) binding).isExternC(); - } - } catch (DOMException e) { + if (binding instanceof ICPPVariable) { + return ((ICPPVariable) binding).isExternC(); } return false; } @@ -1388,22 +1378,16 @@ public class PDOM extends PlatformObject implements IPDOM { } }; } else if (binding instanceof ICompositeType) { - try { - final int key = ((ICompositeType) binding).getKey(); - filter= new IndexFilter() { - @Override - public boolean acceptBinding(IBinding binding) { - try { - if (binding instanceof ICompositeType) { - return ((ICompositeType) binding).getKey() == key; - } - } catch (DOMException e) { - } - return false; + final int key = ((ICompositeType) binding).getKey(); + filter= new IndexFilter() { + @Override + public boolean acceptBinding(IBinding binding) { + if (binding instanceof ICompositeType) { + return ((ICompositeType) binding).getKey() == key; } - }; - } catch (DOMException e) { - } + return false; + } + }; } if (filter != null) { BindingCollector collector= new BindingCollector(cpp, binding.getNameCharArray(), filter, false, true); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java index 994aadb1f27..3fb480687c4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java @@ -269,7 +269,7 @@ public class PDOMASTAdapter { return fDelegate.isSameType(type); } - public IBinding getOwner() throws DOMException { + public IBinding getOwner() { return fDelegate.getOwner(); } @@ -296,7 +296,7 @@ public class PDOMASTAdapter { throw new PDOMNotImplementedError(); } - public IField findField(String name) throws DOMException { + public IField findField(String name) { return fDelegate.findField(name); } @@ -305,15 +305,15 @@ public class PDOMASTAdapter { return fDelegate.getAdapter(adapter); } - public IScope getCompositeScope() throws DOMException { + public IScope getCompositeScope() { return fDelegate.getCompositeScope(); } - public IField[] getFields() throws DOMException { + public IField[] getFields() { return fDelegate.getFields(); } - public int getKey() throws DOMException { + public int getKey() { return fDelegate.getKey(); } @@ -337,11 +337,11 @@ public class PDOMASTAdapter { return fDelegate.isSameType(type); } - public IBinding getOwner() throws DOMException { + public IBinding getOwner() { return fDelegate.getOwner(); } - public boolean isAnonymous() throws DOMException { + public boolean isAnonymous() { return fDelegate.isAnonymous(); } } @@ -403,7 +403,7 @@ public class PDOMASTAdapter { return fDelegate.isGloballyQualified(); } - public IBinding getOwner() throws DOMException { + public IBinding getOwner() { return fDelegate.getOwner(); } } @@ -447,51 +447,51 @@ public class PDOMASTAdapter { super(name, delegate); } - public IField findField(String name) throws DOMException { + public IField findField(String name) { return ((ICPPClassType) fDelegate).findField(name); } - public ICPPMethod[] getAllDeclaredMethods() throws DOMException { + public ICPPMethod[] getAllDeclaredMethods() { return ((ICPPClassType) fDelegate).getAllDeclaredMethods(); } - public ICPPBase[] getBases() throws DOMException { + public ICPPBase[] getBases() { return ((ICPPClassType) fDelegate).getBases(); } - public IScope getCompositeScope() throws DOMException { + public IScope getCompositeScope() { return ((ICPPClassType) fDelegate).getCompositeScope(); } - public ICPPConstructor[] getConstructors() throws DOMException { + public ICPPConstructor[] getConstructors() { return ((ICPPClassType) fDelegate).getConstructors(); } - public ICPPField[] getDeclaredFields() throws DOMException { + public ICPPField[] getDeclaredFields() { return ((ICPPClassType) fDelegate).getDeclaredFields(); } - public ICPPMethod[] getDeclaredMethods() throws DOMException { + public ICPPMethod[] getDeclaredMethods() { return ((ICPPClassType) fDelegate).getDeclaredMethods(); } - public IField[] getFields() throws DOMException { + public IField[] getFields() { return ((ICPPClassType) fDelegate).getFields(); } - public IBinding[] getFriends() throws DOMException { + public IBinding[] getFriends() { return ((ICPPClassType) fDelegate).getFriends(); } - public int getKey() throws DOMException { + public int getKey() { return ((ICPPClassType) fDelegate).getKey(); } - public ICPPMethod[] getMethods() throws DOMException { + public ICPPMethod[] getMethods() { return ((ICPPClassType) fDelegate).getMethods(); } - public ICPPClassType[] getNestedClasses() throws DOMException { + public ICPPClassType[] getNestedClasses() { return ((ICPPClassType) fDelegate).getNestedClasses(); } @@ -499,7 +499,7 @@ public class PDOMASTAdapter { return ((ICPPClassType) fDelegate).isSameType(type); } - public boolean isAnonymous() throws DOMException { + public boolean isAnonymous() { return ((ICPPClassType) fDelegate).isAnonymous(); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java index 12cdac09ec7..05f6860cd23 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java @@ -432,20 +432,19 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding return 0; } - public final IBinding getBinding(IASTName name, boolean resolve) throws DOMException { + public final IBinding getBinding(IASTName name, boolean resolve) { return getBinding(name, resolve, null); } - public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) throws DOMException { + public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) { return null; } - 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, null); } - public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix, IIndexFileSet fileSet) - throws DOMException { + public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix, IIndexFileSet fileSet) { return null; } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMLinkage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMLinkage.java index 9cfed220e7b..4f5d26c04c7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMLinkage.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMLinkage.java @@ -17,7 +17,6 @@ import java.lang.ref.Reference; import java.lang.ref.SoftReference; import org.eclipse.cdt.core.dom.IPDOMVisitor; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTNode; @@ -238,31 +237,28 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage protected PDOMFile getLocalToFile(IBinding binding, PDOMBinding glob) throws CoreException { if (fPDOM instanceof WritablePDOM) { final WritablePDOM wpdom= (WritablePDOM) fPDOM; - try { - if (binding instanceof IField) { - return null; - } - boolean checkIfInSourceOnly= false; - boolean requireDefinition= false; - if (binding instanceof IVariable) { - if (!(binding instanceof IField)) { - checkIfInSourceOnly= ((IVariable) binding).isStatic(); - } - } else if (binding instanceof IFunction) { - IFunction f= (IFunction) binding; - checkIfInSourceOnly= ASTInternal.isStatic(f, false); - } else if (binding instanceof ITypedef || binding instanceof ICompositeType || binding instanceof IEnumeration) { - checkIfInSourceOnly= true; - requireDefinition= true; + if (binding instanceof IField) { + return null; + } + boolean checkIfInSourceOnly= false; + boolean requireDefinition= false; + if (binding instanceof IVariable) { + if (!(binding instanceof IField)) { + checkIfInSourceOnly= ((IVariable) binding).isStatic(); } + } else if (binding instanceof IFunction) { + IFunction f= (IFunction) binding; + checkIfInSourceOnly= ASTInternal.isStatic(f, false); + } else if (binding instanceof ITypedef || binding instanceof ICompositeType || binding instanceof IEnumeration) { + checkIfInSourceOnly= true; + requireDefinition= true; + } - if (checkIfInSourceOnly) { - String path= ASTInternal.getDeclaredInSourceFileOnly(binding, requireDefinition, glob); - if (path != null) { - return wpdom.getFileForASTPath(getLinkageID(), path); - } + if (checkIfInSourceOnly) { + String path= ASTInternal.getDeclaredInSourceFileOnly(binding, requireDefinition, glob); + if (path != null) { + return wpdom.getFileForASTPath(getLinkageID(), path); } - } catch (DOMException e) { } } return null; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCAnnotation.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCAnnotation.java index 989b07165bc..d505b8b5843 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCAnnotation.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 IBM Corporation. + * Copyright (c) 2006, 2010 IBM Corporation. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,7 +12,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.c; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IFunction; import org.eclipse.cdt.core.dom.ast.IVariable; @@ -44,9 +43,8 @@ public class PDOMCAnnotation { * * @param binding the IBinding whose annotation will be encoded. * @return a bit vector of the annotation. - * @throws DOMException */ - public static byte encodeAnnotation(IBinding binding) throws DOMException { + public static byte encodeAnnotation(IBinding binding) { byte modifiers = 0; if (binding instanceof IVariable) { IVariable variable = (IVariable) binding; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java index 1d68bb7953d..7e68e054d41 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 QNX Software Systems and others. + * Copyright (c) 2006, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -152,11 +152,11 @@ class PDOMCFunction extends PDOMBinding implements IFunction { } } - public boolean isStatic() throws DOMException { + public boolean isStatic() { return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.STATIC_OFFSET); } - public boolean isExtern() throws DOMException { + public boolean isExtern() { return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.EXTERN_OFFSET); } @@ -184,21 +184,21 @@ class PDOMCFunction extends PDOMBinding implements IFunction { } } - public boolean isAuto() throws DOMException { + public boolean isAuto() { // ISO/IEC 9899:TC1 6.9.1.4 return false; } - public boolean isRegister() throws DOMException { + public boolean isRegister() { // ISO/IEC 9899:TC1 6.9.1.4 return false; } - public boolean isInline() throws DOMException { + public boolean isInline() { return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.INLINE_OFFSET); } - public boolean takesVarArgs() throws DOMException { + public boolean takesVarArgs() { return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.VARARGS_OFFSET); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java index b8f1c653d20..54f1afefaa9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java @@ -26,7 +26,6 @@ import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.IVariable; import org.eclipse.cdt.core.index.IIndexBinding; -import org.eclipse.cdt.internal.core.Util; import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer; import org.eclipse.cdt.internal.core.dom.parser.c.CArrayType; import org.eclipse.cdt.internal.core.dom.parser.c.CBasicType; @@ -206,30 +205,26 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants { * @throws CoreException */ final private PDOMNode getAdaptedParent(IBinding binding) throws CoreException { - try { - if (binding instanceof IIndexBinding) { - IIndexBinding ib= (IIndexBinding) binding; - if (ib.isFileLocal()) { - return null; - } - } - - IBinding owner= binding.getOwner(); - // For plain c the enumeration type is not the parent of the enumeration item. - if (owner instanceof IEnumeration) { - owner= owner.getOwner(); - } - if (owner == null) { - return this; - } - if (owner instanceof IFunction) { + if (binding instanceof IIndexBinding) { + IIndexBinding ib= (IIndexBinding) binding; + if (ib.isFileLocal()) { return null; } - - return adaptBinding(owner); - } catch (DOMException e) { - throw new CoreException(Util.createStatus(e)); + } + + IBinding owner= binding.getOwner(); + // For plain c the enumeration type is not the parent of the enumeration item. + if (owner instanceof IEnumeration) { + owner= owner.getOwner(); + } + if (owner == null) { + return this; } + if (owner instanceof IFunction) { + return null; + } + + return adaptBinding(owner); } @Override diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCParameter.java index 83fa923111d..b46776ec791 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCParameter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 QNX Software Systems and others. + * Copyright (c) 2006, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -74,12 +74,12 @@ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBin return fType; } - public boolean isAuto() throws DOMException { + public boolean isAuto() { byte flag = 1<<PDOMCAnnotation.AUTO_OFFSET; return hasFlag(flag, true); } - public boolean isRegister() throws DOMException { + public boolean isRegister() { byte flag = 1<<PDOMCAnnotation.REGISTER_OFFSET; return hasFlag(flag, false); } @@ -170,12 +170,8 @@ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBin protected byte encodeFlags(IParameter param) { // C99 ISO/IEC 9899: 6.7.5.3.2 byte flags= 0; - try { - flags |= (param.isAuto() ? 1 : 0) << PDOMCAnnotation.AUTO_OFFSET; - flags |= (param.isRegister() ? 1 : 0) << PDOMCAnnotation.REGISTER_OFFSET; - } catch (DOMException e) { - // ignore and miss out on some flags - } + flags |= (param.isAuto() ? 1 : 0) << PDOMCAnnotation.AUTO_OFFSET; + flags |= (param.isRegister() ? 1 : 0) << PDOMCAnnotation.REGISTER_OFFSET; return flags; } @@ -190,11 +186,11 @@ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBin } - public boolean isExtern() throws DOMException { + public boolean isExtern() { return false; } - public boolean isStatic() throws DOMException { + public boolean isStatic() { return false; } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java index 66bb7e54981..8d91c4280a6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 QNX Software Systems and others. + * Copyright (c) 2006, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,7 +18,6 @@ import java.util.List; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.IPDOMNode; import org.eclipse.cdt.core.dom.IPDOMVisitor; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.EScopeKind; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IBinding; @@ -31,7 +30,6 @@ import org.eclipse.cdt.core.dom.ast.c.ICCompositeTypeScope; import org.eclipse.cdt.core.index.IIndexBinding; import org.eclipse.cdt.core.index.IIndexFileSet; import org.eclipse.cdt.core.index.IndexFilter; -import org.eclipse.cdt.internal.core.Util; import org.eclipse.cdt.internal.core.index.IIndexCBindingConstants; import org.eclipse.cdt.internal.core.index.IIndexScope; import org.eclipse.cdt.internal.core.index.IIndexType; @@ -82,19 +80,11 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom } private void setKind(ICompositeType ct) throws CoreException { - try { - getDB().putByte(record + KEY, (byte) ct.getKey()); - } catch (DOMException e) { - throw new CoreException(Util.createStatus(e)); - } + getDB().putByte(record + KEY, (byte) ct.getKey()); } private void setAnonymous(ICompositeType ct) throws CoreException { - try { - getDB().putByte(record + ANONYMOUS, (byte) (ct.isAnonymous() ? 1 : 0)); - } catch (DOMException e) { - throw new CoreException(Util.createStatus(e)); - } + getDB().putByte(record + ANONYMOUS, (byte) (ct.isAnonymous() ? 1 : 0)); } @@ -114,7 +104,7 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom throw new UnsupportedOperationException(); } - public int getKey() throws DOMException { + public int getKey() { try { return getDB().getByte(record + KEY); } catch (CoreException e) { @@ -123,7 +113,7 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom } } - public boolean isAnonymous() throws DOMException { + public boolean isAnonymous() { try { return getDB().getByte(record + ANONYMOUS) != 0; } catch (CoreException e) { @@ -141,11 +131,8 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom fields.add(node); } } else if (node instanceof ICompositeType) { - try { - if (((ICompositeType) node).isAnonymous()) { - return true; // visit children - } - } catch (DOMException e) { + if (((ICompositeType) node).isAnonymous()) { + return true; // visit children } } return false; @@ -156,7 +143,7 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom return fields.toArray(new IField[fields.size()]); } } - public IField[] getFields() throws DOMException { + public IField[] getFields() { try { GetFields fields = new GetFields(); accept(fields); @@ -183,11 +170,8 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom } } } else if (node instanceof ICompositeType) { - try { - if (((ICompositeType) node).isAnonymous()) { - return true; // visit children - } - } catch (DOMException e) { + if (((ICompositeType) node).isAnonymous()) { + return true; // visit children } } return false; @@ -197,7 +181,7 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom public IField getField() { return field; } } - public IField findField(String name) throws DOMException { + public IField findField(String name) { final PDOM pdom = getPDOM(); final String key= pdom.createKeyForCache(record, name.toCharArray()); IField result= (IField) pdom.getCachedResult(key); @@ -272,25 +256,25 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom return this; } - public IBinding getBinding(char[] name) throws DOMException { + public IBinding getBinding(char[] name) { return findField(new String(name)); } @Override - public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) throws DOMException { + public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) { return getBinding(name.toCharArray()); } @Override - public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) throws DOMException { + public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) { return getBindings(name.toCharArray()); } - public IBinding[] find(String name) throws DOMException { + public IBinding[] find(String name) { return getBindings(name.toCharArray()); } - private IBinding[] getBindings(char[] name) throws DOMException { + private IBinding[] getBindings(char[] name) { IBinding b= getBinding(name); if (b == null) return IBinding.EMPTY_BINDING_ARRAY; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java index fab027692bc..8c3b1ddaf45 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 QNX Software Systems and others. + * Copyright (c) 2006, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -136,19 +136,19 @@ class PDOMCVariable extends PDOMBinding implements IVariable { } } - public boolean isStatic() throws DOMException { + public boolean isStatic() { return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.STATIC_OFFSET); } - public boolean isExtern() throws DOMException { + public boolean isExtern() { return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.EXTERN_OFFSET); } - public boolean isAuto() throws DOMException { + public boolean isAuto() { return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.AUTO_OFFSET); } - public boolean isRegister() throws DOMException { + public boolean isRegister() { return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.REGISTER_OFFSET); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPAnnotation.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPAnnotation.java index 205f4c5db63..3d599c671e6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPAnnotation.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 IBM Corporation. + * Copyright (c) 2006, 2010 IBM Corporation. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -47,9 +47,8 @@ class PDOMCPPAnnotation { * * @param binding the IBinding whose annotation will be encoded. * @return a bit vector of the annotation. - * @throws DOMException */ - public static byte encodeAnnotation(IBinding binding) throws DOMException { + public static byte encodeAnnotation(IBinding binding) { byte modifiers = PDOMCAnnotation.encodeAnnotation(binding); if (binding instanceof ICPPMember) { ICPPMember member = (ICPPMember) binding; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBase.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBase.java index e17657ca818..15ce48f1f83 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBase.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 QNX Software Systems and others. + * Copyright (c) 2006, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.IName; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase; import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBase; @@ -149,7 +148,7 @@ class PDOMCPPBase implements ICPPBase, ICPPInternalBase { public PDOMCPPBaseClone(ICPPBase base) { this.base = base; } - public IBinding getBaseClass() throws DOMException { + public IBinding getBaseClass() { if (baseClass == null) { return base.getBaseClass(); } @@ -158,10 +157,10 @@ class PDOMCPPBase implements ICPPBase, ICPPInternalBase { public IName getBaseClassSpecifierName() { return base.getBaseClassSpecifierName(); } - public int getVisibility() throws DOMException { + public int getVisibility() { return base.getVisibility(); } - public boolean isVirtual() throws DOMException { + public boolean isVirtual() { return base.isVirtual(); } public void setBaseClass(IBinding binding) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassScope.java index ee5f3443d55..d4c75b5cc22 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassScope.java @@ -23,7 +23,6 @@ import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.ILinkage; import org.eclipse.cdt.core.dom.IPDOMNode; import org.eclipse.cdt.core.dom.IPDOMVisitor; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.EScopeKind; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IBinding; @@ -73,11 +72,8 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope { fResult.put(nchars, list); } list.add(binding); - try { - if (binding instanceof ICompositeType && ((ICompositeType) binding).isAnonymous()) { - return true; // visit children - } - } catch (DOMException e) { + if (binding instanceof ICompositeType && ((ICompositeType) binding).isAnonymous()) { + return true; // visit children } } return false; @@ -109,15 +105,15 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope { return fBinding; } - public IBinding getBinding(IASTName name, boolean resolve) throws DOMException { + public IBinding getBinding(IASTName name, boolean resolve) { return getBinding(name, resolve, null); } - public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup) throws DOMException { + public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup) { return getBindings(name, resolve, prefixLookup, null); } - public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) throws DOMException { + public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) { try { final char[] nameChars = name.getSimpleID(); if (CharArrayUtils.equals(fBinding.getNameCharArray(), nameChars)) { @@ -133,7 +129,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope { return null; } - private IBinding getClassNameBinding() throws DOMException { + private IBinding getClassNameBinding() { if (fBinding instanceof ICPPClassTemplatePartialSpecialization) return ((ICPPClassTemplatePartialSpecialization) fBinding).getPrimaryClassTemplate(); if (fBinding instanceof ICPPSpecialization) @@ -141,7 +137,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope { return fBinding; } - public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) throws DOMException { + public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) { try { if (name instanceof ICPPASTConversionName) { BindingCollector visitor = new BindingCollector(fBinding.getLinkage(), Keywords.cOPERATOR, CONVERSION_FILTER, true, true); @@ -244,7 +240,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope { return map; } - public IBinding[] find(String name) throws DOMException { + public IBinding[] find(String name) { return CPPSemantics.findBindings( this, name, false ); } @@ -262,7 +258,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope { } } - public ICPPConstructor[] getConstructors() throws DOMException { + public ICPPConstructor[] getConstructors() { return fBinding.getConstructors(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java index 7a6e7046063..6918f243b50 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java @@ -18,7 +18,6 @@ import java.util.List; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.IPDOMVisitor; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IField; import org.eclipse.cdt.core.dom.ast.IScope; @@ -182,7 +181,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements } // implementation of class type - public ICPPBase[] getBases() throws DOMException { + public ICPPBase[] getBases() { IScope scope= getCompositeScope(); if (scope instanceof ICPPClassSpecializationScope) { return ((ICPPClassSpecializationScope) scope).getBases(); @@ -208,7 +207,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements return ICPPBase.EMPTY_BASE_ARRAY; } - public ICPPConstructor[] getConstructors() throws DOMException { + public ICPPConstructor[] getConstructors() { IScope scope= getCompositeScope(); if (scope instanceof ICPPClassSpecializationScope) { return ((ICPPClassSpecializationScope) scope).getConstructors(); @@ -223,7 +222,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements } } - public ICPPMethod[] getDeclaredMethods() throws DOMException { + public ICPPMethod[] getDeclaredMethods() { IScope scope= getCompositeScope(); if (scope instanceof ICPPClassSpecializationScope) { return ((ICPPClassSpecializationScope) scope).getDeclaredMethods(); @@ -238,7 +237,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements } } - public ICPPField[] getDeclaredFields() throws DOMException { + public ICPPField[] getDeclaredFields() { IScope scope= getCompositeScope(); if (scope instanceof ICPPClassSpecializationScope) { return ((ICPPClassSpecializationScope) scope).getDeclaredFields(); @@ -253,7 +252,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements } } - public ICPPClassType[] getNestedClasses() throws DOMException { + public ICPPClassType[] getNestedClasses() { IScope scope= getCompositeScope(); if (scope instanceof ICPPClassSpecializationScope) { return ((ICPPClassSpecializationScope) scope).getNestedClasses(); @@ -268,28 +267,28 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements } } - public IBinding[] getFriends() throws DOMException { + public IBinding[] getFriends() { // not yet supported. return IBinding.EMPTY_BINDING_ARRAY; } - public ICPPMethod[] getMethods() throws DOMException { + public ICPPMethod[] getMethods() { return ClassTypeHelper.getMethods(this); } - public ICPPMethod[] getAllDeclaredMethods() throws DOMException { + public ICPPMethod[] getAllDeclaredMethods() { return ClassTypeHelper.getAllDeclaredMethods(this); } - public IField[] getFields() throws DOMException { + public IField[] getFields() { return ClassTypeHelper.getFields(this); } - public IField findField(String name) throws DOMException { + public IField findField(String name) { return ClassTypeHelper.findField(this, name); } - public int getKey() throws DOMException { + public int getKey() { return (getSpecializedBinding()).getKey(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java index 8a17263bb9a..384de439beb 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 QNX Software Systems and others. + * Copyright (c) 2007, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -177,8 +177,7 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType } } int pos= newParamLength; - for (int j = 0; j < allParams.length; j++) { - IPDOMCPPTemplateParameter unused = allParams[j]; + for (IPDOMCPPTemplateParameter unused : allParams) { if (unused != null) newAllParams[pos++]= unused; } @@ -250,21 +249,17 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType type instanceof ICPPClassSpecialization) return false; - try { - ICPPClassType ctype= (ICPPClassType) type; - if (ctype.getKey() != getKey()) - return false; - char[] nchars = ctype.getNameCharArray(); - if (nchars.length == 0) { - nchars= ASTTypeUtil.createNameForAnonymous(ctype); - } - if (nchars == null || !CharArrayUtils.equals(nchars, getNameCharArray())) - return false; - - return SemanticUtil.isSameOwner(getOwner(), ctype.getOwner()); - } catch (DOMException e) { + ICPPClassType ctype= (ICPPClassType) type; + if (ctype.getKey() != getKey()) return false; + char[] nchars = ctype.getNameCharArray(); + if (nchars.length == 0) { + nchars= ASTTypeUtil.createNameForAnonymous(ctype); } + if (nchars == null || !CharArrayUtils.equals(nchars, getNameCharArray())) + return false; + + return SemanticUtil.isSameOwner(getOwner(), ctype.getOwner()); } public ICPPTemplateInstance getInstance(ICPPTemplateArgument[] arguments) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java index fa060cabbed..a8dcfa6dee9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2009 QNX Software Systems and others. + * Copyright (c) 2005, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,7 +21,6 @@ import java.util.List; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.IPDOMVisitor; 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.IField; import org.eclipse.cdt.core.dom.ast.IType; @@ -33,7 +32,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; import org.eclipse.cdt.core.dom.ast.cpp.ICPPField; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.core.parser.util.CharArrayUtils; -import org.eclipse.cdt.internal.core.Util; import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding; import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil; @@ -98,19 +96,11 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO } private void setKind(ICPPClassType ct) throws CoreException { - try { - getDB().putByte(record + KEY, (byte) ct.getKey()); - } catch (DOMException e) { - throw new CoreException(Util.createStatus(e)); - } + getDB().putByte(record + KEY, (byte) ct.getKey()); } private void setAnonymous(ICPPClassType ct) throws CoreException { - try { - getDB().putByte(record + ANONYMOUS, (byte) (ct.isAnonymous() ? 1 : 0)); - } catch (DOMException e) { - throw new CoreException(Util.createStatus(e)); - } + getDB().putByte(record + ANONYMOUS, (byte) (ct.isAnonymous() ? 1 : 0)); } @Override @@ -220,14 +210,14 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO } } - public ICPPClassScope getCompositeScope() throws DOMException { + public ICPPClassScope getCompositeScope() { if (fScope == null) { fScope= new PDOMCPPClassScope(this); } return fScope; } - public int getKey() throws DOMException { + public int getKey() { try { return getDB().getByte(record + KEY); } catch (CoreException e) { @@ -236,7 +226,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO } } - public boolean isAnonymous() throws DOMException { + public boolean isAnonymous() { try { return getDB().getByte(record + ANONYMOUS) != 0; } catch (CoreException e) { @@ -259,25 +249,21 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO if (type instanceof ICPPClassType && !(type instanceof ProblemBinding)) { ICPPClassType ctype= (ICPPClassType) type; - try { - if (ctype.getKey() != getKey()) - return false; - char[] nchars = ctype.getNameCharArray(); - if (nchars.length == 0) { - nchars= ASTTypeUtil.createNameForAnonymous(ctype); - } - if (nchars == null || !CharArrayUtils.equals(nchars, getNameCharArray())) - return false; - - return SemanticUtil.isSameOwner(getOwner(), ctype.getOwner()); - } catch (DOMException e) { - CCorePlugin.log(e); + if (ctype.getKey() != getKey()) + return false; + char[] nchars = ctype.getNameCharArray(); + if (nchars.length == 0) { + nchars= ASTTypeUtil.createNameForAnonymous(ctype); } + if (nchars == null || !CharArrayUtils.equals(nchars, getNameCharArray())) + return false; + + return SemanticUtil.isSameOwner(getOwner(), ctype.getOwner()); } return false; } - public ICPPBase[] getBases() throws DOMException { + public ICPPBase[] getBases() { Long key= record + PDOMCPPLinkage.CACHE_BASES; ICPPBase[] bases= (ICPPBase[]) getPDOM().getCachedResult(key); if (bases != null) @@ -297,7 +283,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO } } - public ICPPConstructor[] getConstructors() throws DOMException { + public ICPPConstructor[] getConstructors() { PDOMClassUtil.ConstructorCollector visitor= new PDOMClassUtil.ConstructorCollector(); try { PDOMCPPClassScope.acceptViaCache(this, visitor, false); @@ -308,7 +294,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO } } - public ICPPMethod[] getDeclaredMethods() throws DOMException { + public ICPPMethod[] getDeclaredMethods() { try { PDOMClassUtil.MethodCollector methods = new PDOMClassUtil.MethodCollector(false); PDOMCPPClassScope.acceptViaCache(this, methods, false); @@ -319,7 +305,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO } } - public ICPPField[] getDeclaredFields() throws DOMException { + public ICPPField[] getDeclaredFields() { try { PDOMClassUtil.FieldCollector visitor = new PDOMClassUtil.FieldCollector(); PDOMCPPClassScope.acceptViaCache(this, visitor, false); @@ -330,7 +316,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO } } - public ICPPClassType[] getNestedClasses() throws DOMException { + public ICPPClassType[] getNestedClasses() { try { PDOMClassUtil.NestedClassCollector visitor = new PDOMClassUtil.NestedClassCollector(); PDOMCPPClassScope.acceptViaCache(this, visitor, false); @@ -341,7 +327,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO } } - public IBinding[] getFriends() throws DOMException { + public IBinding[] getFriends() { try { final List<IBinding> list = new ArrayList<IBinding>(); for (PDOMCPPFriend friend = getFirstFriend(); @@ -355,19 +341,19 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO } } - public ICPPMethod[] getMethods() throws DOMException { + public ICPPMethod[] getMethods() { return ClassTypeHelper.getMethods(this); } - public ICPPMethod[] getAllDeclaredMethods() throws DOMException { + public ICPPMethod[] getAllDeclaredMethods() { return ClassTypeHelper.getAllDeclaredMethods(this); } - public IField[] getFields() throws DOMException { + public IField[] getFields() { return ClassTypeHelper.getFields(this); } - public IField findField(String name) throws DOMException { + public IField findField(String name) { return ClassTypeHelper.findField(this, name); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructor.java index 170ff494a46..ddd8db8fb6f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2010 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,7 +29,7 @@ class PDOMCPPConstructor extends PDOMCPPMethod implements ICPPConstructor { super(linkage, record); } - public boolean isExplicit() throws DOMException { + public boolean isExplicit() { return getBit(getAnnotation1(), PDOMCPPAnnotation.EXPLICIT_CONSTRUCTOR_OFFSET); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java index b3af609e159..2759f273c66 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 QNX Software Systems and others. + * Copyright (c) 2007, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom.dom.cpp; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants; @@ -51,7 +50,7 @@ public class PDOMCPPConstructorInstance extends PDOMCPPMethodInstance implements return IIndexCPPBindingConstants.CPP_CONSTRUCTOR_INSTANCE; } - public boolean isExplicit() throws DOMException { + public boolean isExplicit() { return ((ICPPConstructor)getTemplateDefinition()).isExplicit(); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorSpecialization.java index 3f9a10905fc..01cf06f8353 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorSpecialization.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 QNX Software Systems and others. + * Copyright (c) 2007, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom.dom.cpp; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants; import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; @@ -49,7 +48,7 @@ class PDOMCPPConstructorSpecialization extends return IIndexCPPBindingConstants.CPP_CONSTRUCTOR_SPECIALIZATION; } - public boolean isExplicit() throws DOMException { + public boolean isExplicit() { return getBit(getByte(record + ANNOTATION1), PDOMCPPAnnotation.EXPLICIT_CONSTRUCTOR_OFFSET); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java index 9642d8909e0..76c8c45c831 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 QNX Software Systems and others. + * Copyright (c) 2007, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -33,7 +33,7 @@ class PDOMCPPConstructorTemplate extends PDOMCPPMethodTemplate implements super(linkage, record); } - public boolean isExplicit() throws DOMException { + public boolean isExplicit() { return getBit(getAnnotation1(), PDOMCPPAnnotation.EXPLICIT_CONSTRUCTOR_OFFSET); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java index e787307f4ab..2155a317ad7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 QNX Software Systems and others. + * Copyright (c) 2007, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom.dom.cpp; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants; import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; @@ -50,7 +49,7 @@ class PDOMCPPConstructorTemplateSpecialization extends return IIndexCPPBindingConstants.CPP_CONSTRUCTOR_TEMPLATE_SPECIALIZATION; } - public boolean isExplicit() throws DOMException { + public boolean isExplicit() { return ((ICPPConstructor)getSpecializedBinding()).isExplicit(); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPDeferredClassInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPDeferredClassInstance.java index e6fc9322bd1..f5cf030d33e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPDeferredClassInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPDeferredClassInstance.java @@ -85,7 +85,7 @@ class PDOMCPPDeferredClassInstance extends PDOMCPPSpecialization implements ICPP return false; } - public IScope getCompositeScope() throws DOMException { + public IScope getCompositeScope() { return asScope(); } @@ -169,14 +169,14 @@ class PDOMCPPDeferredClassInstance extends PDOMCPPSpecialization implements ICPP return ICPPClassType.EMPTY_CLASS_ARRAY; } - public int getKey() throws DOMException{ + public int getKey(){ return getClassTemplate().getKey(); } @Override public Object clone() {fail();return null;} - public ICPPScope asScope() throws DOMException { + public ICPPScope asScope() { if (unknownScope == null) { unknownScope= new PDOMCPPUnknownScope(this, getUnknownName()); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumScope.java index 83b1a99e351..c9633d6b9e9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumScope.java @@ -18,7 +18,6 @@ import java.util.List; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.IPDOMVisitor; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.EScopeKind; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IBinding; @@ -49,15 +48,15 @@ class PDOMCPPEnumScope implements ICPPScope, IIndexScope { return EScopeKind.eEnumeration; } - public IBinding getBinding(IASTName name, boolean resolve) throws DOMException { + public IBinding getBinding(IASTName name, boolean resolve) { return getBinding(name, resolve, null); } - public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup) throws DOMException { + public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup) { return getBindings(name, resolve, prefixLookup, null); } - public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) throws DOMException { + public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) { try { CharArrayMap<PDOMCPPEnumerator> map= getBindingMap(fBinding); return map.get(name.toCharArray()); @@ -67,7 +66,7 @@ class PDOMCPPEnumScope implements ICPPScope, IIndexScope { } } - public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) throws DOMException { + public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) { try { CharArrayMap<PDOMCPPEnumerator> map= getBindingMap(fBinding); if (prefixLookup) { @@ -90,7 +89,7 @@ class PDOMCPPEnumScope implements ICPPScope, IIndexScope { return IBinding.EMPTY_BINDING_ARRAY; } - public IBinding[] find(String name) throws DOMException { + public IBinding[] find(String name) { return CPPSemantics.findBindings(this, name, false); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java index c4c707c0cdc..6f3b3cbe6d0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java @@ -16,7 +16,6 @@ import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.IPDOMNode; import org.eclipse.cdt.core.dom.IPDOMVisitor; 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.IEnumeration; import org.eclipse.cdt.core.dom.ast.IEnumerator; @@ -135,20 +134,16 @@ class PDOMCPPEnumeration extends PDOMCPPBinding implements IPDOMCPPEnumType, IPD } } - try { - if (type instanceof IEnumeration) { - IEnumeration etype= (IEnumeration) type; - char[] nchars = etype.getNameCharArray(); - if (nchars.length == 0) { - nchars= ASTTypeUtil.createNameForAnonymous(etype); - } - if (nchars == null || !CharArrayUtils.equals(nchars, getNameCharArray())) - return false; - - return SemanticUtil.isSameOwner(getOwner(), etype.getOwner()); + if (type instanceof IEnumeration) { + IEnumeration etype= (IEnumeration) type; + char[] nchars = etype.getNameCharArray(); + if (nchars.length == 0) { + nchars= ASTTypeUtil.createNameForAnonymous(etype); } - } catch (DOMException e) { - CCorePlugin.log(e); + if (nchars == null || !CharArrayUtils.equals(nchars, getNameCharArray())) + return false; + + return SemanticUtil.isSameOwner(getOwner(), etype.getOwner()); } return false; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldSpecialization.java index 94fb13b9fa7..0eaa5bfa30b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldSpecialization.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 QNX Software Systems and others. + * Copyright (c) 2007, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -71,7 +71,7 @@ class PDOMCPPFieldSpecialization extends PDOMCPPSpecialization implements ICPPFi return (ICPPField) getSpecializedBinding(); } - public ICompositeType getCompositeTypeOwner() throws DOMException { + public ICompositeType getCompositeTypeOwner() { return getClassOwner(); } @@ -95,11 +95,11 @@ class PDOMCPPFieldSpecialization extends PDOMCPPSpecialization implements ICPPFi } } - public boolean isAuto() throws DOMException { + public boolean isAuto() { return getField().isAuto(); } - public boolean isExtern() throws DOMException { + public boolean isExtern() { return getField().isExtern(); } @@ -107,23 +107,23 @@ class PDOMCPPFieldSpecialization extends PDOMCPPSpecialization implements ICPPFi return false; } - public boolean isRegister() throws DOMException { + public boolean isRegister() { return getField().isRegister(); } - public boolean isStatic() throws DOMException { + public boolean isStatic() { return getField().isStatic(); } - public ICPPClassType getClassOwner() throws DOMException { + public ICPPClassType getClassOwner() { return (ICPPClassType) getOwner(); } - public int getVisibility() throws DOMException { + public int getVisibility() { return getField().getVisibility(); } - public boolean isMutable() throws DOMException { + public boolean isMutable() { return getField().isMutable(); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java index c972adea008..0dcaf92dd7d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java @@ -99,7 +99,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl } } - private short getAnnotation(ICPPFunction function) throws DOMException { + private short getAnnotation(ICPPFunction function) { int annot= PDOMCPPAnnotation.encodeAnnotation(function) & 0xff; if (function.hasParameterPack()) { annot |= (1<<ANNOT_PARAMETER_PACK); @@ -190,12 +190,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl // don't store the exception specification, compute it on demand. exceptionSpec= null; } else { - try{ - exceptionSpec= binding.getExceptionSpecification(); - } catch (DOMException e) { - // ignore problems in the exception specification. - exceptionSpec= null; - } + exceptionSpec= binding.getExceptionSpecification(); } return exceptionSpec; } @@ -271,11 +266,11 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl return fAnnotation; } - public boolean isExternC() throws DOMException { + public boolean isExternC() { return getBit(getAnnotation(), PDOMCPPAnnotation.EXTERN_C_OFFSET); } - public boolean isMutable() throws DOMException { + public boolean isMutable() { throw new PDOMNotImplementedError(); } @@ -340,7 +335,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl return getBit(getAnnotation(), PDOMCAnnotation.STATIC_OFFSET); } - public boolean takesVarArgs() throws DOMException { + public boolean takesVarArgs() { return getBit(getAnnotation(), PDOMCAnnotation.VARARGS_OFFSET); } @@ -375,7 +370,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl return 0; } - public IType[] getExceptionSpecification() throws DOMException { + public IType[] getExceptionSpecification() { try { final long rec = getPDOM().getDB().getRecPtr(record+EXCEPTION_SPEC); return PDOMCPPTypeList.getTypes(this, rec); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionInstance.java index a6f14b6baa5..23451750eee 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionInstance.java @@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp; import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument; @@ -48,12 +47,8 @@ class PDOMCPPFunctionInstance extends PDOMCPPFunctionSpecialization implements I final Database db = getDB(); db.putRecPtr(record+ARGUMENTS, argListRec); - try { - long exceptSpecRec = PDOMCPPTypeList.putTypes(this, function.getExceptionSpecification()); - db.putRecPtr(record+EXCEPTION_SPEC, exceptSpecRec); - } catch (DOMException e) { - // ignore problems in the exception specification - } + long exceptSpecRec = PDOMCPPTypeList.putTypes(this, function.getExceptionSpecification()); + db.putRecPtr(record+EXCEPTION_SPEC, exceptSpecRec); } public PDOMCPPFunctionInstance(PDOMLinkage linkage, long bindingRecord) { @@ -93,7 +88,7 @@ class PDOMCPPFunctionInstance extends PDOMCPPFunctionSpecialization implements I } @Override - public IType[] getExceptionSpecification() throws DOMException { + public IType[] getExceptionSpecification() { try { final long rec = getPDOM().getDB().getRecPtr(record+EXCEPTION_SPEC); return PDOMCPPTypeList.getTypes(this, rec); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionSpecialization.java index 93f48d1dfaf..e601bf5928c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionSpecialization.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 QNX Software Systems and others. + * Copyright (c) 2007, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -122,21 +122,17 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP } catch (DOMException e) { throw new CoreException(Util.createStatus(e)); } - try { - long typelist= 0; - if (astFunction instanceof ICPPMethod && ((ICPPMethod) astFunction).isImplicit()) { - // don't store the exception specification, computed it on demand. - } else { - typelist = PDOMCPPTypeList.putTypes(this, astFunction.getExceptionSpecification()); - } - db.putRecPtr(record + EXCEPTION_SPEC, typelist); - } catch (DOMException e) { - // ignore problems in the exception specification + long typelist= 0; + if (astFunction instanceof ICPPMethod && ((ICPPMethod) astFunction).isImplicit()) { + // don't store the exception specification, computed it on demand. + } else { + typelist = PDOMCPPTypeList.putTypes(this, astFunction.getExceptionSpecification()); } + db.putRecPtr(record + EXCEPTION_SPEC, typelist); } - private short getAnnotation(ICPPFunction astFunction) throws DOMException { + private short getAnnotation(ICPPFunction astFunction) { int annot= PDOMCPPAnnotation.encodeAnnotation(astFunction) & 0xff; if (astFunction.hasParameterPack()) { annot |= (1 << ANNOT_PARAMETER_PACK); @@ -161,7 +157,7 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP return IIndexCPPBindingConstants.CPP_FUNCTION_SPECIALIZATION; } - public boolean isInline() throws DOMException { + public boolean isInline() { return getBit(readAnnotation(), PDOMCAnnotation.INLINE_OFFSET); } @@ -176,7 +172,7 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP return fAnnotation; } - public boolean isMutable() throws DOMException { + public boolean isMutable() { return false; } @@ -219,29 +215,29 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP return fType; } - public boolean isAuto() throws DOMException { + public boolean isAuto() { // ISO/IEC 14882:2003 7.1.1.2 return false; } - public boolean isExtern() throws DOMException { + public boolean isExtern() { return getBit(readAnnotation(), PDOMCAnnotation.EXTERN_OFFSET); } - public boolean isExternC() throws DOMException { + public boolean isExternC() { return getBit(readAnnotation(), PDOMCPPAnnotation.EXTERN_C_OFFSET); } - public boolean isRegister() throws DOMException { + public boolean isRegister() { // ISO/IEC 14882:2003 7.1.1.2 return false; } - public boolean isStatic() throws DOMException { + public boolean isStatic() { return getBit(readAnnotation(), PDOMCAnnotation.STATIC_OFFSET); } - public boolean takesVarArgs() throws DOMException { + public boolean takesVarArgs() { return getBit(readAnnotation(), PDOMCAnnotation.VARARGS_OFFSET); } @@ -283,7 +279,7 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP return cmp==0 ? PDOMCPPFunction.compareSignatures(this, other) : cmp; } - public IType[] getExceptionSpecification() throws DOMException { + public IType[] getExceptionSpecification() { try { final long rec = getPDOM().getDB().getRecPtr(record+EXCEPTION_SPEC); return PDOMCPPTypeList.getTypes(this, rec); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java index 6cd2a680165..76f3bb5a0ac 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java @@ -693,36 +693,32 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { * @throws CoreException */ private final PDOMNode adaptOrAddParent(boolean add, IBinding binding) throws CoreException { - try { - IBinding owner= binding.getOwner(); - if (owner instanceof IFunction && !(binding instanceof ICPPTemplateParameter)) { - return null; - } + IBinding owner= binding.getOwner(); + if (owner instanceof IFunction && !(binding instanceof ICPPTemplateParameter)) { + return null; + } - if (binding instanceof IIndexBinding) { - IIndexBinding ib= (IIndexBinding) binding; - // don't adapt file local bindings from other fragments to this one. - if (ib.isFileLocal()) { - return null; - } - } else { - // skip unnamed namespaces - while (owner instanceof ICPPNamespace) { - char[] name= owner.getNameCharArray(); - if (name.length > 0) { - break; - } - owner= owner.getOwner(); - } - } - - if (owner == null) - return this; + if (binding instanceof IIndexBinding) { + IIndexBinding ib= (IIndexBinding) binding; + // don't adapt file local bindings from other fragments to this one. + if (ib.isFileLocal()) { + return null; + } + } else { + // skip unnamed namespaces + while (owner instanceof ICPPNamespace) { + char[] name= owner.getNameCharArray(); + if (name.length > 0) { + break; + } + owner= owner.getOwner(); + } + } + + if (owner == null) + return this; - return adaptOrAddBinding(add, owner); - } catch (DOMException e) { - throw new CoreException(Util.createStatus(e)); - } + return adaptOrAddBinding(add, owner); } private PDOMBinding adaptOrAddBinding(boolean add, IBinding binding) throws CoreException { @@ -864,33 +860,29 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { name = (IASTName) parent; } IScope container= CPPVisitor.getContainingScope(name); - try { - boolean doit= false; - PDOMCPPNamespace containerNS= null; - - IASTNode node= ASTInternal.getPhysicalNodeOfScope(container); - if (node instanceof IASTTranslationUnit) { - doit= true; - } - else if (node instanceof ICPPASTNamespaceDefinition) { - ICPPASTNamespaceDefinition nsDef= (ICPPASTNamespaceDefinition) node; - IASTName nsContainerName= nsDef.getName(); - if (nsContainerName != null) { - PDOMBinding binding= adaptBinding(nsContainerName.resolveBinding()); - if (binding instanceof PDOMCPPNamespace) { - containerNS= (PDOMCPPNamespace) binding; - doit= true; - } + boolean doit= false; + PDOMCPPNamespace containerNS= null; + + IASTNode node= ASTInternal.getPhysicalNodeOfScope(container); + if (node instanceof IASTTranslationUnit) { + doit= true; + } + else if (node instanceof ICPPASTNamespaceDefinition) { + ICPPASTNamespaceDefinition nsDef= (ICPPASTNamespaceDefinition) node; + IASTName nsContainerName= nsDef.getName(); + if (nsContainerName != null) { + PDOMBinding binding= adaptBinding(nsContainerName.resolveBinding()); + if (binding instanceof PDOMCPPNamespace) { + containerNS= (PDOMCPPNamespace) binding; + doit= true; } } - if (doit) { - long rec= file.getLastUsingDirectiveRec(); - PDOMCPPUsingDirective ud= new PDOMCPPUsingDirective(this, rec, containerNS, - pdomName.getBinding(), pdomName.getFileLocation().getNodeOffset()); - file.setFirstUsingDirectiveRec(ud.getRecord()); - } - } catch (DOMException e) { - CCorePlugin.log(e); + } + if (doit) { + long rec= file.getLastUsingDirectiveRec(); + PDOMCPPUsingDirective ud= new PDOMCPPUsingDirective(this, rec, containerNS, + pdomName.getBinding(), pdomName.getFileLocation().getNodeOffset()); + file.setFirstUsingDirectiveRec(ud.getRecord()); } } else if (parentNode instanceof ICPPASTElaboratedTypeSpecifier) { ICPPASTElaboratedTypeSpecifier elaboratedSpecifier = (ICPPASTElaboratedTypeSpecifier)parentNode; @@ -994,17 +986,14 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { } } if (file == null && !(binding instanceof IIndexBinding)) { - try { - IBinding owner= binding.getOwner(); - if (owner instanceof ICPPNamespace) { - if (owner.getNameCharArray().length == 0) { - String path= ASTInternal.getDeclaredInSourceFileOnly(owner, false, glob); - if (path != null) { - file= wpdom.getFileForASTPath(getLinkageID(), path); - } + IBinding owner= binding.getOwner(); + if (owner instanceof ICPPNamespace) { + if (owner.getNameCharArray().length == 0) { + String path= ASTInternal.getDeclaredInSourceFileOnly(owner, false, glob); + if (path != null) { + file= wpdom.getFileForASTPath(getLinkageID(), path); } } - } catch (DOMException e) { } } if (file != null) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java index 8817e580a76..8b6e95ecd4f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 QNX Software Systems and others. + * Copyright (c) 2006, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -103,7 +103,7 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod { return IIndexCPPBindingConstants.CPPMETHOD; } - public boolean isVirtual() throws DOMException { + public boolean isVirtual() { return getBit(getAnnotation1(), PDOMCPPAnnotation.VIRTUAL_OFFSET); } @@ -113,7 +113,7 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod { return annotation1; } - public boolean isPureVirtual() throws DOMException { + public boolean isPureVirtual() { return getBit(getAnnotation1(), PDOMCPPAnnotation.PURE_VIRTUAL_OFFSET); } @@ -122,7 +122,7 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod { } @Override - public boolean isMutable() throws DOMException { + public boolean isMutable() { throw new PDOMNotImplementedError(); } @@ -158,11 +158,11 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod { return false; } - public int getVisibility() throws DOMException { + public int getVisibility() { return PDOMCPPAnnotation.getVisibility(getAnnotation()); } - public ICPPClassType getClassOwner() throws DOMException { + public ICPPClassType getClassOwner() { return (ICPPClassType) getOwner(); } @@ -210,7 +210,7 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod { } @Override - public IType[] getExceptionSpecification() throws DOMException { + public IType[] getExceptionSpecification() { if (isImplicit()) { return ClassTypeHelper.getInheritedExceptionSpecification(this); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java index 4daded16b7c..95f32619c90 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 QNX Software Systems and others. + * Copyright (c) 2007, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,7 +11,6 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom.dom.cpp; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants; @@ -64,19 +63,19 @@ class PDOMCPPMethodInstance extends PDOMCPPFunctionInstance implements ICPPMetho return ((ICPPMethod)getTemplateDefinition()).isImplicit(); } - public boolean isVirtual() throws DOMException { + public boolean isVirtual() { return ((ICPPMethod)getTemplateDefinition()).isVirtual(); } - public boolean isPureVirtual() throws DOMException { + public boolean isPureVirtual() { return ((ICPPMethod)getTemplateDefinition()).isPureVirtual(); } - public ICPPClassType getClassOwner() throws DOMException { + public ICPPClassType getClassOwner() { return (ICPPClassType) getOwner(); } - public int getVisibility() throws DOMException { + public int getVisibility() { return ((ICPPMethod)getTemplateDefinition()).getVisibility(); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java index f7ae8fc32c2..797bccd6a47 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 QNX Software Systems and others. + * Copyright (c) 2007, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -86,16 +86,16 @@ class PDOMCPPMethodSpecialization extends PDOMCPPFunctionSpecialization return getBit(getByte(record + ANNOTATION1), PDOMCPPAnnotation.IMPLICIT_METHOD_OFFSET); } - public boolean isVirtual() throws DOMException { + public boolean isVirtual() { return getBit(getByte(record + ANNOTATION1), PDOMCPPAnnotation.VIRTUAL_OFFSET); } - public boolean isPureVirtual() throws DOMException { + public boolean isPureVirtual() { return getBit(getByte(record + ANNOTATION1), PDOMCPPAnnotation.PURE_VIRTUAL_OFFSET); } @Override - public boolean isExtern() throws DOMException { + public boolean isExtern() { // ISO/IEC 14882:2003 9.2.6 return false; } @@ -105,11 +105,11 @@ class PDOMCPPMethodSpecialization extends PDOMCPPFunctionSpecialization return false; } - public ICPPClassType getClassOwner() throws DOMException { + public ICPPClassType getClassOwner() { return (ICPPClassType) getOwner(); } - public int getVisibility() throws DOMException { + public int getVisibility() { return PDOMCPPAnnotation.getVisibility(getByte(record + ANNOTATION_OFFSET)); } @@ -124,7 +124,7 @@ class PDOMCPPMethodSpecialization extends PDOMCPPFunctionSpecialization } @Override - public IType[] getExceptionSpecification() throws DOMException { + public IType[] getExceptionSpecification() { if (isImplicit()) { return ClassTypeHelper.getInheritedExceptionSpecification(this); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java index a867040f200..599649a873b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 QNX Software Systems and others. + * Copyright (c) 2007, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -93,15 +93,15 @@ class PDOMCPPMethodTemplate extends PDOMCPPFunctionTemplate implements ICPPMetho return getBit(getAnnotation1(), PDOMCPPAnnotation.IMPLICIT_METHOD_OFFSET); } - public boolean isVirtual() throws DOMException { + public boolean isVirtual() { return getBit(getAnnotation1(), PDOMCPPAnnotation.VIRTUAL_OFFSET); } - public ICPPClassType getClassOwner() throws DOMException { + public ICPPClassType getClassOwner() { return (ICPPClassType) getOwner(); } - public int getVisibility() throws DOMException { + public int getVisibility() { return PDOMCPPAnnotation.getVisibility(getAnnotation()); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java index c7529e96e90..c9bcf33a9cd 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 QNX Software Systems and others. + * Copyright (c) 2007, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,7 +11,6 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom.dom.cpp; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate; @@ -59,7 +58,7 @@ class PDOMCPPMethodTemplateSpecialization extends return false; } - public boolean isVirtual() throws DOMException { + public boolean isVirtual() { IBinding spec = getSpecializedBinding(); if (spec instanceof ICPPMethod) { ((ICPPMethod)spec).isVirtual(); @@ -67,11 +66,11 @@ class PDOMCPPMethodTemplateSpecialization extends return false; } - public ICPPClassType getClassOwner() throws DOMException { + public ICPPClassType getClassOwner() { return (ICPPClassType) getOwner(); } - public int getVisibility() throws DOMException { + public int getVisibility() { IBinding spec = getSpecializedBinding(); if (spec instanceof ICPPMethod) { ((ICPPMethod)spec).getVisibility(); @@ -84,7 +83,7 @@ class PDOMCPPMethodTemplateSpecialization extends return false; } - public boolean isPureVirtual() throws DOMException { + public boolean isPureVirtual() { return false; } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java index 8e6af112efd..799959c45a8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java @@ -18,7 +18,6 @@ import java.util.List; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.IPDOMVisitor; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.EScopeKind; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IBinding; @@ -162,7 +161,7 @@ class PDOMCPPNamespace extends PDOMCPPBinding } @Override - public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) throws DOMException { + public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) { try { IBinding[] bindings= getBindingsViaCache(name.getLookupKey()); if (fileSet != null) { @@ -176,8 +175,7 @@ class PDOMCPPNamespace extends PDOMCPPBinding } @Override - public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) - throws DOMException { + public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) { IBinding[] result = null; try { if (!prefixLookup) { @@ -217,7 +215,7 @@ class PDOMCPPNamespace extends PDOMCPPBinding return true; } - public IBinding[] getMemberBindings() throws DOMException { + public IBinding[] getMemberBindings() { IBinding[] result = null; final List<PDOMNode> preresult = new ArrayList<PDOMNode>(); try { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespaceAlias.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespaceAlias.java index 9395d567685..9f93d1e31ba 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespaceAlias.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespaceAlias.java @@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp; import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias; import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope; @@ -69,7 +68,7 @@ class PDOMCPPNamespaceAlias extends PDOMCPPBinding implements ICPPNamespaceAlias return IIndexCPPBindingConstants.CPPNAMESPACEALIAS; } - public ICPPNamespaceScope getNamespaceScope() throws DOMException { + public ICPPNamespaceScope getNamespaceScope() { return getNamespaceScope(this, 20); // avoid an infinite loop. } @@ -88,7 +87,7 @@ class PDOMCPPNamespaceAlias extends PDOMCPPBinding implements ICPPNamespaceAlias return null; } - public IBinding[] getMemberBindings() throws DOMException { + public IBinding[] getMemberBindings() { throw new PDOMNotImplementedError(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameter.java index 4f37726fd58..8705bb7cbaa 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 QNX Software Systems and others. + * Copyright (c) 2006, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -67,12 +67,8 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind } private void storeAnnotations(Database db, ICPPParameter param) throws CoreException { - try { - byte annotations = PDOMCPPAnnotation.encodeAnnotation(param); - db.putByte(record + ANNOTATIONS, annotations); - } catch (DOMException e) { - // ignore and miss out on some properties of the parameter - } + byte annotations = PDOMCPPAnnotation.encodeAnnotation(param); + db.putByte(record + ANNOTATIONS, annotations); } public void update(ICPPParameter newPar) throws CoreException { @@ -113,7 +109,7 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind return false; } - public boolean isMutable() throws DOMException { + public boolean isMutable() { // ISO/IEC 14882:2003 7.1.1.8 return false; } @@ -122,13 +118,13 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind return fType; } - public boolean isAuto() throws DOMException { + public boolean isAuto() { // ISO/IEC 14882:2003 7.1.1.2 byte flag = 1<<PDOMCAnnotation.AUTO_OFFSET; return hasFlag(flag, true, ANNOTATIONS); } - public boolean isExtern() throws DOMException { + public boolean isExtern() { // ISO/IEC 14882:2003 7.1.1.5 return false; } @@ -137,13 +133,13 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind return false; } - public boolean isRegister() throws DOMException { + public boolean isRegister() { // ISO/IEC 14882:2003 7.1.1.2 byte flag = 1<<PDOMCAnnotation.REGISTER_OFFSET; return hasFlag(flag, true, ANNOTATIONS); } - public boolean isStatic() throws DOMException { + public boolean isStatic() { // ISO/IEC 14882:2003 7.1.1.4 return false; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameterSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameterSpecialization.java index f2a8209a161..d8343400cce 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameterSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPParameterSpecialization.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 QNX Software Systems and others. + * Copyright (c) 2007, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -116,15 +116,15 @@ class PDOMCPPParameterSpecialization extends PDOMCPPSpecialization implements IC return getType() instanceof ICPPParameterPackType; } - public boolean isAuto() throws DOMException { + public boolean isAuto() { return getParameter().isAuto(); } - public boolean isRegister() throws DOMException { + public boolean isRegister() { return getParameter().isRegister(); } - public boolean isExtern() throws DOMException { + public boolean isExtern() { return false; } @@ -132,11 +132,11 @@ class PDOMCPPParameterSpecialization extends PDOMCPPSpecialization implements IC return false; } - public boolean isStatic() throws DOMException { + public boolean isStatic() { return false; } - public boolean isMutable() throws DOMException { + public boolean isMutable() { return false; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassInstance.java index a3f45a15ccc..c349e2d7719 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassInstance.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 Google, Inc and others. + * Copyright (c) 2008, 2010 Google, Inc and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,7 +12,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp; import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.ITypedef; @@ -104,13 +103,10 @@ class PDOMCPPUnknownClassInstance extends PDOMCPPUnknownClassType implements ICP return false; } } - try { - final IBinding lhsContainer= getOwner(); - final IBinding rhsContainer= rhs.getOwner(); - if (lhsContainer instanceof IType && rhsContainer instanceof IType) { - return (((IType) lhsContainer).isSameType((IType) rhsContainer)); - } - } catch (DOMException e) { + final IBinding lhsContainer= getOwner(); + final IBinding rhsContainer= rhs.getOwner(); + if (lhsContainer instanceof IType && rhsContainer instanceof IType) { + return (((IType) lhsContainer).isSameType((IType) rhsContainer)); } } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassType.java index 9990e0d030c..1239abc4db2 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUnknownClassType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 Google, Inc and others. + * Copyright (c) 2008, 2010 Google, Inc and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,7 +12,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp; import org.eclipse.cdt.core.dom.IPDOMVisitor; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.EScopeKind; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IBinding; @@ -30,7 +29,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope; import org.eclipse.cdt.core.index.IIndexBinding; import org.eclipse.cdt.core.index.IIndexFileSet; import org.eclipse.cdt.core.parser.util.CharArrayUtils; -import org.eclipse.cdt.internal.core.Util; import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance; import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownClassInstance; import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownClassType; @@ -82,11 +80,7 @@ class PDOMCPPUnknownClassType extends PDOMCPPUnknownBinding implements ICPPClass } private void setKind(ICPPClassType ct) throws CoreException { - try { - getDB().putByte(record + KEY, (byte) ct.getKey()); - } catch (DOMException e) { - throw new CoreException(Util.createStatus(e)); - } + getDB().putByte(record + KEY, (byte) ct.getKey()); } @Override @@ -116,7 +110,7 @@ class PDOMCPPUnknownClassType extends PDOMCPPUnknownBinding implements ICPPClass return ICPPMethod.EMPTY_CPPMETHOD_ARRAY; } - public IScope getCompositeScope() throws DOMException { + public IScope getCompositeScope() { return this; } @@ -137,17 +131,16 @@ class PDOMCPPUnknownClassType extends PDOMCPPUnknownBinding implements ICPPClass } @Override - public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) throws DOMException { + public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) { return null; } @Override - public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) - throws DOMException { + public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) { return IBinding.EMPTY_BINDING_ARRAY; } - public IBinding[] find(String name) throws DOMException { + public IBinding[] find(String name) { return CPPSemantics.findBindings(this, name, false); } @@ -155,7 +148,7 @@ class PDOMCPPUnknownClassType extends PDOMCPPUnknownBinding implements ICPPClass @Override public Object clone() { fail(); return null; } - public IField findField(String name) throws DOMException { fail(); return null; } + public IField findField(String name) { fail(); return null; } @Override public boolean mayHaveChildren() { @@ -247,13 +240,10 @@ class PDOMCPPUnknownClassType extends PDOMCPPUnknownBinding implements ICPPClass && type instanceof ICPPDeferredClassInstance == false) { ICPPUnknownClassType rhs= (ICPPUnknownClassType) type; if (CharArrayUtils.equals(getNameCharArray(), rhs.getNameCharArray())) { - try { - final IBinding lhsContainer = getOwner(); - final IBinding rhsContainer = rhs.getOwner(); - if (lhsContainer instanceof IType && rhsContainer instanceof IType) { - return ((IType)lhsContainer).isSameType((IType) rhsContainer); - } - } catch (DOMException e) { + final IBinding lhsContainer = getOwner(); + final IBinding rhsContainer = rhs.getOwner(); + if (lhsContainer instanceof IType && rhsContainer instanceof IType) { + return ((IType)lhsContainer).isSameType((IType) rhsContainer); } } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUsingDirective.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUsingDirective.java index 844b75a7d9e..0e3b9ff9c1b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUsingDirective.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPUsingDirective.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 Wind River Systems, Inc. and others. + * Copyright (c) 2008, 2010 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.IPDOMNode; import org.eclipse.cdt.core.dom.IPDOMVisitor; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace; import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope; @@ -72,7 +71,6 @@ public class PDOMCPPUsingDirective implements ICPPUsingDirective, IPDOMNode { } } catch (CoreException e) { CCorePlugin.log(e); - } catch (DOMException e) { } return null; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java index c1efb8f5457..78606813fb4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2009 QNX Software Systems and others. + * Copyright (c) 2005, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -86,7 +86,7 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable { linkage.storeType(record+TYPE_OFFSET, newType); } - protected byte encodeFlags(IVariable variable) throws DOMException { + protected byte encodeFlags(IVariable variable) { return PDOMCPPAnnotation.encodeAnnotation(variable); } @@ -104,7 +104,7 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable { return IIndexCPPBindingConstants.CPPVARIABLE; } - public boolean isMutable() throws DOMException { + public boolean isMutable() { // ISO/IEC 14882:2003 7.1.1.8 return false; } @@ -129,23 +129,23 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable { } } - public boolean isAuto() throws DOMException { + public boolean isAuto() { return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.AUTO_OFFSET); } - public boolean isExtern() throws DOMException { + public boolean isExtern() { return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.EXTERN_OFFSET); } - public boolean isExternC() throws DOMException { + public boolean isExternC() { return getBit(getByte(record + ANNOTATIONS), PDOMCPPAnnotation.EXTERN_C_OFFSET); } - public boolean isRegister() throws DOMException { + public boolean isRegister() { return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.REGISTER_OFFSET); } - public boolean isStatic() throws DOMException { + public boolean isStatic() { return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.STATIC_OFFSET); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMClassUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMClassUtil.java index 70f0f3d3cb7..99a51cfb63d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMClassUtil.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMClassUtil.java @@ -16,7 +16,6 @@ import java.util.List; import org.eclipse.cdt.core.dom.IPDOMNode; import org.eclipse.cdt.core.dom.IPDOMVisitor; -import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; import org.eclipse.cdt.core.dom.ast.cpp.ICPPField; @@ -54,16 +53,13 @@ class PDOMClassUtil { if (node instanceof ICPPConstructor) { ICPPConstructor cons= (ICPPConstructor) node; if (IndexFilter.ALL_DECLARED_OR_IMPLICIT.acceptBinding(cons)) { - try { - if (cons instanceof ICPPTemplateInstance) { - ICPPClassType owner = cons.getClassOwner(); - if (owner == null || owner.equals(((ICPPTemplateInstance) cons).getSpecializedBinding().getOwner())) { - return false; - } + if (cons instanceof ICPPTemplateInstance) { + ICPPClassType owner = cons.getClassOwner(); + if (owner == null || owner.equals(((ICPPTemplateInstance) cons).getSpecializedBinding().getOwner())) { + return false; } - fConstructors.add(cons); - } catch (DOMException e) { } + fConstructors.add(cons); } } return false; |