mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +02:00
Cosmetics.
This commit is contained in:
parent
e3830010d7
commit
3d92885495
8 changed files with 27 additions and 25 deletions
|
@ -10,6 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.browser;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.browser.IFunctionInfo;
|
||||
import org.eclipse.cdt.core.browser.IQualifiedTypeName;
|
||||
|
@ -37,8 +39,6 @@ import org.eclipse.core.runtime.Assert;
|
|||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Type info object needed to support search for local variables.
|
||||
* @since 5.0
|
||||
|
@ -62,13 +62,13 @@ public class ASTTypeInfo implements ITypeInfo, IFunctionInfo {
|
|||
final ASTTypeReference ref= createReference(name);
|
||||
elementType = IndexModelUtil.getElementType(binding);
|
||||
if (binding instanceof ICPPBinding) {
|
||||
fqn= ((ICPPBinding)binding).getQualifiedName();
|
||||
fqn= ((ICPPBinding) binding).getQualifiedName();
|
||||
} else if (binding instanceof IField) {
|
||||
IField field= (IField) binding;
|
||||
ICompositeType owner= field.getCompositeTypeOwner();
|
||||
fqn= new String[] {owner.getName(), field.getName()};
|
||||
fqn= new String[] { owner.getName(), field.getName() };
|
||||
} else {
|
||||
fqn= new String[] {binding.getName()};
|
||||
fqn= new String[] { binding.getName() };
|
||||
}
|
||||
if (binding instanceof IFunction) {
|
||||
final IFunction function= (IFunction)binding;
|
||||
|
@ -132,7 +132,7 @@ public class ASTTypeInfo implements ITypeInfo, IFunctionInfo {
|
|||
|
||||
@Override
|
||||
public ICProject getEnclosingProject() {
|
||||
if (getResolvedReference()!=null) {
|
||||
if (getResolvedReference() != null) {
|
||||
IProject project = reference.getProject();
|
||||
if (project != null) {
|
||||
return CCorePlugin.getDefault().getCoreModel().getCModel().getCProject(project.getName());
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
*/
|
||||
public interface IPointerType extends IType {
|
||||
/**
|
||||
* Returns the type that this is a pointer to
|
||||
* Returns the type that this is a pointer to.
|
||||
*/
|
||||
public IType getType();
|
||||
|
||||
|
@ -33,7 +33,7 @@ public interface IPointerType extends IType {
|
|||
|
||||
/**
|
||||
* Returns whether the pointer is qualified to be restrict.
|
||||
* For c++ this is a gnu-extension.
|
||||
* For c++ this is a GNU-extension.
|
||||
* @since 5.3
|
||||
*/
|
||||
boolean isRestrict();
|
||||
|
|
|
@ -16,7 +16,7 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
*/
|
||||
public interface ITypedef extends IBinding, IType {
|
||||
/**
|
||||
* Returns the type that this thing is a typedef of
|
||||
* Returns the type that this thing is a typedef of.
|
||||
*/
|
||||
public IType getType();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
|||
*/
|
||||
public interface ICPPReferenceType extends IType {
|
||||
/**
|
||||
* Returns the type that this is a reference of
|
||||
* Returns the type that this is a reference of.
|
||||
*/
|
||||
public IType getType();
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ public interface IIndexFile extends IFileNomination {
|
|||
|
||||
/**
|
||||
* Returns an IIndexFileLocation representing the location of this file
|
||||
* @return an IIndexFileLocation representing the location of this file
|
||||
* @throws CoreException
|
||||
*/
|
||||
IIndexFileLocation getLocation() throws CoreException;
|
||||
|
|
|
@ -57,8 +57,6 @@ public class IndexLocationFactory {
|
|||
/**
|
||||
* Returns the absolute file path of a location, or {@code null}
|
||||
* if the location is not a file-system path.
|
||||
* @return the absolute file path of a location, or {@code null}
|
||||
* if the location is not a file-system path.
|
||||
*/
|
||||
public static IPath getAbsolutePath(IIndexFileLocation location) {
|
||||
return UNCPathConverter.toPath(location.getURI());
|
||||
|
|
|
@ -46,9 +46,10 @@ public class AccessContext {
|
|||
|
||||
/**
|
||||
* Checks if a binding is accessible from a given name.
|
||||
*
|
||||
* @param binding A binding to check access for.
|
||||
* @param from A name corresponding to the binding.
|
||||
* @return <code>true</code> if the binding is accessible.
|
||||
* @return {@code true} if the binding is accessible.
|
||||
*/
|
||||
public static boolean isAccessible(IBinding binding, IASTName from) {
|
||||
return new AccessContext(from).isAccessible(binding);
|
||||
|
@ -56,11 +57,12 @@ public class AccessContext {
|
|||
|
||||
/**
|
||||
* Checks if a binding is accessible from a given name.
|
||||
*
|
||||
* @param binding A binding to check access for.
|
||||
* @param bindingVisibility visibility of the binding in the containing composite type.
|
||||
* Used instead of calling {@link ICPPMember#getVisibility()}.
|
||||
* @param from A name corresponding to the binding.
|
||||
* @return <code>true</code> if the binding is accessible.
|
||||
* @return {@code true} if the binding is accessible.
|
||||
*/
|
||||
public static boolean isAccessible(IBinding binding, int bindingVisibility, IASTName from) {
|
||||
return new AccessContext(from).isAccessible(binding, bindingVisibility);
|
||||
|
@ -68,9 +70,10 @@ public class AccessContext {
|
|||
|
||||
private final IASTName name;
|
||||
/**
|
||||
* A chain of nested classes or/and a function that determine accessibility of private/protected members
|
||||
* by participating in friendship or class inheritance relationships. If both, classes and a function
|
||||
* are present in the context, the outermost class has to be local to the function.
|
||||
* A chain of nested classes or/and a function that determine accessibility of private/protected
|
||||
* members by participating in friendship or class inheritance relationships. If both, classes
|
||||
* and a function are present in the context, the outermost class has to be local to
|
||||
* the function.
|
||||
* {@link "http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#45"}
|
||||
*/
|
||||
private IBinding[] context;
|
||||
|
@ -78,7 +81,7 @@ public class AccessContext {
|
|||
* A class through which the bindings are accessed (11.2.4).
|
||||
*/
|
||||
private boolean isUnqualifiedLookup;
|
||||
private ICPPClassType namingClass; // depends on the binding for which we check the access
|
||||
private ICPPClassType namingClass; // Depends on the binding for which we check the access.
|
||||
// The first candidate is independent of the binding for which we do the access-check.
|
||||
private ICPPClassType firstCandidateForNamingClass;
|
||||
private DOMException initializationException;
|
||||
|
@ -89,8 +92,9 @@ public class AccessContext {
|
|||
|
||||
/**
|
||||
* Checks if a binding is accessible in a given context.
|
||||
*
|
||||
* @param binding A binding to check access for.
|
||||
* @return <code>true</code> if the binding is accessible.
|
||||
* @return {@code true} if the binding is accessible.
|
||||
*/
|
||||
public boolean isAccessible(IBinding binding) {
|
||||
if (binding instanceof ICPPTemplateParameter)
|
||||
|
@ -123,10 +127,11 @@ public class AccessContext {
|
|||
|
||||
/**
|
||||
* Checks if a binding is accessible in a given context.
|
||||
*
|
||||
* @param binding A binding to check access for.
|
||||
* @param bindingVisibility visibility of the binding in the containing composite type.
|
||||
* Used instead of calling {@link ICPPMember#getVisibility()}.
|
||||
* @return <code>true</code> if the binding is accessible.
|
||||
* @return {@code true} if the binding is accessible.
|
||||
*/
|
||||
public boolean isAccessible(IBinding binding, int bindingVisibility) {
|
||||
IBinding owner;
|
||||
|
@ -149,7 +154,7 @@ public class AccessContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if initialization succeeded.
|
||||
* @return {@code true} if initialization succeeded.
|
||||
*/
|
||||
private boolean initialize(ICPPClassType accessOwner) {
|
||||
if (context == null) {
|
||||
|
@ -276,7 +281,6 @@ public class AccessContext {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
private ICPPClassType getNamingClass(ICPPClassType accessOwner) {
|
||||
ICPPClassType classType = firstCandidateForNamingClass;
|
||||
if (classType != null && isUnqualifiedLookup) {
|
||||
|
@ -333,9 +337,10 @@ public class AccessContext {
|
|||
|
||||
/**
|
||||
* Checks if objects with the given visibility are accessible at the given access level.
|
||||
*
|
||||
* @param visibility one of: v_public, v_protected, v_private.
|
||||
* @param accessLevel one of: v_public, v_protected, v_private.
|
||||
* @return <code>true</code> if the access level is sufficiently high.
|
||||
* @return {@code true} if the access level is sufficiently high.
|
||||
*/
|
||||
private static boolean isAccessible(int visibility, int accessLevel) {
|
||||
// Note the ordering of numeric visibility values: v_public < v_protected < v_private.
|
||||
|
|
|
@ -152,7 +152,7 @@ public class PDOMFile implements IIndexFragmentFile {
|
|||
if (obj == this)
|
||||
return true;
|
||||
if (obj instanceof PDOMFile) {
|
||||
PDOMFile other = (PDOMFile)obj;
|
||||
PDOMFile other = (PDOMFile) obj;
|
||||
return fLinkage.getPDOM().equals(other.getLinkage().getPDOM()) && record == other.record;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue