mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Code streamlining.
This commit is contained in:
parent
35044af3ee
commit
11f921e614
7 changed files with 135 additions and 154 deletions
|
@ -446,11 +446,11 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
||||||
|
|
||||||
IBinding b1 = getBindingFromASTName("c; ", 1);
|
IBinding b1 = getBindingFromASTName("c; ", 1);
|
||||||
assertVariable(b1, "c", ICPPClassType.class, "C");
|
assertVariable(b1, "c", ICPPClassType.class, "C");
|
||||||
ICPPClassType b1type = (ICPPClassType)((ICPPVariable)b1).getType();
|
ICPPClassType b1type = (ICPPClassType) ((ICPPVariable) b1).getType();
|
||||||
assertClassTypeBinding(b1type, "C", ICPPClassType.k_class, 0, 0, 0, 4, 0, 0, 0, 2, 0);
|
assertClassTypeBinding(b1type, "C", ICPPClassType.k_class, 0, 0, 0, 4, 0, 0, 0, 2, 0);
|
||||||
assertTrue(b1type.getScope() == null);
|
assertTrue(b1type.getScope() == null);
|
||||||
assertTrue(b1type.getCompositeScope() instanceof ICPPClassScope);
|
assertTrue(b1type.getCompositeScope() instanceof ICPPClassScope);
|
||||||
assertClassTypeBinding(((ICPPClassScope)b1type.getCompositeScope()).getClassType(), "C", ICPPClassType.k_class, 0, 0, 0, 4, 0, 0, 0, 2, 0);
|
assertClassTypeBinding(((ICPPClassScope) b1type.getCompositeScope()).getClassType(), "C", ICPPClassType.k_class, 0, 0, 0, 4, 0, 0, 0, 2, 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
IBinding b2 = getBindingFromASTName("S s;", 1);
|
IBinding b2 = getBindingFromASTName("S s;", 1);
|
||||||
|
@ -458,7 +458,7 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
||||||
|
|
||||||
IBinding b3 = getBindingFromASTName("s;", 1);
|
IBinding b3 = getBindingFromASTName("s;", 1);
|
||||||
assertVariable(b3, "s", ICPPClassType.class, "S");
|
assertVariable(b3, "s", ICPPClassType.class, "S");
|
||||||
ICPPClassType b3type = (ICPPClassType)((ICPPVariable)b3).getType();
|
ICPPClassType b3type = (ICPPClassType) ((ICPPVariable) b3).getType();
|
||||||
assertClassTypeBinding(b3type, "S", ICompositeType.k_struct, 0, 0, 0, 4, 0, 0, 0, 2, 0);
|
assertClassTypeBinding(b3type, "S", ICompositeType.k_struct, 0, 0, 0, 4, 0, 0, 0, 2, 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -467,7 +467,7 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
||||||
|
|
||||||
IBinding b5 = getBindingFromASTName("u; ", 1);
|
IBinding b5 = getBindingFromASTName("u; ", 1);
|
||||||
assertVariable(b5, "u", ICPPClassType.class, "U");
|
assertVariable(b5, "u", ICPPClassType.class, "U");
|
||||||
ICPPClassType b5type = (ICPPClassType)((ICPPVariable)b5).getType();
|
ICPPClassType b5type = (ICPPClassType) ((ICPPVariable) b5).getType();
|
||||||
assertClassTypeBinding(b5type, "U", ICompositeType.k_union, 0, 0, 0, 4, 0, 0, 0, 2, 0);
|
assertClassTypeBinding(b5type, "U", ICompositeType.k_union, 0, 0, 0, 4, 0, 0, 0, 2, 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -476,7 +476,7 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
||||||
|
|
||||||
IBinding b7 = getBindingFromASTName("e; ", 1);
|
IBinding b7 = getBindingFromASTName("e; ", 1);
|
||||||
assertVariable(b7, "e", IEnumeration.class, "E");
|
assertVariable(b7, "e", IEnumeration.class, "E");
|
||||||
IEnumeration b5type = (IEnumeration)((ICPPVariable)b7).getType();
|
IEnumeration b5type = (IEnumeration) ((ICPPVariable) b7).getType();
|
||||||
assertEnumeration(b5type, "E", new String[] {"ER1","ER2","ER3"});
|
assertEnumeration(b5type, "E", new String[] {"ER1","ER2","ER3"});
|
||||||
assertTrue(b5type.getScope() == null);
|
assertTrue(b5type.getScope() == null);
|
||||||
}
|
}
|
||||||
|
@ -487,13 +487,13 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
||||||
{
|
{
|
||||||
IBinding b9 = getBindingFromASTName("var2 = c;", 4);
|
IBinding b9 = getBindingFromASTName("var2 = c;", 4);
|
||||||
assertVariable(b9, "var2", ICPPClassType.class, "C");
|
assertVariable(b9, "var2", ICPPClassType.class, "C");
|
||||||
ICPPClassType b9type = (ICPPClassType)((ICPPVariable)b9).getType();
|
ICPPClassType b9type = (ICPPClassType) ((ICPPVariable) b9).getType();
|
||||||
assertClassTypeBinding(b9type, "C", ICPPClassType.k_class, 0, 0, 0, 4, 0, 0, 0, 2, 0);
|
assertClassTypeBinding(b9type, "C", ICPPClassType.k_class, 0, 0, 0, 4, 0, 0, 0, 2, 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
IBinding b10 = getBindingFromASTName("var3 = &s;", 4);
|
IBinding b10 = getBindingFromASTName("var3 = &s;", 4);
|
||||||
assertVariable(b10, "var3", IPointerType.class, null);
|
assertVariable(b10, "var3", IPointerType.class, null);
|
||||||
IPointerType b10type = (IPointerType) ((ICPPVariable)b10).getType();
|
IPointerType b10type = (IPointerType) ((ICPPVariable) b10).getType();
|
||||||
assertClassTypeBinding((ICPPClassType) b10type.getType(), "S", ICompositeType.k_struct, 0, 0, 0, 4, 0, 0, 0, 2, 0);
|
assertClassTypeBinding((ICPPClassType) b10type.getType(), "S", ICompositeType.k_struct, 0, 0, 0, 4, 0, 0, 0, 2, 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,7 +60,7 @@ import org.eclipse.core.runtime.Path;
|
||||||
/**
|
/**
|
||||||
* This is a utility class to help convert AST elements to Strings corresponding to
|
* This is a utility class to help convert AST elements to Strings corresponding to
|
||||||
* the AST element's type.
|
* the AST element's type.
|
||||||
*
|
*
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||||
*/
|
*/
|
||||||
|
@ -71,16 +71,16 @@ public class ASTTypeUtil {
|
||||||
private static final int DEAULT_ITYPE_SIZE = 2;
|
private static final int DEAULT_ITYPE_SIZE = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a string representation for the parameters of the given function type.
|
* Returns a string representation for the parameters of the given function type.
|
||||||
* The representation contains the comma-separated list of the normalized parameter
|
* The representation contains the comma-separated list of the normalized parameter
|
||||||
* type representations wrapped in parentheses.
|
* type representations wrapped in parentheses.
|
||||||
*/
|
*/
|
||||||
public static String getParameterTypeString(IFunctionType type) {
|
public static String getParameterTypeString(IFunctionType type) {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
appendParameterTypeString(type, result);
|
appendParameterTypeString(type, result);
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void appendParameterTypeString(IFunctionType ft, StringBuilder result) {
|
private static void appendParameterTypeString(IFunctionType ft, StringBuilder result) {
|
||||||
IType[] types = ft.getParameterTypes();
|
IType[] types = ft.getParameterTypes();
|
||||||
result.append(Keywords.cpLPAREN);
|
result.append(Keywords.cpLPAREN);
|
||||||
|
@ -102,9 +102,8 @@ public class ASTTypeUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Whether the function matching the given function binding takes
|
* Returns whether the function matching the given function binding takes parameters or not.
|
||||||
* parameters or not.
|
*
|
||||||
*
|
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
public static boolean functionTakesParameters(IFunction function) {
|
public static boolean functionTakesParameters(IFunction function) {
|
||||||
|
@ -112,17 +111,16 @@ public class ASTTypeUtil {
|
||||||
|
|
||||||
if (parameters.length == 0) {
|
if (parameters.length == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (parameters.length == 1 && SemanticUtil.isVoidType(parameters[0].getType())) {
|
if (parameters.length == 1 && SemanticUtil.isVoidType(parameters[0].getType())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a string representation for the type array. The representation is
|
* Returns a string representation for the type array. The representation is a comma-separated
|
||||||
* a comma-separated list of the normalized string representations of the
|
* list of the normalized string representations of the provided types.
|
||||||
* provided types.
|
|
||||||
* @see #getTypeListString(IType[], boolean)
|
* @see #getTypeListString(IType[], boolean)
|
||||||
*/
|
*/
|
||||||
public static String getTypeListString(IType[] types) {
|
public static String getTypeListString(IType[] types) {
|
||||||
|
@ -133,7 +131,8 @@ public class ASTTypeUtil {
|
||||||
* Returns a String representation of the type array as a
|
* Returns a String representation of the type array as a
|
||||||
* comma-separated list.
|
* comma-separated list.
|
||||||
* @param types
|
* @param types
|
||||||
* @return representation of the type array as a comma-separated list
|
* @param normalize indicates whether normalization shall be performed
|
||||||
|
* @return representation of the type array as a comma-separated list
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
public static String getTypeListString(IType[] types, boolean normalize) {
|
public static String getTypeListString(IType[] types, boolean normalize) {
|
||||||
|
@ -147,10 +146,10 @@ public class ASTTypeUtil {
|
||||||
}
|
}
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a comma-separated list of the string representations of the arguments, enclosed
|
* Returns a comma-separated list of the string representations of the arguments, enclosed
|
||||||
* in angle brackets.
|
* in angle brackets.
|
||||||
* Optionally normalization is performed:
|
* Optionally normalization is performed:
|
||||||
* <br> template parameter names are represented by their parameter position,
|
* <br> template parameter names are represented by their parameter position,
|
||||||
* <br> further normalization may be performed in future versions.
|
* <br> further normalization may be performed in future versions.
|
||||||
|
@ -164,20 +163,18 @@ public class ASTTypeUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void appendArgumentList(ICPPTemplateArgument[] args, boolean normalize, StringBuilder result) {
|
private static void appendArgumentList(ICPPTemplateArgument[] args, boolean normalize, StringBuilder result) {
|
||||||
boolean first= true;
|
|
||||||
result.append('<');
|
result.append('<');
|
||||||
for (ICPPTemplateArgument arg : args) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
if (!first) {
|
if (i != 0) {
|
||||||
result.append(',');
|
result.append(',');
|
||||||
}
|
}
|
||||||
first= false;
|
appendArgument(args[i], normalize, result);
|
||||||
appendArgument(arg, normalize, result);
|
|
||||||
}
|
}
|
||||||
result.append('>');
|
result.append('>');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a string representation for an template argument. Optionally
|
* Returns a string representation for an template argument. Optionally
|
||||||
* normalization is performed:
|
* normalization is performed:
|
||||||
* <br> template parameter names are represented by their parameter position,
|
* <br> template parameter names are represented by their parameter position,
|
||||||
* <br> further normalization may be performed in future versions.
|
* <br> further normalization may be performed in future versions.
|
||||||
|
@ -189,7 +186,7 @@ public class ASTTypeUtil {
|
||||||
appendArgument(arg, normalize, buf);
|
appendArgument(arg, normalize, buf);
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void appendArgument(ICPPTemplateArgument arg, boolean normalize, StringBuilder buf) {
|
private static void appendArgument(ICPPTemplateArgument arg, boolean normalize, StringBuilder buf) {
|
||||||
IValue val= arg.getNonTypeValue();
|
IValue val= arg.getNonTypeValue();
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
|
@ -209,19 +206,19 @@ public class ASTTypeUtil {
|
||||||
public static String[] getParameterTypeStringArray(IFunctionType type) {
|
public static String[] getParameterTypeStringArray(IFunctionType type) {
|
||||||
IType[] parms = type.getParameterTypes();
|
IType[] parms = type.getParameterTypes();
|
||||||
String[] result = new String[parms.length];
|
String[] result = new String[parms.length];
|
||||||
|
|
||||||
for (int i = 0; i < parms.length; i++) {
|
for (int i = 0; i < parms.length; i++) {
|
||||||
if (parms[i] != null) {
|
if (parms[i] != null) {
|
||||||
result[i] = getType(parms[i]);
|
result[i] = getType(parms[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void appendTypeString(IType type, boolean normalize, StringBuilder result) {
|
private static void appendTypeString(IType type, boolean normalize, StringBuilder result) {
|
||||||
boolean needSpace = false;
|
boolean needSpace = false;
|
||||||
|
|
||||||
if (type instanceof IArrayType) {
|
if (type instanceof IArrayType) {
|
||||||
result.append(Keywords.cpLBRACKET);
|
result.append(Keywords.cpLBRACKET);
|
||||||
if (type instanceof ICArrayType) {
|
if (type instanceof ICArrayType) {
|
||||||
|
@ -247,7 +244,7 @@ public class ASTTypeUtil {
|
||||||
}
|
}
|
||||||
result.append(Keywords.VOLATILE);
|
result.append(Keywords.VOLATILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IValue val= ((IArrayType) type).getSize();
|
IValue val= ((IArrayType) type).getSize();
|
||||||
if (val != null && val != Value.UNKNOWN) {
|
if (val != null && val != Value.UNKNOWN) {
|
||||||
if (normalize) {
|
if (normalize) {
|
||||||
|
@ -295,7 +292,7 @@ public class ASTTypeUtil {
|
||||||
result.append(SPACE); needSpace = false;
|
result.append(SPACE); needSpace = false;
|
||||||
}
|
}
|
||||||
result.append(Keywords.LONG_LONG); needSpace = true;
|
result.append(Keywords.LONG_LONG); needSpace = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (basicType.isComplex()) {
|
if (basicType.isComplex()) {
|
||||||
if (needSpace) {
|
if (needSpace) {
|
||||||
|
@ -309,7 +306,7 @@ public class ASTTypeUtil {
|
||||||
}
|
}
|
||||||
result.append(Keywords.c_IMAGINARY); needSpace = true;
|
result.append(Keywords.c_IMAGINARY); needSpace = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case eChar:
|
case eChar:
|
||||||
if (needSpace) result.append(SPACE);
|
if (needSpace) result.append(SPACE);
|
||||||
|
@ -420,7 +417,7 @@ public class ASTTypeUtil {
|
||||||
result.append(Keywords.RESTRICT); needSpace = true;
|
result.append(Keywords.RESTRICT); needSpace = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IQualifierType qt= (IQualifierType) type;
|
IQualifierType qt= (IQualifierType) type;
|
||||||
needSpace= appendCVQ(result, needSpace, qt.isConst(), qt.isVolatile(), false);
|
needSpace= appendCVQ(result, needSpace, qt.isConst(), qt.isVolatile(), false);
|
||||||
} else if (type instanceof TypeOfDependentExpression) {
|
} else if (type instanceof TypeOfDependentExpression) {
|
||||||
|
@ -428,7 +425,7 @@ public class ASTTypeUtil {
|
||||||
} else if (type instanceof ISemanticProblem) {
|
} else if (type instanceof ISemanticProblem) {
|
||||||
result.append('?');
|
result.append('?');
|
||||||
} else if (type != null) {
|
} else if (type != null) {
|
||||||
result.append('@').append(type.hashCode());
|
result.append('@').append(type.hashCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,23 +444,23 @@ public class ASTTypeUtil {
|
||||||
final boolean isVolatile, final boolean isRestrict) {
|
final boolean isVolatile, final boolean isRestrict) {
|
||||||
if (isConst) {
|
if (isConst) {
|
||||||
if (needSpace) {
|
if (needSpace) {
|
||||||
target.append(SPACE);
|
target.append(SPACE);
|
||||||
}
|
}
|
||||||
target.append(Keywords.CONST);
|
target.append(Keywords.CONST);
|
||||||
needSpace = true;
|
needSpace = true;
|
||||||
}
|
}
|
||||||
if (isVolatile) {
|
if (isVolatile) {
|
||||||
if (needSpace) {
|
if (needSpace) {
|
||||||
target.append(SPACE);
|
target.append(SPACE);
|
||||||
}
|
}
|
||||||
target.append(Keywords.VOLATILE);
|
target.append(Keywords.VOLATILE);
|
||||||
needSpace = true;
|
needSpace = true;
|
||||||
}
|
}
|
||||||
if (isRestrict) {
|
if (isRestrict) {
|
||||||
if (needSpace) {
|
if (needSpace) {
|
||||||
target.append(SPACE);
|
target.append(SPACE);
|
||||||
}
|
}
|
||||||
target.append(Keywords.RESTRICT);
|
target.append(Keywords.RESTRICT);
|
||||||
needSpace = true;
|
needSpace = true;
|
||||||
}
|
}
|
||||||
return needSpace;
|
return needSpace;
|
||||||
|
@ -472,21 +469,21 @@ public class ASTTypeUtil {
|
||||||
private static void appendRefQualifier(StringBuilder target, boolean needSpace,
|
private static void appendRefQualifier(StringBuilder target, boolean needSpace,
|
||||||
boolean isRValueReference) {
|
boolean isRValueReference) {
|
||||||
if (needSpace) {
|
if (needSpace) {
|
||||||
target.append(SPACE);
|
target.append(SPACE);
|
||||||
}
|
}
|
||||||
target.append(isRValueReference ? Keywords.cpAND : Keywords.cpAMPER);
|
target.append(isRValueReference ? Keywords.cpAND : Keywords.cpAMPER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the normalized string representation of the type.
|
* Returns the normalized string representation of the type.
|
||||||
* @see #getType(IType, boolean)
|
* @see #getType(IType, boolean)
|
||||||
*/
|
*/
|
||||||
public static String getType(IType type) {
|
public static String getType(IType type) {
|
||||||
return getType(type, true);
|
return getType(type, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a string representation of a type.
|
* Returns a string representation of a type.
|
||||||
* Optionally the representation is normalized:
|
* Optionally the representation is normalized:
|
||||||
* <br> typedefs are resolved
|
* <br> typedefs are resolved
|
||||||
* <br> template parameter names are represented by their parameter position
|
* <br> template parameter names are represented by their parameter position
|
||||||
|
@ -500,67 +497,68 @@ public class ASTTypeUtil {
|
||||||
appendType(type, normalize, result);
|
appendType(type, normalize, result);
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends the the result of {@link #getType(IType, boolean)} to the given buffer.
|
* Appends the the result of {@link #getType(IType, boolean)} to the given buffer.
|
||||||
* @since 5.3
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
public static void appendType(IType type, boolean normalize, StringBuilder result) {
|
public static void appendType(IType type, boolean normalize, StringBuilder result) {
|
||||||
IType[] types = new IType[DEAULT_ITYPE_SIZE];
|
IType[] types = new IType[DEAULT_ITYPE_SIZE];
|
||||||
|
int numTypes = 0;
|
||||||
// Push all of the types onto the stack
|
|
||||||
|
// Push all of the types onto the stack.
|
||||||
int i = 0;
|
int i = 0;
|
||||||
IQualifierType cvq= null;
|
IQualifierType cvq= null;
|
||||||
ICPPReferenceType ref= null;
|
ICPPReferenceType ref= null;
|
||||||
while (type != null && ++i < 100) {
|
while (type != null && ++i < 100) {
|
||||||
if (type instanceof ITypedef) {
|
if (type instanceof ITypedef) {
|
||||||
if (normalize) {
|
// If normalization was not requested, skip the typedef and proceed with its target
|
||||||
// Skip the typedef and proceed with its target type.
|
// type.
|
||||||
} else {
|
if (!normalize) {
|
||||||
// Output reference, qualifier and typedef, then stop.
|
// Output reference, qualifier and typedef, then stop.
|
||||||
if (ref != null) {
|
if (ref != null) {
|
||||||
types = ArrayUtil.append(IType.class, types, ref);
|
types = ArrayUtil.appendAt(types, numTypes++, ref);
|
||||||
ref= null;
|
ref= null;
|
||||||
}
|
}
|
||||||
if (cvq != null) {
|
if (cvq != null) {
|
||||||
types = ArrayUtil.append(IType.class, types, cvq);
|
types = ArrayUtil.appendAt(types, numTypes++, cvq);
|
||||||
cvq= null;
|
cvq= null;
|
||||||
}
|
}
|
||||||
types = ArrayUtil.append(IType.class, types, type);
|
types = ArrayUtil.appendAt(types, numTypes++, type);
|
||||||
type= null;
|
type= null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (type instanceof ICPPReferenceType) {
|
if (type instanceof ICPPReferenceType) {
|
||||||
// Reference types ignore cv-qualifiers
|
// Reference types ignore cv-qualifiers.
|
||||||
cvq= null;
|
cvq= null;
|
||||||
// Lvalue references win over rvalue references
|
// Lvalue references win over rvalue references.
|
||||||
if (ref == null || ref.isRValueReference()) {
|
if (ref == null || ref.isRValueReference()) {
|
||||||
// Delay reference to see if there are more
|
// Delay reference to see if there are more.
|
||||||
ref= (ICPPReferenceType) type;
|
ref= (ICPPReferenceType) type;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (cvq != null) {
|
if (cvq != null) {
|
||||||
// Merge cv qualifiers
|
// Merge cv qualifiers.
|
||||||
if (type instanceof IQualifierType || type instanceof IPointerType) {
|
if (type instanceof IQualifierType || type instanceof IPointerType) {
|
||||||
type= SemanticUtil.addQualifiers(type, cvq.isConst(), cvq.isVolatile(), false);
|
type= SemanticUtil.addQualifiers(type, cvq.isConst(), cvq.isVolatile(), false);
|
||||||
cvq= null;
|
cvq= null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type instanceof IQualifierType) {
|
if (type instanceof IQualifierType) {
|
||||||
// Delay cv qualifier to merge it with others
|
// Delay cv qualifier to merge it with others
|
||||||
cvq= (IQualifierType) type;
|
cvq= (IQualifierType) type;
|
||||||
} else {
|
} else {
|
||||||
// No reference, no cv qualifier: output reference and cv-qualifier
|
// No reference, no cv qualifier: output reference and cv-qualifier.
|
||||||
if (ref != null) {
|
if (ref != null) {
|
||||||
types = ArrayUtil.append(IType.class, types, ref);
|
types = ArrayUtil.appendAt(types, numTypes++, ref);
|
||||||
ref= null;
|
ref= null;
|
||||||
}
|
}
|
||||||
if (cvq != null) {
|
if (cvq != null) {
|
||||||
types = ArrayUtil.append(IType.class, types, cvq);
|
types = ArrayUtil.appendAt(types, numTypes++, cvq);
|
||||||
cvq= null;
|
cvq= null;
|
||||||
}
|
}
|
||||||
types = ArrayUtil.append(IType.class, types, type);
|
types = ArrayUtil.appendAt(types, numTypes++, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type instanceof ITypeContainer) {
|
if (type instanceof ITypeContainer) {
|
||||||
|
@ -570,30 +568,30 @@ public class ASTTypeUtil {
|
||||||
} else {
|
} else {
|
||||||
type= null;
|
type= null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pop all of the types off of the stack, and build the string representation while doing so.
|
// Pop all of the types from the stack, and build the string representation while doing so.
|
||||||
List<IType> postfix= null;
|
List<IType> postfix= null;
|
||||||
BitSet parenthesis= null;
|
BitSet parenthesis= null;
|
||||||
boolean needParenthesis= false;
|
boolean needParenthesis= false;
|
||||||
boolean needSpace= false;
|
boolean needSpace= false;
|
||||||
for (int j = types.length; --j >= 0;) {
|
for (int j = numTypes; --j >= 0;) {
|
||||||
IType tj = types[j];
|
IType tj = types[j];
|
||||||
if (tj != null) {
|
if (tj != null) {
|
||||||
if (j > 0 && types[j - 1] instanceof IQualifierType) {
|
if (j > 0 && types[j - 1] instanceof IQualifierType) {
|
||||||
if (needSpace)
|
if (needSpace)
|
||||||
result.append(SPACE);
|
result.append(SPACE);
|
||||||
appendTypeString(types[j - 1], normalize, result);
|
appendTypeString(types[j - 1], normalize, result);
|
||||||
result.append(SPACE);
|
result.append(SPACE);
|
||||||
appendTypeString(tj, normalize, result);
|
appendTypeString(tj, normalize, result);
|
||||||
needSpace= true;
|
needSpace= true;
|
||||||
--j;
|
--j;
|
||||||
} else {
|
} else {
|
||||||
// Handle post-fix
|
// Handle post-fix.
|
||||||
if (tj instanceof IFunctionType || tj instanceof IArrayType) {
|
if (tj instanceof IFunctionType || tj instanceof IArrayType) {
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
if (needSpace)
|
if (needSpace)
|
||||||
result.append(SPACE);
|
result.append(SPACE);
|
||||||
appendTypeString(tj, normalize, result);
|
appendTypeString(tj, normalize, result);
|
||||||
needSpace= true;
|
needSpace= true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -635,18 +633,18 @@ public class ASTTypeUtil {
|
||||||
/**
|
/**
|
||||||
* For testing purposes, only.
|
* For testing purposes, only.
|
||||||
* Returns the normalized string representation of the type defined by the given declarator.
|
* Returns the normalized string representation of the type defined by the given declarator.
|
||||||
*
|
*
|
||||||
* @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 getType(IASTDeclarator declarator) {
|
public static String getType(IASTDeclarator declarator) {
|
||||||
// get the most nested declarator
|
// Get the most nested declarator.
|
||||||
while (declarator.getNestedDeclarator() != null) {
|
while (declarator.getNestedDeclarator() != null) {
|
||||||
declarator = declarator.getNestedDeclarator();
|
declarator = declarator.getNestedDeclarator();
|
||||||
}
|
}
|
||||||
|
|
||||||
IBinding binding = declarator.getName().resolveBinding();
|
IBinding binding = declarator.getName().resolveBinding();
|
||||||
IType type = null;
|
IType type = null;
|
||||||
|
|
||||||
if (binding instanceof IEnumerator) {
|
if (binding instanceof IEnumerator) {
|
||||||
type = ((IEnumerator)binding).getType();
|
type = ((IEnumerator)binding).getType();
|
||||||
} else if (binding instanceof IFunction) {
|
} else if (binding instanceof IFunction) {
|
||||||
|
@ -656,18 +654,18 @@ public class ASTTypeUtil {
|
||||||
} else if (binding instanceof IVariable) {
|
} else if (binding instanceof IVariable) {
|
||||||
type = ((IVariable)binding).getType();
|
type = ((IVariable)binding).getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
return getType(type);
|
return getType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For testing purposes, only.
|
* For testing purposes, only.
|
||||||
* Return's the String representation of a node's type (if available).
|
* Return's the String representation of a node's type (if available).
|
||||||
*
|
*
|
||||||
* @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) {
|
||||||
|
@ -681,13 +679,13 @@ public class ASTTypeUtil {
|
||||||
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);
|
||||||
|
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the type representation of the IASTTypeId as a String.
|
* Returns the type representation of the IASTTypeId as a String.
|
||||||
*
|
*
|
||||||
* @param typeId
|
* @param typeId
|
||||||
* @return the type representation of the IASTTypeId as a String
|
* @return the type representation of the IASTTypeId as a String
|
||||||
*/
|
*/
|
||||||
|
@ -696,20 +694,20 @@ public class ASTTypeUtil {
|
||||||
return createCType(typeId.getAbstractDeclarator());
|
return createCType(typeId.getAbstractDeclarator());
|
||||||
else if (typeId instanceof CPPASTTypeId)
|
else if (typeId instanceof CPPASTTypeId)
|
||||||
return createCPPType(typeId.getAbstractDeclarator());
|
return createCPPType(typeId.getAbstractDeclarator());
|
||||||
|
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String createCType(IASTDeclarator declarator) {
|
private static String createCType(IASTDeclarator declarator) {
|
||||||
IType type = CVisitor.createType(declarator);
|
IType type = CVisitor.createType(declarator);
|
||||||
return getType(type);
|
return getType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String createCPPType(IASTDeclarator declarator) {
|
private static String createCPPType(IASTDeclarator declarator) {
|
||||||
IType type = CPPVisitor.createType(declarator);
|
IType type = CPPVisitor.createType(declarator);
|
||||||
return getType(type);
|
return getType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated don't use it does something strange
|
* @deprecated don't use it does something strange
|
||||||
*/
|
*/
|
||||||
|
@ -744,7 +742,7 @@ public class ASTTypeUtil {
|
||||||
appendCppName(binding, false, true, buf);
|
appendCppName(binding, false, true, buf);
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void appendCppName(IBinding binding, boolean normalize, boolean qualify, StringBuilder result) {
|
private static void appendCppName(IBinding binding, boolean normalize, boolean qualify, StringBuilder result) {
|
||||||
ICPPTemplateParameter tpar= getTemplateParameter(binding);
|
ICPPTemplateParameter tpar= getTemplateParameter(binding);
|
||||||
if (tpar != null) {
|
if (tpar != null) {
|
||||||
|
@ -784,18 +782,18 @@ public class ASTTypeUtil {
|
||||||
}
|
}
|
||||||
appendNameCheckAnonymous(binding, result);
|
appendNameCheckAnonymous(binding, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (binding instanceof ICPPTemplateInstance) {
|
if (binding instanceof ICPPTemplateInstance) {
|
||||||
appendArgumentList(((ICPPTemplateInstance) binding).getTemplateArguments(), normalize, result);
|
appendArgumentList(((ICPPTemplateInstance) binding).getTemplateArguments(), normalize, result);
|
||||||
} else if (binding instanceof ICPPUnknownMemberClassInstance) {
|
} else if (binding instanceof ICPPUnknownMemberClassInstance) {
|
||||||
appendArgumentList(((ICPPUnknownMemberClassInstance) binding).getArguments(), normalize, result);
|
appendArgumentList(((ICPPUnknownMemberClassInstance) binding).getArguments(), normalize, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ICPPTemplateParameter getTemplateParameter(IBinding binding) {
|
private static ICPPTemplateParameter getTemplateParameter(IBinding binding) {
|
||||||
if (binding instanceof ICPPTemplateParameter)
|
if (binding instanceof ICPPTemplateParameter)
|
||||||
return (ICPPTemplateParameter) binding;
|
return (ICPPTemplateParameter) binding;
|
||||||
|
|
||||||
if (binding instanceof ICPPDeferredClassInstance)
|
if (binding instanceof ICPPDeferredClassInstance)
|
||||||
return getTemplateParameter(((ICPPDeferredClassInstance) binding).getTemplateDefinition());
|
return getTemplateParameter(((ICPPDeferredClassInstance) binding).getTemplateDefinition());
|
||||||
|
|
||||||
|
@ -816,10 +814,10 @@ public class ASTTypeUtil {
|
||||||
appendNameForAnonymous(binding, result);
|
appendNameForAnonymous(binding, result);
|
||||||
if (result.length() == 0)
|
if (result.length() == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return extractChars(result);
|
return extractChars(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static char[] extractChars(StringBuilder buf) {
|
private static char[] extractChars(StringBuilder buf) {
|
||||||
final int length = buf.length();
|
final int length = buf.length();
|
||||||
char[] result= new char[length];
|
char[] result= new char[length];
|
||||||
|
|
|
@ -143,79 +143,51 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return node instanceof IASTName ? new String(((IASTName) node).getSimpleID()) : CPPSemantics.EMPTY_NAME;
|
return node instanceof IASTName ? new String(((IASTName) node).getSimpleID()) : CPPSemantics.EMPTY_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getNameCharArray()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public char[] getNameCharArray() {
|
public char[] getNameCharArray() {
|
||||||
return node instanceof IASTName ? ((IASTName) node).getSimpleID() : CharArrayUtils.EMPTY;
|
return node instanceof IASTName ? ((IASTName) node).getSimpleID() : CharArrayUtils.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IScope getScope() throws DOMException {
|
public IScope getScope() throws DOMException {
|
||||||
throw new DOMException(this);
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getPhysicalNode()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IASTNode getPhysicalNode() {
|
public IASTNode getPhysicalNode() {
|
||||||
return getASTNode();
|
return getASTNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
// Don't clone problems
|
// Don't clone problems.
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getParent()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IScope getParent() throws DOMException {
|
public IScope getParent() throws DOMException {
|
||||||
throw new DOMException(this);
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IBinding[] find(String name) {
|
public IBinding[] find(String name) {
|
||||||
return IBinding.EMPTY_BINDING_ARRAY;
|
return IBinding.EMPTY_BINDING_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getScopeName()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IName getScopeName() {
|
public IName getScopeName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#addName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void addName(IASTName name) {
|
public void addName(IASTName name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IBinding getBinding(IASTName name, boolean resolve) {
|
public IBinding getBinding(IASTName name, boolean resolve) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -226,37 +198,22 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
||||||
return IBinding.EMPTY_BINDING_ARRAY;
|
return IBinding.EMPTY_BINDING_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) {
|
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean)
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #getBindings(ScopeLookupData)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) {
|
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet) {
|
||||||
return getBindings(new ScopeLookupData(name, resolve, prefixLookup));
|
return getBindings(new ScopeLookupData(name, resolve, prefixLookup));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IBinding[] getBindings(ScopeLookupData lookup) {
|
public IBinding[] getBindings(ScopeLookupData lookup) {
|
||||||
return IBinding.EMPTY_BINDING_ARRAY;
|
return IBinding.EMPTY_BINDING_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSameType(IType type) {
|
public boolean isSameType(IType type) {
|
||||||
return type == this;
|
return type == this;
|
||||||
|
@ -320,76 +277,99 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
||||||
public void removeNestedFromCache(IASTNode container) {
|
public void removeNestedFromCache(IASTNode container) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dummy methods for derived classes
|
// Dummy methods for derived classes.
|
||||||
public IType getType() {
|
public IType getType() {
|
||||||
return new ProblemType(getID());
|
return new ProblemType(getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStatic() {
|
public boolean isStatic() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getQualifiedName() throws DOMException {
|
public String[] getQualifiedName() throws DOMException {
|
||||||
throw new DOMException(this);
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public char[][] getQualifiedNameCharArray() throws DOMException {
|
public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||||
throw new DOMException(this);
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isGloballyQualified() throws DOMException {
|
public boolean isGloballyQualified() throws DOMException {
|
||||||
throw new DOMException(this);
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMutable() {
|
public boolean isMutable() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExtern() {
|
public boolean isExtern() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExternC() {
|
public boolean isExternC() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAuto() {
|
public boolean isAuto() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRegister() {
|
public boolean isRegister() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public IValue getInitialValue() {
|
|
||||||
|
public IValue getInitialValue() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public boolean isAnonymous() {
|
|
||||||
|
public boolean isAnonymous() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public boolean isDeleted() {
|
|
||||||
|
public boolean isDeleted() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInline() {
|
public boolean isInline() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean takesVarArgs() {
|
public boolean takesVarArgs() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public IType[] getExceptionSpecification() {
|
|
||||||
|
public IType[] getExceptionSpecification() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasParameterPack() {
|
public boolean hasParameterPack() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVirtual() {
|
public boolean isVirtual() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPureVirtual() {
|
public boolean isPureVirtual() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isImplicit() {
|
public boolean isImplicit() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public boolean isExplicit() {
|
|
||||||
|
public boolean isExplicit() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasDefaultValue() {
|
public boolean hasDefaultValue() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IValue getDefaultValue() {
|
public IValue getDefaultValue() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isParameterPack() {
|
public boolean isParameterPack() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.IName;
|
import org.eclipse.cdt.core.dom.IName;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.EScopeKind;
|
import org.eclipse.cdt.core.dom.ast.EScopeKind;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
|
@ -84,7 +83,7 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IScope getParent() throws DOMException {
|
public IScope getParent() {
|
||||||
//we can't just resolve the function and get its parent scope, since there are cases where that
|
//we can't just resolve the function and get its parent scope, since there are cases where that
|
||||||
//could loop since resolving functions requires resolving their parameter types
|
//could loop since resolving functions requires resolving their parameter types
|
||||||
IASTFunctionDeclarator fdtor = (IASTFunctionDeclarator) getPhysicalNode();
|
IASTFunctionDeclarator fdtor = (IASTFunctionDeclarator) getPhysicalNode();
|
||||||
|
|
|
@ -17,7 +17,6 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IName;
|
import org.eclipse.cdt.core.dom.IName;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
|
@ -78,7 +77,7 @@ abstract public class CPPScope implements ICPPASTInternalScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IScope getParent() throws DOMException {
|
public IScope getParent() {
|
||||||
return CPPVisitor.getContainingNonTemplateScope(physicalNode);
|
return CPPVisitor.getContainingNonTemplateScope(physicalNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,7 @@ public class CPPScopeMapper {
|
||||||
public IBinding[] getBindings(ScopeLookupData lookup) {
|
public IBinding[] getBindings(ScopeLookupData lookup) {
|
||||||
return fScope.getBindings(lookup);
|
return fScope.getBindings(lookup);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IScope getParent() throws DOMException {
|
public IScope getParent() throws DOMException {
|
||||||
IScope parent= fScope.getParent();
|
IScope parent= fScope.getParent();
|
||||||
|
|
|
@ -14,15 +14,19 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Non API methods for cpp bindings.
|
* Non API methods for C++ bindings.
|
||||||
*/
|
*/
|
||||||
public interface ICPPInternalBinding extends ICPPBinding {
|
public interface ICPPInternalBinding extends ICPPBinding {
|
||||||
|
/**
|
||||||
|
* Returns the definition of the binding, or {@code null} if the binding doesn't have
|
||||||
|
* a definition.
|
||||||
|
*/
|
||||||
IASTNode getDefinition();
|
IASTNode getDefinition();
|
||||||
|
|
||||||
/** Implementors must keep the node with the lowest offset in declarations[0] */
|
/** Implementors must keep the node with the lowest offset in declarations[0] */
|
||||||
IASTNode[] getDeclarations();
|
IASTNode[] getDeclarations();
|
||||||
|
|
||||||
void addDefinition(IASTNode node);
|
void addDefinition(IASTNode node);
|
||||||
|
|
||||||
void addDeclaration(IASTNode node);
|
void addDeclaration(IASTNode node);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue