mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
Cosmetics.
This commit is contained in:
parent
234f14db57
commit
cfe498ae3b
10 changed files with 63 additions and 71 deletions
|
@ -35,7 +35,7 @@ public class CPPAliasTemplateInstance extends PlatformObject
|
||||||
private final ICPPAliasTemplate aliasTemplate;
|
private final ICPPAliasTemplate aliasTemplate;
|
||||||
private IType aliasedType;
|
private IType aliasedType;
|
||||||
|
|
||||||
public CPPAliasTemplateInstance(char[] name, IType aliasedType, ICPPAliasTemplate aliasTemplate) {
|
public CPPAliasTemplateInstance(char[] name, ICPPAliasTemplate aliasTemplate, IType aliasedType) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.aliasTemplate = aliasTemplate;
|
this.aliasTemplate = aliasTemplate;
|
||||||
this.aliasedType = aliasedType;
|
this.aliasedType = aliasedType;
|
||||||
|
@ -122,7 +122,7 @@ public class CPPAliasTemplateInstance extends PlatformObject
|
||||||
char[] name = buffer.getCharArray();
|
char[] name = buffer.getCharArray();
|
||||||
IType unmarshalledAliasedTypeInstance = buffer.unmarshalType();
|
IType unmarshalledAliasedTypeInstance = buffer.unmarshalType();
|
||||||
ICPPAliasTemplate unmarshalledAlias = (ICPPAliasTemplate)buffer.unmarshalBinding();
|
ICPPAliasTemplate unmarshalledAlias = (ICPPAliasTemplate)buffer.unmarshalBinding();
|
||||||
return new CPPAliasTemplateInstance(name, unmarshalledAliasedTypeInstance, unmarshalledAlias);
|
return new CPPAliasTemplateInstance(name, unmarshalledAlias, unmarshalledAliasedTypeInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Andrew Niefer (IBM Corporation) - initial API and implementation
|
* Andrew Niefer (IBM Corporation) - initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
|
@ -28,7 +28,8 @@ public class CPPTypedefSpecialization extends CPPSpecialization implements IType
|
||||||
|
|
||||||
private IType fType;
|
private IType fType;
|
||||||
|
|
||||||
public CPPTypedefSpecialization(IBinding specialized, ICPPClassType owner, ICPPTemplateParameterMap tpmap, IType type) {
|
public CPPTypedefSpecialization(IBinding specialized, ICPPClassType owner,
|
||||||
|
ICPPTemplateParameterMap tpmap, IType type) {
|
||||||
super(specialized, owner, tpmap);
|
super(specialized, owner, tpmap);
|
||||||
fType= type;
|
fType= type;
|
||||||
}
|
}
|
||||||
|
@ -38,23 +39,17 @@ public class CPPTypedefSpecialization extends CPPSpecialization implements IType
|
||||||
return fType;
|
return fType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#clone()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
IType t = null;
|
IType t = null;
|
||||||
try {
|
try {
|
||||||
t = (IType) super.clone();
|
t = (IType) super.clone();
|
||||||
} catch (CloneNotSupportedException e) {
|
} catch (CloneNotSupportedException e) {
|
||||||
// not going to happen
|
// Not going to happen.
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSameType(IType o) {
|
public boolean isSameType(IType o) {
|
||||||
if (o == this)
|
if (o == this)
|
||||||
|
|
|
@ -33,6 +33,7 @@ public class CPPUnknownMemberClass extends CPPUnknownMember implements ICPPUnkno
|
||||||
public static CPPUnknownMemberClass createUnnamedInstance() {
|
public static CPPUnknownMemberClass createUnnamedInstance() {
|
||||||
return new CPPUnknownMemberClass(null, CharArrayUtils.EMPTY);
|
return new CPPUnknownMemberClass(null, CharArrayUtils.EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CPPUnknownMemberClass(IType owner, char[] name) {
|
public CPPUnknownMemberClass(IType owner, char[] name) {
|
||||||
super(owner, name);
|
super(owner, name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,7 +241,7 @@ public class CPPSemantics {
|
||||||
|
|
||||||
private static final char[] CALL_FUNCTION = "call-function".toCharArray(); //$NON-NLS-1$
|
private static final char[] CALL_FUNCTION = "call-function".toCharArray(); //$NON-NLS-1$
|
||||||
private static final ICPPEvaluation[] NO_INITCLAUSE_EVALUATION = {};
|
private static final ICPPEvaluation[] NO_INITCLAUSE_EVALUATION = {};
|
||||||
|
|
||||||
// Set to true for debugging.
|
// Set to true for debugging.
|
||||||
public static boolean traceBindingResolution = false;
|
public static boolean traceBindingResolution = false;
|
||||||
public static int traceIndent= 0;
|
public static int traceIndent= 0;
|
||||||
|
@ -308,7 +308,7 @@ public class CPPSemantics {
|
||||||
final IASTName lookupName = data.getLookupName();
|
final IASTName lookupName = data.getLookupName();
|
||||||
if (lookupName == null)
|
if (lookupName == null)
|
||||||
return binding;
|
return binding;
|
||||||
|
|
||||||
IASTNode lookupPoint = data.getLookupPoint();
|
IASTNode lookupPoint = data.getLookupPoint();
|
||||||
|
|
||||||
if (binding == null && data.checkClassContainingFriend()) {
|
if (binding == null && data.checkClassContainingFriend()) {
|
||||||
|
@ -904,7 +904,7 @@ public class CPPSemantics {
|
||||||
IASTName lookupName= data.getLookupName();
|
IASTName lookupName= data.getLookupName();
|
||||||
if (lookupName == null)
|
if (lookupName == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nextScope= getLookupScope(lookupName);
|
nextScope= getLookupScope(lookupName);
|
||||||
|
|
||||||
if (nextScope instanceof ICPPTemplateScope) {
|
if (nextScope instanceof ICPPTemplateScope) {
|
||||||
|
@ -1087,7 +1087,7 @@ public class CPPSemantics {
|
||||||
IBinding[] typedefs = ld2.getFoundBindings();
|
IBinding[] typedefs = ld2.getFoundBindings();
|
||||||
if (typedefs.length < 1 || !(typedefs[0] instanceof ITypedef))
|
if (typedefs.length < 1 || !(typedefs[0] instanceof ITypedef))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
IType t= SemanticUtil.getNestedType((ITypedef) typedefs[0], TDEF);
|
IType t= SemanticUtil.getNestedType((ITypedef) typedefs[0], TDEF);
|
||||||
if (t instanceof ICPPUnknownBinding || t instanceof ISemanticProblem ||
|
if (t instanceof ICPPUnknownBinding || t instanceof ISemanticProblem ||
|
||||||
!(t instanceof ICPPClassType)) {
|
!(t instanceof ICPPClassType)) {
|
||||||
|
@ -1224,7 +1224,7 @@ public class CPPSemantics {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return expandUsingDeclarationsAndRemoveObjects(bindings, data);
|
return expandUsingDeclarationsAndRemoveObjects(bindings, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1489,7 +1489,7 @@ public class CPPSemantics {
|
||||||
} else {
|
} else {
|
||||||
populateCache(scope, item);
|
populateCache(scope, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nodes != null && ++idx < nodes.length) {
|
if (nodes != null && ++idx < nodes.length) {
|
||||||
item = nodes[idx];
|
item = nodes[idx];
|
||||||
} else {
|
} else {
|
||||||
|
@ -1531,7 +1531,7 @@ public class CPPSemantics {
|
||||||
idx = nodeIdxStack[nodeStackPos--];
|
idx = nodeIdxStack[nodeStackPos--];
|
||||||
if (++idx >= nodes.length)
|
if (++idx >= nodes.length)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
item = nodes[idx];
|
item = nodes[idx];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1764,16 +1764,16 @@ public class CPPSemantics {
|
||||||
// Bug 238180
|
// Bug 238180
|
||||||
if (candidate instanceof ICPPClassTemplatePartialSpecialization)
|
if (candidate instanceof ICPPClassTemplatePartialSpecialization)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// Specialization is selected during instantiation
|
// Specialization is selected during instantiation
|
||||||
if (candidate instanceof ICPPTemplateInstance)
|
if (candidate instanceof ICPPTemplateInstance)
|
||||||
candidate= ((ICPPTemplateInstance) candidate).getSpecializedBinding();
|
candidate= ((ICPPTemplateInstance) candidate).getSpecializedBinding();
|
||||||
|
|
||||||
if (!(candidate instanceof ICPPFunctionTemplate))
|
if (!(candidate instanceof ICPPFunctionTemplate))
|
||||||
return candidate;
|
return candidate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LookupData data = createLookupData(name);
|
LookupData data = createLookupData(name);
|
||||||
data.foundItems = bindings;
|
data.foundItems = bindings;
|
||||||
try {
|
try {
|
||||||
|
@ -1781,7 +1781,7 @@ public class CPPSemantics {
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
return e.getProblem();
|
return e.getProblem();
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// IBinding[] result = null;
|
// IBinding[] result = null;
|
||||||
// for (Object binding : bindings) {
|
// for (Object binding : bindings) {
|
||||||
// if (binding instanceof IASTName) {
|
// if (binding instanceof IASTName) {
|
||||||
|
@ -1796,13 +1796,13 @@ public class CPPSemantics {
|
||||||
public static boolean declaredBefore(Object obj, IASTNode node, boolean indexBased) {
|
public static boolean declaredBefore(Object obj, IASTNode node, boolean indexBased) {
|
||||||
if (node == null)
|
if (node == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
final int pointOfRef= ((ASTNode) node).getOffset();
|
final int pointOfRef= ((ASTNode) node).getOffset();
|
||||||
ASTNode nd = null;
|
ASTNode nd = null;
|
||||||
if (obj instanceof ICPPSpecialization) {
|
if (obj instanceof ICPPSpecialization) {
|
||||||
obj = ((ICPPSpecialization) obj).getSpecializedBinding();
|
obj = ((ICPPSpecialization) obj).getSpecializedBinding();
|
||||||
}
|
}
|
||||||
|
|
||||||
int pointOfDecl= -1;
|
int pointOfDecl= -1;
|
||||||
if (obj instanceof ICPPInternalBinding) {
|
if (obj instanceof ICPPInternalBinding) {
|
||||||
ICPPInternalBinding cpp = (ICPPInternalBinding) obj;
|
ICPPInternalBinding cpp = (ICPPInternalBinding) obj;
|
||||||
|
@ -1838,7 +1838,7 @@ public class CPPSemantics {
|
||||||
pointOfDecl= ((ICPPUsingDirective) obj).getPointOfDeclaration();
|
pointOfDecl= ((ICPPUsingDirective) obj).getPointOfDeclaration();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pointOfDecl < 0 && nd != null) {
|
if (pointOfDecl < 0 && nd != null) {
|
||||||
ASTNodeProperty prop = nd.getPropertyInParent();
|
ASTNodeProperty prop = nd.getPropertyInParent();
|
||||||
if (prop == IASTDeclarator.DECLARATOR_NAME || nd instanceof IASTDeclarator) {
|
if (prop == IASTDeclarator.DECLARATOR_NAME || nd instanceof IASTDeclarator) {
|
||||||
|
@ -1903,13 +1903,13 @@ public class CPPSemantics {
|
||||||
final IASTName lookupName = data.getLookupName();
|
final IASTName lookupName = data.getLookupName();
|
||||||
IASTNode lookupPoint = data.getLookupPoint();
|
IASTNode lookupPoint = data.getLookupPoint();
|
||||||
final boolean indexBased= data.getIndex() != null;
|
final boolean indexBased= data.getIndex() != null;
|
||||||
final boolean checkWholeClass= lookupName == null || LookupData.checkWholeClassScope(lookupName);
|
final boolean checkWholeClass= lookupName == null || LookupData.checkWholeClassScope(lookupName);
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
ObjectSet<ICPPFunction> fns= ObjectSet.EMPTY_SET;
|
ObjectSet<ICPPFunction> fns= ObjectSet.EMPTY_SET;
|
||||||
IBinding type = null;
|
IBinding type = null;
|
||||||
IBinding obj = null;
|
IBinding obj = null;
|
||||||
IBinding temp = null;
|
IBinding temp = null;
|
||||||
|
|
||||||
final CPPASTTranslationUnit tu = data.getTranslationUnit();
|
final CPPASTTranslationUnit tu = data.getTranslationUnit();
|
||||||
Object[] items = (Object[]) data.foundItems;
|
Object[] items = (Object[]) data.foundItems;
|
||||||
for (int i = 0; i < items.length && items[i] != null; i++) {
|
for (int i = 0; i < items.length && items[i] != null; i++) {
|
||||||
|
@ -2059,7 +2059,7 @@ public class CPPSemantics {
|
||||||
if (type != null && overrulesByRelevance(data, type, fnArray)) {
|
if (type != null && overrulesByRelevance(data, type, fnArray)) {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj != null) {
|
if (obj != null) {
|
||||||
int cmp= compareByRelevance(data, obj, fnArray);
|
int cmp= compareByRelevance(data, obj, fnArray);
|
||||||
if (cmp == 0) {
|
if (cmp == 0) {
|
||||||
|
@ -2072,7 +2072,7 @@ public class CPPSemantics {
|
||||||
}
|
}
|
||||||
return resolveFunction(data, fnArray, true);
|
return resolveFunction(data, fnArray, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj != null) {
|
if (obj != null) {
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
@ -2342,9 +2342,9 @@ public class CPPSemantics {
|
||||||
if (fns == null || fns.length == 0 || fns[0] == null)
|
if (fns == null || fns.length == 0 || fns[0] == null)
|
||||||
return null;
|
return null;
|
||||||
fns= ArrayUtil.trim(fns);
|
fns= ArrayUtil.trim(fns);
|
||||||
|
|
||||||
sortAstBeforeIndex(fns);
|
sortAstBeforeIndex(fns);
|
||||||
|
|
||||||
if (data.forUsingDeclaration)
|
if (data.forUsingDeclaration)
|
||||||
return new CPPUsingDeclaration(lookupName, fns);
|
return new CPPUsingDeclaration(lookupName, fns);
|
||||||
|
|
||||||
|
@ -2355,7 +2355,7 @@ public class CPPSemantics {
|
||||||
if (data.forDeclaration() != null) {
|
if (data.forDeclaration() != null) {
|
||||||
return resolveFunctionDeclaration(data, fns);
|
return resolveFunctionDeclaration(data, fns);
|
||||||
}
|
}
|
||||||
|
|
||||||
// No arguments to resolve function
|
// No arguments to resolve function
|
||||||
final IASTNode lookupPoint = data.getLookupPoint();
|
final IASTNode lookupPoint = data.getLookupPoint();
|
||||||
if (!data.hasFunctionArguments()) {
|
if (!data.hasFunctionArguments()) {
|
||||||
|
@ -2365,9 +2365,9 @@ public class CPPSemantics {
|
||||||
// Reduce our set of candidate functions to only those who have the right number of parameters
|
// Reduce our set of candidate functions to only those who have the right number of parameters
|
||||||
final IType[] argTypes = data.getFunctionArgumentTypes();
|
final IType[] argTypes = data.getFunctionArgumentTypes();
|
||||||
ICPPFunction[] tmp= selectByArgumentCount(data, fns);
|
ICPPFunction[] tmp= selectByArgumentCount(data, fns);
|
||||||
tmp= CPPTemplates.instantiateForFunctionCall(tmp, data.fTemplateArguments,
|
tmp= CPPTemplates.instantiateForFunctionCall(tmp, data.fTemplateArguments,
|
||||||
Arrays.asList(argTypes),
|
Arrays.asList(argTypes),
|
||||||
Arrays.asList(data.getFunctionArgumentValueCategories()),
|
Arrays.asList(data.getFunctionArgumentValueCategories()),
|
||||||
data.argsContainImpliedObject, lookupPoint);
|
data.argsContainImpliedObject, lookupPoint);
|
||||||
if (tmp.length == 0 || tmp[0] == null) {
|
if (tmp.length == 0 || tmp[0] == null) {
|
||||||
return new ProblemBinding(lookupName, lookupPoint, IProblemBinding.SEMANTIC_NAME_NOT_FOUND, fns);
|
return new ProblemBinding(lookupName, lookupPoint, IProblemBinding.SEMANTIC_NAME_NOT_FOUND, fns);
|
||||||
|
@ -2522,7 +2522,7 @@ public class CPPSemantics {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result instanceof ICPPFunctionTemplate)
|
if (result instanceof ICPPFunctionTemplate)
|
||||||
return CPPTemplates.instantiateForAddressOfFunction((ICPPFunctionTemplate) result, null, args, point);
|
return CPPTemplates.instantiateForAddressOfFunction((ICPPFunctionTemplate) result, null, args, point);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -2677,7 +2677,7 @@ public class CPPSemantics {
|
||||||
IType t= getNestedType(implicitParameterType, TDEF|REF|CVTYPE);
|
IType t= getNestedType(implicitParameterType, TDEF|REF|CVTYPE);
|
||||||
if (SemanticUtil.calculateInheritanceDepth(s, t, data.getLookupPoint()) >= 0)
|
if (SemanticUtil.calculateInheritanceDepth(s, t, data.getLookupPoint()) >= 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return CONTAINS_DEPENDENT_TYPES;
|
return CONTAINS_DEPENDENT_TYPES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2714,7 +2714,7 @@ public class CPPSemantics {
|
||||||
} else {
|
} else {
|
||||||
if (CPPTemplates.isDependentType(paramType))
|
if (CPPTemplates.isDependentType(paramType))
|
||||||
return CONTAINS_DEPENDENT_TYPES;
|
return CONTAINS_DEPENDENT_TYPES;
|
||||||
|
|
||||||
Context ctx= Context.ORDINARY;
|
Context ctx= Context.ORDINARY;
|
||||||
if (j == 0 && sourceLen == 1 && fn instanceof ICPPConstructor) {
|
if (j == 0 && sourceLen == 1 && fn instanceof ICPPConstructor) {
|
||||||
if (paramType instanceof ICPPReferenceType) {
|
if (paramType instanceof ICPPReferenceType) {
|
||||||
|
@ -2805,7 +2805,7 @@ public class CPPSemantics {
|
||||||
prop= node.getPropertyInParent();
|
prop= node.getPropertyInParent();
|
||||||
parent= node.getParent();
|
parent= node.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
IType targetType= null;
|
IType targetType= null;
|
||||||
if (prop == IASTDeclarator.INITIALIZER) {
|
if (prop == IASTDeclarator.INITIALIZER) {
|
||||||
// Target is an object or reference being initialized
|
// Target is an object or reference being initialized
|
||||||
|
@ -2989,7 +2989,7 @@ public class CPPSemantics {
|
||||||
ICPPEvaluation arg1, ICPPEvaluation arg2) {
|
ICPPEvaluation arg1, ICPPEvaluation arg2) {
|
||||||
if (op == null || arg1 == null || arg2 == null)
|
if (op == null || arg1 == null || arg2 == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
IType op1type = getNestedType(arg1.getTypeOrFunctionSet(point), TDEF | REF | CVTYPE);
|
IType op1type = getNestedType(arg1.getTypeOrFunctionSet(point), TDEF | REF | CVTYPE);
|
||||||
if (!isUserDefined(op1type) && !isUserDefined(
|
if (!isUserDefined(op1type) && !isUserDefined(
|
||||||
getNestedType(arg2.getTypeOrFunctionSet(point), TDEF | REF | CVTYPE)))
|
getNestedType(arg2.getTypeOrFunctionSet(point), TDEF | REF | CVTYPE)))
|
||||||
|
@ -3001,7 +3001,7 @@ public class CPPSemantics {
|
||||||
} else {
|
} else {
|
||||||
lookupNonMember= LookupMode.LIMITED_GLOBALS;
|
lookupNonMember= LookupMode.LIMITED_GLOBALS;
|
||||||
}
|
}
|
||||||
return findOverloadedOperator(point, new ICPPEvaluation[] {arg1, arg2},
|
return findOverloadedOperator(point, new ICPPEvaluation[] {arg1, arg2},
|
||||||
op1type, op, lookupNonMember);
|
op1type, op, lookupNonMember);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3041,7 +3041,7 @@ public class CPPSemantics {
|
||||||
if (type == null)
|
if (type == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
ICPPEvaluation[] args = {new EvalFixed(type, LVALUE, Value.UNKNOWN),
|
ICPPEvaluation[] args = {new EvalFixed(type, LVALUE, Value.UNKNOWN),
|
||||||
((ICPPASTExpression) expr.getOperand()).getEvaluation()};
|
((ICPPASTExpression) expr.getOperand()).getEvaluation()};
|
||||||
return findOverloadedOperator(expr, args, type, op, LookupMode.GLOBALS_IF_NO_MEMBERS);
|
return findOverloadedOperator(expr, args, type, op, LookupMode.GLOBALS_IF_NO_MEMBERS);
|
||||||
}
|
}
|
||||||
|
@ -3102,7 +3102,7 @@ public class CPPSemantics {
|
||||||
return null;
|
return null;
|
||||||
if (type instanceof ICPPClassTemplate || type instanceof ICPPUnknownType || type instanceof ISemanticProblem)
|
if (type instanceof ICPPClassTemplate || type instanceof ICPPUnknownType || type instanceof ISemanticProblem)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
final ICPPClassType classType = (ICPPClassType) type;
|
final ICPPClassType classType = (ICPPClassType) type;
|
||||||
if (initializer instanceof IASTEqualsInitializer) {
|
if (initializer instanceof IASTEqualsInitializer) {
|
||||||
// Copy initialization
|
// Copy initialization
|
||||||
|
@ -3204,7 +3204,7 @@ public class CPPSemantics {
|
||||||
return idExpression;
|
return idExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For simplicity returns an operator of form RT (T, T) rather than RT (boolean, T, T)
|
* For simplicity returns an operator of form RT (T, T) rather than RT (boolean, T, T)
|
||||||
|
@ -3231,11 +3231,11 @@ public class CPPSemantics {
|
||||||
|
|
||||||
|
|
||||||
static enum LookupMode {NO_GLOBALS, GLOBALS_IF_NO_MEMBERS, LIMITED_GLOBALS, ALL_GLOBALS}
|
static enum LookupMode {NO_GLOBALS, GLOBALS_IF_NO_MEMBERS, LIMITED_GLOBALS, ALL_GLOBALS}
|
||||||
static ICPPFunction findOverloadedOperator(IASTNode point, ICPPEvaluation[] args, IType methodLookupType,
|
static ICPPFunction findOverloadedOperator(IASTNode point, ICPPEvaluation[] args, IType methodLookupType,
|
||||||
OverloadableOperator operator, LookupMode mode) {
|
OverloadableOperator operator, LookupMode mode) {
|
||||||
while (point instanceof IASTName)
|
while (point instanceof IASTName)
|
||||||
point= point.getParent();
|
point= point.getParent();
|
||||||
|
|
||||||
ICPPClassType callToObjectOfClassType= null;
|
ICPPClassType callToObjectOfClassType= null;
|
||||||
IType type2= null;
|
IType type2= null;
|
||||||
if (args.length >= 2) {
|
if (args.length >= 2) {
|
||||||
|
@ -3252,7 +3252,7 @@ public class CPPSemantics {
|
||||||
methodData = new LookupData(operator.toCharArray(), null, point);
|
methodData = new LookupData(operator.toCharArray(), null, point);
|
||||||
methodData.setFunctionArguments(true, args);
|
methodData.setFunctionArguments(true, args);
|
||||||
methodData.qualified = true; // (13.3.1.2.3)
|
methodData.qualified = true; // (13.3.1.2.3)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IScope scope = classType.getCompositeScope();
|
IScope scope = classType.getCompositeScope();
|
||||||
if (scope == null)
|
if (scope == null)
|
||||||
|
@ -3407,7 +3407,7 @@ public class CPPSemantics {
|
||||||
} else if (methodData != null) {
|
} else if (methodData != null) {
|
||||||
binding = resolveAmbiguities(methodData);
|
binding = resolveAmbiguities(methodData);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (binding instanceof ICPPFunction)
|
if (binding instanceof ICPPFunction)
|
||||||
return (ICPPFunction) binding;
|
return (ICPPFunction) binding;
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
|
|
|
@ -659,7 +659,7 @@ public class CPPTemplates {
|
||||||
IBinding owner = template.getOwner();
|
IBinding owner = template.getOwner();
|
||||||
ICPPClassSpecialization within = getSpecializationContext(owner);
|
ICPPClassSpecialization within = getSpecializationContext(owner);
|
||||||
IType instantiatedType = instantiateType(aliasedType, parameterMap, -1, within, id);
|
IType instantiatedType = instantiateType(aliasedType, parameterMap, -1, within, id);
|
||||||
return new CPPAliasTemplateInstance(id.toCharArray(), instantiatedType, aliasTemplate);
|
return new CPPAliasTemplateInstance(id.toCharArray(), aliasTemplate, instantiatedType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Class template.
|
// Class template.
|
||||||
|
@ -830,7 +830,7 @@ public class CPPTemplates {
|
||||||
} else if (decl instanceof ICPPAliasTemplate) {
|
} else if (decl instanceof ICPPAliasTemplate) {
|
||||||
ICPPAliasTemplate aliasTemplate = (ICPPAliasTemplate) decl;
|
ICPPAliasTemplate aliasTemplate = (ICPPAliasTemplate) decl;
|
||||||
IType type= instantiateType(aliasTemplate.getType(), tpMap, -1, getSpecializationContext(owner), point);
|
IType type= instantiateType(aliasTemplate.getType(), tpMap, -1, getSpecializationContext(owner), point);
|
||||||
spec = new CPPAliasTemplateInstance(decl.getNameCharArray(), type, aliasTemplate);
|
spec = new CPPAliasTemplateInstance(decl.getNameCharArray(), aliasTemplate, type);
|
||||||
} else if (decl instanceof IEnumeration || decl instanceof IEnumerator) {
|
} else if (decl instanceof IEnumeration || decl instanceof IEnumerator) {
|
||||||
// TODO(sprigogin): Deal with a case when an enumerator value depends on a template parameter.
|
// TODO(sprigogin): Deal with a case when an enumerator value depends on a template parameter.
|
||||||
spec = decl;
|
spec = decl;
|
||||||
|
|
|
@ -16,7 +16,6 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryTypeIdExpression.Operator;
|
import org.eclipse.cdt.core.dom.ast.IASTBinaryTypeIdExpression.Operator;
|
||||||
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.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
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.ICPPClassSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
||||||
|
@ -73,7 +72,7 @@ public class EvalBinaryTypeId extends CPPEvaluation {
|
||||||
case __is_base_of:
|
case __is_base_of:
|
||||||
return CPPBasicType.BOOLEAN;
|
return CPPBasicType.BOOLEAN;
|
||||||
}
|
}
|
||||||
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
|
return ProblemType.UNKNOWN_FOR_EXPRESSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -174,7 +174,7 @@ public class EvalConditional extends CPPEvaluation {
|
||||||
} else if (void2 && void3) {
|
} else if (void2 && void3) {
|
||||||
fType= uqt2;
|
fType= uqt2;
|
||||||
} else {
|
} else {
|
||||||
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
|
fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -204,10 +204,10 @@ public class EvalConditional extends CPPEvaluation {
|
||||||
if (cost2.converts() || cost3.converts()) {
|
if (cost2.converts() || cost3.converts()) {
|
||||||
if (cost2.converts()) {
|
if (cost2.converts()) {
|
||||||
if (cost3.converts() || cost2.isAmbiguousUDC()) {
|
if (cost3.converts() || cost2.isAmbiguousUDC()) {
|
||||||
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
|
fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
|
||||||
}
|
}
|
||||||
} else if (cost3.isAmbiguousUDC()) {
|
} else if (cost3.isAmbiguousUDC()) {
|
||||||
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
|
fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ public class EvalConditional extends CPPEvaluation {
|
||||||
fType= t3;
|
fType= t3;
|
||||||
fValueCategory= vcat3;
|
fValueCategory= vcat3;
|
||||||
} else {
|
} else {
|
||||||
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
|
fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ public class EvalConditional extends CPPEvaluation {
|
||||||
if (fOverload != null) {
|
if (fOverload != null) {
|
||||||
fType= ExpressionTypes.typeFromFunctionCall(fOverload);
|
fType= ExpressionTypes.typeFromFunctionCall(fOverload);
|
||||||
} else {
|
} else {
|
||||||
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
|
fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ public class EvalConditional extends CPPEvaluation {
|
||||||
if (fType == null) {
|
if (fType == null) {
|
||||||
fType= Conversions.compositePointerType(t2, t3);
|
fType= Conversions.compositePointerType(t2, t3);
|
||||||
if (fType == null) {
|
if (fType == null) {
|
||||||
fType= new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
|
fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||||
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.ICPPClassSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
||||||
|
@ -123,7 +122,7 @@ public class EvalFunctionCall extends CPPEvaluation {
|
||||||
final ICPPEvaluation arg0 = fArguments[0];
|
final ICPPEvaluation arg0 = fArguments[0];
|
||||||
IType t= SemanticUtil.getNestedType(arg0.getTypeOrFunctionSet(point), TDEF|REF|CVTYPE);
|
IType t= SemanticUtil.getNestedType(arg0.getTypeOrFunctionSet(point), TDEF|REF|CVTYPE);
|
||||||
if (t instanceof ICPPClassType) {
|
if (t instanceof ICPPClassType) {
|
||||||
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
|
return ProblemType.UNKNOWN_FOR_EXPRESSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t instanceof IPointerType) {
|
if (t instanceof IPointerType) {
|
||||||
|
@ -136,7 +135,7 @@ public class EvalFunctionCall extends CPPEvaluation {
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
|
return ProblemType.UNKNOWN_FOR_EXPRESSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -151,7 +150,6 @@ public class EvalFunctionCall extends CPPEvaluation {
|
||||||
if (overload != null)
|
if (overload != null)
|
||||||
return valueCategoryFromFunctionCall(overload);
|
return valueCategoryFromFunctionCall(overload);
|
||||||
|
|
||||||
|
|
||||||
IType t= fArguments[0].getTypeOrFunctionSet(point);
|
IType t= fArguments[0].getTypeOrFunctionSet(point);
|
||||||
if (t instanceof IPointerType) {
|
if (t instanceof IPointerType) {
|
||||||
t= SemanticUtil.getNestedType(((IPointerType) t).getType(), TDEF | REF | CVTYPE);
|
t= SemanticUtil.getNestedType(((IPointerType) t).getType(), TDEF | REF | CVTYPE);
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||||
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.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;
|
||||||
|
@ -196,7 +195,7 @@ public class EvalMemberAccess extends CPPEvaluation {
|
||||||
if (CPPTemplates.isDependentType(type))
|
if (CPPTemplates.isDependentType(type))
|
||||||
return returnUnnamed ? CPPUnknownMemberClass.createUnnamedInstance() : null;
|
return returnUnnamed ? CPPUnknownMemberClass.createUnnamedInstance() : null;
|
||||||
|
|
||||||
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
|
return ProblemType.UNKNOWN_FOR_EXPRESSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class EvalUnary extends CPPEvaluation {
|
||||||
if (fType != null)
|
if (fType != null)
|
||||||
return fType instanceof TypeOfDependentExpression;
|
return fType instanceof TypeOfDependentExpression;
|
||||||
|
|
||||||
switch(fOperator) {
|
switch (fOperator) {
|
||||||
case op_alignOf:
|
case op_alignOf:
|
||||||
case op_not:
|
case op_not:
|
||||||
case op_sizeof:
|
case op_sizeof:
|
||||||
|
@ -217,7 +217,7 @@ public class EvalUnary extends CPPEvaluation {
|
||||||
if (type instanceof ISemanticProblem) {
|
if (type instanceof ISemanticProblem) {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
|
return ProblemType.UNKNOWN_FOR_EXPRESSION;
|
||||||
case op_noexcept:
|
case op_noexcept:
|
||||||
case op_not:
|
case op_not:
|
||||||
return CPPBasicType.BOOLEAN;
|
return CPPBasicType.BOOLEAN;
|
||||||
|
|
Loading…
Add table
Reference in a new issue