1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 17:55:39 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2010-04-05 03:07:07 +00:00
parent 8703b944a2
commit ea1547dae1

View file

@ -85,7 +85,7 @@ public class LookupData {
/** 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<IScope>(1);
public boolean checkWholeClassScope = false; public boolean checkWholeClassScope = false;
public boolean ignoreUsingDirectives = false; public boolean ignoreUsingDirectives = false;
public boolean usingDirectivesOnly = false; public boolean usingDirectivesOnly = false;
@ -134,7 +134,7 @@ public class LookupData {
if (astName.getPropertyInParent() == CPPSemantics.STRING_LOOKUP_PROPERTY) return true; if (astName.getPropertyInParent() == CPPSemantics.STRING_LOOKUP_PROPERTY) return true;
if ((astName != null && astName.getParent() instanceof IASTIdExpression) || if ((astName != null && astName.getParent() instanceof IASTIdExpression) ||
item instanceof ICPPASTNamespaceDefinition || item instanceof ICPPASTNamespaceDefinition ||
(item instanceof IASTSimpleDeclaration && ((IASTSimpleDeclaration)item).getDeclSpecifier() instanceof IASTCompositeTypeSpecifier) || (item instanceof IASTSimpleDeclaration && ((IASTSimpleDeclaration) item).getDeclSpecifier() instanceof IASTCompositeTypeSpecifier) ||
item instanceof ICPPASTTemplateDeclaration) { item instanceof ICPPASTTemplateDeclaration) {
return true; return true;
} }
@ -149,7 +149,7 @@ public class LookupData {
parent instanceof ICPPASTCompositeTypeSpecifier) parent instanceof ICPPASTCompositeTypeSpecifier)
return true; return true;
if (parent instanceof ICPPASTQualifiedName) { if (parent instanceof ICPPASTQualifiedName) {
IASTName[] ns = ((ICPPASTQualifiedName)parent).getNames(); IASTName[] ns = ((ICPPASTQualifiedName) parent).getNames();
return (name != ns[ns.length -1]); return (name != ns[ns.length -1]);
} }
return false; return false;
@ -192,7 +192,7 @@ public class LookupData {
if (p2.getParent() instanceof ICPPASTExplicitTemplateInstantiation) if (p2.getParent() instanceof ICPPASTExplicitTemplateInstantiation)
return false; return false;
if (astName instanceof ICPPASTTemplateId && if (astName instanceof ICPPASTTemplateId &&
((ICPPASTDeclSpecifier)((IASTSimpleDeclaration)p2).getDeclSpecifier()).isFriend()) ((ICPPASTDeclSpecifier)((IASTSimpleDeclaration) p2).getDeclSpecifier()).isFriend())
return false; return false;
return true; return true;
@ -255,7 +255,7 @@ public class LookupData {
if (astName.getPropertyInParent() == CPPSemantics.STRING_LOOKUP_PROPERTY) return false; if (astName.getPropertyInParent() == CPPSemantics.STRING_LOOKUP_PROPERTY) return false;
IASTNode p1 = astName.getParent(); IASTNode p1 = astName.getParent();
if (p1 instanceof ICPPASTQualifiedName) { if (p1 instanceof ICPPASTQualifiedName) {
final IASTName[] qnames = ((ICPPASTQualifiedName)p1).getNames(); final IASTName[] qnames = ((ICPPASTQualifiedName) p1).getNames();
return qnames.length == 1 || qnames[0] != astName; return qnames.length == 1 || qnames[0] != astName;
} }
return p1 instanceof ICPPASTFieldReference; return p1 instanceof ICPPASTFieldReference;
@ -323,9 +323,9 @@ public class LookupData {
if (foundItems == null) if (foundItems == null)
return false; return false;
if (foundItems instanceof Object[]) if (foundItems instanceof Object[])
return ((Object[])foundItems).length != 0; return ((Object[]) foundItems).length != 0;
if (foundItems instanceof CharArrayObjectMap) if (foundItems instanceof CharArrayObjectMap)
return ((CharArrayObjectMap)foundItems).size() != 0; return ((CharArrayObjectMap) foundItems).size() != 0;
return false; return false;
} }
@ -333,7 +333,7 @@ public class LookupData {
if(foundItems == null) if(foundItems == null)
return false; return false;
if(foundItems instanceof Object[]) { if(foundItems instanceof Object[]) {
for(Object item : (Object[])foundItems) { for(Object item : (Object[]) foundItems) {
if(item instanceof ICPPMethod || item instanceof IType) { if(item instanceof ICPPMethod || item instanceof IType) {
return true; return true;
} }
@ -368,12 +368,12 @@ public class LookupData {
ICPPASTFieldReference fieldRef = (ICPPASTFieldReference) tempNameParent; ICPPASTFieldReference fieldRef = (ICPPASTFieldReference) tempNameParent;
IType implied = fieldRef.getFieldOwner().getExpressionType(); IType implied = fieldRef.getFieldOwner().getExpressionType();
if (fieldRef.isPointerDereference() && implied instanceof IPointerType) { if (fieldRef.isPointerDereference() && implied instanceof IPointerType) {
return ((IPointerType)implied).getType(); return ((IPointerType) implied).getType();
} }
return implied; return implied;
} }
if (tempNameParent instanceof IASTArraySubscriptExpression) { if (tempNameParent instanceof IASTArraySubscriptExpression) {
IASTExpression exp = ((IASTArraySubscriptExpression)tempNameParent).getArrayExpression(); IASTExpression exp = ((IASTArraySubscriptExpression) tempNameParent).getArrayExpression();
return exp.getExpressionType(); return exp.getExpressionType();
} }
if (tempNameParent instanceof IASTFunctionCallExpression) { if (tempNameParent instanceof IASTFunctionCallExpression) {
@ -385,7 +385,7 @@ public class LookupData {
if (tempNameParent instanceof ICPPASTDeleteExpression) { if (tempNameParent instanceof ICPPASTDeleteExpression) {
IType implied = ((ICPPASTDeleteExpression) tempNameParent).getOperand().getExpressionType(); IType implied = ((ICPPASTDeleteExpression) tempNameParent).getOperand().getExpressionType();
if(implied instanceof IPointerType) { if(implied instanceof IPointerType) {
return ((IPointerType)implied).getType(); return ((IPointerType) implied).getType();
} }
return implied; return implied;
} }
@ -397,19 +397,19 @@ public class LookupData {
if (fieldRef.isPointerDereference()) { if (fieldRef.isPointerDereference()) {
implied= SemanticUtil.getUltimateTypeUptoPointers(implied); implied= SemanticUtil.getUltimateTypeUptoPointers(implied);
if (implied instanceof IPointerType) if (implied instanceof IPointerType)
return ((IPointerType)implied).getType(); return ((IPointerType) implied).getType();
} }
return implied; return implied;
} }
if (prop == IASTIdExpression.ID_NAME) { if (prop == IASTIdExpression.ID_NAME) {
IScope scope = CPPVisitor.getContainingScope(tempName); IScope scope = CPPVisitor.getContainingScope(tempName);
if (scope instanceof ICPPClassScope) { if (scope instanceof ICPPClassScope) {
return ((ICPPClassScope)scope).getClassType(); return ((ICPPClassScope) scope).getClassType();
} }
IType implied = CPPVisitor.getThisType(scope); IType implied = CPPVisitor.getThisType(scope);
if (implied instanceof IPointerType) { if (implied instanceof IPointerType) {
return ((IPointerType)implied).getType(); return ((IPointerType) implied).getType();
} }
return implied; return implied;
} }
@ -417,7 +417,7 @@ public class LookupData {
if (forExplicitFunctionInstantiation()) { if (forExplicitFunctionInstantiation()) {
IScope scope = CPPVisitor.getContainingScope(astName); IScope scope = CPPVisitor.getContainingScope(astName);
if (scope instanceof ICPPClassScope) { if (scope instanceof ICPPClassScope) {
return ((ICPPClassScope)scope).getClassType(); return ((ICPPClassScope) scope).getClassType();
} }
} }
} }
@ -450,14 +450,14 @@ public class LookupData {
} }
if (decl instanceof IASTSimpleDeclaration) { if (decl instanceof IASTSimpleDeclaration) {
IASTSimpleDeclaration simple = (IASTSimpleDeclaration) decl; IASTSimpleDeclaration simple = (IASTSimpleDeclaration) decl;
if (!((ICPPASTDeclSpecifier)simple.getDeclSpecifier()).isFriend()) if (!((ICPPASTDeclSpecifier) simple.getDeclSpecifier()).isFriend())
return false; return false;
if (dtor != null) if (dtor != null)
return true; return true;
return simple.getDeclarators().length == 0; return simple.getDeclarators().length == 0;
} else if (decl instanceof IASTFunctionDefinition) { } else if (decl instanceof IASTFunctionDefinition) {
IASTFunctionDefinition fnDef = (IASTFunctionDefinition) decl; IASTFunctionDefinition fnDef = (IASTFunctionDefinition) decl;
if (!((ICPPASTDeclSpecifier)fnDef.getDeclSpecifier()).isFriend()) if (!((ICPPASTDeclSpecifier) fnDef.getDeclSpecifier()).isFriend())
return false; return false;
return (dtor != null); return (dtor != null);
} }
@ -489,15 +489,15 @@ public class LookupData {
prop = p.getPropertyInParent(); prop = p.getPropertyInParent();
if (prop == ICPPASTTemplateId.TEMPLATE_ID_ARGUMENT || prop == IASTDeclarator.DECLARATOR_NAME) if (prop == ICPPASTTemplateId.TEMPLATE_ID_ARGUMENT || prop == IASTDeclarator.DECLARATOR_NAME)
return false; return false;
if (p instanceof IASTDeclarator && !(((IASTDeclarator)p).getName() instanceof ICPPASTQualifiedName)) if (p instanceof IASTDeclarator && !(((IASTDeclarator) p).getName() instanceof ICPPASTQualifiedName))
return false; return false;
if (p instanceof IASTDeclaration) { if (p instanceof IASTDeclaration) {
if (prop == IASTCompositeTypeSpecifier.MEMBER_DECLARATION) { if (prop == IASTCompositeTypeSpecifier.MEMBER_DECLARATION) {
if (p instanceof IASTSimpleDeclaration) { if (p instanceof IASTSimpleDeclaration) {
ICPPASTDeclSpecifier declSpec = (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration)p).getDeclSpecifier(); ICPPASTDeclSpecifier declSpec = (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration) p).getDeclSpecifier();
return declSpec.isFriend(); return declSpec.isFriend();
} else if (p instanceof IASTFunctionDefinition) { } else if (p instanceof IASTFunctionDefinition) {
ICPPASTDeclSpecifier declSpec = (ICPPASTDeclSpecifier) ((IASTFunctionDefinition)p).getDeclSpecifier(); ICPPASTDeclSpecifier declSpec = (ICPPASTDeclSpecifier) ((IASTFunctionDefinition) p).getDeclSpecifier();
return declSpec.isFriend(); return declSpec.isFriend();
} }
} else { } else {