1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 08:55:25 +02:00

Fixed an "unsafe method call" exception.

Change-Id: Iacc5a6a5c410766bd14ef2ec4ac626d1077e93b6
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
Reviewed-on: https://git.eclipse.org/r/14398
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
Nathan Ridge 2013-07-08 22:52:11 -04:00 committed by Sergey Prigogin
parent c5b4670184
commit 982b93967b
3 changed files with 5 additions and 5 deletions

View file

@ -355,7 +355,7 @@ public class Value implements IValue {
type1 = SemanticUtil.getNestedType(type1, TDEF);
type2 = SemanticUtil.getNestedType(type2, TDEF);
if (type1 instanceof ICPPClassType && type2 instanceof ICPPClassType) {
return ClassTypeHelper.isSubclass((ICPPClassType) type2, (ICPPClassType) type1) ? 1 : 0;
return ClassTypeHelper.isSubclass((ICPPClassType) type2, (ICPPClassType) type1, point) ? 1 : 0;
} else {
return 0;
}

View file

@ -309,8 +309,8 @@ public class ClassTypeHelper {
* Checks inheritance relationship between two classes.
* @return <code>true</code> if {@code subclass} is a subclass of {@code superclass}.
*/
public static boolean isSubclass(ICPPClassType subclass, ICPPClassType superclass) {
ICPPBase[] bases= subclass.getBases();
public static boolean isSubclass(ICPPClassType subclass, ICPPClassType superclass, IASTNode point) {
ICPPBase[] bases= getBases(subclass, point);
for (ICPPBase base : bases) {
IBinding b= base.getBaseClass();
if (b instanceof ICPPClassType) {
@ -318,7 +318,7 @@ public class ClassTypeHelper {
if (baseClass.isSameType(superclass)) {
return true;
}
if (isSubclass(baseClass, superclass)) {
if (isSubclass(baseClass, superclass, point)) {
return true;
}
}

View file

@ -314,7 +314,7 @@ public class LinkedNamesFinder {
if (binding instanceof ICPPClassType) {
if (seenClasses.add(binding)) {
ICPPClassType candidate = (ICPPClassType) binding;
if (ClassTypeHelper.isSubclass(candidate, baseClass)) {
if (ClassTypeHelper.isSubclass(candidate, baseClass, name)) {
subclasses.add(candidate);
}
}