mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch for Jason - 160884. Change DOMException to not be a CoreException.
This commit is contained in:
parent
c12e07dd19
commit
780f7df35c
25 changed files with 284 additions and 169 deletions
|
@ -14,6 +14,7 @@ package org.eclipse.cdt.internal.pdom.tests;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IField;
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
|
@ -120,7 +121,7 @@ public class CPPFieldTests extends PDOMTestBase {
|
||||||
assertFieldType(pdom, "Class2::c2b", IBasicType.t_float);
|
assertFieldType(pdom, "Class2::c2b", IBasicType.t_float);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertFieldType(PDOM pdom, String name, int type) throws CoreException {
|
private void assertFieldType(PDOM pdom, String name, int type) throws CoreException, DOMException {
|
||||||
IBinding[] bindings = findQualifiedName(pdom, name);
|
IBinding[] bindings = findQualifiedName(pdom, name);
|
||||||
assertEquals(1, bindings.length);
|
assertEquals(1, bindings.length);
|
||||||
IField field = (IField) bindings[0];
|
IField field = (IField) bindings[0];
|
||||||
|
|
|
@ -14,6 +14,7 @@ package org.eclipse.cdt.internal.pdom.tests;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
|
@ -177,7 +178,7 @@ public class CPPFunctionTests extends PDOMTestBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertReturnType(PDOM pdom, String name, int type) throws CoreException {
|
private void assertReturnType(PDOM pdom, String name, int type) throws CoreException, DOMException {
|
||||||
IBinding[] bindings = findQualifiedName(pdom, name);
|
IBinding[] bindings = findQualifiedName(pdom, name);
|
||||||
assertEquals(1, bindings.length);
|
assertEquals(1, bindings.length);
|
||||||
IFunction function = (IFunction) bindings[0];
|
IFunction function = (IFunction) bindings[0];
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.util.regex.Pattern;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IName;
|
import org.eclipse.cdt.core.dom.IName;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
|
||||||
import org.eclipse.cdt.core.index.IndexFilter;
|
import org.eclipse.cdt.core.index.IndexFilter;
|
||||||
|
@ -167,7 +168,7 @@ public class PDOMTestBase extends BaseTestCase {
|
||||||
assertTrue(c.isAssignableFrom(bindings[0].getClass()));
|
assertTrue(c.isAssignableFrom(bindings[0].getClass()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertVisibility(PDOM pdom, String name, int visibility) throws CoreException {
|
protected void assertVisibility(PDOM pdom, String name, int visibility) throws CoreException, DOMException {
|
||||||
IBinding[] bindings = findQualifiedName(pdom, name);
|
IBinding[] bindings = findQualifiedName(pdom, name);
|
||||||
assertEquals(1, bindings.length);
|
assertEquals(1, bindings.length);
|
||||||
ICPPMember member = (ICPPMember) bindings[0];
|
ICPPMember member = (ICPPMember) bindings[0];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -14,10 +14,6 @@
|
||||||
*/
|
*/
|
||||||
package org.eclipse.cdt.core.dom.ast;
|
package org.eclipse.cdt.core.dom.ast;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IStatus;
|
|
||||||
import org.eclipse.core.runtime.Status;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the general purpose exception that is thrown for resolving semantic
|
* This is the general purpose exception that is thrown for resolving semantic
|
||||||
|
@ -25,7 +21,7 @@ import org.eclipse.core.runtime.Status;
|
||||||
*
|
*
|
||||||
* @author aniefer
|
* @author aniefer
|
||||||
*/
|
*/
|
||||||
public class DOMException extends CoreException {
|
public class DOMException extends Exception {
|
||||||
|
|
||||||
private static final long serialVersionUID = 0;
|
private static final long serialVersionUID = 0;
|
||||||
|
|
||||||
|
@ -37,8 +33,6 @@ public class DOMException extends CoreException {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public DOMException(IProblemBinding problem) {
|
public DOMException(IProblemBinding problem) {
|
||||||
super(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID,
|
|
||||||
0, "DOMException", new Exception()));
|
|
||||||
problemBinding = problem;
|
problemBinding = problem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* QNX - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||||
|
@ -15,6 +16,7 @@ package org.eclipse.cdt.internal.core.pdom.dom;
|
||||||
import org.eclipse.cdt.core.dom.ILinkage;
|
import org.eclipse.cdt.core.dom.ILinkage;
|
||||||
import org.eclipse.cdt.core.dom.IName;
|
import org.eclipse.cdt.core.dom.IName;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
|
@ -27,6 +29,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
import org.eclipse.cdt.core.index.IIndexLinkage;
|
import org.eclipse.cdt.core.index.IIndexLinkage;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.BTree;
|
import org.eclipse.cdt.internal.core.pdom.db.BTree;
|
||||||
|
@ -149,6 +152,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
|
||||||
public abstract PDOMBinding resolveBinding(IASTName name) throws CoreException;
|
public abstract PDOMBinding resolveBinding(IASTName name) throws CoreException;
|
||||||
|
|
||||||
public PDOMNode getAdaptedParent(IBinding binding) throws CoreException {
|
public PDOMNode getAdaptedParent(IBinding binding) throws CoreException {
|
||||||
|
try {
|
||||||
IScope scope = binding.getScope();
|
IScope scope = binding.getScope();
|
||||||
if (scope == null)
|
if (scope == null)
|
||||||
return null;
|
return null;
|
||||||
|
@ -192,7 +196,9 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
|
||||||
return scopePDOMBinding;
|
return scopePDOMBinding;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* QNX - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||||
|
@ -16,6 +17,7 @@ import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
|
@ -44,6 +46,7 @@ public class PDOMPointerType extends PDOMNode implements IPointerType,
|
||||||
|
|
||||||
Database db = pdom.getDB();
|
Database db = pdom.getDB();
|
||||||
|
|
||||||
|
try {
|
||||||
// type
|
// type
|
||||||
IType targetType = ((ITypeContainer)type).getType();
|
IType targetType = ((ITypeContainer)type).getType();
|
||||||
int typeRec = 0;
|
int typeRec = 0;
|
||||||
|
@ -61,6 +64,9 @@ public class PDOMPointerType extends PDOMNode implements IPointerType,
|
||||||
if (type.isVolatile())
|
if (type.isVolatile())
|
||||||
flags |= VOLATILE;
|
flags |= VOLATILE;
|
||||||
db.putByte(record + FLAGS, flags);
|
db.putByte(record + FLAGS, flags);
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getRecordSize() {
|
protected int getRecordSize() {
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* QNX - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||||
|
@ -16,6 +17,7 @@ import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IQualifierType;
|
import org.eclipse.cdt.core.dom.ast.IQualifierType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
|
@ -46,6 +48,7 @@ public class PDOMQualifierType extends PDOMNode implements IQualifierType,
|
||||||
Database db = pdom.getDB();
|
Database db = pdom.getDB();
|
||||||
|
|
||||||
// type
|
// type
|
||||||
|
try {
|
||||||
IType targetType = ((ITypeContainer)type).getType();
|
IType targetType = ((ITypeContainer)type).getType();
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
PDOMNode targetTypeNode = getLinkageImpl().addType(this, targetType);
|
PDOMNode targetTypeNode = getLinkageImpl().addType(this, targetType);
|
||||||
|
@ -61,6 +64,10 @@ public class PDOMQualifierType extends PDOMNode implements IQualifierType,
|
||||||
if (type.isVolatile())
|
if (type.isVolatile())
|
||||||
flags |= VOLATILE;
|
flags |= VOLATILE;
|
||||||
db.putByte(record + FLAGS, flags);
|
db.putByte(record + FLAGS, flags);
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getRecordSize() {
|
protected int getRecordSize() {
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
|
@ -42,7 +43,11 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
||||||
|
|
||||||
public PDOMCFunction(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
public PDOMCFunction(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||||
super(pdom, parent, name);
|
super(pdom, parent, name);
|
||||||
|
try {
|
||||||
pdom.getDB().putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(name.resolveBinding()));
|
pdom.getDB().putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(name.resolveBinding()));
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCFunction(PDOM pdom, int record) {
|
public PDOMCFunction(PDOM pdom, int record) {
|
||||||
|
|
|
@ -8,12 +8,14 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* QNX - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.IPDOMNode;
|
import org.eclipse.cdt.core.dom.IPDOMNode;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
@ -32,6 +34,7 @@ import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage;
|
import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage;
|
||||||
import org.eclipse.cdt.core.model.ILanguage;
|
import org.eclipse.cdt.core.model.ILanguage;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
|
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
|
@ -109,11 +112,15 @@ class PDOMCLinkage extends PDOMLinkage {
|
||||||
else if (binding instanceof IEnumeration)
|
else if (binding instanceof IEnumeration)
|
||||||
pdomBinding = new PDOMCEnumeration(pdom, parent, name);
|
pdomBinding = new PDOMCEnumeration(pdom, parent, name);
|
||||||
else if (binding instanceof IEnumerator) {
|
else if (binding instanceof IEnumerator) {
|
||||||
|
try {
|
||||||
IEnumeration enumeration = (IEnumeration)((IEnumerator)binding).getType();
|
IEnumeration enumeration = (IEnumeration)((IEnumerator)binding).getType();
|
||||||
PDOMBinding pdomEnumeration = adaptBinding(enumeration);
|
PDOMBinding pdomEnumeration = adaptBinding(enumeration);
|
||||||
if (pdomEnumeration instanceof PDOMCEnumeration)
|
if (pdomEnumeration instanceof PDOMCEnumeration)
|
||||||
pdomBinding = new PDOMCEnumerator(pdom, parent, name,
|
pdomBinding = new PDOMCEnumerator(pdom, parent, name,
|
||||||
(PDOMCEnumeration)pdomEnumeration);
|
(PDOMCEnumeration)pdomEnumeration);
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
} else if (binding instanceof ITypedef)
|
} else if (binding instanceof ITypedef)
|
||||||
pdomBinding = new PDOMCTypedef(pdom, parent, name, (ITypedef)binding);
|
pdomBinding = new PDOMCTypedef(pdom, parent, name, (ITypedef)binding);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* QNX - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
||||||
|
|
||||||
|
@ -16,6 +17,7 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
|
@ -35,10 +37,14 @@ class PDOMCTypedef extends PDOMBinding implements ITypedef {
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
super(pdom, parent, name);
|
super(pdom, parent, name);
|
||||||
|
|
||||||
|
try {
|
||||||
IType type = typedef.getType();
|
IType type = typedef.getType();
|
||||||
PDOMNode typeNode = parent.getLinkageImpl().addType(this, type);
|
PDOMNode typeNode = parent.getLinkageImpl().addType(this, type);
|
||||||
if (typeNode != null)
|
if (typeNode != null)
|
||||||
pdom.getDB().putInt(record + TYPE, typeNode.getRecord());
|
pdom.getDB().putInt(record + TYPE, typeNode.getRecord());
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCTypedef(PDOM pdom, int record) {
|
public PDOMCTypedef(PDOM pdom, int record) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
|
@ -41,10 +42,12 @@ class PDOMCVariable extends PDOMBinding implements IVariable {
|
||||||
public PDOMCVariable(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
public PDOMCVariable(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||||
super(pdom, parent, name);
|
super(pdom, parent, name);
|
||||||
IVariable binding = (IVariable)name.getBinding();
|
IVariable binding = (IVariable)name.getBinding();
|
||||||
if (binding != null) {
|
|
||||||
IType type = binding.getType();
|
try {
|
||||||
}
|
|
||||||
pdom.getDB().putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(binding));
|
pdom.getDB().putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(binding));
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCVariable(PDOM pdom, int record) {
|
public PDOMCVariable(PDOM pdom, int record) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
|
@ -46,6 +47,7 @@ class PDOMCPPBasicType extends PDOMNode implements ICPPBasicType {
|
||||||
|
|
||||||
Database db = pdom.getDB();
|
Database db = pdom.getDB();
|
||||||
|
|
||||||
|
try {
|
||||||
db.putChar(record + TYPE_ID, (char)type.getType());
|
db.putChar(record + TYPE_ID, (char)type.getType());
|
||||||
|
|
||||||
char flags = 0;
|
char flags = 0;
|
||||||
|
@ -59,6 +61,9 @@ class PDOMCPPBasicType extends PDOMNode implements ICPPBasicType {
|
||||||
flags |= IS_UNSIGNED;
|
flags |= IS_UNSIGNED;
|
||||||
|
|
||||||
db.putChar(record + FLAGS, flags);
|
db.putChar(record + FLAGS, flags);
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getRecordSize() {
|
protected int getRecordSize() {
|
||||||
|
|
|
@ -23,7 +23,6 @@ import org.eclipse.cdt.core.dom.IPDOMNode;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IField;
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
@ -35,6 +34,7 @@ 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.ICPPField;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList;
|
import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
|
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
|
||||||
|
@ -63,10 +63,14 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
|
||||||
super(pdom, parent, name);
|
super(pdom, parent, name);
|
||||||
|
|
||||||
IBinding binding = name.resolveBinding();
|
IBinding binding = name.resolveBinding();
|
||||||
|
try {
|
||||||
int key = 0;
|
int key = 0;
|
||||||
if (binding instanceof ICPPClassType) // not sure why it wouldn't
|
if (binding instanceof ICPPClassType) // not sure why it wouldn't
|
||||||
key = ((ICPPClassType) binding).getKey();
|
key = ((ICPPClassType) binding).getKey();
|
||||||
pdom.getDB().putByte(record + KEY, (byte) key);
|
pdom.getDB().putByte(record + KEY, (byte) key);
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
// linked list is initialized by storage being zero'd by malloc
|
// linked list is initialized by storage being zero'd by malloc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,9 +193,13 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
|
||||||
|
|
||||||
// Visit my base classes
|
// Visit my base classes
|
||||||
for (PDOMCPPBase base = getFirstBase(); base != null; base = base.getNextBase()) {
|
for (PDOMCPPBase base = getFirstBase(); base != null; base = base.getNextBase()) {
|
||||||
|
try {
|
||||||
IBinding baseClass = base.getBaseClass();
|
IBinding baseClass = base.getBaseClass();
|
||||||
if (baseClass != null && baseClass instanceof PDOMCPPClassType)
|
if (baseClass != null && baseClass instanceof PDOMCPPClassType)
|
||||||
((PDOMCPPClassType)baseClass).visitAllDeclaredMethods(visited, methods);
|
((PDOMCPPClassType)baseClass).visitAllDeclaredMethods(visited, methods);
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
|
@ -47,8 +48,12 @@ class PDOMCPPField extends PDOMCPPBinding implements ICPPField {
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
super(pdom, parent, name);
|
super(pdom, parent, name);
|
||||||
IBinding binding = name.resolveBinding();
|
IBinding binding = name.resolveBinding();
|
||||||
|
try {
|
||||||
Database db = pdom.getDB();
|
Database db = pdom.getDB();
|
||||||
db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(binding));
|
db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(binding));
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPField(PDOM pdom, int bindingRecord) {
|
public PDOMCPPField(PDOM pdom, int bindingRecord) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
|
@ -83,7 +84,11 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, ICPPFuncti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IBinding binding = name.resolveBinding();
|
IBinding binding = name.resolveBinding();
|
||||||
|
try {
|
||||||
db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(binding));
|
db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(binding));
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPFunction(PDOM pdom, int bindingRecord) {
|
public PDOMCPPFunction(PDOM pdom, int bindingRecord) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.IPDOMNode;
|
import org.eclipse.cdt.core.dom.IPDOMNode;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
@ -42,6 +43,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
|
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
|
||||||
import org.eclipse.cdt.core.model.ILanguage;
|
import org.eclipse.cdt.core.model.ILanguage;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBlockScope;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBlockScope;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPImplicitMethod;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPImplicitMethod;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
|
@ -115,6 +117,7 @@ class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
PDOMBinding pdomBinding = adaptBinding(binding);
|
PDOMBinding pdomBinding = adaptBinding(binding);
|
||||||
|
try {
|
||||||
if (pdomBinding == null) {
|
if (pdomBinding == null) {
|
||||||
PDOMNode parent = getAdaptedParent(binding);
|
PDOMNode parent = getAdaptedParent(binding);
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
|
@ -152,6 +155,9 @@ class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
|
|
||||||
// final processing
|
// final processing
|
||||||
if (pdomBinding != null) {
|
if (pdomBinding != null) {
|
||||||
|
@ -314,9 +320,13 @@ class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
return resolveBinding(names[0]);
|
return resolveBinding(names[0]);
|
||||||
IASTName lastName = names[names.length - 1];
|
IASTName lastName = names[names.length - 1];
|
||||||
PDOMBinding nsBinding = adaptBinding(names[names.length - 2].resolveBinding());
|
PDOMBinding nsBinding = adaptBinding(names[names.length - 2].resolveBinding());
|
||||||
|
try {
|
||||||
if (nsBinding instanceof IScope) {
|
if (nsBinding instanceof IScope) {
|
||||||
return (PDOMBinding) ((IScope)nsBinding).getBinding(lastName, true);
|
return (PDOMBinding) ((IScope)nsBinding).getBinding(lastName, true);
|
||||||
}
|
}
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
IASTNode parent = name.getParent();
|
IASTNode parent = name.getParent();
|
||||||
if (parent instanceof ICPPASTQualifiedName) {
|
if (parent instanceof ICPPASTQualifiedName) {
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
|
@ -94,10 +95,14 @@ class PDOMCPPMethod extends PDOMCPPBinding implements ICPPMethod, ICPPFunctionTy
|
||||||
}
|
}
|
||||||
annotation |= PDOMCAnnotation.encodeCVQualifiers(funcDecl) << CV_OFFSET;
|
annotation |= PDOMCAnnotation.encodeCVQualifiers(funcDecl) << CV_OFFSET;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
IBinding binding = name.resolveBinding();
|
IBinding binding = name.resolveBinding();
|
||||||
annotation |= PDOMCPPAnnotation.encodeExtraAnnotation(binding);
|
annotation |= PDOMCPPAnnotation.encodeExtraAnnotation(binding);
|
||||||
db.putByte(record + ANNOTATION0, PDOMCPPAnnotation.encodeAnnotation(binding));
|
db.putByte(record + ANNOTATION0, PDOMCPPAnnotation.encodeAnnotation(binding));
|
||||||
db.putByte(record + ANNOTATION1, annotation);
|
db.putByte(record + ANNOTATION1, annotation);
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPMethod(PDOM pdom, int record) {
|
public PDOMCPPMethod(PDOM pdom, int record) {
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNamedNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNamedNode;
|
||||||
|
@ -63,11 +64,15 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter {
|
||||||
|
|
||||||
db.putInt(record + NEXT_PARAM, 0);
|
db.putInt(record + NEXT_PARAM, 0);
|
||||||
|
|
||||||
|
try {
|
||||||
IType type = param.getType();
|
IType type = param.getType();
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
PDOMNode typeNode = getLinkageImpl().addType(this, type);
|
PDOMNode typeNode = getLinkageImpl().addType(this, type);
|
||||||
db.putInt(record + TYPE, typeNode != null ? typeNode.getRecord() : 0);
|
db.putInt(record + TYPE, typeNode != null ? typeNode.getRecord() : 0);
|
||||||
}
|
}
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getRecordSize() {
|
protected int getRecordSize() {
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
|
@ -34,10 +35,14 @@ class PDOMCPPTypedef extends PDOMBinding implements ITypedef {
|
||||||
public PDOMCPPTypedef(PDOM pdom, PDOMNode parent, IASTName name, ITypedef typedef)
|
public PDOMCPPTypedef(PDOM pdom, PDOMNode parent, IASTName name, ITypedef typedef)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
super(pdom, parent, name);
|
super(pdom, parent, name);
|
||||||
|
try {
|
||||||
IType type = typedef.getType();
|
IType type = typedef.getType();
|
||||||
PDOMNode typeNode = parent.getLinkageImpl().addType(this, type);
|
PDOMNode typeNode = parent.getLinkageImpl().addType(this, type);
|
||||||
if (typeNode != null)
|
if (typeNode != null)
|
||||||
pdom.getDB().putInt(record + TYPE, typeNode.getRecord());
|
pdom.getDB().putInt(record + TYPE, typeNode.getRecord());
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPTypedef(PDOM pdom, int record) {
|
public PDOMCPPTypedef(PDOM pdom, int record) {
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
|
@ -64,7 +65,11 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable {
|
||||||
if (typeNode != null)
|
if (typeNode != null)
|
||||||
db.putInt(record + TYPE_OFFSET, typeNode.getRecord());
|
db.putInt(record + TYPE_OFFSET, typeNode.getRecord());
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
db.putByte(record + ANNOTATIONS, PDOMCPPAnnotation.encodeAnnotation(name.resolveBinding()));
|
db.putByte(record + ANNOTATIONS, PDOMCPPAnnotation.encodeAnnotation(name.resolveBinding()));
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPVariable(PDOM pdom, int record) {
|
public PDOMCPPVariable(PDOM pdom, int record) {
|
||||||
|
|
|
@ -21,9 +21,12 @@ import java.util.Locale;
|
||||||
import java.util.MissingResourceException;
|
import java.util.MissingResourceException;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
|
||||||
public class Util {
|
public class Util {
|
||||||
|
|
||||||
|
@ -366,6 +369,15 @@ public class Util {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an IStatus object with severity IStatus.ERROR based on the
|
||||||
|
* given Throwable.
|
||||||
|
* @param t the Throwable that caused the error.
|
||||||
|
* @return an IStatus object based on the given Throwable.
|
||||||
|
*/
|
||||||
|
public static IStatus createStatus(Throwable t) {
|
||||||
|
return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, 0, t.getMessage(), t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,12 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* QNX - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui;
|
package org.eclipse.cdt.internal.ui;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
|
@ -71,7 +73,7 @@ public class IndexLabelProvider extends LabelProvider {
|
||||||
desc = CElementImageProvider.getUnionImageDescriptor();
|
desc = CElementImageProvider.getUnionImageDescriptor();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (DOMException e) {
|
||||||
CUIPlugin.getDefault().log(e);
|
CUIPlugin.getDefault().log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,9 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.editor;
|
package org.eclipse.cdt.internal.ui.editor;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.preference.PreferenceConverter;
|
import org.eclipse.jface.preference.PreferenceConverter;
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
|
@ -312,7 +314,7 @@ public class SemanticHighlightings {
|
||||||
try {
|
try {
|
||||||
return ((IField)binding).isStatic();
|
return ((IField)binding).isStatic();
|
||||||
} catch (DOMException exc) {
|
} catch (DOMException exc) {
|
||||||
CUIPlugin.getDefault().log(exc.getStatus());
|
CUIPlugin.getDefault().log(exc);
|
||||||
} catch (Error e) /* PDOMNotImplementedError */ {
|
} catch (Error e) /* PDOMNotImplementedError */ {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
@ -945,7 +947,7 @@ public class SemanticHighlightings {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (DOMException exc) {
|
} catch (DOMException exc) {
|
||||||
CUIPlugin.getDefault().log(exc.getStatus());
|
CUIPlugin.getDefault().log(exc);
|
||||||
} catch (Error e) /* PDOMNotImplementedError */ {
|
} catch (Error e) /* PDOMNotImplementedError */ {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
@ -1023,7 +1025,7 @@ public class SemanticHighlightings {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (DOMException exc) {
|
} catch (DOMException exc) {
|
||||||
CUIPlugin.getDefault().log(exc.getStatus());
|
CUIPlugin.getDefault().log(exc);
|
||||||
} catch (Error e) /* PDOMNotImplementedError */ {
|
} catch (Error e) /* PDOMNotImplementedError */ {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
@ -1112,7 +1114,7 @@ public class SemanticHighlightings {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (DOMException exc) {
|
} catch (DOMException exc) {
|
||||||
CUIPlugin.getDefault().log(exc.getStatus());
|
CUIPlugin.getDefault().log(exc);
|
||||||
} catch (Error e) /* PDOMNotImplementedError */ {
|
} catch (Error e) /* PDOMNotImplementedError */ {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||||
|
@ -40,6 +41,8 @@ import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
import org.eclipse.cdt.core.index.IndexFilter;
|
import org.eclipse.cdt.core.index.IndexFilter;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.util.Messages;
|
import org.eclipse.cdt.internal.ui.util.Messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -177,7 +180,10 @@ public class PDOMSearchPatternQuery extends PDOMSearchQuery {
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return e.getStatus();
|
return e.getStatus();
|
||||||
|
} catch (DOMException e) {
|
||||||
|
return Util.createStatus(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.eclipse.cdt.core.browser.ITypeInfo;
|
||||||
import org.eclipse.cdt.core.browser.ITypeReference;
|
import org.eclipse.cdt.core.browser.ITypeReference;
|
||||||
import org.eclipse.cdt.core.browser.TypeSearchScope;
|
import org.eclipse.cdt.core.browser.TypeSearchScope;
|
||||||
import org.eclipse.cdt.core.dom.ILinkage;
|
import org.eclipse.cdt.core.dom.ILinkage;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
||||||
|
@ -448,6 +449,8 @@ public class NewClassWizardUtil {
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return SEARCH_MATCH_ERROR;
|
return SEARCH_MATCH_ERROR;
|
||||||
|
} catch (DOMException e) {
|
||||||
|
return SEARCH_MATCH_ERROR;
|
||||||
}
|
}
|
||||||
return SEARCH_MATCH_NOTFOUND;
|
return SEARCH_MATCH_NOTFOUND;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue