mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 323723: Removes the remaining throw declarations from IVariable and IFunction.
This commit is contained in:
parent
7f684f342a
commit
0dea806506
98 changed files with 672 additions and 1020 deletions
|
@ -16,7 +16,6 @@ import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||||
|
@ -257,14 +256,10 @@ public final class CxxAstUtils {
|
||||||
for (IBinding b : bindings) {
|
for (IBinding b : bindings) {
|
||||||
if (b instanceof IFunction) {
|
if (b instanceof IFunction) {
|
||||||
IFunction f = (IFunction) b;
|
IFunction f = (IFunction) b;
|
||||||
try {
|
if (f.getParameters().length == expectedParametersNum) {
|
||||||
if (f.getParameters().length == expectedParametersNum) {
|
// Consider this overload
|
||||||
// Consider this overload
|
IIndexName[] decls = index.findDeclarations(b);
|
||||||
IIndexName[] decls = index.findDeclarations(b);
|
declSet.addAll(Arrays.asList(decls));
|
||||||
declSet.addAll(Arrays.asList(decls));
|
|
||||||
}
|
|
||||||
} catch (DOMException e) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,18 +221,14 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void assertVariable(IBinding b, String qn, Class expType, String expTypeQN) {
|
protected static void assertVariable(IBinding b, String qn, Class expType, String expTypeQN) {
|
||||||
try {
|
assertInstance(b, IVariable.class);
|
||||||
assertInstance(b, IVariable.class);
|
IVariable variable = (IVariable) b;
|
||||||
IVariable variable = (IVariable) b;
|
assertQNEquals(qn, variable);
|
||||||
assertQNEquals(qn, variable);
|
assertInstance(variable.getType(), expType);
|
||||||
assertInstance(variable.getType(), expType);
|
if (expTypeQN != null) {
|
||||||
if (expTypeQN != null) {
|
IType type= variable.getType();
|
||||||
IType type= variable.getType();
|
assertInstance(type, IBinding.class);
|
||||||
assertInstance(type, IBinding.class);
|
assertQNEquals(expTypeQN, (IBinding) type);
|
||||||
assertQNEquals(expTypeQN, (IBinding) type);
|
|
||||||
}
|
|
||||||
} catch (DOMException de) {
|
|
||||||
fail(de.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1592,18 +1592,14 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
||||||
String qn,
|
String qn,
|
||||||
Class expType,
|
Class expType,
|
||||||
String expTypeQN) {
|
String expTypeQN) {
|
||||||
try {
|
assertTrue(binding instanceof ICPPField);
|
||||||
assertTrue(binding instanceof ICPPField);
|
ICPPField field = (ICPPField) binding;
|
||||||
ICPPField field = (ICPPField) binding;
|
assertQNEquals(qn, field);
|
||||||
assertQNEquals(qn, field);
|
assertTrue(expType.isInstance(field.getType()));
|
||||||
assertTrue(expType.isInstance(field.getType()));
|
if (expTypeQN != null) {
|
||||||
if (expTypeQN != null) {
|
assert(field.getType() instanceof ICPPBinding);
|
||||||
assert(field.getType() instanceof ICPPBinding);
|
ICPPBinding tyBinding = (ICPPBinding) field.getType();
|
||||||
ICPPBinding tyBinding = (ICPPBinding) field.getType();
|
assertQNEquals(expTypeQN, tyBinding);
|
||||||
assertQNEquals(expTypeQN, tyBinding);
|
|
||||||
}
|
|
||||||
} catch (DOMException de) {
|
|
||||||
fail(de.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1647,7 +1643,7 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
||||||
assertEquals(methods, classType.getMethods().length);
|
assertEquals(methods, classType.getMethods().length);
|
||||||
assertEquals(declaredMethods, classType.getDeclaredMethods().length);
|
assertEquals(declaredMethods, classType.getDeclaredMethods().length);
|
||||||
assertEquals(allDeclaredMethods, classType.getAllDeclaredMethods().length);
|
assertEquals(allDeclaredMethods, classType.getAllDeclaredMethods().length);
|
||||||
// assertEquals(friends, classType.getFriends().length); (PDOMNotImplementedError)
|
assertEquals(friends, classType.getFriends().length);
|
||||||
assertEquals(constructors, classType.getConstructors().length);
|
assertEquals(constructors, classType.getConstructors().length);
|
||||||
assertEquals(nestedClasses, classType.getNestedClasses().length);
|
assertEquals(nestedClasses, classType.getNestedClasses().length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
|
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
|
||||||
import org.eclipse.cdt.internal.core.Util;
|
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexFragment;
|
import org.eclipse.cdt.internal.core.index.IIndexFragment;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
|
@ -187,8 +186,8 @@ public class PDOMTestBase extends BaseTestCase {
|
||||||
*/
|
*/
|
||||||
private void assertUniqueNameCount(IName[] names, int count) {
|
private void assertUniqueNameCount(IName[] names, int count) {
|
||||||
Set offsets = new HashSet();
|
Set offsets = new HashSet();
|
||||||
for (int i = 0; i < names.length; i++) {
|
for (IName name : names) {
|
||||||
offsets.add(names[i].getFileLocation());
|
offsets.add(name.getFileLocation());
|
||||||
}
|
}
|
||||||
assertEquals(count, offsets.size());
|
assertEquals(count, offsets.size());
|
||||||
}
|
}
|
||||||
|
@ -217,27 +216,23 @@ public class PDOMTestBase extends BaseTestCase {
|
||||||
|
|
||||||
// this is only approximate - composite types are not supported
|
// this is only approximate - composite types are not supported
|
||||||
public static IBinding[] findIFunctions(Class[] paramTypes, IBinding[] bindings) throws CoreException {
|
public static IBinding[] findIFunctions(Class[] paramTypes, IBinding[] bindings) throws CoreException {
|
||||||
try {
|
List preresult = new ArrayList();
|
||||||
List preresult = new ArrayList();
|
for (IBinding binding : bindings) {
|
||||||
for(int i=0; i<bindings.length; i++) {
|
if(binding instanceof IFunction) {
|
||||||
if(bindings[i] instanceof IFunction) {
|
IFunction function = (IFunction) binding;
|
||||||
IFunction function = (IFunction) bindings[i];
|
IType[] candidate = function.getType().getParameterTypes();
|
||||||
IType[] candidate = function.getType().getParameterTypes();
|
boolean areEqual = candidate.length == paramTypes.length;
|
||||||
boolean areEqual = candidate.length == paramTypes.length;
|
for(int j=0; areEqual && j<paramTypes.length; j++) {
|
||||||
for(int j=0; areEqual && j<paramTypes.length; j++) {
|
if(!paramTypes[j].isAssignableFrom(candidate[j].getClass())) {
|
||||||
if(!paramTypes[j].isAssignableFrom(candidate[j].getClass())) {
|
areEqual = false;
|
||||||
areEqual = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(areEqual) {
|
|
||||||
preresult.add(bindings[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(areEqual) {
|
||||||
|
preresult.add(binding);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (IBinding[]) preresult.toArray(new IBinding[preresult.size()]);
|
|
||||||
} catch(DOMException e) {
|
|
||||||
throw new CoreException(Util.createStatus(e));
|
|
||||||
}
|
}
|
||||||
|
return (IBinding[]) preresult.toArray(new IBinding[preresult.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertInstance(Object o, Class c) {
|
protected void assertInstance(Object o, Class c) {
|
||||||
|
@ -247,8 +242,8 @@ public class PDOMTestBase extends BaseTestCase {
|
||||||
|
|
||||||
public static Pattern[] makePatternArray(String[] args) {
|
public static Pattern[] makePatternArray(String[] args) {
|
||||||
List preresult = new ArrayList();
|
List preresult = new ArrayList();
|
||||||
for(int i=0; i<args.length; i++) {
|
for (String arg : args) {
|
||||||
preresult.add(Pattern.compile(args[i]));
|
preresult.add(Pattern.compile(arg));
|
||||||
}
|
}
|
||||||
return (Pattern[]) preresult.toArray(new Pattern[preresult.size()]);
|
return (Pattern[]) preresult.toArray(new Pattern[preresult.size()]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@ import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||||
import org.eclipse.cdt.internal.core.browser.IndexModelUtil;
|
import org.eclipse.cdt.internal.core.browser.IndexModelUtil;
|
||||||
import org.eclipse.cdt.internal.core.browser.IndexTypeReference;
|
import org.eclipse.cdt.internal.core.browser.IndexTypeReference;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
|
||||||
import org.eclipse.core.filesystem.URIUtil;
|
import org.eclipse.core.filesystem.URIUtil;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
@ -475,7 +474,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void addDerivedReference(ITypeReference location) {
|
public void addDerivedReference(ITypeReference location) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -484,7 +483,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void addReference(ITypeReference location) {
|
public void addReference(ITypeReference location) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -493,7 +492,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean canSubstituteFor(ITypeInfo info) {
|
public boolean canSubstituteFor(ITypeInfo info) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -502,7 +501,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean encloses(ITypeInfo info) {
|
public boolean encloses(ITypeInfo info) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -511,7 +510,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean exists() {
|
public boolean exists() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -520,7 +519,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ITypeReference[] getDerivedReferences() {
|
public ITypeReference[] getDerivedReferences() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -529,7 +528,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ITypeInfo[] getEnclosedTypes() {
|
public ITypeInfo[] getEnclosedTypes() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -538,7 +537,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ITypeInfo[] getEnclosedTypes(int[] kinds) {
|
public ITypeInfo[] getEnclosedTypes(int[] kinds) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -547,7 +546,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ITypeInfo getEnclosingNamespace(boolean includeGlobalNamespace) {
|
public ITypeInfo getEnclosingNamespace(boolean includeGlobalNamespace) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -567,7 +566,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ITypeInfo getEnclosingType(int[] kinds) {
|
public ITypeInfo getEnclosingType(int[] kinds) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -577,7 +576,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ITypeInfo getRootNamespace(boolean includeGlobalNamespace) {
|
public ITypeInfo getRootNamespace(boolean includeGlobalNamespace) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -586,7 +585,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ITypeInfo[] getSubTypes() {
|
public ITypeInfo[] getSubTypes() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -595,7 +594,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ASTAccessVisibility getSuperTypeAccess(ITypeInfo subType) {
|
public ASTAccessVisibility getSuperTypeAccess(ITypeInfo subType) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -604,7 +603,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ITypeInfo[] getSuperTypes() {
|
public ITypeInfo[] getSuperTypes() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -613,7 +612,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean hasEnclosedTypes() {
|
public boolean hasEnclosedTypes() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -622,7 +621,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean hasSubTypes() {
|
public boolean hasSubTypes() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -631,7 +630,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean hasSuperTypes() {
|
public boolean hasSuperTypes() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -640,7 +639,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isClass() {
|
public boolean isClass() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -649,7 +648,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isEnclosed(ITypeInfo info) {
|
public boolean isEnclosed(ITypeInfo info) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -658,7 +657,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isEnclosed(ITypeSearchScope scope) {
|
public boolean isEnclosed(ITypeSearchScope scope) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -667,7 +666,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isEnclosedType() {
|
public boolean isEnclosedType() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -676,7 +675,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isEnclosingType() {
|
public boolean isEnclosingType() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -685,7 +684,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isReferenced(ITypeSearchScope scope) {
|
public boolean isReferenced(ITypeSearchScope scope) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -694,7 +693,7 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isUndefinedType() {
|
public boolean isUndefinedType() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -703,6 +702,6 @@ public class IndexTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void setCElementType(int type) {
|
public void setCElementType(int type) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.eclipse.cdt.core.index.IIndexFileLocation;
|
||||||
import org.eclipse.cdt.core.index.IndexLocationFactory;
|
import org.eclipse.cdt.core.index.IndexLocationFactory;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
|
||||||
import org.eclipse.core.filesystem.URIUtil;
|
import org.eclipse.core.filesystem.URIUtil;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
@ -209,47 +208,47 @@ public class ASTTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void addDerivedReference(ITypeReference location) {
|
public void addDerivedReference(ITypeReference location) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void addReference(ITypeReference location) {
|
public void addReference(ITypeReference location) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean canSubstituteFor(ITypeInfo info) {
|
public boolean canSubstituteFor(ITypeInfo info) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean encloses(ITypeInfo info) {
|
public boolean encloses(ITypeInfo info) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean exists() {
|
public boolean exists() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ITypeReference[] getDerivedReferences() {
|
public ITypeReference[] getDerivedReferences() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ITypeInfo[] getEnclosedTypes() {
|
public ITypeInfo[] getEnclosedTypes() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ITypeInfo[] getEnclosedTypes(int[] kinds) {
|
public ITypeInfo[] getEnclosedTypes(int[] kinds) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ITypeInfo getEnclosingNamespace(boolean includeGlobalNamespace) {
|
public ITypeInfo getEnclosingNamespace(boolean includeGlobalNamespace) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -260,81 +259,81 @@ public class ASTTypeInfo implements ITypeInfo, IFunctionInfo {
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ITypeInfo getEnclosingType(int[] kinds) {
|
public ITypeInfo getEnclosingType(int[] kinds) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ITypeInfo getRootNamespace(boolean includeGlobalNamespace) {
|
public ITypeInfo getRootNamespace(boolean includeGlobalNamespace) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ITypeInfo[] getSubTypes() {
|
public ITypeInfo[] getSubTypes() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ASTAccessVisibility getSuperTypeAccess(ITypeInfo subType) {
|
public ASTAccessVisibility getSuperTypeAccess(ITypeInfo subType) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ITypeInfo[] getSuperTypes() {
|
public ITypeInfo[] getSuperTypes() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean hasEnclosedTypes() {
|
public boolean hasEnclosedTypes() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean hasSubTypes() {
|
public boolean hasSubTypes() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean hasSuperTypes() {
|
public boolean hasSuperTypes() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isClass() {
|
public boolean isClass() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isEnclosed(ITypeInfo info) {
|
public boolean isEnclosed(ITypeInfo info) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isEnclosed(ITypeSearchScope scope) {
|
public boolean isEnclosed(ITypeSearchScope scope) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isEnclosedType() {
|
public boolean isEnclosedType() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isEnclosingType() {
|
public boolean isEnclosingType() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isReferenced(ITypeSearchScope scope) {
|
public boolean isReferenced(ITypeSearchScope scope) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isUndefinedType() {
|
public boolean isUndefinedType() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void setCElementType(int type) {
|
public void setCElementType(int type) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ import java.util.List;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.IPositionConverter;
|
import org.eclipse.cdt.core.IPositionConverter;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
|
@ -261,7 +260,7 @@ abstract class CElementHandle implements ICElementHandle, ISourceReference {
|
||||||
return EMPTY_STRING_ARRAY;
|
return EMPTY_STRING_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String[] extractParameterTypes(IFunction func) throws DOMException {
|
protected String[] extractParameterTypes(IFunction func) {
|
||||||
IParameter[] params= func.getParameters();
|
IParameter[] params= func.getParameters();
|
||||||
String[] parameterTypes= new String[params.length];
|
String[] parameterTypes= new String[params.length];
|
||||||
for (int i = 0; i < params.length; i++) {
|
for (int i = 0; i < params.length; i++) {
|
||||||
|
|
|
@ -10,9 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.model.ext;
|
package org.eclipse.cdt.internal.core.model.ext;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IField;
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
@ -26,12 +24,7 @@ public class FieldHandle extends CElementHandle implements org.eclipse.cdt.core.
|
||||||
|
|
||||||
public FieldHandle(ICElement parent, IField field) {
|
public FieldHandle(ICElement parent, IField field) {
|
||||||
super(parent, ICElement.C_FIELD, field.getName());
|
super(parent, ICElement.C_FIELD, field.getName());
|
||||||
try {
|
fTypeName= ASTTypeUtil.getType(field.getType(), false);
|
||||||
fTypeName= ASTTypeUtil.getType(field.getType(), false);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
CCorePlugin.log(e);
|
|
||||||
fTypeName= ""; //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
fVisibility= getVisibility(field);
|
fVisibility= getVisibility(field);
|
||||||
fIsStatic= field.isStatic();
|
fIsStatic= field.isStatic();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
package org.eclipse.cdt.internal.core.model.ext;
|
package org.eclipse.cdt.internal.core.model.ext;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
@ -25,11 +24,11 @@ public class FunctionDeclarationHandle extends CElementHandle implements IFuncti
|
||||||
private String fReturnType;
|
private String fReturnType;
|
||||||
private boolean fIsStatic;
|
private boolean fIsStatic;
|
||||||
|
|
||||||
public FunctionDeclarationHandle(ICElement parent, IFunction func) throws DOMException {
|
public FunctionDeclarationHandle(ICElement parent, IFunction func) {
|
||||||
this(parent, ICElement.C_FUNCTION_DECLARATION, func);
|
this(parent, ICElement.C_FUNCTION_DECLARATION, func);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected FunctionDeclarationHandle(ICElement parent, int type, IFunction func) throws DOMException {
|
protected FunctionDeclarationHandle(ICElement parent, int type, IFunction func) {
|
||||||
super(parent, type, func.getName());
|
super(parent, type, func.getName());
|
||||||
fParameterTypes= extractParameterTypes(func);
|
fParameterTypes= extractParameterTypes(func);
|
||||||
fReturnType= ASTTypeUtil.getType(func.getType().getReturnType(), false);
|
fReturnType= ASTTypeUtil.getType(func.getType().getReturnType(), false);
|
||||||
|
|
|
@ -11,13 +11,12 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.model.ext;
|
package org.eclipse.cdt.internal.core.model.ext;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
|
||||||
public class FunctionHandle extends FunctionDeclarationHandle implements org.eclipse.cdt.core.model.IFunction {
|
public class FunctionHandle extends FunctionDeclarationHandle implements org.eclipse.cdt.core.model.IFunction {
|
||||||
|
|
||||||
public FunctionHandle(ICElement parent, IFunction func) throws DOMException {
|
public FunctionHandle(ICElement parent, IFunction func) {
|
||||||
super(parent, ICElement.C_FUNCTION, func);
|
super(parent, ICElement.C_FUNCTION, func);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
package org.eclipse.cdt.internal.core.model.ext;
|
package org.eclipse.cdt.internal.core.model.ext;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
|
@ -29,11 +28,11 @@ public class MethodDeclarationHandle extends CElementHandle implements IMethodDe
|
||||||
private boolean fIsConstructor;
|
private boolean fIsConstructor;
|
||||||
private boolean fIsDestructor;
|
private boolean fIsDestructor;
|
||||||
|
|
||||||
public MethodDeclarationHandle(ICElement parent, ICPPMethod method) throws DOMException {
|
public MethodDeclarationHandle(ICElement parent, ICPPMethod method) {
|
||||||
this(parent, ICElement.C_METHOD_DECLARATION, method);
|
this(parent, ICElement.C_METHOD_DECLARATION, method);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MethodDeclarationHandle(ICElement parent, int type, ICPPMethod method) throws DOMException {
|
protected MethodDeclarationHandle(ICElement parent, int type, ICPPMethod method) {
|
||||||
super(parent, type, method.getName());
|
super(parent, type, method.getName());
|
||||||
fParameterTypes= extractParameterTypes(method);
|
fParameterTypes= extractParameterTypes(method);
|
||||||
fReturnType= ASTTypeUtil.getType(method.getType().getReturnType(), false);
|
fReturnType= ASTTypeUtil.getType(method.getType().getReturnType(), false);
|
||||||
|
|
|
@ -11,14 +11,13 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.model.ext;
|
package org.eclipse.cdt.internal.core.model.ext;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.IMethod;
|
import org.eclipse.cdt.core.model.IMethod;
|
||||||
|
|
||||||
public class MethodHandle extends MethodDeclarationHandle implements IMethod {
|
public class MethodHandle extends MethodDeclarationHandle implements IMethod {
|
||||||
|
|
||||||
public MethodHandle(ICElement parent, ICPPMethod method) throws DOMException {
|
public MethodHandle(ICElement parent, ICPPMethod method) {
|
||||||
super(parent, ICElement.C_METHOD, method);
|
super(parent, ICElement.C_METHOD, method);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,14 +11,13 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.model.ext;
|
package org.eclipse.cdt.internal.core.model.ext;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.INamespace;
|
import org.eclipse.cdt.core.model.INamespace;
|
||||||
|
|
||||||
public class NamespaceHandle extends CElementHandle implements INamespace {
|
public class NamespaceHandle extends CElementHandle implements INamespace {
|
||||||
|
|
||||||
public NamespaceHandle(ICElement parent, ICPPNamespace ns) throws DOMException {
|
public NamespaceHandle(ICElement parent, ICPPNamespace ns) {
|
||||||
super(parent, ICElement.C_NAMESPACE, ns.getName());
|
super(parent, ICElement.C_NAMESPACE, ns.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.model.ext;
|
package org.eclipse.cdt.internal.core.model.ext;
|
||||||
|
|
||||||
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.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
@ -23,7 +22,7 @@ public class StructureHandle extends CElementHandle implements IStructure {
|
||||||
private static final IField[] EMPTY_FIELDS = new IField[0];
|
private static final IField[] EMPTY_FIELDS = new IField[0];
|
||||||
private static final IMethodDeclaration[] EMPTY_METHODS = new IMethodDeclaration[0];
|
private static final IMethodDeclaration[] EMPTY_METHODS = new IMethodDeclaration[0];
|
||||||
|
|
||||||
public StructureHandle(ICElement parent, ICompositeType type) throws DOMException {
|
public StructureHandle(ICElement parent, ICompositeType type) {
|
||||||
super(parent, convertKey(type.getKey()), type.getName());
|
super(parent, convertKey(type.getKey()), type.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.model.ext;
|
package org.eclipse.cdt.internal.core.model.ext;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
@ -23,12 +21,7 @@ public class VariableHandle extends CElementHandle implements org.eclipse.cdt.co
|
||||||
|
|
||||||
public VariableHandle(ICElement parent, IVariable var) {
|
public VariableHandle(ICElement parent, IVariable var) {
|
||||||
super(parent, ICElement.C_VARIABLE, var.getName());
|
super(parent, ICElement.C_VARIABLE, var.getName());
|
||||||
try {
|
fTypeName= ASTTypeUtil.getType(var.getType(), false);
|
||||||
fTypeName= ASTTypeUtil.getType(var.getType(), false);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
CCorePlugin.log(e);
|
|
||||||
fTypeName= ""; //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
fIsStatic= var.isStatic();
|
fIsStatic= var.isStatic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,12 +91,10 @@ public class ASTTypeUtil {
|
||||||
/**
|
/**
|
||||||
* @return Whether the function matching the given function binding takes
|
* @return Whether the function matching the given function binding takes
|
||||||
* parameters or not.
|
* parameters or not.
|
||||||
* @throws DOMException
|
|
||||||
*
|
*
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
public static boolean functionTakesParameters(IFunction function)
|
public static boolean functionTakesParameters(IFunction function) {
|
||||||
throws DOMException {
|
|
||||||
IParameter[] parameters = function.getParameters();
|
IParameter[] parameters = function.getParameters();
|
||||||
|
|
||||||
if (parameters.length == 0) {
|
if (parameters.length == 0) {
|
||||||
|
@ -624,20 +622,16 @@ public class ASTTypeUtil {
|
||||||
* @noreference This method is not intended to be referenced by clients.
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
public static String getNodeType(IASTNode node) {
|
public static String getNodeType(IASTNode node) {
|
||||||
try {
|
if (node instanceof IASTDeclarator)
|
||||||
if (node instanceof IASTDeclarator)
|
return getType((IASTDeclarator) node);
|
||||||
return getType((IASTDeclarator) node);
|
if (node instanceof IASTName && ((IASTName) node).resolveBinding() instanceof IVariable)
|
||||||
if (node instanceof IASTName && ((IASTName) node).resolveBinding() instanceof IVariable)
|
return getType(((IVariable)((IASTName) node).resolveBinding()).getType());
|
||||||
return getType(((IVariable)((IASTName) node).resolveBinding()).getType());
|
if (node instanceof IASTName && ((IASTName) node).resolveBinding() instanceof IFunction)
|
||||||
if (node instanceof IASTName && ((IASTName) node).resolveBinding() instanceof IFunction)
|
return getType(((IFunction)((IASTName) node).resolveBinding()).getType());
|
||||||
return getType(((IFunction)((IASTName) node).resolveBinding()).getType());
|
if (node instanceof IASTName && ((IASTName) node).resolveBinding() instanceof IType)
|
||||||
if (node instanceof IASTName && ((IASTName) node).resolveBinding() instanceof IType)
|
return getType((IType)((IASTName) node).resolveBinding());
|
||||||
return getType((IType)((IASTName) node).resolveBinding());
|
if (node instanceof IASTTypeId)
|
||||||
if (node instanceof IASTTypeId)
|
return getType((IASTTypeId) node);
|
||||||
return getType((IASTTypeId) node);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
return EMPTY_STRING;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,24 +22,18 @@ public interface IFunction extends IBinding {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the formal parameters of the function.
|
* Returns the formal parameters of the function.
|
||||||
*
|
|
||||||
* @return array of IParameter
|
|
||||||
* @throws DOMException if this is a problem binding.
|
|
||||||
*/
|
*/
|
||||||
public IParameter[] getParameters() throws DOMException;
|
public IParameter[] getParameters();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the function scope
|
* Get the function scope
|
||||||
*
|
|
||||||
* @throws DOMException if this is a problem binding.
|
|
||||||
*/
|
*/
|
||||||
public IScope getFunctionScope() throws DOMException;
|
public IScope getFunctionScope();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the IFunctionType for this function
|
* Get the IFunctionType for this function
|
||||||
* @throws DOMException if this is a problem binding.
|
|
||||||
*/
|
*/
|
||||||
public IFunctionType getType() throws DOMException;
|
public IFunctionType getType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns {@code true} if the function has the static storage-class specifier
|
* Returns {@code true} if the function has the static storage-class specifier
|
||||||
|
|
|
@ -22,7 +22,7 @@ public interface IVariable extends IBinding {
|
||||||
/**
|
/**
|
||||||
* Returns the type of the variable
|
* Returns the type of the variable
|
||||||
*/
|
*/
|
||||||
public IType getType() throws DOMException;
|
public IType getType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value for a variable with an initializer,
|
* Returns the value for a variable with an initializer,
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
|
||||||
|
@ -50,17 +49,17 @@ public interface ICPPFunction extends IFunction, ICPPBinding {
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
public ICPPFunctionType getType() throws DOMException;
|
public ICPPFunctionType getType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
public ICPPParameter[] getParameters() throws DOMException;
|
public ICPPParameter[] getParameters();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
public int getRequiredArgumentCount() throws DOMException;
|
public int getRequiredArgumentCount();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.core.parser.util;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTGenericVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTGenericVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTComment;
|
import org.eclipse.cdt.core.dom.ast.IASTComment;
|
||||||
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;
|
||||||
|
@ -262,13 +261,9 @@ public class ASTPrinter {
|
||||||
} else if (n instanceof IVariable) {
|
} else if (n instanceof IVariable) {
|
||||||
IVariable var = (IVariable) n;
|
IVariable var = (IVariable) n;
|
||||||
IType t;
|
IType t;
|
||||||
try {
|
t = var.getType();
|
||||||
t = var.getType();
|
out.println();
|
||||||
out.println();
|
print(out, indentLevel, t);
|
||||||
print(out, indentLevel, t);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
//e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (n instanceof IProblemBinding) {
|
} else if (n instanceof IProblemBinding) {
|
||||||
IProblemBinding problem = (IProblemBinding)n;
|
IProblemBinding problem = (IProblemBinding)n;
|
||||||
|
|
|
@ -278,8 +278,8 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
||||||
|
|
||||||
|
|
||||||
// Dummy methods for derived classes
|
// Dummy methods for derived classes
|
||||||
public IType getType() throws DOMException {
|
public IType getType() {
|
||||||
throw new DOMException(this);
|
return new ProblemType(getID());
|
||||||
}
|
}
|
||||||
public boolean isStatic() {
|
public boolean isStatic() {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 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
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Markus Schorn - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.dom.parser;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of problem types.
|
||||||
|
*/
|
||||||
|
public class ProblemFunctionType extends ProblemType implements ICPPFunctionType {
|
||||||
|
|
||||||
|
public ProblemFunctionType(int id) {
|
||||||
|
super(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void marshal(ITypeMarshalBuffer buffer) throws CoreException {
|
||||||
|
buffer.putByte((byte) (ITypeMarshalBuffer.PROBLEM_TYPE | ITypeMarshalBuffer.FLAG1));
|
||||||
|
buffer.putShort((short) getID());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IType unmarshal(int firstByte, ITypeMarshalBuffer buffer) throws CoreException {
|
||||||
|
return new ProblemFunctionType(buffer.getShort());
|
||||||
|
}
|
||||||
|
|
||||||
|
public IType getReturnType() {
|
||||||
|
return new ProblemType(getID());
|
||||||
|
}
|
||||||
|
|
||||||
|
public IType[] getParameterTypes() {
|
||||||
|
return new IType[] {new ProblemType(getID())};
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isConst() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVolatile() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean takesVarArgs() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IPointerType getThisType() {
|
||||||
|
return new CPPPointerType(new ProblemType(getID()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -53,6 +53,9 @@ public class ProblemType implements IProblemType, ISerializableType {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IType unmarshal(int firstByte, ITypeMarshalBuffer buffer) throws CoreException {
|
public static IType unmarshal(int firstByte, ITypeMarshalBuffer buffer) throws CoreException {
|
||||||
return new ProblemType(buffer.getShort() & 0xffff);
|
if ((firstByte & ITypeMarshalBuffer.FLAG1) != 0)
|
||||||
|
return ProblemFunctionType.unmarshal(firstByte, buffer);
|
||||||
|
|
||||||
|
return new ProblemType(buffer.getShort());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser;
|
package org.eclipse.cdt.internal.core.dom.parser;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||||
|
@ -75,15 +74,12 @@ public abstract class VariableReadWriteFlags {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int rwInInitializerExpression(int indirection, IASTNode parent) {
|
protected int rwInInitializerExpression(int indirection, IASTNode parent) {
|
||||||
try {
|
IASTNode grand= parent.getParent();
|
||||||
IASTNode grand= parent.getParent();
|
if (grand instanceof IASTDeclarator) {
|
||||||
if (grand instanceof IASTDeclarator) {
|
IBinding binding= ((IASTDeclarator) grand).getName().getBinding();
|
||||||
IBinding binding= ((IASTDeclarator) grand).getName().getBinding();
|
if (binding instanceof IVariable) {
|
||||||
if (binding instanceof IVariable) {
|
return rwAssignmentToType(((IVariable) binding).getType(), indirection);
|
||||||
return rwAssignmentToType(((IVariable) binding).getType(), indirection);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
}
|
||||||
return READ | WRITE; // fallback
|
return READ | WRITE; // fallback
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompletionContext;
|
import org.eclipse.cdt.core.dom.ast.IASTCompletionContext;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
|
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
|
||||||
|
@ -137,11 +136,7 @@ public class CASTFieldReference extends ASTNode implements IASTFieldReference, I
|
||||||
public IType getExpressionType() {
|
public IType getExpressionType() {
|
||||||
IBinding binding = getFieldName().resolveBinding();
|
IBinding binding = getFieldName().resolveBinding();
|
||||||
if (binding instanceof IVariable) {
|
if (binding instanceof IVariable) {
|
||||||
try {
|
return ((IVariable)binding).getType();
|
||||||
return ((IVariable)binding).getType();
|
|
||||||
} catch (DOMException e) {
|
|
||||||
return e.getProblem();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
|
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,10 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IField;
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICCompositeTypeScope;
|
import org.eclipse.cdt.core.dom.ast.c.ICCompositeTypeScope;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||||
|
|
||||||
public class CField extends CVariable implements IField {
|
public class CField extends CVariable implements IField {
|
||||||
public static class CFieldProblem extends CVariable.CVariableProblem implements IField {
|
public static class CFieldProblem extends ProblemBinding implements IField {
|
||||||
private ICompositeType fOwner;
|
private ICompositeType fOwner;
|
||||||
|
|
||||||
public CFieldProblem(ICompositeType owner, IASTNode node, int id, char[] arg) {
|
public CFieldProblem(ICompositeType owner, IASTNode node, int id, char[] arg) {
|
||||||
|
@ -38,5 +39,4 @@ public class CField extends CVariable implements IField {
|
||||||
ICCompositeTypeScope scope = (ICCompositeTypeScope) getScope();
|
ICCompositeTypeScope scope = (ICCompositeTypeScope) getScope();
|
||||||
return scope.getCompositeType();
|
return scope.getCompositeType();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,12 +26,10 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.internal.core.dom.Linkage;
|
import org.eclipse.cdt.internal.core.dom.Linkage;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.IInternalVariable;
|
import org.eclipse.cdt.internal.core.dom.parser.IInternalVariable;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||||
import org.eclipse.core.runtime.PlatformObject;
|
import org.eclipse.core.runtime.PlatformObject;
|
||||||
|
|
||||||
|
@ -39,12 +37,6 @@ import org.eclipse.core.runtime.PlatformObject;
|
||||||
* Binding for a global or a local variable, serves as base class for fields.
|
* Binding for a global or a local variable, serves as base class for fields.
|
||||||
*/
|
*/
|
||||||
public class CVariable extends PlatformObject implements IInternalVariable, ICInternalBinding {
|
public class CVariable extends PlatformObject implements IInternalVariable, ICInternalBinding {
|
||||||
public static class CVariableProblem extends ProblemBinding implements IVariable {
|
|
||||||
public CVariableProblem(IASTNode node, int id, char[] arg) {
|
|
||||||
super(node, id, arg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private IASTName[] declarations = null;
|
private IASTName[] declarations = null;
|
||||||
private IType type = null;
|
private IType type = null;
|
||||||
|
|
||||||
|
|
|
@ -737,10 +737,7 @@ public class CVisitor extends ASTQueries {
|
||||||
if (binding instanceof IParameter) {
|
if (binding instanceof IParameter) {
|
||||||
return new ProblemBinding(name, IProblemBinding.SEMANTIC_INVALID_REDECLARATION, name.toCharArray());
|
return new ProblemBinding(name, IProblemBinding.SEMANTIC_INVALID_REDECLARATION, name.toCharArray());
|
||||||
} else if (binding instanceof IVariable) {
|
} else if (binding instanceof IVariable) {
|
||||||
try {
|
t2 = ((IVariable)binding).getType();
|
||||||
t2 = ((IVariable)binding).getType();
|
|
||||||
} catch (DOMException e1) {
|
|
||||||
}
|
|
||||||
if (t1 != null && t2 != null && (
|
if (t1 != null && t2 != null && (
|
||||||
t1.isSameType(t2) || isCompatibleArray(t1, t2) != null)) {
|
t1.isSameType(t2) || isCompatibleArray(t1, t2) != null)) {
|
||||||
if (binding instanceof CVariable)
|
if (binding instanceof CVariable)
|
||||||
|
|
|
@ -18,7 +18,6 @@ import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionT
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
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.IASTFunctionCallExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
|
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
|
||||||
|
@ -167,14 +166,13 @@ public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionLi
|
||||||
vcat= valueCat(e2);
|
vcat= valueCat(e2);
|
||||||
} else {
|
} else {
|
||||||
overloads[i - 1] = overload;
|
overloads[i - 1] = overload;
|
||||||
try {
|
lookupType = overload.getType().getReturnType();
|
||||||
lookupType = overload.getType().getReturnType();
|
vcat= valueCategoryFromReturnType(lookupType);
|
||||||
vcat= valueCategoryFromReturnType(lookupType);
|
lookupType= typeFromReturnType(lookupType);
|
||||||
lookupType= typeFromReturnType(lookupType);
|
if (lookupType instanceof ISemanticProblem) {
|
||||||
} catch (DOMException e) {
|
|
||||||
lookupType = typeOrFunctionSet(e2);
|
lookupType = typeOrFunctionSet(e2);
|
||||||
vcat= valueCat(e2);
|
vcat= valueCat(e2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,26 +265,23 @@ public class CPPASTFieldReference extends ASTNode implements ICPPASTFieldReferen
|
||||||
public ValueCategory getValueCategory() {
|
public ValueCategory getValueCategory() {
|
||||||
IASTName name= getFieldName();
|
IASTName name= getFieldName();
|
||||||
IBinding binding = name.resolvePreBinding();
|
IBinding binding = name.resolvePreBinding();
|
||||||
try {
|
if (binding instanceof IVariable) {
|
||||||
if (binding instanceof IVariable) {
|
IType e2= ((IVariable) binding).getType();
|
||||||
IType e2= ((IVariable) binding).getType();
|
e2= SemanticUtil.getNestedType(e2, TDEF);
|
||||||
e2= SemanticUtil.getNestedType(e2, TDEF);
|
if (e2 instanceof ICPPReferenceType) {
|
||||||
if (e2 instanceof ICPPReferenceType) {
|
|
||||||
return LVALUE;
|
|
||||||
}
|
|
||||||
if (binding instanceof ICPPField && !((ICPPField) binding).isStatic()) {
|
|
||||||
if (isPointerDereference())
|
|
||||||
return LVALUE;
|
|
||||||
|
|
||||||
return owner.getValueCategory();
|
|
||||||
}
|
|
||||||
return LVALUE;
|
return LVALUE;
|
||||||
}
|
}
|
||||||
if (binding instanceof IFunction) {
|
if (binding instanceof ICPPField && !((ICPPField) binding).isStatic()) {
|
||||||
return LVALUE;
|
if (isPointerDereference())
|
||||||
}
|
return LVALUE;
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
return owner.getValueCategory();
|
||||||
|
}
|
||||||
|
return LVALUE;
|
||||||
|
}
|
||||||
|
if (binding instanceof IFunction) {
|
||||||
|
return LVALUE;
|
||||||
|
}
|
||||||
return PRVALUE;
|
return PRVALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,9 +86,6 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
|
||||||
public ICPPConstructor[] getConstructors() {
|
public ICPPConstructor[] getConstructors() {
|
||||||
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
|
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
|
||||||
}
|
}
|
||||||
public ICPPMethod[] getDeclaredConversionOperators() throws DOMException {
|
|
||||||
throw new DOMException(this);
|
|
||||||
}
|
|
||||||
public int getKey() {
|
public int getKey() {
|
||||||
return k_class;
|
return k_class;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,19 +11,11 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
|
|
||||||
public class CPPConstructor extends CPPMethod implements ICPPConstructor {
|
public class CPPConstructor extends CPPMethod implements ICPPConstructor {
|
||||||
|
|
||||||
static public class CPPConstructorProblem extends CPPMethod.CPPMethodProblem implements ICPPConstructor {
|
|
||||||
public CPPConstructorProblem(ICPPClassType owner, IASTNode node, int id, char[] arg) {
|
|
||||||
super(owner, node, id, arg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CPPConstructor(ICPPASTFunctionDeclarator declarator) {
|
public CPPConstructor(ICPPASTFunctionDeclarator declarator) {
|
||||||
super(declarator);
|
super(declarator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,12 +27,13 @@ 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.core.parser.util.CharArrayUtils;
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binding for a field.
|
* Binding for a field.
|
||||||
*/
|
*/
|
||||||
public class CPPField extends CPPVariable implements ICPPField {
|
public class CPPField extends CPPVariable implements ICPPField {
|
||||||
public static class CPPFieldProblem extends CPPVariable.CPPVariableProblem implements ICPPField {
|
public static class CPPFieldProblem extends ProblemBinding implements ICPPField {
|
||||||
private ICPPClassType fOwner;
|
private ICPPClassType fOwner;
|
||||||
|
|
||||||
public CPPFieldProblem(ICPPClassType owner, IASTNode node, int id, char[] arg ) {
|
public CPPFieldProblem(ICPPClassType owner, IASTNode node, int id, char[] arg ) {
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
@ -45,7 +44,7 @@ public class CPPFieldSpecialization extends CPPSpecialization implements ICPPFie
|
||||||
return getField().getClassOwner();
|
return getField().getClassOwner();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IType getType() throws DOMException {
|
public IType getType() {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
type= specializeType(getField().getType());
|
type= specializeType(getField().getType());
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||||
|
@ -47,7 +48,7 @@ import org.eclipse.cdt.internal.core.dom.Linkage;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemFunctionType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
|
||||||
import org.eclipse.core.runtime.PlatformObject;
|
import org.eclipse.core.runtime.PlatformObject;
|
||||||
|
@ -57,28 +58,6 @@ import org.eclipse.core.runtime.PlatformObject;
|
||||||
*/
|
*/
|
||||||
public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInternalFunction {
|
public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInternalFunction {
|
||||||
|
|
||||||
public static class CPPFunctionProblem extends ProblemBinding implements ICPPFunction {
|
|
||||||
public CPPFunctionProblem(IASTNode node, int id, char[] arg) {
|
|
||||||
super(node, id, arg);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public ICPPFunctionType getType() throws DOMException {
|
|
||||||
throw new DOMException(this);
|
|
||||||
}
|
|
||||||
public ICPPParameter[] getParameters() throws DOMException {
|
|
||||||
throw new DOMException(this);
|
|
||||||
}
|
|
||||||
public IScope getFunctionScope() throws DOMException {
|
|
||||||
throw new DOMException(this);
|
|
||||||
}
|
|
||||||
public int getRequiredArgumentCount() throws DOMException {
|
|
||||||
throw new DOMException(this);
|
|
||||||
}
|
|
||||||
public boolean hasSameFunctionParameterTypeList(ICPPFunction function) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected IASTDeclarator[] declarations;
|
protected IASTDeclarator[] declarations;
|
||||||
protected ICPPASTFunctionDeclarator definition;
|
protected ICPPASTFunctionDeclarator definition;
|
||||||
protected ICPPFunctionType type = null;
|
protected ICPPFunctionType type = null;
|
||||||
|
@ -264,8 +243,14 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
|
||||||
public ICPPFunctionType getType() {
|
public ICPPFunctionType getType() {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
final IType t = getNestedType(CPPVisitor.createType((definition != null) ? definition : declarations[0]), TDEF);
|
final IType t = getNestedType(CPPVisitor.createType((definition != null) ? definition : declarations[0]), TDEF);
|
||||||
if (t instanceof ICPPFunctionType)
|
if (t instanceof ICPPFunctionType) {
|
||||||
type = (ICPPFunctionType) t;
|
type = (ICPPFunctionType) t;
|
||||||
|
} else if (t instanceof ISemanticProblem){
|
||||||
|
type= new ProblemFunctionType(((ISemanticProblem) t).getID());
|
||||||
|
} else {
|
||||||
|
// This case is unexpected
|
||||||
|
type = new ProblemFunctionType(ISemanticProblem.TYPE_UNRESOLVED_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
@ -556,11 +541,11 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRequiredArgumentCount() throws DOMException {
|
public int getRequiredArgumentCount() {
|
||||||
return getRequiredArgumentCount(getParameters());
|
return getRequiredArgumentCount(getParameters());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getRequiredArgumentCount(ICPPParameter[] pars) throws DOMException {
|
public static int getRequiredArgumentCount(ICPPParameter[] pars) {
|
||||||
int result= pars.length;
|
int result= pars.length;
|
||||||
while(result > 0) {
|
while(result > 0) {
|
||||||
final ICPPParameter p = pars[result-1];
|
final ICPPParameter p = pars[result-1];
|
||||||
|
|
|
@ -11,9 +11,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
@ -72,17 +70,13 @@ public class CPPFunctionInstance extends CPPFunctionSpecialization implements IC
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if( (obj instanceof ICPPTemplateInstance) && (obj instanceof ICPPFunction)){
|
if( (obj instanceof ICPPTemplateInstance) && (obj instanceof ICPPFunction)){
|
||||||
try {
|
final ICPPTemplateInstance inst = (ICPPTemplateInstance)obj;
|
||||||
final ICPPTemplateInstance inst = (ICPPTemplateInstance)obj;
|
ICPPFunctionType ct1= ((ICPPFunction)getSpecializedBinding()).getType();
|
||||||
ICPPFunctionType ct1= ((ICPPFunction)getSpecializedBinding()).getType();
|
ICPPFunctionType ct2= ((ICPPFunction)inst.getTemplateDefinition()).getType();
|
||||||
ICPPFunctionType ct2= ((ICPPFunction)inst.getTemplateDefinition()).getType();
|
if(!ct1.isSameType(ct2))
|
||||||
if(!ct1.isSameType(ct2))
|
return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
return CPPTemplates.haveSameArguments(this, inst);
|
return CPPTemplates.haveSameArguments(this, inst);
|
||||||
} catch(DOMException de) {
|
|
||||||
CCorePlugin.log(de);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||||
|
@ -52,7 +51,7 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
|
||||||
return (ICPPFunction) getSpecializedBinding();
|
return (ICPPFunction) getSpecializedBinding();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPParameter[] getParameters() throws DOMException {
|
public ICPPParameter[] getParameters() {
|
||||||
if (fParams == null) {
|
if (fParams == null) {
|
||||||
ICPPFunction function = getFunction();
|
ICPPFunction function = getFunction();
|
||||||
ICPPParameter[] params = function.getParameters();
|
ICPPParameter[] params = function.getParameters();
|
||||||
|
@ -76,7 +75,7 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
|
||||||
return fParams;
|
return fParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRequiredArgumentCount() throws DOMException {
|
public int getRequiredArgumentCount() {
|
||||||
return ((ICPPFunction) getSpecializedBinding()).getRequiredArgumentCount();
|
return ((ICPPFunction) getSpecializedBinding()).getRequiredArgumentCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +87,7 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPFunctionType getType() throws DOMException {
|
public ICPPFunctionType getType() {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
ICPPFunction function = (ICPPFunction) getSpecializedBinding();
|
ICPPFunction function = (ICPPFunction) getSpecializedBinding();
|
||||||
type = (ICPPFunctionType) specializeType(function.getType());
|
type = (ICPPFunctionType) specializeType(function.getType());
|
||||||
|
@ -279,11 +278,7 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
result.append(getName());
|
result.append(getName());
|
||||||
IFunctionType t = null;
|
IFunctionType t = getType();
|
||||||
try {
|
|
||||||
t = getType();
|
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
|
||||||
result.append(t != null ? ASTTypeUtil.getParameterTypeString(t) : "()"); //$NON-NLS-1$
|
result.append(t != null ? ASTTypeUtil.getParameterTypeString(t) : "()"); //$NON-NLS-1$
|
||||||
ICPPTemplateParameterMap tpmap= getTemplateParameterMap();
|
ICPPTemplateParameterMap tpmap= getTemplateParameterMap();
|
||||||
if (tpmap != null) {
|
if (tpmap != null) {
|
||||||
|
|
|
@ -15,7 +15,6 @@ import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUti
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getNestedType;
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getNestedType;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
|
@ -29,17 +28,16 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
|
||||||
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.core.dom.ast.cpp.ICPPTemplateParameter;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemFunctionType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,31 +45,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
*/
|
*/
|
||||||
public class CPPFunctionTemplate extends CPPTemplateDefinition
|
public class CPPFunctionTemplate extends CPPTemplateDefinition
|
||||||
implements ICPPFunctionTemplate, ICPPInternalFunction {
|
implements ICPPFunctionTemplate, ICPPInternalFunction {
|
||||||
public static final class CPPFunctionTemplateProblem extends ProblemBinding
|
|
||||||
implements ICPPFunctionTemplate {
|
|
||||||
public CPPFunctionTemplateProblem(IASTNode node, int id, char[] arg) {
|
|
||||||
super(node, id, arg);
|
|
||||||
}
|
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
|
|
||||||
throw new DOMException(this);
|
|
||||||
}
|
|
||||||
public ICPPClassTemplatePartialSpecialization[] getTemplateSpecializations() throws DOMException {
|
|
||||||
throw new DOMException(this);
|
|
||||||
}
|
|
||||||
public ICPPParameter[] getParameters() throws DOMException {
|
|
||||||
throw new DOMException(this);
|
|
||||||
}
|
|
||||||
public IScope getFunctionScope() throws DOMException {
|
|
||||||
throw new DOMException(this);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public ICPPFunctionType getType() throws DOMException {
|
|
||||||
throw new DOMException(this);
|
|
||||||
}
|
|
||||||
public int getRequiredArgumentCount() throws DOMException {
|
|
||||||
throw new DOMException( this );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ICPPFunctionType type = null;
|
protected ICPPFunctionType type = null;
|
||||||
|
|
||||||
|
@ -145,7 +118,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
||||||
return CPPBuiltinParameter.createParameterList(getType());
|
return CPPBuiltinParameter.createParameterList(getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRequiredArgumentCount() throws DOMException {
|
public int getRequiredArgumentCount() {
|
||||||
return CPPFunction.getRequiredArgumentCount(getParameters());
|
return CPPFunction.getRequiredArgumentCount(getParameters());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,9 +138,15 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
|
||||||
while (parent.getParent() instanceof IASTDeclarator)
|
while (parent.getParent() instanceof IASTDeclarator)
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
|
|
||||||
IType temp = getNestedType(CPPVisitor.createType((IASTDeclarator)parent), TDEF);
|
IType t = getNestedType(CPPVisitor.createType((IASTDeclarator)parent), TDEF);
|
||||||
if (temp instanceof ICPPFunctionType)
|
if (t instanceof ICPPFunctionType) {
|
||||||
type = (ICPPFunctionType) temp;
|
type = (ICPPFunctionType) t;
|
||||||
|
} else if (t instanceof ISemanticProblem){
|
||||||
|
type= new ProblemFunctionType(((ISemanticProblem) t).getID());
|
||||||
|
} else {
|
||||||
|
// This case is unexpected
|
||||||
|
type= new ProblemFunctionType(ISemanticProblem.TYPE_UNRESOLVED_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||||
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.IASTSimpleDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||||
|
@ -28,7 +27,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
||||||
|
@ -39,27 +37,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
* The binding for a method.
|
* The binding for a method.
|
||||||
*/
|
*/
|
||||||
public class CPPMethod extends CPPFunction implements ICPPMethod {
|
public class CPPMethod extends CPPFunction implements ICPPMethod {
|
||||||
public static class CPPMethodProblem extends CPPFunctionProblem implements ICPPMethod {
|
|
||||||
private ICPPClassType fOwner;
|
|
||||||
public CPPMethodProblem(ICPPClassType owner, IASTNode node, int id, char[] arg) {
|
|
||||||
super(node, id, arg);
|
|
||||||
fOwner= owner;
|
|
||||||
}
|
|
||||||
public ICPPClassType getClassOwner() {
|
|
||||||
return fOwner;
|
|
||||||
}
|
|
||||||
public boolean isDestructor() {
|
|
||||||
char[] name = getNameCharArray();
|
|
||||||
if (name.length > 1 && name[0] == '~')
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public int getVisibility() {
|
|
||||||
return ICPPMember.v_private;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CPPMethod(IASTDeclarator declarator) {
|
public CPPMethod(IASTDeclarator declarator) {
|
||||||
super(declarator);
|
super(declarator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
|
@ -37,7 +36,7 @@ public class CPPParameterSpecialization extends CPPSpecialization implements ICP
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#getType()
|
* @see org.eclipse.cdt.core.dom.ast.IVariable#getType()
|
||||||
*/
|
*/
|
||||||
public IType getType() throws DOMException {
|
public IType getType() {
|
||||||
return fType;
|
return fType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class CPPUnknownFunction extends CPPUnknownBinding implements ICPPFunctio
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IScope getFunctionScope() throws DOMException {
|
public IScope getFunctionScope() {
|
||||||
return asScope();
|
return asScope();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,19 +41,12 @@ import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.internal.core.dom.Linkage;
|
import org.eclipse.cdt.internal.core.dom.Linkage;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.IInternalVariable;
|
import org.eclipse.cdt.internal.core.dom.parser.IInternalVariable;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
|
||||||
import org.eclipse.core.runtime.PlatformObject;
|
import org.eclipse.core.runtime.PlatformObject;
|
||||||
|
|
||||||
public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInternalBinding, IInternalVariable {
|
public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInternalBinding, IInternalVariable {
|
||||||
public static class CPPVariableProblem extends ProblemBinding implements ICPPVariable {
|
|
||||||
public CPPVariableProblem(IASTNode node, int id, char[] arg) {
|
|
||||||
super(node, id, arg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private IASTName fDefinition = null;
|
private IASTName fDefinition = null;
|
||||||
private IASTName fDeclarations[] = null;
|
private IASTName fDeclarations[] = null;
|
||||||
private IType fType = null;
|
private IType fType = null;
|
||||||
|
|
|
@ -127,9 +127,8 @@ public class ClassTypeHelper {
|
||||||
* @param binding a binding.
|
* @param binding a binding.
|
||||||
* @param classType a class.
|
* @param classType a class.
|
||||||
* @return <code>true</code> if <code>binding</code> is a friend of <code>classType</code>.
|
* @return <code>true</code> if <code>binding</code> is a friend of <code>classType</code>.
|
||||||
* @throws DOMException
|
|
||||||
*/
|
*/
|
||||||
public static boolean isFriend(IBinding binding, ICPPClassType classType) throws DOMException {
|
public static boolean isFriend(IBinding binding, ICPPClassType classType) {
|
||||||
IType type;
|
IType type;
|
||||||
if (binding instanceof ICPPClassType) {
|
if (binding instanceof ICPPClassType) {
|
||||||
type = (IType) binding;
|
type = (IType) binding;
|
||||||
|
@ -158,7 +157,6 @@ public class ClassTypeHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A host maybe backed up with a definition from the index.
|
* A host maybe backed up with a definition from the index.
|
||||||
* @throws DOMException
|
|
||||||
*/
|
*/
|
||||||
private static ICPPClassType getBackupDefinition(ICPPInternalClassTypeMixinHost host) {
|
private static ICPPClassType getBackupDefinition(ICPPInternalClassTypeMixinHost host) {
|
||||||
ICPPClassScope scope = host.getCompositeScope();
|
ICPPClassScope scope = host.getCompositeScope();
|
||||||
|
@ -437,7 +435,7 @@ public class ClassTypeHelper {
|
||||||
* Returns whether {@code method} is virtual. This is the case if it is declared to be virtual or
|
* Returns whether {@code method} is virtual. This is the case if it is declared to be virtual or
|
||||||
* overrides another virtual method.
|
* overrides another virtual method.
|
||||||
*/
|
*/
|
||||||
public static boolean isVirtual(ICPPMethod m) throws DOMException {
|
public static boolean isVirtual(ICPPMethod m) {
|
||||||
if (m instanceof ICPPConstructor)
|
if (m instanceof ICPPConstructor)
|
||||||
return false;
|
return false;
|
||||||
if (m.isVirtual())
|
if (m.isVirtual())
|
||||||
|
@ -489,9 +487,8 @@ public class ClassTypeHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns {@code true} if {@code source} overrides {@code target}.
|
* Returns {@code true} if {@code source} overrides {@code target}.
|
||||||
* @throws DOMException
|
|
||||||
*/
|
*/
|
||||||
public static boolean isOverrider(ICPPMethod source, ICPPMethod target) throws DOMException {
|
public static boolean isOverrider(ICPPMethod source, ICPPMethod target) {
|
||||||
if (source instanceof ICPPConstructor || target instanceof ICPPConstructor)
|
if (source instanceof ICPPConstructor || target instanceof ICPPConstructor)
|
||||||
return false;
|
return false;
|
||||||
if (!isVirtual(target))
|
if (!isVirtual(target))
|
||||||
|
@ -515,9 +512,8 @@ public class ClassTypeHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all methods that are overridden by the given {@code method}.
|
* Returns all methods that are overridden by the given {@code method}.
|
||||||
* @throws DOMException
|
|
||||||
*/
|
*/
|
||||||
public static ICPPMethod[] findOverridden(ICPPMethod method) throws DOMException {
|
public static ICPPMethod[] findOverridden(ICPPMethod method) {
|
||||||
if (method instanceof ICPPConstructor)
|
if (method instanceof ICPPConstructor)
|
||||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||||
|
|
||||||
|
@ -551,7 +547,7 @@ public class ClassTypeHelper {
|
||||||
* Returns whether {@code cl} contains an overridden method.
|
* Returns whether {@code cl} contains an overridden method.
|
||||||
*/
|
*/
|
||||||
private static boolean findOverridden(ICPPClassType cl, char[] mname, ICPPFunctionType mft,
|
private static boolean findOverridden(ICPPClassType cl, char[] mname, ICPPFunctionType mft,
|
||||||
HashMap<ICPPClassType, Boolean> virtualInClass, ArrayList<ICPPMethod> result) throws DOMException {
|
HashMap<ICPPClassType, Boolean> virtualInClass, ArrayList<ICPPMethod> result) {
|
||||||
Boolean visitedBefore= virtualInClass.get(cl);
|
Boolean visitedBefore= virtualInClass.get(cl);
|
||||||
if (visitedBefore != null)
|
if (visitedBefore != null)
|
||||||
return visitedBefore;
|
return visitedBefore;
|
||||||
|
@ -589,10 +585,9 @@ public class ClassTypeHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all methods found in the index, that override the given {@code method}.
|
* Returns all methods found in the index, that override the given {@code method}.
|
||||||
* @throws DOMException
|
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public static ICPPMethod[] findOverriders(IIndex index, ICPPMethod method) throws DOMException, CoreException {
|
public static ICPPMethod[] findOverriders(IIndex index, ICPPMethod method) throws CoreException {
|
||||||
if (!isVirtual(method))
|
if (!isVirtual(method))
|
||||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||||
|
|
||||||
|
@ -606,10 +601,8 @@ public class ClassTypeHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all methods belonging to the given set of classes that override the given {@code method}.
|
* Returns all methods belonging to the given set of classes that override the given {@code method}.
|
||||||
* @throws DOMException
|
|
||||||
*/
|
*/
|
||||||
public static ICPPMethod[] findOverriders(ICPPClassType[] subclasses, ICPPMethod method)
|
public static ICPPMethod[] findOverriders(ICPPClassType[] subclasses, ICPPMethod method) {
|
||||||
throws DOMException {
|
|
||||||
final char[] mname= method.getNameCharArray();
|
final char[] mname= method.getNameCharArray();
|
||||||
final ICPPFunctionType mft= method.getType();
|
final ICPPFunctionType mft= method.getType();
|
||||||
final ArrayList<ICPPMethod> result= new ArrayList<ICPPMethod>();
|
final ArrayList<ICPPMethod> result= new ArrayList<ICPPMethod>();
|
||||||
|
@ -700,37 +693,34 @@ public class ClassTypeHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getImplicitMethodKind(ICPPClassType ct, ICPPMethod method) {
|
private static int getImplicitMethodKind(ICPPClassType ct, ICPPMethod method) {
|
||||||
try {
|
if (method instanceof ICPPConstructor) {
|
||||||
if (method instanceof ICPPConstructor) {
|
final IFunctionType type= method.getType();
|
||||||
final IFunctionType type= method.getType();
|
final IType[] params= type.getParameterTypes();
|
||||||
final IType[] params= type.getParameterTypes();
|
if (params.length == 0)
|
||||||
if (params.length == 0)
|
return KIND_DEFAULT_CTOR;
|
||||||
|
if (params.length == 1) {
|
||||||
|
IType t= SemanticUtil.getNestedType(params[0], SemanticUtil.TDEF);
|
||||||
|
if (SemanticUtil.isVoidType(t))
|
||||||
return KIND_DEFAULT_CTOR;
|
return KIND_DEFAULT_CTOR;
|
||||||
if (params.length == 1) {
|
|
||||||
IType t= SemanticUtil.getNestedType(params[0], SemanticUtil.TDEF);
|
|
||||||
if (SemanticUtil.isVoidType(t))
|
|
||||||
return KIND_DEFAULT_CTOR;
|
|
||||||
|
|
||||||
if (isRefToConstClass(ct, t))
|
if (isRefToConstClass(ct, t))
|
||||||
return KIND_COPY_CTOR;
|
return KIND_COPY_CTOR;
|
||||||
}
|
|
||||||
return KIND_OTHER;
|
|
||||||
}
|
}
|
||||||
|
return KIND_OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
if (method.isDestructor())
|
if (method.isDestructor())
|
||||||
return KIND_DTOR;
|
return KIND_DTOR;
|
||||||
|
|
||||||
if (CharArrayUtils.equals(method.getNameCharArray(), OverloadableOperator.ASSIGN.toCharArray())) {
|
if (CharArrayUtils.equals(method.getNameCharArray(), OverloadableOperator.ASSIGN.toCharArray())) {
|
||||||
final IFunctionType type= method.getType();
|
final IFunctionType type= method.getType();
|
||||||
final IType[] params= type.getParameterTypes();
|
final IType[] params= type.getParameterTypes();
|
||||||
if (params.length == 1) {
|
if (params.length == 1) {
|
||||||
IType t= params[0];
|
IType t= params[0];
|
||||||
if (isRefToConstClass(ct, t))
|
if (isRefToConstClass(ct, t))
|
||||||
return KIND_ASSIGNMENT_OP;
|
return KIND_ASSIGNMENT_OP;
|
||||||
}
|
|
||||||
return KIND_OTHER;
|
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
return KIND_OTHER;
|
||||||
}
|
}
|
||||||
return KIND_OTHER;
|
return KIND_OTHER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,27 +71,22 @@ public class AccessContext {
|
||||||
* @return <code>true</code> if the binding is accessible.
|
* @return <code>true</code> if the binding is accessible.
|
||||||
*/
|
*/
|
||||||
public boolean isAccessible(IBinding binding) {
|
public boolean isAccessible(IBinding binding) {
|
||||||
try {
|
IBinding owner;
|
||||||
IBinding owner;
|
while ((owner = binding.getOwner()) instanceof ICompositeType &&
|
||||||
while ((owner = binding.getOwner()) instanceof ICompositeType &&
|
((ICompositeType) owner).isAnonymous()) {
|
||||||
((ICompositeType) owner).isAnonymous()) {
|
binding = owner;
|
||||||
binding = owner;
|
|
||||||
}
|
|
||||||
if (!(owner instanceof ICPPClassType)) {
|
|
||||||
return true; // The binding is not a class member.
|
|
||||||
}
|
|
||||||
ICPPClassType accessOwner= (ICPPClassType) owner;
|
|
||||||
if (!initialize(accessOwner)) {
|
|
||||||
return true; // Assume visibility if anything goes wrong.
|
|
||||||
}
|
|
||||||
if (namingClass == null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return isAccessible(binding, (ICPPClassType) owner, namingClass, v_public, 0);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
CCorePlugin.log(e);
|
|
||||||
}
|
}
|
||||||
return true;
|
if (!(owner instanceof ICPPClassType)) {
|
||||||
|
return true; // The binding is not a class member.
|
||||||
|
}
|
||||||
|
ICPPClassType accessOwner= (ICPPClassType) owner;
|
||||||
|
if (!initialize(accessOwner)) {
|
||||||
|
return true; // Assume visibility if anything goes wrong.
|
||||||
|
}
|
||||||
|
if (namingClass == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return isAccessible(binding, (ICPPClassType) owner, namingClass, v_public, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,7 +111,7 @@ public class AccessContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAccessible(IBinding binding, ICPPClassType owner, ICPPClassType derivedClass,
|
private boolean isAccessible(IBinding binding, ICPPClassType owner, ICPPClassType derivedClass,
|
||||||
int accessLevel, int depth) throws DOMException {
|
int accessLevel, int depth) {
|
||||||
if (depth > CPPSemantics.MAX_INHERITANCE_DEPTH)
|
if (depth > CPPSemantics.MAX_INHERITANCE_DEPTH)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -156,7 +151,7 @@ public class AccessContext {
|
||||||
* v_private.
|
* v_private.
|
||||||
* @return One of: v_public, v_protected, v_private.
|
* @return One of: v_public, v_protected, v_private.
|
||||||
*/
|
*/
|
||||||
private int getMemberAccessLevel(ICPPClassType classType, int inheritedAccessLevel) throws DOMException {
|
private int getMemberAccessLevel(ICPPClassType classType, int inheritedAccessLevel) {
|
||||||
int accessLevel = inheritedAccessLevel;
|
int accessLevel = inheritedAccessLevel;
|
||||||
for (IBinding contextBinding : context) {
|
for (IBinding contextBinding : context) {
|
||||||
if (ClassTypeHelper.isFriend(contextBinding, classType))
|
if (ClassTypeHelper.isFriend(contextBinding, classType))
|
||||||
|
|
|
@ -71,11 +71,11 @@ class AutoTypeResolver implements ICPPFunctionTemplate {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPParameter[] getParameters() throws DOMException {
|
public ICPPParameter[] getParameters() {
|
||||||
throw new UnsupportedOperationException(UNEXPECTED_CALL);
|
throw new UnsupportedOperationException(UNEXPECTED_CALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRequiredArgumentCount() throws DOMException {
|
public int getRequiredArgumentCount() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class AutoTypeResolver implements ICPPFunctionTemplate {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IScope getFunctionScope() throws DOMException {
|
public IScope getFunctionScope() {
|
||||||
throw new UnsupportedOperationException(UNEXPECTED_CALL);
|
throw new UnsupportedOperationException(UNEXPECTED_CALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -553,10 +553,7 @@ class BuiltinOperators {
|
||||||
if (fGlobalCandidates != null) {
|
if (fGlobalCandidates != null) {
|
||||||
for (Object cand : fGlobalCandidates) {
|
for (Object cand : fGlobalCandidates) {
|
||||||
if (cand instanceof IFunction && !(cand instanceof ICPPMethod)) {
|
if (cand instanceof IFunction && !(cand instanceof ICPPMethod)) {
|
||||||
try {
|
fSignatures.add(ASTTypeUtil.getType(((IFunction)cand).getType(), true));
|
||||||
fSignatures.add(ASTTypeUtil.getType(((IFunction)cand).getType(), true));
|
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1106,13 +1106,10 @@ public class CPPSemantics {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (b instanceof IVariable) {
|
if (b instanceof IVariable) {
|
||||||
try {
|
IType t= SemanticUtil.getUltimateType(((IVariable) b).getType(), true);
|
||||||
IType t= SemanticUtil.getUltimateType(((IVariable) b).getType(), true);
|
if (t instanceof ICPPUnknownBinding || t instanceof ICPPTemplateDefinition) {
|
||||||
if (t instanceof ICPPUnknownBinding || t instanceof ICPPTemplateDefinition) {
|
result[0]= true;
|
||||||
result[0]= true;
|
return PROCESS_ABORT;
|
||||||
return PROCESS_ABORT;
|
|
||||||
}
|
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (name instanceof ICPPASTTemplateId)
|
if (name instanceof ICPPASTTemplateId)
|
||||||
|
@ -2651,15 +2648,11 @@ public class CPPSemantics {
|
||||||
IFunction unknown= null;
|
IFunction unknown= null;
|
||||||
for (IFunction function : fns) {
|
for (IFunction function : fns) {
|
||||||
if (function != null) {
|
if (function != null) {
|
||||||
try {
|
IType t2= function.getType().getReturnType();
|
||||||
IType t2= function.getType().getReturnType();
|
if (t.isSameType(t2))
|
||||||
if (t.isSameType(t2))
|
return function;
|
||||||
return function;
|
if (unknown == null && function instanceof ICPPUnknownBinding) {
|
||||||
if (unknown == null && function instanceof ICPPUnknownBinding) {
|
unknown= function;
|
||||||
unknown= function;
|
|
||||||
}
|
|
||||||
} catch (DOMException e) {
|
|
||||||
// ignore, try other candidates
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2717,10 +2710,7 @@ public class CPPSemantics {
|
||||||
ICPPASTConstructorChainInitializer memInit= (ICPPASTConstructorChainInitializer) parentOfInit;
|
ICPPASTConstructorChainInitializer memInit= (ICPPASTConstructorChainInitializer) parentOfInit;
|
||||||
IBinding var= memInit.getMemberInitializerId().resolveBinding();
|
IBinding var= memInit.getMemberInitializerId().resolveBinding();
|
||||||
if (var instanceof IVariable) {
|
if (var instanceof IVariable) {
|
||||||
try {
|
targetType= ((IVariable) var).getType();
|
||||||
targetType= ((IVariable) var).getType();
|
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2783,11 +2773,8 @@ public class CPPSemantics {
|
||||||
dtor= ASTQueries.findInnermostDeclarator(dtor);
|
dtor= ASTQueries.findInnermostDeclarator(dtor);
|
||||||
IBinding binding = dtor.getName().resolveBinding();
|
IBinding binding = dtor.getName().resolveBinding();
|
||||||
if (binding instanceof IFunction) {
|
if (binding instanceof IFunction) {
|
||||||
try {
|
IFunctionType ft = ((IFunction) binding).getType();
|
||||||
IFunctionType ft = ((IFunction) binding).getType();
|
targetType= ft.getReturnType();
|
||||||
targetType= ft.getReturnType();
|
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2815,13 +2802,10 @@ public class CPPSemantics {
|
||||||
|
|
||||||
// First pass, consider functions
|
// First pass, consider functions
|
||||||
for (ICPPFunction fn : fns) {
|
for (ICPPFunction fn : fns) {
|
||||||
try {
|
if (!(fn instanceof ICPPFunctionTemplate)) {
|
||||||
if (!(fn instanceof ICPPFunctionTemplate)) {
|
if (targetType.isSameType(fn.getType()))
|
||||||
if (targetType.isSameType(fn.getType()))
|
return fn;
|
||||||
return fn;
|
}
|
||||||
}
|
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second pass, consider templates
|
// Second pass, consider templates
|
||||||
|
@ -3328,14 +3312,11 @@ public class CPPSemantics {
|
||||||
for (Object object : items) {
|
for (Object object : items) {
|
||||||
if (object instanceof ICPPFunction) {
|
if (object instanceof ICPPFunction) {
|
||||||
ICPPFunction func= (ICPPFunction) object;
|
ICPPFunction func= (ICPPFunction) object;
|
||||||
try {
|
ICPPFunctionType ft = func.getType();
|
||||||
ICPPFunctionType ft = func.getType();
|
IType[] pts= ft.getParameterTypes();
|
||||||
IType[] pts= ft.getParameterTypes();
|
if ((enum1 != null && pts.length > 0 && enum1.isSameType(getUltimateTypeUptoPointers(pts[0]))) ||
|
||||||
if ((enum1 != null && pts.length > 0 && enum1.isSameType(getUltimateTypeUptoPointers(pts[0]))) ||
|
(enum2 != null && pts.length > 1 && enum2.isSameType(getUltimateTypeUptoPointers(pts[1])))) {
|
||||||
(enum2 != null && pts.length > 1 && enum2.isSameType(getUltimateTypeUptoPointers(pts[1])))) {
|
items[j++]= object;
|
||||||
items[j++]= object;
|
|
||||||
}
|
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3605,12 +3586,9 @@ public class CPPSemantics {
|
||||||
}
|
}
|
||||||
|
|
||||||
declarator= ASTQueries.findTypeRelevantDeclarator(declarator);
|
declarator= ASTQueries.findTypeRelevantDeclarator(declarator);
|
||||||
try {
|
if (declarator instanceof ICPPASTFunctionDeclarator) {
|
||||||
if (declarator instanceof ICPPASTFunctionDeclarator) {
|
IType type = function.getType();
|
||||||
IType type = function.getType();
|
return type.isSameType(CPPVisitor.createType(declarator));
|
||||||
return type.isSameType(CPPVisitor.createType(declarator));
|
|
||||||
}
|
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1776,12 +1776,9 @@ public class CPPTemplates {
|
||||||
private static IType[] addImplicitObjectType(IType[] types, ICPPMethod f1) {
|
private static IType[] addImplicitObjectType(IType[] types, ICPPMethod f1) {
|
||||||
ICPPClassType ct = f1.getClassOwner();
|
ICPPClassType ct = f1.getClassOwner();
|
||||||
if (ct != null) {
|
if (ct != null) {
|
||||||
try {
|
ICPPFunctionType ft = f1.getType();
|
||||||
ICPPFunctionType ft = f1.getType();
|
final CPPReferenceType t = new CPPReferenceType(addQualifiers(ct, ft.isConst(), ft.isVolatile()), false);
|
||||||
final CPPReferenceType t = new CPPReferenceType(addQualifiers(ct, ft.isConst(), ft.isVolatile()), false);
|
return concat(t, types);
|
||||||
return concat(t, types);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
|
@ -681,10 +681,7 @@ public class CPPVisitor extends ASTQueries {
|
||||||
// Variable declaration
|
// Variable declaration
|
||||||
IType t2= null;
|
IType t2= null;
|
||||||
if (binding != null && binding instanceof IVariable && !(binding instanceof IIndexBinding)) {
|
if (binding != null && binding instanceof IVariable && !(binding instanceof IIndexBinding)) {
|
||||||
try {
|
t2 = ((IVariable) binding).getType();
|
||||||
t2 = ((IVariable) binding).getType();
|
|
||||||
} catch (DOMException e1) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (t1 != null && t2 != null) {
|
if (t1 != null && t2 != null) {
|
||||||
if (t1.isSameType(t2) || isCompatibleArray(t1, t2) != null) {
|
if (t1.isSameType(t2) || isCompatibleArray(t1, t2) != null) {
|
||||||
|
@ -1578,22 +1575,18 @@ public class CPPVisitor extends ASTQueries {
|
||||||
IType pt = null;
|
IType pt = null;
|
||||||
|
|
||||||
for (int i = 0; i < parameters.length; i++) {
|
for (int i = 0; i < parameters.length; i++) {
|
||||||
try {
|
pt = parameters[i].getType();
|
||||||
pt = parameters[i].getType();
|
|
||||||
|
// remove qualifiers
|
||||||
// remove qualifiers
|
if (pt instanceof IQualifierType) {
|
||||||
if (pt instanceof IQualifierType) {
|
pt= ((IQualifierType) pt).getType();
|
||||||
pt= ((IQualifierType) pt).getType();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (pt instanceof IArrayType) {
|
if (pt instanceof IArrayType) {
|
||||||
pt = new CPPPointerType(((IArrayType) pt).getType());
|
pt = new CPPPointerType(((IArrayType) pt).getType());
|
||||||
} else if (pt instanceof IFunctionType) {
|
} else if (pt instanceof IFunctionType) {
|
||||||
pt = new CPPPointerType(pt);
|
pt = new CPPPointerType(pt);
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
|
||||||
pt = e.getProblem();
|
|
||||||
}
|
|
||||||
|
|
||||||
pTypes[i] = pt;
|
pTypes[i] = pt;
|
||||||
}
|
}
|
||||||
|
@ -1933,15 +1926,11 @@ public class CPPVisitor extends ASTQueries {
|
||||||
if (b instanceof IType) {
|
if (b instanceof IType) {
|
||||||
return (IType) b;
|
return (IType) b;
|
||||||
}
|
}
|
||||||
try {
|
if (b instanceof IVariable) {
|
||||||
if (b instanceof IVariable) {
|
return ((IVariable) b).getType();
|
||||||
return ((IVariable) b).getType();
|
}
|
||||||
}
|
if (b instanceof IFunction) {
|
||||||
if (b instanceof IFunction) {
|
return ((IFunction) b).getType();
|
||||||
return ((IFunction) b).getType();
|
|
||||||
}
|
|
||||||
} catch (DOMException e) {
|
|
||||||
return e.getProblem();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUti
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.REF;
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.REF;
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
|
||||||
|
|
||||||
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.IASTExpression.ValueCategory;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
||||||
|
@ -44,12 +43,8 @@ public class ExpressionTypes {
|
||||||
|
|
||||||
|
|
||||||
public static ValueCategory valueCategoryFromFunctionCall(ICPPFunction function) {
|
public static ValueCategory valueCategoryFromFunctionCall(ICPPFunction function) {
|
||||||
try {
|
final ICPPFunctionType ft = function.getType();
|
||||||
final ICPPFunctionType ft = function.getType();
|
return valueCategoryFromReturnType(ft.getReturnType());
|
||||||
return valueCategoryFromReturnType(ft.getReturnType());
|
|
||||||
} catch (DOMException e) {
|
|
||||||
return ValueCategory.PRVALUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ValueCategory valueCategoryFromReturnType(IType r) {
|
public static ValueCategory valueCategoryFromReturnType(IType r) {
|
||||||
|
@ -68,12 +63,8 @@ public class ExpressionTypes {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IType typeFromFunctionCall(ICPPFunction function) {
|
public static IType typeFromFunctionCall(ICPPFunction function) {
|
||||||
try {
|
final ICPPFunctionType ft = function.getType();
|
||||||
final ICPPFunctionType ft = function.getType();
|
return typeFromReturnType(ft.getReturnType());
|
||||||
return typeFromReturnType(ft.getReturnType());
|
|
||||||
} catch (DOMException e) {
|
|
||||||
return e.getProblem();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IType typeFromReturnType(IType r) {
|
public static IType typeFromReturnType(IType r) {
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
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.ISemanticProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
|
@ -116,7 +117,7 @@ public class CCompositesFactory extends AbstractCompositeFactory {
|
||||||
}
|
}
|
||||||
return at;
|
return at;
|
||||||
}
|
}
|
||||||
if (rtype instanceof IBasicType || rtype == null) {
|
if (rtype instanceof IBasicType || rtype instanceof ISemanticProblem || rtype == null) {
|
||||||
return rtype;
|
return rtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,12 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.index.composite.c;
|
package org.eclipse.cdt.internal.core.index.composite.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.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.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexScope;
|
|
||||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||||
|
|
||||||
class CompositeCFunction extends CompositeCBinding implements IFunction {
|
class CompositeCFunction extends CompositeCBinding implements IFunction {
|
||||||
|
@ -26,12 +24,11 @@ class CompositeCFunction extends CompositeCBinding implements IFunction {
|
||||||
super(cf, rbinding);
|
super(cf, rbinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IScope getFunctionScope() throws DOMException {
|
public IScope getFunctionScope() {
|
||||||
IScope scope= ((IFunction)rbinding).getFunctionScope();
|
return null;
|
||||||
return cf.getCompositeScope((IIndexScope)scope);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IParameter[] getParameters() throws DOMException {
|
public IParameter[] getParameters() {
|
||||||
IParameter[] preResult = ((IFunction)rbinding).getParameters();
|
IParameter[] preResult = ((IFunction)rbinding).getParameters();
|
||||||
IParameter[] result = new IParameter[preResult.length];
|
IParameter[] result = new IParameter[preResult.length];
|
||||||
for(int i=0; i<preResult.length; i++) {
|
for(int i=0; i<preResult.length; i++) {
|
||||||
|
@ -40,7 +37,7 @@ class CompositeCFunction extends CompositeCBinding implements IFunction {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IFunctionType getType() throws DOMException {
|
public IFunctionType getType() {
|
||||||
IType rtype = ((IFunction)rbinding).getType();
|
IType rtype = ((IFunction)rbinding).getType();
|
||||||
return (IFunctionType) cf.getCompositeType(rtype);
|
return (IFunctionType) cf.getCompositeType(rtype);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.index.composite.c;
|
package org.eclipse.cdt.internal.core.index.composite.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
|
@ -23,7 +22,7 @@ class CompositeCParameter extends CompositeCBinding implements IParameter {
|
||||||
super(cf, rbinding);
|
super(cf, rbinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IType getType() throws DOMException {
|
public IType getType() {
|
||||||
IType rtype = ((IParameter)rbinding).getType();
|
IType rtype = ((IParameter)rbinding).getType();
|
||||||
return cf.getCompositeType(rtype);
|
return cf.getCompositeType(rtype);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.index.composite.c;
|
package org.eclipse.cdt.internal.core.index.composite.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
|
@ -23,7 +22,7 @@ class CompositeCVariable extends CompositeCBinding implements IVariable {
|
||||||
super(cf, rbinding);
|
super(cf, rbinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IType getType() throws DOMException {
|
public IType getType() {
|
||||||
IType rtype = ((IVariable)rbinding).getType();
|
IType rtype = ((IVariable)rbinding).getType();
|
||||||
return cf.getCompositeType(rtype);
|
return cf.getCompositeType(rtype);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.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.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
|
@ -39,11 +38,11 @@ class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction {
|
||||||
return ((ICPPFunction)rbinding).isMutable();
|
return ((ICPPFunction)rbinding).isMutable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IScope getFunctionScope() throws DOMException {
|
public IScope getFunctionScope() {
|
||||||
fail(); return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPParameter[] getParameters() throws DOMException {
|
public ICPPParameter[] getParameters() {
|
||||||
ICPPParameter[] result = ((ICPPFunction)rbinding).getParameters();
|
ICPPParameter[] result = ((ICPPFunction)rbinding).getParameters();
|
||||||
for(int i=0; i<result.length; i++) {
|
for(int i=0; i<result.length; i++) {
|
||||||
result[i] = (ICPPParameter) cf.getCompositeBinding((IIndexFragmentBinding) result[i]);
|
result[i] = (ICPPParameter) cf.getCompositeBinding((IIndexFragmentBinding) result[i]);
|
||||||
|
@ -51,7 +50,7 @@ class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPFunctionType getType() throws DOMException {
|
public ICPPFunctionType getType() {
|
||||||
IType rtype = ((ICPPFunction)rbinding).getType();
|
IType rtype = ((ICPPFunction)rbinding).getType();
|
||||||
return (ICPPFunctionType) cf.getCompositeType(rtype);
|
return (ICPPFunctionType) cf.getCompositeType(rtype);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +79,7 @@ class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction {
|
||||||
return ((ICPPFunction)rbinding).takesVarArgs();
|
return ((ICPPFunction)rbinding).takesVarArgs();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRequiredArgumentCount() throws DOMException {
|
public int getRequiredArgumentCount() {
|
||||||
return ((ICPPFunction)rbinding).getRequiredArgumentCount();
|
return ((ICPPFunction)rbinding).getRequiredArgumentCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,11 +95,7 @@ class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer result = new StringBuffer();
|
StringBuffer result = new StringBuffer();
|
||||||
try {
|
result.append(getName()+" "+ASTTypeUtil.getParameterTypeString(getType())); //$NON-NLS-1$
|
||||||
result.append(getName()+" "+ASTTypeUtil.getParameterTypeString(getType())); //$NON-NLS-1$
|
|
||||||
} catch(DOMException de) {
|
|
||||||
result.append(de);
|
|
||||||
}
|
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
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.ICPPFunction;
|
||||||
|
@ -43,11 +42,7 @@ public class CompositeCPPFunctionSpecialization extends CompositeCPPFunction imp
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer result = new StringBuffer();
|
StringBuffer result = new StringBuffer();
|
||||||
try {
|
result.append(getName()+" "+ASTTypeUtil.getParameterTypeString(getType())); //$NON-NLS-1$
|
||||||
result.append(getName()+" "+ASTTypeUtil.getParameterTypeString(getType())); //$NON-NLS-1$
|
|
||||||
} catch(DOMException de) {
|
|
||||||
result.append(de);
|
|
||||||
}
|
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
|
@ -32,7 +31,7 @@ class CompositeCPPVariable extends CompositeCPPBinding implements ICPPVariable {
|
||||||
return ((ICPPVariable)rbinding).isExternC();
|
return ((ICPPVariable)rbinding).isExternC();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IType getType() throws DOMException {
|
public IType getType() {
|
||||||
IType rtype = ((ICPPVariable)rbinding).getType();
|
IType rtype = ((ICPPVariable)rbinding).getType();
|
||||||
return cf.getCompositeType(rtype);
|
return cf.getCompositeType(rtype);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,6 @@ import org.eclipse.cdt.internal.core.index.IWritableIndex;
|
||||||
import org.eclipse.cdt.internal.core.index.IndexBasedFileContentProvider;
|
import org.eclipse.cdt.internal.core.index.IndexBasedFileContentProvider;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContentProvider;
|
import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContentProvider;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner.StreamHasher;
|
import org.eclipse.cdt.internal.core.parser.scanner.StreamHasher;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
|
||||||
import org.eclipse.cdt.utils.EFSExtensionManager;
|
import org.eclipse.cdt.utils.EFSExtensionManager;
|
||||||
import org.eclipse.core.runtime.Assert;
|
import org.eclipse.core.runtime.Assert;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -763,8 +762,6 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
th= e;
|
th= e;
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
th= e;
|
th= e;
|
||||||
} catch (PDOMNotImplementedError e) {
|
|
||||||
th= e;
|
|
||||||
} catch (StackOverflowError e) {
|
} catch (StackOverflowError e) {
|
||||||
th= e;
|
th= e;
|
||||||
} catch (AssertionError e) {
|
} catch (AssertionError e) {
|
||||||
|
|
|
@ -56,7 +56,6 @@ import org.eclipse.cdt.internal.core.index.IWritableIndex;
|
||||||
import org.eclipse.cdt.internal.core.index.IWritableIndex.IncludeInformation;
|
import org.eclipse.cdt.internal.core.index.IWritableIndex.IncludeInformation;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner.LocationMap;
|
import org.eclipse.cdt.internal.core.parser.scanner.LocationMap;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMASTAdapter;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMASTAdapter;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerASTVisitor;
|
import org.eclipse.cdt.internal.core.pdom.indexer.IndexerASTVisitor;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
@ -211,8 +210,6 @@ abstract public class PDOMWriter {
|
||||||
contextIncludes, lock);
|
contextIncludes, lock);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
th= e;
|
th= e;
|
||||||
} catch (PDOMNotImplementedError e) {
|
|
||||||
th= e;
|
|
||||||
} catch (StackOverflowError e) {
|
} catch (StackOverflowError e) {
|
||||||
th= e;
|
th= e;
|
||||||
} catch (AssertionError e) {
|
} catch (AssertionError e) {
|
||||||
|
@ -281,8 +278,6 @@ abstract public class PDOMWriter {
|
||||||
}
|
}
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
th= e;
|
th= e;
|
||||||
} catch (PDOMNotImplementedError e) {
|
|
||||||
th= e;
|
|
||||||
} catch (StackOverflowError e) {
|
} catch (StackOverflowError e) {
|
||||||
th= e;
|
th= e;
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,7 @@ public class PDOMASTAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
|
@ -293,7 +293,7 @@ public class PDOMASTAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IField findField(String name) {
|
public IField findField(String name) {
|
||||||
|
@ -357,7 +357,7 @@ public class PDOMASTAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|
|
@ -255,10 +255,7 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding
|
||||||
return ASTTypeUtil.getType((IType) this);
|
return ASTTypeUtil.getType((IType) this);
|
||||||
} else if (this instanceof IFunction) {
|
} else if (this instanceof IFunction) {
|
||||||
IFunctionType t= null;
|
IFunctionType t= null;
|
||||||
try {
|
t = ((IFunction) this).getType();
|
||||||
t = ((IFunction) this).getType();
|
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
return getName() + ASTTypeUtil.getParameterTypeString(t);
|
return getName() + ASTTypeUtil.getParameterTypeString(t);
|
||||||
} else {
|
} else {
|
||||||
|
@ -296,13 +293,6 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding
|
||||||
return Integer.toString(value);
|
return Integer.toString(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Convenience method to shorten subclass file length
|
|
||||||
*/
|
|
||||||
protected final void fail() {
|
|
||||||
throw new PDOMNotImplementedError("in " + getClass().getCanonicalName()); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
public PDOMName getScopeName() {
|
public PDOMName getScopeName() {
|
||||||
try {
|
try {
|
||||||
PDOMName name = getFirstDefinition();
|
PDOMName name = getFirstDefinition();
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2005, 2006 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
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* QNX - Initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Doug Schaefer
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class PDOMNotImplementedError extends Error {
|
|
||||||
|
|
||||||
public static final long serialVersionUID = 0;
|
|
||||||
|
|
||||||
public PDOMNotImplementedError() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public PDOMNotImplementedError(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -28,7 +28,6 @@ import org.eclipse.cdt.internal.core.pdom.dom.PDOMASTAdapter;
|
||||||
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.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -162,7 +161,6 @@ class PDOMCEnumeration extends PDOMBinding implements IEnumeration, IIndexType {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,14 +15,14 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
||||||
|
|
||||||
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.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;
|
||||||
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.core.dom.ast.ISemanticProblem;
|
||||||
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.ProblemFunctionType;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCBindingConstants;
|
||||||
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;
|
||||||
|
@ -75,13 +75,9 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
||||||
IFunctionType type;
|
IFunctionType type;
|
||||||
IParameter[] parameters;
|
IParameter[] parameters;
|
||||||
byte annotations;
|
byte annotations;
|
||||||
try {
|
type = function.getType();
|
||||||
type = function.getType();
|
parameters = function.getParameters();
|
||||||
parameters = function.getParameters();
|
annotations = PDOMCAnnotation.encodeAnnotation(function);
|
||||||
annotations = PDOMCAnnotation.encodeAnnotation(function);
|
|
||||||
} catch(DOMException e) {
|
|
||||||
throw new CoreException(Util.createStatus(e));
|
|
||||||
}
|
|
||||||
setType(getLinkage(), type);
|
setType(getLinkage(), type);
|
||||||
setParameters(parameters);
|
setParameters(parameters);
|
||||||
getDB().putByte(record + ANNOTATIONS, annotations);
|
getDB().putByte(record + ANNOTATIONS, annotations);
|
||||||
|
@ -94,13 +90,9 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
||||||
IFunctionType newType;
|
IFunctionType newType;
|
||||||
IParameter[] newParams;
|
IParameter[] newParams;
|
||||||
byte newAnnotation;
|
byte newAnnotation;
|
||||||
try {
|
newType= func.getType();
|
||||||
newType= func.getType();
|
newParams = func.getParameters();
|
||||||
newParams = func.getParameters();
|
newAnnotation = PDOMCAnnotation.encodeAnnotation(func);
|
||||||
newAnnotation = PDOMCAnnotation.encodeAnnotation(func);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
throw new CoreException(Util.createStatus(e));
|
|
||||||
}
|
|
||||||
|
|
||||||
setType(linkage, newType);
|
setType(linkage, newType);
|
||||||
PDOMCParameter oldParams= getFirstParameter(null);
|
PDOMCParameter oldParams= getFirstParameter(null);
|
||||||
|
@ -148,7 +140,7 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
||||||
return (IFunctionType) getLinkage().loadType(record + FUNCTION_TYPE);
|
return (IFunctionType) getLinkage().loadType(record + FUNCTION_TYPE);
|
||||||
} catch(CoreException ce) {
|
} catch(CoreException ce) {
|
||||||
CCorePlugin.log(ce);
|
CCorePlugin.log(ce);
|
||||||
return null;
|
return new ProblemFunctionType(ISemanticProblem.TYPE_NOT_PERSISTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +152,7 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
||||||
return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.EXTERN_OFFSET);
|
return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.EXTERN_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IParameter[] getParameters() throws DOMException {
|
public IParameter[] getParameters() {
|
||||||
try {
|
try {
|
||||||
PDOMLinkage linkage= getLinkage();
|
PDOMLinkage linkage= getLinkage();
|
||||||
Database db= getDB();
|
Database db= getDB();
|
||||||
|
@ -202,7 +194,7 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
||||||
return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.VARARGS_OFFSET);
|
return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.VARARGS_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IScope getFunctionScope() throws DOMException {
|
public IScope getFunctionScope() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
||||||
|
|
||||||
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.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
|
@ -26,7 +25,6 @@ import org.eclipse.cdt.internal.core.pdom.dom.IPDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNamedNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNamedNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,7 +87,7 @@ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBin
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIndexScope getScope() {
|
public IIndexScope getScope() {
|
||||||
throw new PDOMNotImplementedError();
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
|
@ -121,22 +119,10 @@ final class PDOMCParameter extends PDOMNamedNode implements IParameter, IPDOMBin
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compareTo(Object arg0) {
|
|
||||||
throw new PDOMNotImplementedError();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] getQualifiedName() {
|
public String[] getQualifiedName() {
|
||||||
throw new PDOMNotImplementedError();
|
return new String[] {getName()};
|
||||||
}
|
}
|
||||||
|
|
||||||
public char[][] getQualifiedNameCharArray() throws DOMException {
|
|
||||||
throw new PDOMNotImplementedError();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isGloballyQualified() throws DOMException {
|
|
||||||
throw new PDOMNotImplementedError();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getBindingConstant() {
|
public int getBindingConstant() {
|
||||||
return getNodeType();
|
return getNodeType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,12 @@ class PDOMCTypedef extends PDOMBinding implements ITypedef, ITypeContainer, IInd
|
||||||
return getName() + ": " + super.toStringBase(); //$NON-NLS-1$
|
return getName() + ": " + super.toStringBase(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(IType type) {fail();}
|
public void setType(IType type) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() {fail(); return null;}
|
public Object clone() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,13 +13,11 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
||||||
|
|
||||||
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.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
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.dom.parser.c.CVariableReadWriteFlags;
|
import org.eclipse.cdt.internal.core.dom.parser.c.CVariableReadWriteFlags;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCBindingConstants;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
|
@ -62,15 +60,11 @@ class PDOMCVariable extends PDOMBinding implements IVariable {
|
||||||
public PDOMCVariable(PDOMLinkage linkage, PDOMNode parent, IVariable variable) throws CoreException {
|
public PDOMCVariable(PDOMLinkage linkage, PDOMNode parent, IVariable variable) throws CoreException {
|
||||||
super(linkage, parent, variable.getNameCharArray());
|
super(linkage, parent, variable.getNameCharArray());
|
||||||
|
|
||||||
try {
|
final Database db = getDB();
|
||||||
final Database db = getDB();
|
setType(parent.getLinkage(), variable.getType());
|
||||||
setType(parent.getLinkage(), variable.getType());
|
db.putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(variable));
|
||||||
db.putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(variable));
|
|
||||||
|
setValue(db, variable);
|
||||||
setValue(db, variable);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
throw new CoreException(Util.createStatus(e));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setValue(final Database db, IVariable variable) throws CoreException {
|
private void setValue(final Database db, IVariable variable) throws CoreException {
|
||||||
|
@ -85,16 +79,12 @@ class PDOMCVariable extends PDOMBinding implements IVariable {
|
||||||
final Database db = getDB();
|
final Database db = getDB();
|
||||||
IVariable var= (IVariable) newBinding;
|
IVariable var= (IVariable) newBinding;
|
||||||
long valueRec= db.getRecPtr(record + VALUE_OFFSET);
|
long valueRec= db.getRecPtr(record + VALUE_OFFSET);
|
||||||
try {
|
IType newType= var.getType();
|
||||||
IType newType= var.getType();
|
setType(linkage, newType);
|
||||||
setType(linkage, newType);
|
db.putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(var));
|
||||||
db.putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(var));
|
setValue(db, var);
|
||||||
setValue(db, var);
|
|
||||||
|
PDOMValue.delete(db, valueRec);
|
||||||
PDOMValue.delete(db, valueRec);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
throw new CoreException(Util.createStatus(e));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ 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;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -133,7 +132,7 @@ class PDOMCPPBase implements ICPPBase, ICPPInternalBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBaseClass(IBinding binding) {
|
public void setBaseClass(IBinding binding) {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -33,7 +33,6 @@ import org.eclipse.cdt.internal.core.pdom.dom.IPDOMOverloader;
|
||||||
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.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -150,7 +149,7 @@ class PDOMCPPClassTemplatePartialSpecialization extends PDOMCPPClassTemplate
|
||||||
CCorePlugin.log(ce);
|
CCorePlugin.log(ce);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new PDOMNotImplementedError();
|
assert false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cmp;
|
return cmp;
|
||||||
|
|
|
@ -174,7 +174,9 @@ class PDOMCPPDeferredClassInstance extends PDOMCPPSpecialization implements ICPP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() {fail();return null;}
|
public Object clone() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
public ICPPScope asScope() {
|
public ICPPScope asScope() {
|
||||||
if (unknownScope == null) {
|
if (unknownScope == null) {
|
||||||
|
|
|
@ -12,14 +12,14 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
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.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
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.core.dom.ast.cpp.ICPPSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.Util;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||||
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;
|
||||||
|
@ -43,14 +43,10 @@ class PDOMCPPFieldSpecialization extends PDOMCPPSpecialization implements ICPPFi
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
super(linkage, parent, (ICPPSpecialization) field, specialized);
|
super(linkage, parent, (ICPPSpecialization) field, specialized);
|
||||||
|
|
||||||
try {
|
final Database db = getDB();
|
||||||
final Database db = getDB();
|
linkage.storeType(record + TYPE_OFFSET, field.getType());
|
||||||
linkage.storeType(record + TYPE_OFFSET, field.getType());
|
long rec= PDOMValue.store(db, linkage, field.getInitialValue());
|
||||||
long rec= PDOMValue.store(db, linkage, field.getInitialValue());
|
db.putRecPtr(record + VALUE_OFFSET, rec);
|
||||||
db.putRecPtr(record + VALUE_OFFSET, rec);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
throw new CoreException(Util.createStatus(e));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPFieldSpecialization(PDOMLinkage linkage, long bindingRecord) {
|
public PDOMCPPFieldSpecialization(PDOMLinkage linkage, long bindingRecord) {
|
||||||
|
@ -75,13 +71,13 @@ class PDOMCPPFieldSpecialization extends PDOMCPPSpecialization implements ICPPFi
|
||||||
return getClassOwner();
|
return getClassOwner();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IType getType() throws DOMException {
|
public IType getType() {
|
||||||
try {
|
try {
|
||||||
return getLinkage().loadType(record + TYPE_OFFSET);
|
return getLinkage().loadType(record + TYPE_OFFSET);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
|
return new ProblemType(ISemanticProblem.TYPE_NOT_PERSISTED);
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IValue getInitialValue() {
|
public IValue getInitialValue() {
|
||||||
|
|
|
@ -16,12 +16,13 @@ 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.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
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.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.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.dom.parser.ProblemFunctionType;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||||
import org.eclipse.cdt.internal.core.index.IndexCPPSignatureUtil;
|
import org.eclipse.cdt.internal.core.index.IndexCPPSignatureUtil;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
|
@ -29,7 +30,6 @@ import org.eclipse.cdt.internal.core.pdom.dom.IPDOMOverloader;
|
||||||
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.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCAnnotation;
|
import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCAnnotation;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
@ -128,14 +128,10 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
||||||
ICPPParameter[] newParams;
|
ICPPParameter[] newParams;
|
||||||
short newAnnotation;
|
short newAnnotation;
|
||||||
int newBindingRequiredArgCount;
|
int newBindingRequiredArgCount;
|
||||||
try {
|
newType= func.getType();
|
||||||
newType= func.getType();
|
newParams = func.getParameters();
|
||||||
newParams = func.getParameters();
|
newAnnotation = getAnnotation(func);
|
||||||
newAnnotation = getAnnotation(func);
|
newBindingRequiredArgCount= func.getRequiredArgumentCount();
|
||||||
newBindingRequiredArgCount= func.getRequiredArgumentCount();
|
|
||||||
} catch (DOMException e) {
|
|
||||||
throw new CoreException(Util.createStatus(e));
|
|
||||||
}
|
|
||||||
|
|
||||||
fType= null;
|
fType= null;
|
||||||
linkage.storeType(record+FUNCTION_TYPE, newType);
|
linkage.storeType(record+FUNCTION_TYPE, newType);
|
||||||
|
@ -244,7 +240,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getRequiredArgumentCount() throws DOMException {
|
public int getRequiredArgumentCount() {
|
||||||
if (fRequiredArgCount == -1) {
|
if (fRequiredArgCount == -1) {
|
||||||
try {
|
try {
|
||||||
fRequiredArgCount= getDB().getInt(record + REQUIRED_ARG_COUNT);
|
fRequiredArgCount= getDB().getInt(record + REQUIRED_ARG_COUNT);
|
||||||
|
@ -271,14 +267,14 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMutable() {
|
public boolean isMutable() {
|
||||||
throw new PDOMNotImplementedError();
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IScope getFunctionScope() throws DOMException {
|
public IScope getFunctionScope() {
|
||||||
throw new PDOMNotImplementedError();
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPParameter[] getParameters() throws DOMException {
|
public ICPPParameter[] getParameters() {
|
||||||
try {
|
try {
|
||||||
PDOMLinkage linkage= getLinkage();
|
PDOMLinkage linkage= getLinkage();
|
||||||
Database db= getDB();
|
Database db= getDB();
|
||||||
|
@ -308,6 +304,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
||||||
fType= (ICPPFunctionType) getLinkage().loadType(record+FUNCTION_TYPE);
|
fType= (ICPPFunctionType) getLinkage().loadType(record+FUNCTION_TYPE);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
|
fType= new ProblemFunctionType(ISemanticProblem.TYPE_NOT_PERSISTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fType;
|
return fType;
|
||||||
|
@ -345,7 +342,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -365,7 +362,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
|
||||||
CCorePlugin.log(ce);
|
CCorePlugin.log(ce);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new PDOMNotImplementedError(b.getClass().toString());
|
assert false;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,22 +12,21 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
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.IFunctionType;
|
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
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.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.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.core.dom.ast.cpp.ICPPSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.Util;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemFunctionType;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||||
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;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCAnnotation;
|
import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCAnnotation;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
@ -84,44 +83,40 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP
|
||||||
super(linkage, parent, (ICPPSpecialization) astFunction, specialized);
|
super(linkage, parent, (ICPPSpecialization) astFunction, specialized);
|
||||||
|
|
||||||
Database db = getDB();
|
Database db = getDB();
|
||||||
try {
|
ICPPParameter[] astParams= astFunction.getParameters();
|
||||||
ICPPParameter[] astParams= astFunction.getParameters();
|
IFunctionType astFt= astFunction.getType();
|
||||||
IFunctionType astFt= astFunction.getType();
|
if (astFt != null) {
|
||||||
if (astFt != null) {
|
getLinkage().storeType(record + FUNCTION_TYPE, astFt);
|
||||||
getLinkage().storeType(record + FUNCTION_TYPE, astFt);
|
|
||||||
}
|
|
||||||
|
|
||||||
ICPPFunction origAstFunc= (ICPPFunction) ((ICPPSpecialization)astFunction).getSpecializedBinding();
|
|
||||||
ICPPParameter[] origAstParams= origAstFunc.getParameters();
|
|
||||||
if (origAstParams.length == 0) {
|
|
||||||
db.putInt(record + NUM_PARAMS, 0);
|
|
||||||
db.putRecPtr(record + FIRST_PARAM, 0);
|
|
||||||
} else {
|
|
||||||
final int length= astParams.length;
|
|
||||||
db.putInt(record + NUM_PARAMS, length);
|
|
||||||
|
|
||||||
db.putRecPtr(record + FIRST_PARAM, 0);
|
|
||||||
PDOMCPPParameter origPar= null;
|
|
||||||
PDOMCPPParameterSpecialization next= null;
|
|
||||||
for (int i= length-1; i >= 0; --i) {
|
|
||||||
// There may be fewer or less original parameters, because of parameter packs.
|
|
||||||
if (i < origAstParams.length-1) {
|
|
||||||
// Normal case
|
|
||||||
origPar= new PDOMCPPParameter(linkage, specialized, origAstParams[i], null);
|
|
||||||
} else if (origPar == null) {
|
|
||||||
// Use last parameter
|
|
||||||
origPar= new PDOMCPPParameter(linkage, specialized, origAstParams[origAstParams.length-1], null);
|
|
||||||
}
|
|
||||||
next= new PDOMCPPParameterSpecialization(linkage, this, astParams[i], origPar, next);
|
|
||||||
}
|
|
||||||
db.putRecPtr(record + FIRST_PARAM, next == null ? 0 : next.getRecord());
|
|
||||||
}
|
|
||||||
fAnnotation = getAnnotation(astFunction);
|
|
||||||
db.putShort(record + ANNOTATION_OFFSET, fAnnotation);
|
|
||||||
db.putInt(record + REQUIRED_ARG_COUNT_OFFSET, astFunction.getRequiredArgumentCount());
|
|
||||||
} catch (DOMException e) {
|
|
||||||
throw new CoreException(Util.createStatus(e));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ICPPFunction origAstFunc= (ICPPFunction) ((ICPPSpecialization)astFunction).getSpecializedBinding();
|
||||||
|
ICPPParameter[] origAstParams= origAstFunc.getParameters();
|
||||||
|
if (origAstParams.length == 0) {
|
||||||
|
db.putInt(record + NUM_PARAMS, 0);
|
||||||
|
db.putRecPtr(record + FIRST_PARAM, 0);
|
||||||
|
} else {
|
||||||
|
final int length= astParams.length;
|
||||||
|
db.putInt(record + NUM_PARAMS, length);
|
||||||
|
|
||||||
|
db.putRecPtr(record + FIRST_PARAM, 0);
|
||||||
|
PDOMCPPParameter origPar= null;
|
||||||
|
PDOMCPPParameterSpecialization next= null;
|
||||||
|
for (int i= length-1; i >= 0; --i) {
|
||||||
|
// There may be fewer or less original parameters, because of parameter packs.
|
||||||
|
if (i < origAstParams.length-1) {
|
||||||
|
// Normal case
|
||||||
|
origPar= new PDOMCPPParameter(linkage, specialized, origAstParams[i], null);
|
||||||
|
} else if (origPar == null) {
|
||||||
|
// Use last parameter
|
||||||
|
origPar= new PDOMCPPParameter(linkage, specialized, origAstParams[origAstParams.length-1], null);
|
||||||
|
}
|
||||||
|
next= new PDOMCPPParameterSpecialization(linkage, this, astParams[i], origPar, next);
|
||||||
|
}
|
||||||
|
db.putRecPtr(record + FIRST_PARAM, next == null ? 0 : next.getRecord());
|
||||||
|
}
|
||||||
|
fAnnotation = getAnnotation(astFunction);
|
||||||
|
db.putShort(record + ANNOTATION_OFFSET, fAnnotation);
|
||||||
|
db.putInt(record + REQUIRED_ARG_COUNT_OFFSET, astFunction.getRequiredArgumentCount());
|
||||||
long typelist= 0;
|
long typelist= 0;
|
||||||
if (astFunction instanceof ICPPMethod && ((ICPPMethod) astFunction).isImplicit()) {
|
if (astFunction instanceof ICPPMethod && ((ICPPMethod) astFunction).isImplicit()) {
|
||||||
// don't store the exception specification, computed it on demand.
|
// don't store the exception specification, computed it on demand.
|
||||||
|
@ -176,11 +171,11 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IScope getFunctionScope() throws DOMException {
|
public IScope getFunctionScope() {
|
||||||
throw new PDOMNotImplementedError();
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPParameter[] getParameters() throws DOMException {
|
public ICPPParameter[] getParameters() {
|
||||||
try {
|
try {
|
||||||
PDOMLinkage linkage= getLinkage();
|
PDOMLinkage linkage= getLinkage();
|
||||||
Database db= getDB();
|
Database db= getDB();
|
||||||
|
@ -204,12 +199,13 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPFunctionType getType() throws DOMException {
|
public ICPPFunctionType getType() {
|
||||||
if (fType == null) {
|
if (fType == null) {
|
||||||
try {
|
try {
|
||||||
fType= (ICPPFunctionType) getLinkage().loadType(record + FUNCTION_TYPE);
|
fType= (ICPPFunctionType) getLinkage().loadType(record + FUNCTION_TYPE);
|
||||||
} catch(CoreException ce) {
|
} catch(CoreException ce) {
|
||||||
CCorePlugin.log(ce);
|
CCorePlugin.log(ce);
|
||||||
|
fType= new ProblemFunctionType(ISemanticProblem.TYPE_NOT_PERSISTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fType;
|
return fType;
|
||||||
|
@ -242,7 +238,7 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getRequiredArgumentCount() throws DOMException {
|
public int getRequiredArgumentCount() {
|
||||||
if (fRequiredArgCount == -1) {
|
if (fRequiredArgCount == -1) {
|
||||||
try {
|
try {
|
||||||
fRequiredArgCount= getDB().getInt(record + REQUIRED_ARG_COUNT_OFFSET);
|
fRequiredArgCount= getDB().getInt(record + REQUIRED_ARG_COUNT_OFFSET);
|
||||||
|
|
|
@ -35,7 +35,6 @@ import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCAnnotation;
|
import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCAnnotation;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
@ -126,7 +125,7 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMutable() {
|
public boolean isMutable() {
|
||||||
throw new PDOMNotImplementedError();
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isImplicit() {
|
public boolean isImplicit() {
|
||||||
|
@ -138,8 +137,8 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IScope getFunctionScope() throws DOMException {
|
public IScope getFunctionScope() {
|
||||||
throw new PDOMNotImplementedError();
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -175,7 +174,7 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
throw new PDOMNotImplementedError();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConst() {
|
public boolean isConst() {
|
||||||
|
@ -208,12 +207,8 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod {
|
||||||
if (fieldOwner instanceof IASTIdExpression) {
|
if (fieldOwner instanceof IASTIdExpression) {
|
||||||
IBinding b= ((IASTIdExpression) fieldOwner).getName().resolveBinding();
|
IBinding b= ((IASTIdExpression) fieldOwner).getName().resolveBinding();
|
||||||
if (b instanceof IVariable) {
|
if (b instanceof IVariable) {
|
||||||
try {
|
IType t = ((IVariable) b).getType();
|
||||||
IType t = ((IVariable) b).getType();
|
if (!(t instanceof ICPPReferenceType)) {
|
||||||
if (!(t instanceof ICPPReferenceType)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} catch (DOMException e) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,7 +235,9 @@ class PDOMCPPNamespace extends PDOMCPPBinding
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addUsingDirective(ICPPUsingDirective directive) { fail(); }
|
public void addUsingDirective(ICPPUsingDirective directive) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
public IIndexBinding getScopeBinding() {
|
public IIndexBinding getScopeBinding() {
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -14,6 +14,7 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||||
|
@ -21,7 +22,6 @@ 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;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +88,20 @@ class PDOMCPPNamespaceAlias extends PDOMCPPBinding implements ICPPNamespaceAlias
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBinding[] getMemberBindings() {
|
public IBinding[] getMemberBindings() {
|
||||||
throw new PDOMNotImplementedError();
|
ICPPNamespace ns= this;
|
||||||
|
for (int i = 0; i < 20; i++) {
|
||||||
|
if (ns instanceof ICPPNamespaceAlias) {
|
||||||
|
IBinding b= ((ICPPNamespaceAlias) ns).getBinding();
|
||||||
|
if (b instanceof ICPPNamespace) {
|
||||||
|
ns= (ICPPNamespace) b;
|
||||||
|
} else {
|
||||||
|
return IBinding.EMPTY_BINDING_ARRAY;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ns.getMemberBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBinding getBinding() {
|
public IBinding getBinding() {
|
||||||
|
|
|
@ -28,7 +28,6 @@ import org.eclipse.cdt.internal.core.pdom.dom.IPDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNamedNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNamedNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCAnnotation;
|
import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCAnnotation;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
@ -198,10 +197,6 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind
|
||||||
// parameter bindings do not span index fragments
|
// parameter bindings do not span index fragments
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compareTo(Object arg0) {
|
|
||||||
throw new PDOMNotImplementedError();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getBindingConstant() {
|
public int getBindingConstant() {
|
||||||
return getNodeType();
|
return getNodeType();
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
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.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
@ -77,28 +76,25 @@ class PDOMCPPParameterSpecialization extends PDOMCPPSpecialization implements IC
|
||||||
IType type= null;
|
IType type= null;
|
||||||
IBinding parent = getParentBinding();
|
IBinding parent = getParentBinding();
|
||||||
if (parent instanceof ICPPSpecialization && parent instanceof ICPPFunction) {
|
if (parent instanceof ICPPSpecialization && parent instanceof ICPPFunction) {
|
||||||
try {
|
IParameter[] pars= ((ICPPFunction) parent).getParameters();
|
||||||
IParameter[] pars= ((ICPPFunction) parent).getParameters();
|
int parPos= -1;
|
||||||
int parPos= -1;
|
for (parPos= 0; parPos<pars.length; parPos++) {
|
||||||
for (parPos= 0; parPos<pars.length; parPos++) {
|
IParameter par= pars[parPos];
|
||||||
IParameter par= pars[parPos];
|
if (equals(par)) {
|
||||||
if (equals(par)) {
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (parPos < pars.length) {
|
}
|
||||||
parent= ((ICPPSpecialization) parent).getSpecializedBinding();
|
if (parPos < pars.length) {
|
||||||
if (parent instanceof ICPPFunction) {
|
parent= ((ICPPSpecialization) parent).getSpecializedBinding();
|
||||||
ICPPFunctionType ftype = ((ICPPFunction) parent).getType();
|
if (parent instanceof ICPPFunction) {
|
||||||
if (ftype != null) {
|
ICPPFunctionType ftype = ((ICPPFunction) parent).getType();
|
||||||
IType[] ptypes= ftype.getParameterTypes();
|
if (ftype != null) {
|
||||||
if (parPos < ptypes.length) {
|
IType[] ptypes= ftype.getParameterTypes();
|
||||||
type= ptypes[parPos];
|
if (parPos < ptypes.length) {
|
||||||
}
|
type= ptypes[parPos];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new PDOMCPPParameter(getLinkage(), record, type);
|
return new PDOMCPPParameter(getLinkage(), record, type);
|
||||||
|
|
|
@ -207,8 +207,7 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPBinding implements IPDOMMem
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
fail();
|
throw new UnsupportedOperationException();
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
|
|
|
@ -166,7 +166,9 @@ public class PDOMCPPTemplateTemplateParameter extends PDOMCPPBinding
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() { fail(); return null; }
|
public Object clone() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public ICPPScope asScope() {
|
public ICPPScope asScope() {
|
||||||
|
|
|
@ -152,8 +152,9 @@ class PDOMCPPTemplateTypeParameter extends PDOMCPPBinding implements IPDOMMember
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() { fail(); return null; }
|
public Object clone() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
public ICPPScope asScope() {
|
public ICPPScope asScope() {
|
||||||
if (fUnknownScope == null) {
|
if (fUnknownScope == null) {
|
||||||
|
|
|
@ -134,7 +134,9 @@ class PDOMCPPTypedef extends PDOMCPPBinding implements ITypedef, ITypeContainer,
|
||||||
return getName() + ": " + super.toStringBase(); //$NON-NLS-1$
|
return getName() + ": " + super.toStringBase(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(IType type) { fail(); }
|
public void setType(IType type) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
|
|
|
@ -98,7 +98,9 @@ class PDOMCPPTypedefSpecialization extends PDOMCPPSpecialization implements ITyp
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(IType type) { fail(); }
|
public void setType(IType type) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see java.lang.Object#clone()
|
* @see java.lang.Object#clone()
|
||||||
|
|
|
@ -147,8 +147,13 @@ class PDOMCPPUnknownClassType extends PDOMCPPUnknownBinding implements ICPPClass
|
||||||
// Not implemented
|
// Not implemented
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() { fail(); return null; }
|
public Object clone() {
|
||||||
public IField findField(String name) { fail(); return null; }
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IField findField(String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mayHaveChildren() {
|
public boolean mayHaveChildren() {
|
||||||
|
|
|
@ -13,14 +13,12 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
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.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
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.semantics.CPPVariableReadWriteFlags;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVariableReadWriteFlags;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
|
@ -45,15 +43,11 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable {
|
||||||
public PDOMCPPVariable(PDOMLinkage linkage, PDOMNode parent, IVariable variable) throws CoreException {
|
public PDOMCPPVariable(PDOMLinkage linkage, PDOMNode parent, IVariable variable) throws CoreException {
|
||||||
super(linkage, parent, variable.getNameCharArray());
|
super(linkage, parent, variable.getNameCharArray());
|
||||||
|
|
||||||
try {
|
// Find the type record
|
||||||
// Find the type record
|
Database db = getDB();
|
||||||
Database db = getDB();
|
setType(parent.getLinkage(), variable.getType());
|
||||||
setType(parent.getLinkage(), variable.getType());
|
db.putByte(record + ANNOTATIONS, encodeFlags(variable));
|
||||||
db.putByte(record + ANNOTATIONS, encodeFlags(variable));
|
setValue(db, variable);
|
||||||
setValue(db, variable);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
throw new CoreException(Util.createStatus(e));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setValue(Database db, IVariable variable) throws CoreException {
|
private void setValue(Database db, IVariable variable) throws CoreException {
|
||||||
|
@ -68,16 +62,11 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable {
|
||||||
final Database db = getDB();
|
final Database db = getDB();
|
||||||
IVariable var= (IVariable) newBinding;
|
IVariable var= (IVariable) newBinding;
|
||||||
long valueRec= db.getRecPtr(record + VALUE_OFFSET);
|
long valueRec= db.getRecPtr(record + VALUE_OFFSET);
|
||||||
try {
|
IType newType= var.getType();
|
||||||
IType newType= var.getType();
|
setType(linkage, newType);
|
||||||
setType(linkage, newType);
|
db.putByte(record + ANNOTATIONS, encodeFlags(var));
|
||||||
db.putByte(record + ANNOTATIONS, encodeFlags(var));
|
setValue(db, var);
|
||||||
setValue(db, var);
|
PDOMValue.delete(db, valueRec);
|
||||||
PDOMValue.delete(db, valueRec);
|
|
||||||
|
|
||||||
} catch (DOMException e) {
|
|
||||||
throw new CoreException(Util.createStatus(e));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ILinkage;
|
import org.eclipse.cdt.core.dom.ILinkage;
|
||||||
import org.eclipse.cdt.core.dom.ast.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.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||||
|
@ -79,13 +78,9 @@ public class CHQueries {
|
||||||
if (calleeBinding != null) {
|
if (calleeBinding != null) {
|
||||||
findCalledBy1(index, calleeBinding, true, project, result);
|
findCalledBy1(index, calleeBinding, true, project, result);
|
||||||
if (calleeBinding instanceof ICPPMethod) {
|
if (calleeBinding instanceof ICPPMethod) {
|
||||||
try {
|
IBinding[] overriddenBindings= ClassTypeHelper.findOverridden((ICPPMethod) calleeBinding);
|
||||||
IBinding[] overriddenBindings= ClassTypeHelper.findOverridden((ICPPMethod) calleeBinding);
|
for (IBinding overriddenBinding : overriddenBindings) {
|
||||||
for (IBinding overriddenBinding : overriddenBindings) {
|
findCalledBy1(index, overriddenBinding, false, project, result);
|
||||||
findCalledBy1(index, overriddenBinding, false, project, result);
|
|
||||||
}
|
|
||||||
} catch (DOMException e) {
|
|
||||||
// index bindings don't throw DOMExceptions
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,18 +152,14 @@ public class CHQueries {
|
||||||
* Searches for overriders of method and converts them to ICElement, returns null, if there are none.
|
* Searches for overriders of method and converts them to ICElement, returns null, if there are none.
|
||||||
*/
|
*/
|
||||||
static ICElement[] findOverriders(IIndex index, ICPPMethod binding) throws CoreException {
|
static ICElement[] findOverriders(IIndex index, ICPPMethod binding) throws CoreException {
|
||||||
try {
|
IBinding[] virtualOverriders= ClassTypeHelper.findOverriders(index, binding);
|
||||||
IBinding[] virtualOverriders= ClassTypeHelper.findOverriders(index, binding);
|
if (virtualOverriders.length > 0) {
|
||||||
if (virtualOverriders.length > 0) {
|
ArrayList<ICElementHandle> list= new ArrayList<ICElementHandle>();
|
||||||
ArrayList<ICElementHandle> list= new ArrayList<ICElementHandle>();
|
list.addAll(Arrays.asList(IndexUI.findRepresentative(index, binding)));
|
||||||
list.addAll(Arrays.asList(IndexUI.findRepresentative(index, binding)));
|
for (IBinding overrider : virtualOverriders) {
|
||||||
for (IBinding overrider : virtualOverriders) {
|
list.addAll(Arrays.asList(IndexUI.findRepresentative(index, overrider)));
|
||||||
list.addAll(Arrays.asList(IndexUI.findRepresentative(index, overrider)));
|
|
||||||
}
|
|
||||||
return list.toArray(new ICElement[list.size()]);
|
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
return list.toArray(new ICElement[list.size()]);
|
||||||
// index bindings don't throw DOMExceptions
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ import org.eclipse.ui.texteditor.ITextEditor;
|
||||||
import org.eclipse.ui.texteditor.TextEditorAction;
|
import org.eclipse.ui.texteditor.TextEditorAction;
|
||||||
|
|
||||||
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.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
|
import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
|
||||||
|
@ -218,18 +217,14 @@ public class AddIncludeOnSelectionAction extends TextEditorAction {
|
||||||
char[] nameChars = name.toCharArray();
|
char[] nameChars = name.toCharArray();
|
||||||
lookupName[0] = new String(nameChars);
|
lookupName[0] = new String(nameChars);
|
||||||
IBinding binding = name.resolveBinding();
|
IBinding binding = name.resolveBinding();
|
||||||
try {
|
if (binding instanceof ICPPVariable) {
|
||||||
if (binding instanceof ICPPVariable) {
|
IType type = ((ICPPVariable) binding).getType();
|
||||||
IType type = ((ICPPVariable) binding).getType();
|
type = SemanticUtil.getNestedType(type,
|
||||||
type = SemanticUtil.getNestedType(type,
|
SemanticUtil.ALLCVQ | SemanticUtil.PTR | SemanticUtil.ARRAY | SemanticUtil.REF);
|
||||||
SemanticUtil.ALLCVQ | SemanticUtil.PTR | SemanticUtil.ARRAY | SemanticUtil.REF);
|
if (type instanceof IBinding) {
|
||||||
if (type instanceof IBinding) {
|
binding = (IBinding) type;
|
||||||
binding = (IBinding) type;
|
nameChars = binding.getNameCharArray();
|
||||||
nameChars = binding.getNameCharArray();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
|
||||||
CUIPlugin.log(e);
|
|
||||||
}
|
}
|
||||||
if (nameChars.length == 0) {
|
if (nameChars.length == 0) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -835,9 +835,7 @@ public class SemanticHighlightings {
|
||||||
}
|
}
|
||||||
} catch (DOMException exc) {
|
} catch (DOMException exc) {
|
||||||
CUIPlugin.log(exc);
|
CUIPlugin.log(exc);
|
||||||
} catch (Error e) /* PDOMNotImplementedError */ {
|
}
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -920,9 +918,7 @@ public class SemanticHighlightings {
|
||||||
}
|
}
|
||||||
} catch (DOMException exc) {
|
} catch (DOMException exc) {
|
||||||
CUIPlugin.log(exc);
|
CUIPlugin.log(exc);
|
||||||
} catch (Error e) /* PDOMNotImplementedError */ {
|
}
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1023,9 +1019,7 @@ public class SemanticHighlightings {
|
||||||
}
|
}
|
||||||
} catch (DOMException exc) {
|
} catch (DOMException exc) {
|
||||||
CUIPlugin.log(exc);
|
CUIPlugin.log(exc);
|
||||||
} catch (Error e) /* PDOMNotImplementedError */ {
|
}
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -146,11 +146,7 @@ public class IndexLabelProvider extends LabelProvider {
|
||||||
* we don't currently store return types
|
* we don't currently store return types
|
||||||
*/
|
*/
|
||||||
if(element instanceof IFunction) {
|
if(element instanceof IFunction) {
|
||||||
try {
|
result += " "+ASTTypeUtil.getParameterTypeString(((IFunction) element).getType()); //$NON-NLS-1$
|
||||||
result += " "+ASTTypeUtil.getParameterTypeString(((IFunction) element).getType()); //$NON-NLS-1$
|
|
||||||
} catch(DOMException de) {
|
|
||||||
/* NO-OP: just use plain name as label */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -22,20 +22,16 @@ import java.util.Vector;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.ILog;
|
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Status;
|
|
||||||
import org.eclipse.core.runtime.SubMonitor;
|
import org.eclipse.core.runtime.SubMonitor;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.ltk.core.refactoring.RefactoringDescriptor;
|
import org.eclipse.ltk.core.refactoring.RefactoringDescriptor;
|
||||||
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
|
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
|
||||||
import org.eclipse.text.edits.TextEditGroup;
|
import org.eclipse.text.edits.TextEditGroup;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTComment;
|
import org.eclipse.cdt.core.dom.ast.IASTComment;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||||
|
@ -78,7 +74,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.dom.rewrite.ASTRewrite;
|
import org.eclipse.cdt.core.dom.rewrite.ASTRewrite;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.c.CASTBinaryExpression;
|
import org.eclipse.cdt.internal.core.dom.parser.c.CASTBinaryExpression;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTBinaryExpression;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTBinaryExpression;
|
||||||
|
@ -584,56 +579,48 @@ public class ExtractFunctionRefactoring extends CRefactoring {
|
||||||
String name = new String(declarator.getName().toCharArray());
|
String name = new String(declarator.getName().toCharArray());
|
||||||
if (bind instanceof ICPPClassType) {
|
if (bind instanceof ICPPClassType) {
|
||||||
ICPPClassType classBind = (ICPPClassType) bind;
|
ICPPClassType classBind = (ICPPClassType) bind;
|
||||||
try {
|
IField[] fields = classBind.getFields();
|
||||||
IField[] fields = classBind.getFields();
|
for (IField field : fields) {
|
||||||
for (IField field : fields) {
|
if (field.getName().equals(name)) {
|
||||||
if (field.getName().equals(name)) {
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ICPPMethod[] methods = classBind.getAllDeclaredMethods();
|
}
|
||||||
for (ICPPMethod method : methods) {
|
ICPPMethod[] methods = classBind.getAllDeclaredMethods();
|
||||||
if (!method.takesVarArgs() && name.equals(method.getName())) {
|
for (ICPPMethod method : methods) {
|
||||||
IParameter[] parameters = method.getParameters();
|
if (!method.takesVarArgs() && name.equals(method.getName())) {
|
||||||
if (parameters.length == declarator.getParameters().length) {
|
IParameter[] parameters = method.getParameters();
|
||||||
for (int i = 0; i < parameters.length; i++) {
|
if (parameters.length == declarator.getParameters().length) {
|
||||||
IASTName[] origParameterName = unit
|
for (int i = 0; i < parameters.length; i++) {
|
||||||
.getDeclarationsInAST(parameters[i]);
|
IASTName[] origParameterName = unit
|
||||||
|
.getDeclarationsInAST(parameters[i]);
|
||||||
|
|
||||||
IASTParameterDeclaration origParameter = (IASTParameterDeclaration) origParameterName[0]
|
IASTParameterDeclaration origParameter = (IASTParameterDeclaration) origParameterName[0]
|
||||||
.getParent().getParent();
|
.getParent().getParent();
|
||||||
IASTParameterDeclaration newParameter = declarator
|
IASTParameterDeclaration newParameter = declarator
|
||||||
.getParameters()[i];
|
.getParameters()[i];
|
||||||
|
|
||||||
// if not the same break;
|
// if not the same break;
|
||||||
if (!(equalityChecker.isEquals(origParameter
|
if (!(equalityChecker.isEquals(origParameter
|
||||||
.getDeclSpecifier(), newParameter
|
.getDeclSpecifier(), newParameter
|
||||||
.getDeclSpecifier()) && ASTHelper
|
.getDeclSpecifier()) && ASTHelper
|
||||||
.samePointers(origParameter
|
.samePointers(origParameter
|
||||||
.getDeclarator()
|
.getDeclarator()
|
||||||
.getPointerOperators(),
|
.getPointerOperators(),
|
||||||
newParameter.getDeclarator()
|
newParameter.getDeclarator()
|
||||||
.getPointerOperators(),
|
.getPointerOperators(),
|
||||||
equalityChecker))) {
|
equalityChecker))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(i < (parameters.length - 1))) {
|
if (!(i < (parameters.length - 1))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
|
||||||
} catch (DOMException e) {
|
|
||||||
ILog logger = CUIPlugin.getDefault().getLog();
|
|
||||||
IStatus status = new Status(IStatus.WARNING,
|
|
||||||
CUIPlugin.PLUGIN_ID, IStatus.OK, e.getMessage(), e);
|
|
||||||
|
|
||||||
logger.log(status);
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ import java.util.Map;
|
||||||
import org.eclipse.core.runtime.Assert;
|
import org.eclipse.core.runtime.Assert;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||||
|
@ -434,12 +433,9 @@ public class TrailNodeEqualityChecker implements EqualityChecker<IASTNode> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private IType getType(IBinding binding) {
|
private IType getType(IBinding binding) {
|
||||||
try {
|
if (binding instanceof ICPPVariable) {
|
||||||
if (binding instanceof ICPPVariable) {
|
ICPPVariable var = (ICPPVariable) binding;
|
||||||
ICPPVariable var = (ICPPVariable) binding;
|
return var.getType();
|
||||||
return var.getType();
|
|
||||||
}
|
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
|
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
|
||||||
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
|
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.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;
|
||||||
|
@ -113,8 +112,6 @@ public class CRenameMethodProcessor extends CRenameGlobalProcessor {
|
||||||
bindings.addAll(Arrays.asList(bs));
|
bindings.addAll(Arrays.asList(bs));
|
||||||
bs= ClassTypeHelper.findOverriders(getIndex(), m);
|
bs= ClassTypeHelper.findOverriders(getIndex(), m);
|
||||||
bindings.addAll(Arrays.asList(bs));
|
bindings.addAll(Arrays.asList(bs));
|
||||||
} catch (DOMException e) {
|
|
||||||
getAstManager().handleDOMException(argument.getTranslationUnit(), e, status);
|
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
status.addError(e.getMessage());
|
status.addError(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
@ -26,7 +25,6 @@ import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
import org.eclipse.cdt.core.parser.Keywords;
|
import org.eclipse.cdt.core.parser.Keywords;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayIntMap;
|
import org.eclipse.cdt.core.parser.util.CharArrayIntMap;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTQualifiedName;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTQualifiedName;
|
||||||
|
|
||||||
|
@ -144,13 +142,9 @@ public class NameHelper {
|
||||||
IASTName name = parameter.getDeclarator().getName();
|
IASTName name = parameter.getDeclarator().getName();
|
||||||
IBinding binding = name.resolveBinding();
|
IBinding binding = name.resolveBinding();
|
||||||
if (binding instanceof IVariable) {
|
if (binding instanceof IVariable) {
|
||||||
try {
|
IType type = ((IVariable) binding).getType();
|
||||||
IType type = ((IVariable) binding).getType();
|
if (type != null) {
|
||||||
if (type != null) {
|
return ASTTypeUtil.getType(type);
|
||||||
return ASTTypeUtil.getType(type);
|
|
||||||
}
|
|
||||||
} catch (DOMException e) {
|
|
||||||
CUIPlugin.log(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
|
|
|
@ -99,12 +99,8 @@ public class LinkedNamesFinder {
|
||||||
}
|
}
|
||||||
} else if (target instanceof ICPPMethod) {
|
} else if (target instanceof ICPPMethod) {
|
||||||
ICPPMethod method= (ICPPMethod) target;
|
ICPPMethod method= (ICPPMethod) target;
|
||||||
try {
|
for (ICPPMethod m : ClassTypeHelper.findOverridden(method)) {
|
||||||
for (ICPPMethod m : ClassTypeHelper.findOverridden(method)) {
|
findBinding(m);
|
||||||
findBinding(m);
|
|
||||||
}
|
|
||||||
} catch (DOMException e) {
|
|
||||||
// Ignore.
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
for (ICPPMethod m : findOverridersInAST(method)) {
|
for (ICPPMethod m : findOverridersInAST(method)) {
|
||||||
|
|
|
@ -44,7 +44,6 @@ import org.eclipse.ui.texteditor.ITextEditor;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.IPositionConverter;
|
import org.eclipse.cdt.core.IPositionConverter;
|
||||||
import org.eclipse.cdt.core.browser.ITypeReference;
|
import org.eclipse.cdt.core.browser.ITypeReference;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
|
@ -330,20 +329,16 @@ public abstract class PDOMSearchQuery implements ISearchQuery {
|
||||||
|
|
||||||
if (binding instanceof ICPPMethod) {
|
if (binding instanceof ICPPMethod) {
|
||||||
ICPPMethod m= (ICPPMethod) binding;
|
ICPPMethod m= (ICPPMethod) binding;
|
||||||
try {
|
ICPPMethod[] msInBases = ClassTypeHelper.findOverridden(m);
|
||||||
ICPPMethod[] msInBases = ClassTypeHelper.findOverridden(m);
|
if (msInBases.length > 0) {
|
||||||
if (msInBases.length > 0) {
|
if (polymorphicNames == null) {
|
||||||
if (polymorphicNames == null) {
|
polymorphicNames= new ArrayList<IIndexName>();
|
||||||
polymorphicNames= new ArrayList<IIndexName>();
|
}
|
||||||
}
|
for (ICPPMethod mInBase : msInBases) {
|
||||||
for (ICPPMethod mInBase : msInBases) {
|
if (mInBase != null && handled.add(mInBase)) {
|
||||||
if (mInBase != null && handled.add(mInBase)) {
|
createMatches1(index, mInBase, polymorphicNames);
|
||||||
createMatches1(index, mInBase, polymorphicNames);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
|
||||||
CUIPlugin.log(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,6 @@ import org.eclipse.cdt.core.model.ILanguage;
|
||||||
import org.eclipse.cdt.core.model.ISourceRange;
|
import org.eclipse.cdt.core.model.ISourceRange;
|
||||||
import org.eclipse.cdt.core.model.ISourceReference;
|
import org.eclipse.cdt.core.model.ISourceReference;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.internal.ui.viewsupport.CElementLabels;
|
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
@ -93,6 +92,7 @@ import org.eclipse.cdt.internal.core.model.ext.ICElementHandle;
|
||||||
import org.eclipse.cdt.internal.ui.actions.OpenActionUtil;
|
import org.eclipse.cdt.internal.ui.actions.OpenActionUtil;
|
||||||
import org.eclipse.cdt.internal.ui.editor.ASTProvider;
|
import org.eclipse.cdt.internal.ui.editor.ASTProvider;
|
||||||
import org.eclipse.cdt.internal.ui.editor.CEditorMessages;
|
import org.eclipse.cdt.internal.ui.editor.CEditorMessages;
|
||||||
|
import org.eclipse.cdt.internal.ui.viewsupport.CElementLabels;
|
||||||
import org.eclipse.cdt.internal.ui.viewsupport.IndexUI;
|
import org.eclipse.cdt.internal.ui.viewsupport.IndexUI;
|
||||||
|
|
||||||
class OpenDeclarationsJob extends Job implements ASTRunnable {
|
class OpenDeclarationsJob extends Job implements ASTRunnable {
|
||||||
|
@ -730,27 +730,22 @@ class OpenDeclarationsJob extends Job implements ASTRunnable {
|
||||||
// For c++ we can check the number of parameters.
|
// For c++ we can check the number of parameters.
|
||||||
if (binding instanceof ICPPFunction) {
|
if (binding instanceof ICPPFunction) {
|
||||||
ICPPFunction f= (ICPPFunction) binding;
|
ICPPFunction f= (ICPPFunction) binding;
|
||||||
try {
|
if (f.getRequiredArgumentCount() > funcArgCount) {
|
||||||
if (f.getRequiredArgumentCount() > funcArgCount) {
|
iterator.remove();
|
||||||
|
result.add(binding);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!f.takesVarArgs() && !f.hasParameterPack()) {
|
||||||
|
final IType[] parameterTypes = f.getType().getParameterTypes();
|
||||||
|
int maxArgs= parameterTypes.length;
|
||||||
|
if (maxArgs == 1 && SemanticUtil.isVoidType(parameterTypes[0])) {
|
||||||
|
maxArgs= 0;
|
||||||
|
}
|
||||||
|
if (maxArgs < funcArgCount) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
result.add(binding);
|
result.add(binding);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!f.takesVarArgs() && !f.hasParameterPack()) {
|
|
||||||
final IType[] parameterTypes = f.getType().getParameterTypes();
|
|
||||||
int maxArgs= parameterTypes.length;
|
|
||||||
if (maxArgs == 1 && SemanticUtil.isVoidType(parameterTypes[0])) {
|
|
||||||
maxArgs= 0;
|
|
||||||
}
|
|
||||||
if (maxArgs < funcArgCount) {
|
|
||||||
iterator.remove();
|
|
||||||
result.add(binding);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (DOMException e) {
|
|
||||||
// Ignore problem bindings.
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -389,13 +389,10 @@ public class CSourceHover extends AbstractCEditorTextHover {
|
||||||
} else {
|
} else {
|
||||||
final boolean expectClosingBrace;
|
final boolean expectClosingBrace;
|
||||||
IType type= null;
|
IType type= null;
|
||||||
try {
|
if (binding instanceof ITypedef) {
|
||||||
if (binding instanceof ITypedef) {
|
type= ((ITypedef)binding).getType();
|
||||||
type= ((ITypedef)binding).getType();
|
} else if (binding instanceof IVariable) {
|
||||||
} else if (binding instanceof IVariable) {
|
type= ((IVariable)binding).getType();
|
||||||
type= ((IVariable)binding).getType();
|
|
||||||
}
|
|
||||||
} catch (DOMException exc) {
|
|
||||||
}
|
}
|
||||||
expectClosingBrace= type instanceof ICompositeType || type instanceof IEnumeration;
|
expectClosingBrace= type instanceof ICompositeType || type instanceof IEnumeration;
|
||||||
final int nameLine= doc.getLineOfOffset(nameOffset);
|
final int nameLine= doc.getLineOfOffset(nameOffset);
|
||||||
|
|
|
@ -373,47 +373,44 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
|
||||||
StringBuilder idargs = new StringBuilder(); // for the idargString
|
StringBuilder idargs = new StringBuilder(); // for the idargString
|
||||||
boolean hasArgs = true;
|
boolean hasArgs = true;
|
||||||
String returnTypeStr = null;
|
String returnTypeStr = null;
|
||||||
try {
|
IParameter[] params = function.getParameters();
|
||||||
IParameter[] params = function.getParameters();
|
if (params != null) {
|
||||||
if (params != null) {
|
for (int i = 0; i < params.length; ++i) {
|
||||||
for (int i = 0; i < params.length; ++i) {
|
IType paramType = params[i].getType();
|
||||||
IType paramType = params[i].getType();
|
if (i > 0) {
|
||||||
if (i > 0) {
|
dispargs.append(',');
|
||||||
dispargs.append(',');
|
idargs.append(',');
|
||||||
idargs.append(',');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
dispargs.append(ASTTypeUtil.getType(paramType, false));
|
dispargs.append(ASTTypeUtil.getType(paramType, false));
|
||||||
idargs.append(ASTTypeUtil.getType(paramType, false));
|
idargs.append(ASTTypeUtil.getType(paramType, false));
|
||||||
String paramName = params[i].getName();
|
String paramName = params[i].getName();
|
||||||
if (paramName != null && paramName.length() > 0) {
|
if (paramName != null && paramName.length() > 0) {
|
||||||
dispargs.append(' ');
|
dispargs.append(' ');
|
||||||
dispargs.append(paramName);
|
dispargs.append(paramName);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (function.takesVarArgs()) {
|
|
||||||
if (params.length > 0) {
|
|
||||||
dispargs.append(',');
|
|
||||||
idargs.append(',');
|
|
||||||
}
|
|
||||||
dispargs.append("..."); //$NON-NLS-1$
|
|
||||||
idargs.append("..."); //$NON-NLS-1$
|
|
||||||
} else if (params.length == 0) { // force the void in
|
|
||||||
dispargs.append("void"); //$NON-NLS-1$
|
|
||||||
idargs.append("void"); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IFunctionType functionType = function.getType();
|
|
||||||
if (functionType != null) {
|
if (function.takesVarArgs()) {
|
||||||
IType returnType = functionType.getReturnType();
|
if (params.length > 0) {
|
||||||
if (returnType != null)
|
dispargs.append(',');
|
||||||
returnTypeStr = ASTTypeUtil.getType(returnType, false);
|
idargs.append(',');
|
||||||
|
}
|
||||||
|
dispargs.append("..."); //$NON-NLS-1$
|
||||||
|
idargs.append("..."); //$NON-NLS-1$
|
||||||
|
} else if (params.length == 0) { // force the void in
|
||||||
|
dispargs.append("void"); //$NON-NLS-1$
|
||||||
|
idargs.append("void"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
hasArgs = ASTTypeUtil.functionTakesParameters(function);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
}
|
||||||
|
IFunctionType functionType = function.getType();
|
||||||
|
if (functionType != null) {
|
||||||
|
IType returnType = functionType.getReturnType();
|
||||||
|
if (returnType != null)
|
||||||
|
returnTypeStr = ASTTypeUtil.getType(returnType, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
hasArgs = ASTTypeUtil.functionTakesParameters(function);
|
||||||
|
|
||||||
String dispargString = dispargs.toString();
|
String dispargString = dispargs.toString();
|
||||||
String idargString = idargs.toString();
|
String idargString = idargs.toString();
|
||||||
|
@ -457,18 +454,14 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
|
||||||
private void handleVariable(IVariable variable, CContentAssistInvocationContext context,
|
private void handleVariable(IVariable variable, CContentAssistInvocationContext context,
|
||||||
int baseRelevance, List<ICompletionProposal> proposals) {
|
int baseRelevance, List<ICompletionProposal> proposals) {
|
||||||
if (context.isContextInformationStyle()) {
|
if (context.isContextInformationStyle()) {
|
||||||
// Handle the case where a variable is initialized with a constructor
|
IType t = variable.getType();
|
||||||
try {
|
t= unwindTypedefs(t);
|
||||||
IType t = variable.getType();
|
if (t instanceof ICPPClassType) {
|
||||||
t= unwindTypedefs(t);
|
ICPPClassType classType= (ICPPClassType) t;
|
||||||
if (t instanceof ICPPClassType) {
|
ICPPConstructor[] constructors = classType.getConstructors();
|
||||||
ICPPClassType classType= (ICPPClassType) t;
|
for (ICPPConstructor constructor : constructors) {
|
||||||
ICPPConstructor[] constructors = classType.getConstructors();
|
handleFunction(constructor, context, baseRelevance, proposals);
|
||||||
for (ICPPConstructor constructor : constructors) {
|
|
||||||
handleFunction(constructor, context, baseRelevance, proposals);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -477,12 +470,9 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
|
||||||
repStringBuff.append(variable.getName());
|
repStringBuff.append(variable.getName());
|
||||||
|
|
||||||
String returnTypeStr = "<unknown>"; //$NON-NLS-1$
|
String returnTypeStr = "<unknown>"; //$NON-NLS-1$
|
||||||
try {
|
IType varType = variable.getType();
|
||||||
IType varType = variable.getType();
|
if (varType != null)
|
||||||
if (varType != null)
|
returnTypeStr = ASTTypeUtil.getType(varType, false);
|
||||||
returnTypeStr = ASTTypeUtil.getType(varType, false);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuilder dispStringBuff = new StringBuilder(repStringBuff.toString());
|
StringBuilder dispStringBuff = new StringBuilder(repStringBuff.toString());
|
||||||
if (returnTypeStr != null) {
|
if (returnTypeStr != null) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue