From d514c8e8d4c78a5144a796d3afa263622f0679eb Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Tue, 23 Oct 2012 12:28:01 +0200 Subject: [PATCH] Whitespace. --- .../parser/cpp/semantics/SemanticUtil.java | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java index 9de29a630bb..e3aa691c27c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java @@ -78,14 +78,14 @@ public class SemanticUtil { // Resolve typedefs. public static final int TDEF = 0x01; // Resolve typedefs, but only if necessary for a nested type transformation. - public static final int COND_TDEF = 0x02; + public static final int COND_TDEF = 0x02; public static final int REF = 0x04; public static final int CVTYPE = 0x08; public static final int ALLCVQ = 0x10; public static final int PTR = 0x20; public static final int MPTR = 0x40; public static final int ARRAY = 0x80; - + static { final int OPERATOR_SPC= OPERATOR_CHARS.length + 1; for (OverloadableOperator op : OverloadableOperator.values()) { @@ -93,7 +93,7 @@ public class SemanticUtil { cas.put(CharArrayUtils.subarray(name, OPERATOR_SPC, name.length)); } } - + /** * Returns an array of ICPPMethod objects representing all conversion operators * declared by the specified class. This does not include inherited methods. Conversion @@ -116,7 +116,7 @@ public class SemanticUtil { } return methods; } - + /** * Returns an array of ICPPMethod objects representing all conversion operators * declared by the specified class and its ancestors. This includes inherited @@ -132,7 +132,7 @@ public class SemanticUtil { } return methods; } - + /** * @param root the class to start at * @return the root and all its ancestor classes @@ -147,7 +147,7 @@ public class SemanticUtil { ObjectSet next= new ObjectSet(2); for (int i = 0; i < current.size(); i++) { - ICPPClassType clazz= current.keyAt(i); + ICPPClassType clazz= current.keyAt(i); done.put(clazz); for (ICPPBase base : ClassTypeHelper.getBases(clazz, point)) { @@ -181,21 +181,21 @@ public class SemanticUtil { } return false; } - + public static CVQualifier getCVQualifier(IType t) { if (t instanceof IQualifierType) { IQualifierType qt= (IQualifierType) t; - return qt.isConst() + return qt.isConst() ? qt.isVolatile() ? CONST_VOLATILE : CONST : qt.isVolatile() ? VOLATILE : NONE; - } + } if (t instanceof IPointerType) { IPointerType pt= (IPointerType) t; - return pt.isConst() - ? pt.isVolatile() + return pt.isConst() + ? pt.isVolatile() ? pt.isRestrict() ? CONST_VOLATILE_RESTRICT : CONST_VOLATILE : pt.isRestrict() ? CONST_RESTRICT : CONST - : pt.isVolatile() + : pt.isVolatile() ? pt.isRestrict() ? VOLATILE_RESTRICT : VOLATILE : pt.isRestrict() ? RESTRICT : NONE; } @@ -204,7 +204,7 @@ public class SemanticUtil { } return NONE; } - + /** * Descends into type containers, stopping at pointer-to-member types if * specified. @@ -216,7 +216,7 @@ public class SemanticUtil { final int options = TDEF | ALLCVQ | PTR | ARRAY | REF; return getNestedType(type, stopAtPointerToMember ? options : (options | MPTR)); } - + /** * Descends into type containers, stopping at array, pointer or * pointer-to-member types. @@ -273,10 +273,10 @@ public class SemanticUtil { beforeTypedefs = null; } else if (tdef || cond_tdef) { t= getNestedType(qttgt, options); - if (t == qttgt) + if (t == qttgt) return qt; return addQualifiers(t, qt.isConst(), qt.isVolatile(), false); - } + } } else if (type instanceof IArrayType) { final IArrayType atype= (IArrayType) type; if ((options & ARRAY) != 0) { @@ -298,7 +298,7 @@ public class SemanticUtil { // A typedef within the reference type can influence whether the reference is lvalue or rvalue IType nested= rt.getType(); IType newNested = getNestedType(nested, TDEF); - if (nested == newNested) + if (nested == newNested) return type; return replaceNestedType((ITypeContainer) rt, newNested); } @@ -310,7 +310,7 @@ public class SemanticUtil { } return type; } - + type= t; } } @@ -331,7 +331,7 @@ public class SemanticUtil { return type; } return new CPPFunctionType(ret, params, ft.isConst(), ft.isVolatile(), ft.takesVarArgs()); - } + } if (type instanceof ITypedef) { IType t= ((ITypedef) type).getType(); @@ -342,31 +342,31 @@ public class SemanticUtil { if (type instanceof ITypeContainer) { final ITypeContainer tc = (ITypeContainer) type; final IType nestedType= tc.getType(); - if (nestedType == null) + if (nestedType == null) return type; - + IType newType= getSimplifiedType(nestedType); if (newType != nestedType) { return replaceNestedType(tc, newType); - } + } return type; } return type; } - + static boolean isSimplified(IType type) { if (type instanceof ICPPFunctionType) { final ICPPFunctionType ft = (ICPPFunctionType) type; if (!isSimplified(ft.getReturnType())) return false; - + IType[] ps = ft.getParameterTypes(); for (IType p : ps) { if (!isSimplified(p)) return false; } return true; - } + } if (type instanceof ITypedef) { return false; } @@ -379,7 +379,7 @@ public class SemanticUtil { public static IType replaceNestedType(ITypeContainer type, IType newNestedType) { if (newNestedType == null) return type; - + // Bug 249085 make sure not to add unnecessary qualifications if (type instanceof IQualifierType) { IQualifierType qt= (IQualifierType) type; @@ -393,9 +393,9 @@ public class SemanticUtil { /** * Replaces the given type or its nested type with a typedef if that type is the same as - * the type the typedef resolves to. - * - * @param type the type subject to substitution + * the type the typedef resolves to. + * + * @param type the type subject to substitution * @param typedefType the type possibly containing the typedef as its nested type. * @return the given type with the nested type replaced by the typedef, or {@code null} if * the typedefType doesn't contain a typedef or the nested type doesn't match the typedef. @@ -439,7 +439,7 @@ public class SemanticUtil { public static IType mapToAST(IType type, IASTNode node) { if (node == null) return type; - + if (type instanceof IFunctionType) { final ICPPFunctionType ft = (ICPPFunctionType) type; final IType r = ft.getReturnType(); @@ -452,13 +452,13 @@ public class SemanticUtil { if (type instanceof ITypeContainer) { final ITypeContainer tc = (ITypeContainer) type; final IType nestedType= tc.getType(); - if (nestedType == null) + if (nestedType == null) return type; - + IType newType= mapToAST(nestedType, node); if (newType != nestedType) { return replaceNestedType(tc, newType); - } + } return type; } else if (type instanceof ICPPClassType && type instanceof IIndexBinding) { IASTTranslationUnit tu = node.getTranslationUnit(); @@ -535,17 +535,17 @@ public class SemanticUtil { return baseType; } else if (baseType instanceof ICPPPointerToMemberType) { ICPPPointerToMemberType pt= (ICPPPointerToMemberType) baseType; - if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile()) + if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile()) || (restrict && !pt.isRestrict())) { - return new CPPPointerToMemberType(pt.getType(), pt.getMemberOfClass(), + return new CPPPointerToMemberType(pt.getType(), pt.getMemberOfClass(), cnst || pt.isConst(), vol || pt.isVolatile(), restrict || pt.isRestrict()); } return baseType; } else if (baseType instanceof IPointerType) { IPointerType pt= (IPointerType) baseType; - if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile()) + if ((cnst && !pt.isConst()) || (vol && !pt.isVolatile()) || (restrict && !pt.isRestrict())) { - return new CPPPointerType(pt.getType(), + return new CPPPointerType(pt.getType(), cnst || pt.isConst(), vol || pt.isVolatile(), restrict || pt.isRestrict()); } return baseType; @@ -562,7 +562,7 @@ public class SemanticUtil { } else if (baseType == null) { return null; } - + return new CPPQualifierType(baseType, cnst, vol); } return baseType; @@ -590,7 +590,7 @@ public class SemanticUtil { } } else if (owner1 instanceof ICPPNamespace) { if (owner2 instanceof ICPPNamespace) { - if (!CharArrayUtils.equals(owner1.getNameCharArray(), owner2.getNameCharArray())) + if (!CharArrayUtils.equals(owner1.getNameCharArray(), owner2.getNameCharArray())) return false; return isSameOwner(owner1.getOwner(), owner2.getOwner()); } @@ -611,7 +611,7 @@ public class SemanticUtil { public static boolean isEmptyParameterList(IType[] parameters) { if (parameters.length == 0) { return true; - } + } if (parameters.length == 1 && isVoidType(parameters[0])) { return true; } @@ -629,28 +629,28 @@ public class SemanticUtil { public static final int calculateInheritanceDepth(IType type, IType baseClass, IASTNode point) { return calculateInheritanceDepth(CPPSemantics.MAX_INHERITANCE_DEPTH, new HashSet(), type, baseClass, point); } - + private static final int calculateInheritanceDepth(int maxdepth, Set hashSet, IType type, IType baseClass, IASTNode point) { if (type == baseClass || type.isSameType(baseClass)) { return 0; } - + if (maxdepth > 0 && type instanceof ICPPClassType && baseClass instanceof ICPPClassType) { ICPPClassType clazz = (ICPPClassType) type; if (clazz instanceof ICPPDeferredClassInstance) { clazz= (ICPPClassType) ((ICPPDeferredClassInstance) clazz).getSpecializedBinding(); } - + for (ICPPBase cppBase : ClassTypeHelper.getBases(clazz, point)) { IBinding base= cppBase.getBaseClass(); if (base instanceof IType && hashSet.add(base)) { IType tbase= (IType) base; - if (tbase.isSameType(baseClass) || - (baseClass instanceof ICPPSpecialization && // allow some flexibility with templates + if (tbase.isSameType(baseClass) || + (baseClass instanceof ICPPSpecialization && // allow some flexibility with templates ((IType)((ICPPSpecialization) baseClass).getSpecializedBinding()).isSameType(tbase))) { return 1; } - + if (tbase instanceof ICPPClassType) { int n= calculateInheritanceDepth(maxdepth - 1, hashSet, tbase, baseClass, point); if (n > 0) @@ -659,7 +659,7 @@ public class SemanticUtil { } } } - + return -1; } @@ -668,14 +668,14 @@ public class SemanticUtil { final ICPPFunctionType ft = (ICPPFunctionType) type; if (containsUniqueTypeForParameterPack(ft.getReturnType())) return true; - + for (IType pt : ft.getParameterTypes()) { if (containsUniqueTypeForParameterPack(pt)) return true; } return false; - } - + } + if (type instanceof ICPPPointerToMemberType) { if (containsUniqueTypeForParameterPack(((ICPPPointerToMemberType) type).getMemberOfClass())) return true; @@ -688,7 +688,7 @@ public class SemanticUtil { return true; } } - + if (type instanceof ICPPTemplateInstance) { ICPPTemplateArgument[] args = ((ICPPTemplateInstance) type).getTemplateArguments(); for (ICPPTemplateArgument arg : args) { @@ -702,7 +702,7 @@ public class SemanticUtil { final IType nestedType= tc.getType(); return containsUniqueTypeForParameterPack(nestedType); } - + if (type instanceof UniqueType) { return ((UniqueType) type).isForParameterPack(); }