From b7f27c70ca2fa0fd8de091aa9eb7f94c714e9bd8 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Tue, 7 May 2013 19:47:40 -0700 Subject: [PATCH] Cosmetics. --- .../parser/tests/ast2/AST2TemplateTests.java | 46 +++++++++---------- .../dom/parser/cpp/semantics/EvalUnary.java | 34 ++++++++------ .../core/lrparser/tests/LRTemplateTests.java | 4 +- 3 files changed, 45 insertions(+), 39 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java index d03a5f20b41..73eb1c0c404 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java @@ -3523,7 +3523,7 @@ public class AST2TemplateTests extends AST2TestBase { // template void f(T); // }; // template void A::f(T){} //problem on f - public void testClassTemplateMemberFunctionTemplate_Bug104262() throws Exception { + public void testClassTemplateMemberFunctionTemplate_104262() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); @@ -3574,7 +3574,7 @@ public class AST2TemplateTests extends AST2TestBase { // this->a= 1; // } // }; - public void testFieldReference_Bug257186() throws Exception { + public void testFieldReference_257186() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); @@ -3596,7 +3596,7 @@ public class AST2TemplateTests extends AST2TestBase { // f(b); g(b); h(b); m(b); // } // }; - public void testUnknownReferences_Bug257194() throws Exception { + public void testUnknownReferences_257194() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); @@ -3620,7 +3620,7 @@ public class AST2TemplateTests extends AST2TestBase { // v.x; v.y(); // } // }; - public void testTypeOfUnknownReferences_Bug257194a() throws Exception { + public void testTypeOfUnknownReferences_257194a() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); @@ -3645,7 +3645,7 @@ public class AST2TemplateTests extends AST2TestBase { // v->x; v->y(); // } // }; - public void testTypeOfUnknownReferences_Bug257194b() throws Exception { + public void testTypeOfUnknownReferences_257194b() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); @@ -5214,7 +5214,7 @@ public class AST2TemplateTests extends AST2TestBase { // void test() { // sort(MySort); // } - public void testAdressOfUniqueTemplateInst_Bug326076() throws Exception { + public void testAdressOfUniqueTemplateInst_326076() throws Exception { parseAndCheckBindings(); } @@ -5229,7 +5229,7 @@ public class AST2TemplateTests extends AST2TestBase { // f(g, '1'); // f(g, 1); // } - public void testInstantiationOfFunctionTemplateWithOverloadedFunctionSetArgument_Bug326492() throws Exception { + public void testInstantiationOfFunctionTemplateWithOverloadedFunctionSetArgument_326492() throws Exception { String code= getAboveComment(); BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); ICPPFunctionTemplate f1= bh.assertNonProblem("f(T (*)(int), char)", 1); @@ -5259,7 +5259,7 @@ public class AST2TemplateTests extends AST2TestBase { // Ptr parm; // f(parm); // } - public void testADLForTemplateSpecializations_Bug327069() throws Exception { + public void testADLForTemplateSpecializations_327069() throws Exception { parseAndCheckBindings(); } @@ -5269,7 +5269,7 @@ public class AST2TemplateTests extends AST2TestBase { // void x(int* (*) (int*)) { // x(f); // } - public void testPartialOrderingInNonCallContext_Bug326900() throws Exception { + public void testPartialOrderingInNonCallContext_326900() throws Exception { parseAndCheckBindings(); } @@ -5281,7 +5281,7 @@ public class AST2TemplateTests extends AST2TestBase { // X x; // y(x); // } - public void testPartialOrderingForConversions_Bug326900() throws Exception { + public void testPartialOrderingForConversions_326900() throws Exception { parseAndCheckBindings(); } @@ -5297,7 +5297,7 @@ public class AST2TemplateTests extends AST2TestBase { // L::CI l; // l.m().foo = 1; // } - public void testNestedTypedefSpecialization_Bug329795() throws Exception { + public void testNestedTypedefSpecialization_329795() throws Exception { String code= getAboveComment(); BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); ICPPField f1= bh.assertNonProblem("foo;", 3); @@ -5319,7 +5319,7 @@ public class AST2TemplateTests extends AST2TestBase { // TestImpl::Inner2* ptr2=ptr1->ptr2; // func(ptr2->ptr1); // } - public void testSpecializationViaNotDirectlyEnclosingTemplate_Bug333186() throws Exception { + public void testSpecializationViaNotDirectlyEnclosingTemplate_333186() throws Exception { parseAndCheckBindings(); } @@ -5332,21 +5332,21 @@ public class AST2TemplateTests extends AST2TestBase { // // struct C {}; // template class Z{}; - public void testNonTypeTemplateParameterWithTypenameKeyword_Bug333186() throws Exception { + public void testNonTypeTemplateParameterWithTypenameKeyword_333186() throws Exception { parseAndCheckBindings(); } // template void f() { // f(); // } - public void testDefaultTmplArgumentOfFunctionTemplate_Bug333325() throws Exception { + public void testDefaultTmplArgumentOfFunctionTemplate_333325() throws Exception { parseAndCheckBindings(); } // template class X {}; // template void Y(); // X< Y > x; - public void testFunctionInstanceAsTemplateArg_Bug333529() throws Exception { + public void testFunctionInstanceAsTemplateArg_333529() throws Exception { parseAndCheckBindings(); } @@ -5372,7 +5372,7 @@ public class AST2TemplateTests extends AST2TestBase { // void test() { // P(C()); // } - public void testFunctionInstanceAsTemplateArg_Bug334472() throws Exception { + public void testFunctionInstanceAsTemplateArg_334472() throws Exception { parseAndCheckBindings(); } @@ -5382,7 +5382,7 @@ public class AST2TemplateTests extends AST2TestBase { // g(); // g(); // } - public void testFunctionTemplateSignatures_Bug335062() throws Exception { + public void testFunctionTemplateSignatures_335062() throws Exception { parseAndCheckBindings(); } @@ -5404,7 +5404,7 @@ public class AST2TemplateTests extends AST2TestBase { // void g() { // function(0); // ERROR HERE // } - public void testSyntaxErrorInReturnTypeOfFunctionInstance_Bug336426() throws Exception { + public void testSyntaxErrorInReturnTypeOfFunctionInstance_336426() throws Exception { parseAndCheckBindings(); } @@ -5412,7 +5412,7 @@ public class AST2TemplateTests extends AST2TestBase { // template void f(Functor functor) { // A a; // } - public void testFunctionCallOnDependentName_Bug337686() throws Exception { + public void testFunctionCallOnDependentName_337686() throws Exception { parseAndCheckBindings(); } @@ -5424,7 +5424,7 @@ public class AST2TemplateTests extends AST2TestBase { // h(s, 1); // h(s, 1, 2); // } - public void testVariadicFunctionTemplate_Bug333389() throws Exception { + public void testVariadicFunctionTemplate_333389() throws Exception { parseAndCheckBindings(); } @@ -5547,7 +5547,7 @@ public class AST2TemplateTests extends AST2TestBase { // ft(&Foo::function); // return 0; // } - public void testAddressOfMethodForInstantiation_Bug344310() throws Exception { + public void testAddressOfMethodForInstantiation_344310() throws Exception { parseAndCheckBindings(); } @@ -7328,7 +7328,7 @@ public class AST2TemplateTests extends AST2TestBase { // } // void test() { // N::impl::type operand; - // operand.kind(); // ERROR HERE: Method 'kind' could not be resolved + // operand.kind(); // } public void testNameLookupInDependentExpression_399829a() throws Exception { parseAndCheckBindings(); @@ -7352,7 +7352,7 @@ public class AST2TemplateTests extends AST2TestBase { // } // void test() { // N::impl::type operand; - // operand.kind(); // ERROR HERE: Method 'kind' could not be resolved + // operand.kind(); // } public void testNameLookupInDependentExpression_399829b() throws Exception { parseAndCheckBindings(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnary.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnary.java index 147d903871d..582d9254519 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnary.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnary.java @@ -75,11 +75,12 @@ public class EvalUnary extends CPPDependentEvaluation { private ICPPFunction fOverload= CPPFunction.UNINITIALIZED_FUNCTION; private IType fType; - public EvalUnary(int operator, ICPPEvaluation operand, IBinding addressOfQualifiedNameBinding, + public EvalUnary(int operator, ICPPEvaluation operand, IBinding addressOfQualifiedNameBinding, IASTNode pointOfDefinition) { this(operator, operand, addressOfQualifiedNameBinding, findEnclosingTemplate(pointOfDefinition)); } - public EvalUnary(int operator, ICPPEvaluation operand, IBinding addressOfQualifiedNameBinding, + + public EvalUnary(int operator, ICPPEvaluation operand, IBinding addressOfQualifiedNameBinding, IBinding templateDefinition) { super(templateDefinition); fOperator= operator; @@ -161,7 +162,7 @@ public class EvalUnary extends CPPDependentEvaluation { if (fAddressOfQualifiedNameBinding instanceof ICPPMember) { ICPPMember member= (ICPPMember) fAddressOfQualifiedNameBinding; - if (!member.isStatic()) + if (!member.isStatic()) return null; } @@ -176,7 +177,8 @@ public class EvalUnary extends CPPDependentEvaluation { } else { args = new ICPPEvaluation[] { fArgument }; } - return CPPSemantics.findOverloadedOperator(point, getTemplateDefinitionScope(), args, type, op, LookupMode.LIMITED_GLOBALS); + return CPPSemantics.findOverloadedOperator(point, getTemplateDefinitionScope(), args, type, + op, LookupMode.LIMITED_GLOBALS); } @Override @@ -207,7 +209,8 @@ public class EvalUnary extends CPPDependentEvaluation { ICPPMember member= (ICPPMember) fAddressOfQualifiedNameBinding; if (!member.isStatic()) { try { - return new CPPPointerToMemberType(member.getType(), member.getClassOwner(), false, false, false); + return new CPPPointerToMemberType(member.getType(), member.getClassOwner(), + false, false, false); } catch (DOMException e) { return e.getProblem(); } @@ -245,7 +248,7 @@ public class EvalUnary extends CPPDependentEvaluation { public IValue getValue(IASTNode point) { if (isValueDependent()) return Value.create(this); - + if (getOverload(point) != null) { // TODO(sprigogin): Simulate execution of a function call. return Value.create(this); @@ -253,11 +256,13 @@ public class EvalUnary extends CPPDependentEvaluation { switch (fOperator) { case op_sizeof: { - SizeAndAlignment info = SizeofCalculator.getSizeAndAlignment(fArgument.getTypeOrFunctionSet(point), point); + SizeAndAlignment info = + SizeofCalculator.getSizeAndAlignment(fArgument.getTypeOrFunctionSet(point), point); return info == null ? Value.UNKNOWN : Value.create(info.size); } case op_alignOf: { - SizeAndAlignment info = SizeofCalculator.getSizeAndAlignment(fArgument.getTypeOrFunctionSet(point), point); + SizeAndAlignment info = + SizeofCalculator.getSizeAndAlignment(fArgument.getTypeOrFunctionSet(point), point); return info == null ? Value.UNKNOWN : Value.create(info.alignment); } case op_noexcept: @@ -273,7 +278,7 @@ public class EvalUnary extends CPPDependentEvaluation { IValue val = fArgument.getValue(point); if (val == null) return Value.UNKNOWN; - + Long num = val.numericalValue(); if (num != null) { return Value.evaluateUnaryExpression(fOperator, num); @@ -307,7 +312,8 @@ public class EvalUnary extends CPPDependentEvaluation { marshalTemplateDefinition(buffer); } - public static ISerializableEvaluation unmarshal(short firstBytes, ITypeMarshalBuffer buffer) throws CoreException { + public static ISerializableEvaluation unmarshal(short firstBytes, ITypeMarshalBuffer buffer) + throws CoreException { int op= buffer.getByte(); ICPPEvaluation arg= (ICPPEvaluation) buffer.unmarshalEvaluation(); IBinding binding= buffer.unmarshalBinding(); @@ -328,17 +334,17 @@ public class EvalUnary extends CPPDependentEvaluation { } if (argument == fArgument && aoqn == fAddressOfQualifiedNameBinding) return this; - + return new EvalUnary(fOperator, argument, aoqn, getTemplateDefinition()); } @Override - public ICPPEvaluation computeForFunctionCall(CPPFunctionParameterMap parameterMap, - int maxdepth, IASTNode point) { + public ICPPEvaluation computeForFunctionCall(CPPFunctionParameterMap parameterMap, int maxdepth, + IASTNode point) { ICPPEvaluation argument = fArgument.computeForFunctionCall(parameterMap, maxdepth, point); if (argument == fArgument) return this; - + return new EvalUnary(fOperator, argument, fAddressOfQualifiedNameBinding, getTemplateDefinition()); } diff --git a/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/LRTemplateTests.java b/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/LRTemplateTests.java index 82dc3aae40d..4b33ed1f546 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/LRTemplateTests.java +++ b/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/LRTemplateTests.java @@ -103,10 +103,10 @@ public class LRTemplateTests extends AST2TemplateTests { public void testFunctionParameterPacksInNonFinalPosition_324096() throws Exception {} //decltype related @Override - public void testFunctionCallOnDependentName_Bug337686() throws Exception {} + public void testFunctionCallOnDependentName_337686() throws Exception {} //variadic template @Override - public void testVariadicFunctionTemplate_Bug333389() throws Exception {} + public void testVariadicFunctionTemplate_333389() throws Exception {} //auto @Override public void testRRefVsRef_351927() throws Exception {}