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