1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Replaced unsafe getBases() method.

This commit is contained in:
Sergey Prigogin 2013-03-14 16:55:22 -07:00
parent 11171b06ad
commit c801d2545d
2 changed files with 10 additions and 9 deletions

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
@ -24,7 +24,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownType;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPBase extends Cloneable {
public static final ICPPBase[] EMPTY_BASE_ARRAY = new ICPPBase[0];
public static final ICPPBase[] EMPTY_BASE_ARRAY = {};
public static final int v_private = ICPPASTBaseSpecifier.v_private;
public static final int v_protected = ICPPASTBaseSpecifier.v_protected;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2012 Google, Inc and others.
* Copyright (c) 2009, 2013 Google, 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
@ -177,9 +177,10 @@ public class AccessContext {
/**
* Returns access level to the members of a class.
*
* @param classType A class
* @param inheritedAccessLevel Access level inherited from derived class. One of: v_public, v_protected,
* v_private.
* @param inheritedAccessLevel Access level inherited from derived class.
* One of: v_public, v_protected, v_private.
* @return One of: v_public, v_protected, v_private.
*/
private int getMemberAccessLevel(ICPPClassType classType, int inheritedAccessLevel) {
@ -197,14 +198,14 @@ public class AccessContext {
return accessLevel;
}
private boolean isAccessibleBaseClass(ICPPClassType classType, ICPPClassType defived, int depth) {
private boolean isAccessibleBaseClass(ICPPClassType classType, ICPPClassType derived, int depth) {
if (depth > CPPSemantics.MAX_INHERITANCE_DEPTH)
return false;
if (defived.isSameType(classType))
if (derived.isSameType(classType))
return true;
ICPPBase[] bases = defived.getBases();
ICPPBase[] bases = ClassTypeHelper.getBases(derived, name);
if (bases != null) {
for (ICPPBase base : bases) {
IBinding baseClass = base.getBaseClass();