mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for 162217, by Andrew Ferguson, PDOM bindings constructed off bindings
This commit is contained in:
parent
1ee1c0cb84
commit
de14fed9ad
28 changed files with 150 additions and 237 deletions
|
@ -52,7 +52,7 @@ public class OverloadsWithinCommonHeaderTests extends PDOMTestBase {
|
|||
|
||||
public void testDummy() {}
|
||||
|
||||
public void _testOverloadedInCommonHeader_ClassScope() throws CoreException {
|
||||
public void testOverloadedInCommonHeader_ClassScope() throws CoreException {
|
||||
Pattern[] ManyOverloadedQuxPath = makePatternArray(new String[] {"ManyOverloaded","qux"});
|
||||
IBinding[] ManyOverloadedQux = pdom.findBindings(ManyOverloadedQuxPath, new NullProgressMonitor());
|
||||
assertEquals(5,ManyOverloadedQux.length);
|
||||
|
@ -73,7 +73,7 @@ public class OverloadsWithinCommonHeaderTests extends PDOMTestBase {
|
|||
assertFunctionRefCount(new Class[]{ICPPClassType.class}, ManyOverloadedQux, 10);
|
||||
}
|
||||
|
||||
public void _testOverloadedInCommonHeader_FileScope() throws CoreException {
|
||||
public void testOverloadedInCommonHeader_FileScope() throws CoreException {
|
||||
Pattern[] QuuxPath = makePatternArray(new String[] {"quux"});
|
||||
IBinding[] Quux = pdom.findBindings(QuuxPath, false, IndexFilter.getFilter(Linkage.CPP_LINKAGE), new NullProgressMonitor());
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class OverloadsWithinCommonHeaderTests extends PDOMTestBase {
|
|||
assertFunctionRefCount(new Class[] {ICPPClassType.class}, Quux, 12);
|
||||
}
|
||||
|
||||
public void _testOverloadedInCommonHeader_NamespaceScope() throws CoreException {
|
||||
public void testOverloadedInCommonHeader_NamespaceScope() throws CoreException {
|
||||
Pattern[] GraultPath = makePatternArray(new String[] {"corge","grault"});
|
||||
IBinding[] Grault = pdom.findBindings(GraultPath, true, IndexFilter.getFilter(Linkage.CPP_LINKAGE), new NullProgressMonitor());
|
||||
assertEquals(5,Grault.length);
|
||||
|
|
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.internal.core.pdom.dom;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragment;
|
||||
|
@ -35,10 +34,6 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IIndexFragmen
|
|||
|
||||
protected static final int RECORD_SIZE = PDOMNamedNode.RECORD_SIZE + 12;
|
||||
|
||||
protected PDOMBinding(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||
super(pdom, parent, name.toCharArray());
|
||||
}
|
||||
|
||||
protected PDOMBinding(PDOM pdom, PDOMNode parent, char[] name) throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
}
|
||||
|
|
|
@ -177,8 +177,10 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IBindingIdent
|
|||
/**
|
||||
*
|
||||
* @param binding
|
||||
* @return null for filescope for non-pdom bindings, this for filescope for pdom bindings
|
||||
* or the parent binding in any other case
|
||||
* @return <ul><li> null - skip this binding (don't add to pdom)
|
||||
* <li>this - for filescope
|
||||
* <li>a PDOMBinding instance - parent adapted binding
|
||||
* </ul>
|
||||
* @throws CoreException
|
||||
*/
|
||||
public PDOMNode getAdaptedParent(IBinding binding) throws CoreException {
|
||||
|
|
|
@ -16,7 +16,6 @@ package org.eclipse.cdt.internal.core.pdom.dom;
|
|||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
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.IBTreeComparator;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.IString;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
|
@ -47,9 +46,7 @@ public abstract class PDOMNamedNode extends PDOMNode {
|
|||
name != null ? db.newString(name).getRecord() : 0);
|
||||
}
|
||||
|
||||
protected int getRecordSize() {
|
||||
return RECORD_SIZE;
|
||||
}
|
||||
abstract protected int getRecordSize();
|
||||
|
||||
public IString getDBName() throws CoreException {
|
||||
Database db = pdom.getDB();
|
||||
|
@ -65,17 +62,6 @@ public abstract class PDOMNamedNode extends PDOMNode {
|
|||
return getDBName().equals(name);
|
||||
}
|
||||
|
||||
public IBTreeComparator getIndexComparator() {
|
||||
return new IBTreeComparator() {
|
||||
public int compare(int record1, int record2) throws CoreException {
|
||||
Database db = pdom.getDB();
|
||||
int string1 = db.getInt(record1 + NAME);
|
||||
int string2 = db.getInt(record2 + NAME);
|
||||
return db.getString(string1).compare(db.getString(string2));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method for fetching a byte from the database.
|
||||
* @param offset Location of the byte.
|
||||
|
|
|
@ -15,7 +15,7 @@ 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;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||
|
||||
/**
|
||||
* A utility class for packing various annotations into bit fields. This
|
||||
|
@ -67,14 +67,17 @@ public class PDOMCAnnotation {
|
|||
|
||||
/**
|
||||
* Encodes CV qualifiers from a method declarator as a bit vector.
|
||||
* @param declarator Method declarator.
|
||||
* @param type the function type
|
||||
* @return a bit vector of the CV qualifiers.
|
||||
*/
|
||||
public static byte encodeCVQualifiers(ICPPASTFunctionDeclarator declarator) {
|
||||
/*
|
||||
* aftodo - will we put CV information in C pdom bindings or should we
|
||||
* move this to PDOMCPPAnnotation?
|
||||
*/
|
||||
public static byte encodeCVQualifiers(ICPPFunctionType type) {
|
||||
byte modifiers = 0;
|
||||
modifiers |= (declarator.isConst() ? 1 : 0) << CONST_OFFSET;
|
||||
modifiers |= (declarator.isVolatile() ? 1 : 0) << VOLATILE_OFFSET;
|
||||
modifiers |= (type.isConst() ? 1 : 0) << CONST_OFFSET;
|
||||
modifiers |= (type.isVolatile() ? 1 : 0) << VOLATILE_OFFSET;
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import java.util.ArrayList;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
|
@ -33,9 +32,9 @@ class PDOMCEnumeration extends PDOMBinding implements IEnumeration {
|
|||
|
||||
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 4;
|
||||
|
||||
public PDOMCEnumeration(PDOM pdom, PDOMNode parent, IASTName name)
|
||||
public PDOMCEnumeration(PDOM pdom, PDOMNode parent, IEnumeration enumeration)
|
||||
throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
super(pdom, parent, enumeration.getNameCharArray());
|
||||
}
|
||||
|
||||
public PDOMCEnumeration(PDOM pdom, int record) {
|
||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.c;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
|
@ -32,9 +31,9 @@ class PDOMCEnumerator extends PDOMBinding implements IEnumerator {
|
|||
|
||||
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 8;
|
||||
|
||||
public PDOMCEnumerator(PDOM pdom, PDOMNode parent, IASTName name, PDOMCEnumeration enumeration)
|
||||
public PDOMCEnumerator(PDOM pdom, PDOMNode parent, IEnumerator enumerator, PDOMCEnumeration enumeration)
|
||||
throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
super(pdom, parent, enumerator.getNameCharArray());
|
||||
pdom.getDB().putInt(record + ENUMERATION, enumeration.getRecord());
|
||||
enumeration.addEnumerator(this);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,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.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IField;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
|
@ -28,8 +27,8 @@ import org.eclipse.core.runtime.CoreException;
|
|||
*/
|
||||
class PDOMCField extends PDOMBinding implements IField {
|
||||
|
||||
public PDOMCField(PDOM pdom, IPDOMMemberOwner parent, IASTName name) throws CoreException {
|
||||
super(pdom, (PDOMNode) parent, name);
|
||||
public PDOMCField(PDOM pdom, IPDOMMemberOwner parent, IField field) throws CoreException {
|
||||
super(pdom, (PDOMNode) parent, field.getNameCharArray());
|
||||
}
|
||||
|
||||
public PDOMCField(PDOM pdom, int record) {
|
||||
|
|
|
@ -15,17 +15,11 @@ package org.eclipse.cdt.internal.core.pdom.dom.c;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||
|
@ -60,25 +54,16 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
|||
*/
|
||||
public static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 9;
|
||||
|
||||
public PDOMCFunction(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
public PDOMCFunction(PDOM pdom, PDOMNode parent, IFunction function) throws CoreException {
|
||||
super(pdom, parent, function.getNameCharArray());
|
||||
|
||||
try {
|
||||
IASTNode parentNode = name.getParent();
|
||||
if (parentNode instanceof IASTStandardFunctionDeclarator) {
|
||||
IASTStandardFunctionDeclarator funcDecl = (IASTStandardFunctionDeclarator)parentNode;
|
||||
IASTParameterDeclaration[] params = funcDecl.getParameters();
|
||||
pdom.getDB().putInt(record + NUM_PARAMS, params.length);
|
||||
for (int i = 0; i < params.length; ++i) {
|
||||
IASTParameterDeclaration param = params[i];
|
||||
IASTName paramName = param.getDeclarator().getName();
|
||||
IBinding binding = paramName.resolveBinding();
|
||||
IParameter paramBinding = (IParameter)binding;
|
||||
setFirstParameter(new PDOMCParameter(pdom, this, paramName, paramBinding));
|
||||
}
|
||||
} else if(parentNode instanceof ICASTKnRFunctionDeclarator) {
|
||||
fail(); // aftodo
|
||||
IParameter[] params = function.getParameters();
|
||||
pdom.getDB().putInt(record + NUM_PARAMS, params.length);
|
||||
for (int i = 0; i < params.length; ++i) {
|
||||
setFirstParameter(new PDOMCParameter(pdom, this, params[i]));
|
||||
}
|
||||
pdom.getDB().putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(name.resolveBinding()));
|
||||
pdom.getDB().putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(function));
|
||||
} catch(DOMException e) {
|
||||
throw new CoreException(Util.createStatus(e));
|
||||
}
|
||||
|
|
|
@ -114,42 +114,38 @@ class PDOMCLinkage extends PDOMLinkage {
|
|||
return null; // skip parameters
|
||||
else if (binding instanceof IField) { // must be before IVariable
|
||||
if (parent instanceof IPDOMMemberOwner)
|
||||
pdomBinding = new PDOMCField(pdom, (IPDOMMemberOwner)parent, name);
|
||||
pdomBinding = new PDOMCField(pdom, (IPDOMMemberOwner)parent, (IField) binding);
|
||||
} else if (binding instanceof IVariable) {
|
||||
IVariable var= (IVariable) binding;
|
||||
if (!var.isStatic()) { // bug 161216
|
||||
pdomBinding = new PDOMCVariable(pdom, parent, name);
|
||||
pdomBinding = new PDOMCVariable(pdom, parent, var);
|
||||
}
|
||||
}
|
||||
else if (binding instanceof IFunction) {
|
||||
} else if (binding instanceof IFunction) {
|
||||
IFunction func= (IFunction) binding;
|
||||
if (!func.isStatic()) { // bug 161216
|
||||
pdomBinding = new PDOMCFunction(pdom, parent, name);
|
||||
pdomBinding = new PDOMCFunction(pdom, parent, func);
|
||||
}
|
||||
}
|
||||
else if (binding instanceof ICompositeType)
|
||||
pdomBinding = new PDOMCStructure(pdom, parent, name);
|
||||
} else if (binding instanceof ICompositeType)
|
||||
pdomBinding = new PDOMCStructure(pdom, parent, (ICompositeType) binding);
|
||||
else if (binding instanceof IEnumeration)
|
||||
pdomBinding = new PDOMCEnumeration(pdom, parent, name);
|
||||
pdomBinding = new PDOMCEnumeration(pdom, parent, (IEnumeration) binding);
|
||||
else if (binding instanceof IEnumerator) {
|
||||
try {
|
||||
IEnumeration enumeration = (IEnumeration)((IEnumerator)binding).getType();
|
||||
PDOMBinding pdomEnumeration = adaptBinding(enumeration);
|
||||
if (pdomEnumeration instanceof PDOMCEnumeration)
|
||||
pdomBinding = new PDOMCEnumerator(pdom, parent, name,
|
||||
(PDOMCEnumeration)pdomEnumeration);
|
||||
pdomBinding = new PDOMCEnumerator(pdom, parent, (IEnumerator) binding, (PDOMCEnumeration)pdomEnumeration);
|
||||
} catch (DOMException e) {
|
||||
throw new CoreException(Util.createStatus(e));
|
||||
}
|
||||
} else if (binding instanceof ITypedef)
|
||||
pdomBinding = new PDOMCTypedef(pdom, parent, name, (ITypedef)binding);
|
||||
pdomBinding = new PDOMCTypedef(pdom, parent, (ITypedef)binding);
|
||||
|
||||
if(pdomBinding!=null) {
|
||||
parent.addChild(pdomBinding);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (DOMException e) {
|
||||
} catch (DOMException e) {
|
||||
throw new CoreException(Util.createStatus(e));
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.c;
|
|||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
|
@ -44,9 +43,9 @@ class PDOMCParameter extends PDOMNamedNode implements IParameter {
|
|||
super(pdom, record);
|
||||
}
|
||||
|
||||
public PDOMCParameter(PDOM pdom, PDOMNode parent, IASTName name, IParameter param)
|
||||
public PDOMCParameter(PDOM pdom, PDOMNode parent, IParameter param)
|
||||
throws CoreException {
|
||||
super(pdom, parent, name.toCharArray());
|
||||
super(pdom, parent, param.getNameCharArray());
|
||||
|
||||
Database db = pdom.getDB();
|
||||
|
||||
|
|
|
@ -20,7 +20,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.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||
import org.eclipse.cdt.core.dom.ast.IField;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
|
@ -42,8 +41,8 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, IPDOM
|
|||
private static final int MEMBERLIST = PDOMBinding.RECORD_SIZE;
|
||||
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 4;
|
||||
|
||||
public PDOMCStructure(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
public PDOMCStructure(PDOM pdom, PDOMNode parent, ICompositeType compType) throws CoreException {
|
||||
super(pdom, parent, compType.getNameCharArray());
|
||||
// linked list is initialized by malloc zeroing allocated storage
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.c;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
|
@ -33,9 +32,9 @@ class PDOMCTypedef extends PDOMBinding implements ITypedef {
|
|||
|
||||
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 4;
|
||||
|
||||
public PDOMCTypedef(PDOM pdom, PDOMNode parent, IASTName name, ITypedef typedef)
|
||||
public PDOMCTypedef(PDOM pdom, PDOMNode parent, ITypedef typedef)
|
||||
throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
super(pdom, parent, typedef.getNameCharArray());
|
||||
|
||||
try {
|
||||
IType type = typedef.getType();
|
||||
|
|
|
@ -13,7 +13,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.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
|
@ -39,12 +38,11 @@ class PDOMCVariable extends PDOMBinding implements IVariable {
|
|||
*/
|
||||
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 1;
|
||||
|
||||
public PDOMCVariable(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
IVariable binding = (IVariable)name.getBinding();
|
||||
public PDOMCVariable(PDOM pdom, PDOMNode parent, IVariable variable) throws CoreException {
|
||||
super(pdom, parent, variable.getNameCharArray());
|
||||
|
||||
try {
|
||||
pdom.getDB().putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(binding));
|
||||
pdom.getDB().putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(variable));
|
||||
} catch (DOMException e) {
|
||||
throw new CoreException(Util.createStatus(e));
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public class CPPBindingIdentity extends AbstractCLocalBindingIdentity {
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
return name+" "+type+" "+mangledExtendedType;
|
||||
return name+" "+type+" "+mangledExtendedType; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
public char[] getNameCharArray() throws CoreException {
|
||||
|
|
|
@ -16,7 +16,6 @@ import java.util.List;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||
|
@ -31,7 +30,7 @@ abstract public class PDOMCPPBinding extends PDOMBinding implements ICPPBinding
|
|||
public PDOMCPPBinding(PDOM pdom, int record) {
|
||||
super(pdom, record);
|
||||
}
|
||||
public PDOMCPPBinding(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||
public PDOMCPPBinding(PDOM pdom, PDOMNode parent, char[] name) throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ 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.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IField;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
|
@ -61,16 +60,12 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
|
|||
|
||||
protected static final int RECORD_SIZE = PDOMCPPBinding.RECORD_SIZE + 12;
|
||||
|
||||
public PDOMCPPClassType(PDOM pdom, PDOMNode parent, IASTName name)
|
||||
public PDOMCPPClassType(PDOM pdom, PDOMNode parent, ICPPClassType classType)
|
||||
throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
super(pdom, parent, classType.getName().toCharArray());
|
||||
|
||||
IBinding binding = name.resolveBinding();
|
||||
try {
|
||||
int key = 0;
|
||||
if (binding instanceof ICPPClassType) // not sure why it wouldn't
|
||||
key = ((ICPPClassType) binding).getKey();
|
||||
pdom.getDB().putByte(record + KEY, (byte) key);
|
||||
pdom.getDB().putByte(record + KEY, (byte) classType.getKey());
|
||||
} catch (DOMException e) {
|
||||
throw new CoreException(Util.createStatus(e));
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import java.util.ArrayList;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
|
@ -34,9 +33,9 @@ class PDOMCPPEnumeration extends PDOMCPPBinding implements IEnumeration, ICPPBin
|
|||
|
||||
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 4;
|
||||
|
||||
public PDOMCPPEnumeration(PDOM pdom, PDOMNode parent, IASTName name)
|
||||
public PDOMCPPEnumeration(PDOM pdom, PDOMNode parent, IEnumeration enumeration)
|
||||
throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
super(pdom, parent, enumeration.getNameCharArray());
|
||||
}
|
||||
|
||||
public PDOMCPPEnumeration(PDOM pdom, int record) {
|
||||
|
|
|
@ -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.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||
|
@ -33,9 +32,9 @@ class PDOMCPPEnumerator extends PDOMCPPBinding implements IEnumerator, ICPPBindi
|
|||
|
||||
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 8;
|
||||
|
||||
public PDOMCPPEnumerator(PDOM pdom, PDOMNode parent, IASTName name, PDOMCPPEnumeration enumeration)
|
||||
public PDOMCPPEnumerator(PDOM pdom, PDOMNode parent, IEnumerator enumerator, PDOMCPPEnumeration enumeration)
|
||||
throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
super(pdom, parent, enumerator.getNameCharArray());
|
||||
pdom.getDB().putInt(record + ENUMERATION, enumeration.getRecord());
|
||||
enumeration.addEnumerator(this);
|
||||
}
|
||||
|
|
|
@ -14,8 +14,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.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||
|
@ -44,13 +42,12 @@ class PDOMCPPField extends PDOMCPPBinding implements ICPPField {
|
|||
*/
|
||||
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 1;
|
||||
|
||||
public PDOMCPPField(PDOM pdom, PDOMCPPClassType parent, IASTName name)
|
||||
public PDOMCPPField(PDOM pdom, PDOMCPPClassType parent, ICPPField field)
|
||||
throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
IBinding binding = name.resolveBinding();
|
||||
super(pdom, parent, field.getNameCharArray());
|
||||
try {
|
||||
Database db = pdom.getDB();
|
||||
db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(binding));
|
||||
db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(field));
|
||||
} catch (DOMException e) {
|
||||
throw new CoreException(Util.createStatus(e));
|
||||
}
|
||||
|
|
|
@ -14,19 +14,13 @@ 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.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||
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.ICPPFunctionType;
|
||||
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.db.Database;
|
||||
|
@ -65,26 +59,18 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, ICPPFuncti
|
|||
*/
|
||||
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 9;
|
||||
|
||||
public PDOMCPPFunction(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
IASTNode parentNode = name.getParent();
|
||||
public PDOMCPPFunction(PDOM pdom, PDOMNode parent, ICPPFunction function) throws CoreException {
|
||||
super(pdom, parent, function.getNameCharArray());
|
||||
|
||||
Database db = pdom.getDB();
|
||||
if (parentNode instanceof ICPPASTFunctionDeclarator) {
|
||||
ICPPASTFunctionDeclarator funcDecl = (ICPPASTFunctionDeclarator)parentNode;
|
||||
IASTParameterDeclaration[] params = funcDecl.getParameters();
|
||||
db.putInt(record + NUM_PARAMS, params.length);
|
||||
for (int i = 0; i < params.length; ++i) {
|
||||
ICPPASTParameterDeclaration param = (ICPPASTParameterDeclaration)params[i];
|
||||
IASTName paramName = param.getDeclarator().getName();
|
||||
IBinding binding = paramName.resolveBinding();
|
||||
if (!(binding instanceof ICPPParameter))
|
||||
continue;
|
||||
ICPPParameter paramBinding = (ICPPParameter)binding;
|
||||
setFirstParameter(new PDOMCPPParameter(pdom, this, paramName, paramBinding));
|
||||
}
|
||||
}
|
||||
IBinding binding = name.resolveBinding();
|
||||
IBinding binding = function;
|
||||
try {
|
||||
IParameter[] params = function.getParameters();
|
||||
db.putInt(record + NUM_PARAMS, params.length);
|
||||
|
||||
for (int i=0; i<params.length; ++i) {
|
||||
setFirstParameter(new PDOMCPPParameter(pdom, this, params[i]));
|
||||
}
|
||||
db.putByte(record + ANNOTATION, PDOMCPPAnnotation.encodeAnnotation(binding));
|
||||
} catch (DOMException e) {
|
||||
throw new CoreException(Util.createStatus(e));
|
||||
|
|
|
@ -132,50 +132,51 @@ class PDOMCPPLinkage extends PDOMLinkage {
|
|||
try {
|
||||
if (pdomBinding == null) {
|
||||
PDOMNode parent = getAdaptedParent(binding);
|
||||
if (parent != null) {
|
||||
if (binding instanceof ICPPField && parent instanceof PDOMCPPClassType)
|
||||
pdomBinding = new PDOMCPPField(pdom, (PDOMCPPClassType)parent, name);
|
||||
else if (binding instanceof ICPPVariable) {
|
||||
if (!(binding.getScope() instanceof CPPBlockScope)) {
|
||||
ICPPVariable var= (ICPPVariable) binding;
|
||||
if (!var.isStatic()) { // bug 161216
|
||||
pdomBinding = new PDOMCPPVariable(pdom, parent, name);
|
||||
}
|
||||
}
|
||||
} else if (binding instanceof ICPPMethod && parent instanceof PDOMCPPClassType) {
|
||||
pdomBinding = new PDOMCPPMethod(pdom, parent, name);
|
||||
} else if (binding instanceof CPPImplicitMethod && parent instanceof PDOMCPPClassType) {
|
||||
if(!name.isReference()) {
|
||||
//because we got the implicit method off of an IASTName that is not a reference,
|
||||
//it is no longer completly implicit and it should be treated as a normal method.
|
||||
pdomBinding = new PDOMCPPMethod(pdom, parent, name);
|
||||
}
|
||||
} else if (binding instanceof ICPPFunction) {
|
||||
ICPPFunction func= (ICPPFunction) binding;
|
||||
if (!func.isStatic()) { // bug 161216
|
||||
pdomBinding = new PDOMCPPFunction(pdom, parent, name);
|
||||
}
|
||||
} else if (binding instanceof ICPPClassType) {
|
||||
pdomBinding = new PDOMCPPClassType(pdom, parent, name);
|
||||
} else if (binding instanceof ICPPNamespaceAlias) {
|
||||
pdomBinding = new PDOMCPPNamespaceAlias(pdom, parent, name);
|
||||
} else if (binding instanceof ICPPNamespace) {
|
||||
pdomBinding = new PDOMCPPNamespace(pdom, parent, name);
|
||||
} else if (binding instanceof IEnumeration) {
|
||||
pdomBinding = new PDOMCPPEnumeration(pdom, parent, name);
|
||||
} else if (binding instanceof IEnumerator) {
|
||||
IEnumeration enumeration = (IEnumeration)((IEnumerator)binding).getType();
|
||||
PDOMBinding pdomEnumeration = adaptBinding(enumeration);
|
||||
if (pdomEnumeration instanceof PDOMCPPEnumeration)
|
||||
pdomBinding = new PDOMCPPEnumerator(pdom, parent, name,
|
||||
(PDOMCPPEnumeration)pdomEnumeration);
|
||||
} else if (binding instanceof ITypedef) {
|
||||
pdomBinding = new PDOMCPPTypedef(pdom, parent, name, (ITypedef)binding);
|
||||
}
|
||||
if (parent == null)
|
||||
return null;
|
||||
|
||||
if(pdomBinding!=null) {
|
||||
parent.addChild(pdomBinding);
|
||||
if (binding instanceof ICPPField && parent instanceof PDOMCPPClassType)
|
||||
pdomBinding = new PDOMCPPField(pdom, (PDOMCPPClassType)parent, (ICPPField) binding);
|
||||
else if (binding instanceof ICPPVariable && !(binding.getScope() instanceof CPPBlockScope)) {
|
||||
if (!(binding.getScope() instanceof CPPBlockScope)) {
|
||||
ICPPVariable var= (ICPPVariable) binding;
|
||||
if (!var.isStatic()) { // bug 161216
|
||||
pdomBinding = new PDOMCPPVariable(pdom, parent, var);
|
||||
}
|
||||
}
|
||||
} else if (parent instanceof PDOMCPPClassType && binding instanceof ICPPMethod) {
|
||||
pdomBinding = new PDOMCPPMethod(pdom, parent, (ICPPMethod)binding);
|
||||
} else if (binding instanceof CPPImplicitMethod && parent instanceof PDOMCPPClassType) {
|
||||
if(!name.isReference()) {
|
||||
//because we got the implicit method off of an IASTName that is not a reference,
|
||||
//it is no longer completly implicit and it should be treated as a normal method.
|
||||
pdomBinding = new PDOMCPPMethod(pdom, parent, (ICPPMethod)binding);
|
||||
}
|
||||
} else if (binding instanceof ICPPFunction) {
|
||||
ICPPFunction func= (ICPPFunction) binding;
|
||||
if (!func.isStatic()) { // bug 161216
|
||||
pdomBinding = new PDOMCPPFunction(pdom, parent, func);
|
||||
}
|
||||
} else if (binding instanceof ICPPClassType) {
|
||||
pdomBinding = new PDOMCPPClassType(pdom, parent, (ICPPClassType) binding);
|
||||
} else if (binding instanceof ICPPNamespaceAlias) {
|
||||
pdomBinding = new PDOMCPPNamespaceAlias(pdom, parent, (ICPPNamespaceAlias) binding);
|
||||
} else if (binding instanceof ICPPNamespace) {
|
||||
pdomBinding = new PDOMCPPNamespace(pdom, parent, (ICPPNamespace) binding);
|
||||
} else if (binding instanceof IEnumeration) {
|
||||
pdomBinding = new PDOMCPPEnumeration(pdom, parent, (IEnumeration) binding);
|
||||
} else if (binding instanceof IEnumerator) {
|
||||
IEnumeration enumeration = (IEnumeration)((IEnumerator)binding).getType();
|
||||
PDOMBinding pdomEnumeration = adaptBinding(enumeration);
|
||||
if (pdomEnumeration instanceof PDOMCPPEnumeration)
|
||||
pdomBinding = new PDOMCPPEnumerator(pdom, parent, (IEnumerator) binding,
|
||||
(PDOMCPPEnumeration)pdomEnumeration);
|
||||
} else if (binding instanceof ITypedef) {
|
||||
pdomBinding = new PDOMCPPTypedef(pdom, parent, name, (ITypedef)binding);
|
||||
}
|
||||
|
||||
if(pdomBinding!=null) {
|
||||
parent.addChild(pdomBinding);
|
||||
}
|
||||
}
|
||||
} catch(DOMException e) {
|
||||
|
|
|
@ -15,20 +15,13 @@ 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.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration;
|
||||
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.ICPPMethod;
|
||||
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.db.Database;
|
||||
|
@ -78,28 +71,23 @@ class PDOMCPPMethod extends PDOMCPPBinding implements ICPPMethod, ICPPFunctionTy
|
|||
*/
|
||||
private static final int CV_OFFSET = 2;
|
||||
|
||||
public PDOMCPPMethod(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
IASTNode parentNode = name.getParent();
|
||||
byte annotation = 0;
|
||||
public PDOMCPPMethod(PDOM pdom, PDOMNode parent, ICPPMethod method) throws CoreException {
|
||||
super(pdom, parent, method.getNameCharArray());
|
||||
|
||||
Database db = pdom.getDB();
|
||||
if (parentNode instanceof ICPPASTFunctionDeclarator) {
|
||||
ICPPASTFunctionDeclarator funcDecl = (ICPPASTFunctionDeclarator)parentNode;
|
||||
IASTParameterDeclaration[] params = funcDecl.getParameters();
|
||||
db.putInt(record + NUM_PARAMS, params.length);
|
||||
for (int i = 0; i < params.length; ++i) {
|
||||
ICPPASTParameterDeclaration param = (ICPPASTParameterDeclaration)params[i];
|
||||
IASTName paramName = param.getDeclarator().getName();
|
||||
IBinding binding = paramName.resolveBinding();
|
||||
ICPPParameter paramBinding = (ICPPParameter)binding;
|
||||
setFirstParameter(new PDOMCPPParameter(pdom, this, paramName, paramBinding));
|
||||
}
|
||||
annotation |= PDOMCAnnotation.encodeCVQualifiers(funcDecl) << CV_OFFSET;
|
||||
}
|
||||
|
||||
try {
|
||||
IBinding binding = name.resolveBinding();
|
||||
annotation |= PDOMCPPAnnotation.encodeExtraAnnotation(binding);
|
||||
db.putByte(record + ANNOTATION0, PDOMCPPAnnotation.encodeAnnotation(binding));
|
||||
IParameter[] params = method.getParameters();
|
||||
db.putInt(record + NUM_PARAMS, params.length);
|
||||
|
||||
for (int i=0; i<params.length; ++i) {
|
||||
setFirstParameter(new PDOMCPPParameter(pdom, this, params[i]));
|
||||
}
|
||||
ICPPFunctionType type = (ICPPFunctionType) method.getType();
|
||||
byte annotation = 0;
|
||||
annotation |= PDOMCAnnotation.encodeCVQualifiers(type) << CV_OFFSET;
|
||||
annotation |= PDOMCPPAnnotation.encodeExtraAnnotation(method);
|
||||
db.putByte(record + ANNOTATION0, PDOMCPPAnnotation.encodeAnnotation(method));
|
||||
db.putByte(record + ANNOTATION1, annotation);
|
||||
} catch (DOMException e) {
|
||||
throw new CoreException(Util.createStatus(e));
|
||||
|
|
|
@ -49,8 +49,8 @@ class PDOMCPPNamespace extends PDOMCPPBinding
|
|||
|
||||
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 4;
|
||||
|
||||
public PDOMCPPNamespace(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
public PDOMCPPNamespace(PDOM pdom, PDOMNode parent, ICPPNamespace namespace) throws CoreException {
|
||||
super(pdom, parent, namespace.getNameCharArray());
|
||||
}
|
||||
|
||||
public PDOMCPPNamespace(PDOM pdom, int record) throws CoreException {
|
||||
|
|
|
@ -12,7 +12,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.IASTName;
|
||||
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;
|
||||
|
@ -28,9 +27,9 @@ import org.eclipse.core.runtime.CoreException;
|
|||
class PDOMCPPNamespaceAlias extends PDOMCPPBinding implements
|
||||
ICPPNamespaceAlias {
|
||||
|
||||
public PDOMCPPNamespaceAlias(PDOM pdom, PDOMNode parent,
|
||||
IASTName name) throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
public PDOMCPPNamespaceAlias(PDOM pdom, PDOMNode parent, ICPPNamespaceAlias alias)
|
||||
throws CoreException {
|
||||
super(pdom, parent, alias.getNameCharArray());
|
||||
}
|
||||
|
||||
public PDOMCPPNamespaceAlias(PDOM pdom, int record) {
|
||||
|
|
|
@ -16,10 +16,9 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
|||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||
|
@ -33,7 +32,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter {
|
||||
class PDOMCPPParameter extends PDOMNamedNode implements IParameter {
|
||||
|
||||
/**
|
||||
* Offset of pointer to the next parameter (relative to the
|
||||
|
@ -56,9 +55,9 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter {
|
|||
super(pdom, record);
|
||||
}
|
||||
|
||||
public PDOMCPPParameter(PDOM pdom, PDOMNode parent, IASTName name, ICPPParameter param)
|
||||
public PDOMCPPParameter(PDOM pdom, PDOMNode parent, IParameter param)
|
||||
throws CoreException {
|
||||
super(pdom, parent, name.toCharArray());
|
||||
super(pdom, parent, param.getNameCharArray());
|
||||
|
||||
Database db = pdom.getDB();
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class PDOMCPPTypedef extends PDOMBinding implements ITypedef {
|
|||
|
||||
public PDOMCPPTypedef(PDOM pdom, PDOMNode parent, IASTName name, ITypedef typedef)
|
||||
throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
super(pdom, parent, name.toCharArray());
|
||||
try {
|
||||
IType type = typedef.getType();
|
||||
PDOMNode typeNode = parent.getLinkageImpl().addType(this, type);
|
||||
|
|
|
@ -15,13 +15,9 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
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.db.Database;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||
|
@ -52,21 +48,17 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable {
|
|||
*/
|
||||
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 5;
|
||||
|
||||
public PDOMCPPVariable(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||
super(pdom, parent, name);
|
||||
public PDOMCPPVariable(PDOM pdom, PDOMNode parent, ICPPVariable variable) throws CoreException {
|
||||
super(pdom, parent, variable.getNameCharArray());
|
||||
|
||||
// Find the type record
|
||||
IASTNode nameParent = name.getParent();
|
||||
Database db = pdom.getDB();
|
||||
if (nameParent instanceof IASTDeclarator) {
|
||||
IASTDeclarator declarator = (IASTDeclarator)nameParent;
|
||||
IType type = CPPVisitor.createType(declarator);
|
||||
PDOMNode typeNode = parent.getLinkageImpl().addType(this, type);
|
||||
try {
|
||||
// Find the type record
|
||||
Database db = pdom.getDB();
|
||||
PDOMNode typeNode = parent.getLinkageImpl().addType(this, variable.getType());
|
||||
if (typeNode != null)
|
||||
db.putInt(record + TYPE_OFFSET, typeNode.getRecord());
|
||||
}
|
||||
try {
|
||||
db.putByte(record + ANNOTATIONS, PDOMCPPAnnotation.encodeAnnotation(name.resolveBinding()));
|
||||
|
||||
db.putByte(record + ANNOTATIONS, PDOMCPPAnnotation.encodeAnnotation(variable));
|
||||
} catch (DOMException e) {
|
||||
throw new CoreException(Util.createStatus(e));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue