mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 23:05:47 +02:00
Cosmetics.
This commit is contained in:
parent
411506db88
commit
a0fe9152df
1 changed files with 43 additions and 43 deletions
|
@ -82,9 +82,9 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
||||||
public class LookupData extends ScopeLookupData {
|
public class LookupData extends ScopeLookupData {
|
||||||
public ICPPTemplateArgument[] fTemplateArguments;
|
public ICPPTemplateArgument[] fTemplateArguments;
|
||||||
public Map<ICPPNamespaceScope, List<ICPPNamespaceScope>> usingDirectives= Collections.emptyMap();
|
public Map<ICPPNamespaceScope, List<ICPPNamespaceScope>> usingDirectives= Collections.emptyMap();
|
||||||
|
|
||||||
/** Used to ensure we don't visit things more than once. */
|
/** Used to ensure we don't visit things more than once. */
|
||||||
public ObjectSet<IScope> visited= new ObjectSet<IScope>(1);
|
public ObjectSet<IScope> visited= new ObjectSet<>(1);
|
||||||
|
|
||||||
public boolean contentAssist = false;
|
public boolean contentAssist = false;
|
||||||
|
|
||||||
|
@ -97,12 +97,12 @@ public class LookupData extends ScopeLookupData {
|
||||||
public boolean checkAssociatedScopes= false;
|
public boolean checkAssociatedScopes= false;
|
||||||
|
|
||||||
public boolean forUsingDeclaration = false;
|
public boolean forUsingDeclaration = false;
|
||||||
|
|
||||||
/** When computing the cost of a method call, treat the first argument as the implied object. */
|
/** When computing the cost of a method call, treat the first argument as the implied object. */
|
||||||
public boolean argsContainImpliedObject = false;
|
public boolean argsContainImpliedObject = false;
|
||||||
/** In list-initialization **/
|
/** In list-initialization **/
|
||||||
public boolean fNoNarrowing= false;
|
public boolean fNoNarrowing= false;
|
||||||
|
|
||||||
private IASTDeclarator fDeclarator;
|
private IASTDeclarator fDeclarator;
|
||||||
private boolean fFunctionCall;
|
private boolean fFunctionCall;
|
||||||
private IType fImpliedObjectType;
|
private IType fImpliedObjectType;
|
||||||
|
@ -113,7 +113,7 @@ public class LookupData extends ScopeLookupData {
|
||||||
public ICPPClassType skippedScope;
|
public ICPPClassType skippedScope;
|
||||||
public Object foundItems = null;
|
public Object foundItems = null;
|
||||||
public ProblemBinding problem;
|
public ProblemBinding problem;
|
||||||
|
|
||||||
public LookupData(IASTName n) {
|
public LookupData(IASTName n) {
|
||||||
super(n, true, false);
|
super(n, true, false);
|
||||||
if (n == null)
|
if (n == null)
|
||||||
|
@ -130,12 +130,12 @@ public class LookupData extends ScopeLookupData {
|
||||||
fTemplateArguments= args;
|
fTemplateArguments= args;
|
||||||
configureWith(n);
|
configureWith(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LookupData(char[] name, ICPPTemplateArgument[] templateArgs, IASTNode lookupPoint) {
|
public LookupData(char[] name, ICPPTemplateArgument[] templateArgs, IASTNode lookupPoint) {
|
||||||
super(name, lookupPoint);
|
super(name, lookupPoint);
|
||||||
fTemplateArguments= templateArgs;
|
fTemplateArguments= templateArgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LookupData(char[] name, ICPPTemplateArgument[] templateArgs, IASTTranslationUnit tu) {
|
public LookupData(char[] name, ICPPTemplateArgument[] templateArgs, IASTTranslationUnit tu) {
|
||||||
super(name, tu);
|
super(name, tu);
|
||||||
fTemplateArguments= templateArgs;
|
fTemplateArguments= templateArgs;
|
||||||
|
@ -151,7 +151,7 @@ public class LookupData extends ScopeLookupData {
|
||||||
if (tn.getPropertyInParent() == ICPPASTTemplateId.TEMPLATE_NAME) {
|
if (tn.getPropertyInParent() == ICPPASTTemplateId.TEMPLATE_NAME) {
|
||||||
tn= (IASTName) tn.getParent();
|
tn= (IASTName) tn.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
IASTNode parent = tn.getParent();
|
IASTNode parent = tn.getParent();
|
||||||
IASTNode nameParent= parent;
|
IASTNode nameParent= parent;
|
||||||
if (parent instanceof ICPPASTQualifiedName) {
|
if (parent instanceof ICPPASTQualifiedName) {
|
||||||
|
@ -170,10 +170,10 @@ public class LookupData extends ScopeLookupData {
|
||||||
} else if (qualifier.length > 0) {
|
} else if (qualifier.length > 0) {
|
||||||
if (qualifier[0] != tn) {
|
if (qualifier[0] != tn) {
|
||||||
qualified= true;
|
qualified= true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nameParent instanceof ICPPASTBaseSpecifier
|
if (nameParent instanceof ICPPASTBaseSpecifier
|
||||||
|| nameParent instanceof ICPPASTElaboratedTypeSpecifier
|
|| nameParent instanceof ICPPASTElaboratedTypeSpecifier
|
||||||
|| nameParent instanceof ICPPASTCompositeTypeSpecifier) {
|
|| nameParent instanceof ICPPASTCompositeTypeSpecifier) {
|
||||||
|
@ -190,7 +190,7 @@ public class LookupData extends ScopeLookupData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the name belongs to a simple declaration or function definition.
|
* Returns whether the name belongs to a simple declaration or function definition.
|
||||||
*/
|
*/
|
||||||
|
@ -201,19 +201,19 @@ public class LookupData extends ScopeLookupData {
|
||||||
|
|
||||||
if (node instanceof IASTSimpleDeclaration || node instanceof IASTFunctionDefinition)
|
if (node instanceof IASTSimpleDeclaration || node instanceof IASTFunctionDefinition)
|
||||||
return (IASTDeclaration) node;
|
return (IASTDeclaration) node;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTDeclarator getDeclarator() {
|
public IASTDeclarator getDeclarator() {
|
||||||
return fDeclarator;
|
return fDeclarator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean forExplicitFunctionSpecialization() {
|
public boolean forExplicitFunctionSpecialization() {
|
||||||
IASTName n = getLookupName();
|
IASTName n = getLookupName();
|
||||||
if (n == null)
|
if (n == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
IASTDeclaration decl= forDeclaration();
|
IASTDeclaration decl= forDeclaration();
|
||||||
if (decl != null) {
|
if (decl != null) {
|
||||||
if (n.getParent() instanceof ICPPASTTemplateId)
|
if (n.getParent() instanceof ICPPASTTemplateId)
|
||||||
|
@ -233,17 +233,17 @@ public class LookupData extends ScopeLookupData {
|
||||||
public boolean isFunctionCall() {
|
public boolean isFunctionCall() {
|
||||||
return fFunctionCall;
|
return fFunctionCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkWholeClassScope(IASTName name) {
|
public static boolean checkWholeClassScope(IASTName name) {
|
||||||
if (name == null)
|
if (name == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
IASTNode node = name.getParent();
|
IASTNode node = name.getParent();
|
||||||
while (node instanceof IASTName) {
|
while (node instanceof IASTName) {
|
||||||
name= (IASTName) node;
|
name= (IASTName) node;
|
||||||
node= name.getParent();
|
node= name.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
final ASTNodeProperty nameProp = name.getPropertyInParent();
|
final ASTNodeProperty nameProp = name.getPropertyInParent();
|
||||||
if (nameProp == IASTIdExpression.ID_NAME ||
|
if (nameProp == IASTIdExpression.ID_NAME ||
|
||||||
nameProp == IASTFieldReference.FIELD_NAME ||
|
nameProp == IASTFieldReference.FIELD_NAME ||
|
||||||
|
@ -257,7 +257,7 @@ public class LookupData extends ScopeLookupData {
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; node != null; node= node.getParent()) {
|
for (; node != null; node= node.getParent()) {
|
||||||
// 3.3.7-5
|
// 3.3.7-5
|
||||||
if (node.getParent() instanceof IASTFunctionDefinition) {
|
if (node.getParent() instanceof IASTFunctionDefinition) {
|
||||||
|
@ -275,7 +275,7 @@ public class LookupData extends ScopeLookupData {
|
||||||
}
|
}
|
||||||
// No inline method.
|
// No inline method.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (node instanceof IASTInitializerList || node instanceof IASTEqualsInitializer) {
|
if (node instanceof IASTInitializerList || node instanceof IASTEqualsInitializer) {
|
||||||
if (node.getPropertyInParent() == IASTDeclarator.INITIALIZER) {
|
if (node.getPropertyInParent() == IASTDeclarator.INITIALIZER) {
|
||||||
IASTNode decl= node.getParent();
|
IASTNode decl= node.getParent();
|
||||||
|
@ -293,8 +293,8 @@ public class LookupData extends ScopeLookupData {
|
||||||
// Not within a class definition
|
// Not within a class definition
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decl instanceof IASTSimpleDeclaration &&
|
if (decl instanceof IASTSimpleDeclaration &&
|
||||||
decl.getPropertyInParent() == IASTCompositeTypeSpecifier.MEMBER_DECLARATION) {
|
decl.getPropertyInParent() == IASTCompositeTypeSpecifier.MEMBER_DECLARATION) {
|
||||||
// Initializer of non-static data member
|
// Initializer of non-static data member
|
||||||
IASTDeclSpecifier declSpec= ((IASTSimpleDeclaration) decl).getDeclSpecifier();
|
IASTDeclSpecifier declSpec= ((IASTSimpleDeclaration) decl).getDeclSpecifier();
|
||||||
|
@ -302,18 +302,18 @@ public class LookupData extends ScopeLookupData {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Continue search, we could still be in a method.
|
// Continue search, we could still be in a method.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean typesOnly(IASTName tn) {
|
public static boolean typesOnly(IASTName tn) {
|
||||||
if (tn.getPropertyInParent() == ICPPASTTemplateId.TEMPLATE_NAME) {
|
if (tn.getPropertyInParent() == ICPPASTTemplateId.TEMPLATE_NAME) {
|
||||||
tn= (IASTName) tn.getParent();
|
tn= (IASTName) tn.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
IASTNode parent = tn.getParent();
|
IASTNode parent = tn.getParent();
|
||||||
if (parent instanceof ICPPASTBaseSpecifier
|
if (parent instanceof ICPPASTBaseSpecifier
|
||||||
|| parent instanceof ICPPASTElaboratedTypeSpecifier
|
|| parent instanceof ICPPASTElaboratedTypeSpecifier
|
||||||
|
@ -323,7 +323,7 @@ public class LookupData extends ScopeLookupData {
|
||||||
final ICPPASTQualifiedName qn = (ICPPASTQualifiedName) parent;
|
final ICPPASTQualifiedName qn = (ICPPASTQualifiedName) parent;
|
||||||
if (qn.getLastName() != tn) {
|
if (qn.getLastName() != tn) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -331,7 +331,7 @@ public class LookupData extends ScopeLookupData {
|
||||||
public boolean hasResultOrProblem() {
|
public boolean hasResultOrProblem() {
|
||||||
return problem != null || hasResults();
|
return problem != null || hasResults();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasResults() {
|
public boolean hasResults() {
|
||||||
if (foundItems == null)
|
if (foundItems == null)
|
||||||
return false;
|
return false;
|
||||||
|
@ -354,7 +354,7 @@ public class LookupData extends ScopeLookupData {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the implied object type, or <code>null</code>.
|
* Returns the implied object type, or <code>null</code>.
|
||||||
*/
|
*/
|
||||||
|
@ -364,7 +364,7 @@ public class LookupData extends ScopeLookupData {
|
||||||
}
|
}
|
||||||
return fImpliedObjectType;
|
return fImpliedObjectType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Explicitly set the implied object type.
|
* Explicitly set the implied object type.
|
||||||
* This is for use in cases where implied object type cannot
|
* This is for use in cases where implied object type cannot
|
||||||
|
@ -378,11 +378,11 @@ public class LookupData extends ScopeLookupData {
|
||||||
IASTName tn = getLookupName();
|
IASTName tn = getLookupName();
|
||||||
if (tn == null)
|
if (tn == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (tn.getPropertyInParent() == ICPPASTTemplateId.TEMPLATE_NAME) {
|
if (tn.getPropertyInParent() == ICPPASTTemplateId.TEMPLATE_NAME) {
|
||||||
tn= (IASTName) tn.getParent();
|
tn= (IASTName) tn.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
IASTNode parent = tn.getParent();
|
IASTNode parent = tn.getParent();
|
||||||
IASTNode nameParent= parent;
|
IASTNode nameParent= parent;
|
||||||
if (parent instanceof ICPPASTQualifiedName) {
|
if (parent instanceof ICPPASTQualifiedName) {
|
||||||
|
@ -390,8 +390,8 @@ public class LookupData extends ScopeLookupData {
|
||||||
if (qn.getLastName() == tn) {
|
if (qn.getLastName() == tn) {
|
||||||
nameParent= parent.getParent();
|
nameParent= parent.getParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nameParent instanceof IASTFieldReference) {
|
if (nameParent instanceof IASTFieldReference) {
|
||||||
return ((ICPPASTFieldReference) nameParent).getFieldOwnerType();
|
return ((ICPPASTFieldReference) nameParent).getFieldOwnerType();
|
||||||
} else if (nameParent instanceof IASTIdExpression) {
|
} else if (nameParent instanceof IASTIdExpression) {
|
||||||
|
@ -411,11 +411,11 @@ public class LookupData extends ScopeLookupData {
|
||||||
IASTName lookupName= getLookupName();
|
IASTName lookupName= getLookupName();
|
||||||
if (lookupName == null)
|
if (lookupName == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
IASTNode node = lookupName.getParent();
|
IASTNode node = lookupName.getParent();
|
||||||
while (node instanceof IASTName)
|
while (node instanceof IASTName)
|
||||||
node = node.getParent();
|
node = node.getParent();
|
||||||
|
|
||||||
IASTDeclaration decl = null;
|
IASTDeclaration decl = null;
|
||||||
IASTDeclarator dtor = null;
|
IASTDeclarator dtor = null;
|
||||||
if (node instanceof ICPPASTDeclSpecifier && node.getParent() instanceof IASTDeclaration) {
|
if (node instanceof ICPPASTDeclSpecifier && node.getParent() instanceof IASTDeclaration) {
|
||||||
|
@ -445,7 +445,7 @@ public class LookupData extends ScopeLookupData {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkAssociatedScopes() {
|
public boolean checkAssociatedScopes() {
|
||||||
return !qualified && fFunctionCall;
|
return !qualified && fFunctionCall;
|
||||||
}
|
}
|
||||||
|
@ -474,7 +474,7 @@ public class LookupData extends ScopeLookupData {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFunctionArguments(boolean containsImpliedObject, ICPPEvaluation... exprs) {
|
public void setFunctionArguments(boolean containsImpliedObject, ICPPEvaluation... exprs) {
|
||||||
argsContainImpliedObject= containsImpliedObject;
|
argsContainImpliedObject= containsImpliedObject;
|
||||||
functionArgs= exprs;
|
functionArgs= exprs;
|
||||||
|
@ -498,7 +498,7 @@ public class LookupData extends ScopeLookupData {
|
||||||
}
|
}
|
||||||
return functionArgTypes;
|
return functionArgTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueCategory[] getFunctionArgumentValueCategories() {
|
public ValueCategory[] getFunctionArgumentValueCategories() {
|
||||||
if (functionArgValueCategories == null) {
|
if (functionArgValueCategories == null) {
|
||||||
ICPPEvaluation[] args= functionArgs;
|
ICPPEvaluation[] args= functionArgs;
|
||||||
|
@ -508,7 +508,7 @@ public class LookupData extends ScopeLookupData {
|
||||||
final ICPPEvaluation arg = args[i];
|
final ICPPEvaluation arg = args[i];
|
||||||
functionArgValueCategories[i] = arg.getValueCategory(getLookupPoint());
|
functionArgValueCategories[i] = arg.getValueCategory(getLookupPoint());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return functionArgValueCategories;
|
return functionArgValueCategories;
|
||||||
}
|
}
|
||||||
|
@ -519,7 +519,7 @@ public class LookupData extends ScopeLookupData {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFunctionArgumentPackExpansionCount() {
|
public int getFunctionArgumentPackExpansionCount() {
|
||||||
int count= 0;
|
int count= 0;
|
||||||
if (functionArgs != null) {
|
if (functionArgs != null) {
|
||||||
for (ICPPEvaluation arg : functionArgs) {
|
for (ICPPEvaluation arg : functionArgs) {
|
||||||
|
@ -537,7 +537,7 @@ public class LookupData extends ScopeLookupData {
|
||||||
public IBinding[] getFoundBindings() {
|
public IBinding[] getFoundBindings() {
|
||||||
if (foundItems instanceof Object[]) {
|
if (foundItems instanceof Object[]) {
|
||||||
Object[] items = (Object[]) foundItems;
|
Object[] items = (Object[]) foundItems;
|
||||||
if (items.length != 0) {
|
if (items.length != 0) {
|
||||||
IBinding[] bindings = new IBinding[items.length];
|
IBinding[] bindings = new IBinding[items.length];
|
||||||
int k = 0;
|
int k = 0;
|
||||||
for (Object item : items) {
|
for (Object item : items) {
|
||||||
|
@ -554,7 +554,7 @@ public class LookupData extends ScopeLookupData {
|
||||||
}
|
}
|
||||||
return IBinding.EMPTY_BINDING_ARRAY;
|
return IBinding.EMPTY_BINDING_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ignoreRecursionResolvingBindings() {
|
public boolean ignoreRecursionResolvingBindings() {
|
||||||
// When name lookup is performed during template instantiation
|
// When name lookup is performed during template instantiation
|
||||||
// rather than for an AST name, infinite recursion can sometimes
|
// rather than for an AST name, infinite recursion can sometimes
|
||||||
|
|
Loading…
Add table
Reference in a new issue