diff --git a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/CxxAstUtils.java b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/CxxAstUtils.java index 443b5c3cd93..e3edb4db8a3 100644 --- a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/CxxAstUtils.java +++ b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/CxxAstUtils.java @@ -169,7 +169,7 @@ public final class CxxAstUtils { * For any BinaryExpression, guess the type from the other operand. (A good * guess for =, ==; hard to get a better guess for others) * - * @return inferred type or {@code null} if couldn't infer + * @return inferred type or null if couldn't infer */ private static IType tryInferTypeFromBinaryExpr(IASTName astName) { if (astName.getParent() instanceof IASTIdExpression && astName.getParent().getParent() instanceof IASTBinaryExpression) { @@ -188,8 +188,9 @@ public final class CxxAstUtils { * For a function call, tries to find a matching function declaration. * Checks the argument count. * - * @param index the index - * @return a generated declaration or {@code null} if not suitable + * @param index + * + * @return a generated declaration or null if not suitable */ private static IASTSimpleDeclaration tryInferTypeFromFunctionCall(IASTName astName, INodeFactory factory, IIndex index) { if (astName.getParent() instanceof IASTIdExpression && astName.getParent().getParent() instanceof IASTFunctionCallExpression @@ -302,11 +303,13 @@ public final class CxxAstUtils { /** * If the function definition belongs to a class, returns the class. - * Otherwise, returns {@code null}. + * Otherwise, returns null. * - * @param function the function definition to check - * @param index the index to use for name lookup - * @return either a type specifier or {@code null} + * @param function + * the function definition to check + * @param index + * the index to use for name lookup + * @return Either a type specifier or null */ public static IASTCompositeTypeSpecifier getCompositeTypeFromFunction(final IASTFunctionDefinition function, final IIndex index) { // Return value to be set via visitor. @@ -368,19 +371,19 @@ public final class CxxAstUtils { return returnSpecifier[0]; } - public static boolean isThrowStatement(IASTNode statement) { - if (!(statement instanceof IASTExpressionStatement)) + public static boolean isThrowStatement(IASTNode body) { + if (!(body instanceof IASTExpressionStatement)) return false; - IASTExpression expression = ((IASTExpressionStatement) statement).getExpression(); + IASTExpression expression = ((IASTExpressionStatement) body).getExpression(); if (!(expression instanceof IASTUnaryExpression)) return false; return ((IASTUnaryExpression) expression).getOperator() == IASTUnaryExpression.op_throw; } - public static boolean isExitStatement(IASTNode statement) { - if (!(statement instanceof IASTExpressionStatement)) + public static boolean isExitStatement(IASTNode body) { + if (!(body instanceof IASTExpressionStatement)) return false; - IASTExpression expression = ((IASTExpressionStatement) statement).getExpression(); + IASTExpression expression = ((IASTExpressionStatement) body).getExpression(); if (!(expression instanceof IASTFunctionCallExpression)) return false; IASTExpression functionNameExpression = ((IASTFunctionCallExpression) expression).getFunctionNameExpression(); diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java index bb2240c7301..1ef8546ec14 100644 --- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java +++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java @@ -1,55 +1,55 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Alena Laskavaia + * Copyright (c) 2009, 2010 Alena Laskavaia * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Alena Laskavaia - initial API and implementation + * Alena Laskavaia - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.codan.core.model; import org.eclipse.core.resources.IResource; /** - * Interface to describe problem location. Usually contains file and line number, + * Interface to describe problem location. Usually contains file and linenumber, * also supports character positions for sophisticated errors. - * + * * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. */ public interface IProblemLocation { /** - * - * @return the file where the problem occurred + * + * @return File for the problem - absolute full paths */ IResource getFile(); /** - * + * * @return Primary line for the problem, lines start with 1 for file. If -1 * char position would be used. */ int getLineNumber(); /** - * + * * @return character position where problem starts within file, first char * is 0, inclusive, tab count as one. If unknown return -1. */ int getStartingChar(); /** - * + * * @return character position where problem ends within file, first char is * 0, exclusive, tab count as one. If unknown return -1. */ int getEndingChar(); /** - * - * @return extra data for the problem location, checker specific, can be + * + * @return extra data for problem location, checker specific, can be * backtrace for example */ Object getData(); diff --git a/core/org.eclipse.cdt.core.native/.settings/org.eclipse.jdt.core.prefs b/core/org.eclipse.cdt.core.native/.settings/org.eclipse.jdt.core.prefs index 11e273c7aee..84309ca7d50 100644 --- a/core/org.eclipse.cdt.core.native/.settings/org.eclipse.jdt.core.prefs +++ b/core/org.eclipse.cdt.core.native/.settings/org.eclipse.jdt.core.prefs @@ -80,7 +80,6 @@ org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 @@ -88,21 +87,18 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_e org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 @@ -122,7 +118,6 @@ org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line @@ -138,17 +133,11 @@ org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.comment.line_length=110 org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true @@ -166,9 +155,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert @@ -216,7 +203,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert @@ -235,14 +221,12 @@ org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invoca org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert @@ -266,7 +250,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invoc org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert @@ -294,7 +277,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert @@ -323,7 +305,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invoc org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert @@ -333,7 +314,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=inser org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -349,7 +329,7 @@ org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=110 +org.eclipse.jdt.core.formatter.lineSplit=100 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 @@ -357,8 +337,5 @@ org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.size=4 -org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true -org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/core/org.eclipse.cdt.core.native/.settings/org.eclipse.jdt.ui.prefs b/core/org.eclipse.cdt.core.native/.settings/org.eclipse.jdt.ui.prefs index 59ca621b2ed..b6ac6d0fe0b 100644 --- a/core/org.eclipse.cdt.core.native/.settings/org.eclipse.jdt.ui.prefs +++ b/core/org.eclipse.cdt.core.native/.settings/org.eclipse.jdt.ui.prefs @@ -1,4 +1,5 @@ +#Wed Jan 28 12:19:26 CET 2009 eclipse.preferences.version=1 formatter_profile=_CDT -formatter_settings_version=12 +formatter_settings_version=11 internal.default.compliance=user diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ASTComparer.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ASTComparer.java index 50bb5310f43..c855b0120a2 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ASTComparer.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ASTComparer.java @@ -18,11 +18,11 @@ import java.util.Arrays; import java.util.HashSet; import java.util.Set; +import junit.framework.Assert; import junit.framework.AssertionFailedError; import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.internal.core.dom.parser.ASTNode; -import org.junit.Assert; public class ASTComparer extends Assert { diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPImplicitNameTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPImplicitNameTests.java index acc1ac4e1f0..89696edce96 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPImplicitNameTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPImplicitNameTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 IBM Corporation and others. + * Copyright (c) 2009, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -13,12 +13,8 @@ *******************************************************************************/ package org.eclipse.cdt.core.parser.tests.ast2; -import java.io.IOException; - import junit.framework.TestSuite; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorNameOwner; import org.eclipse.cdt.core.dom.ast.IASTImplicitName; import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner; import org.eclipse.cdt.core.dom.ast.IASTNodeSelector; @@ -29,11 +25,9 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance; import org.eclipse.cdt.core.parser.ParserLanguage; -import org.eclipse.cdt.internal.core.parser.ParserException; /** - * Tests for classes implementing {@link IASTImplicitNameOwner} and {@link IASTImplicitDestructorNameOwner} - * interfaces. + * Tests for classes implementing IASTImplicitNameOwner interface. */ public class AST2CPPImplicitNameTests extends AST2TestBase { @@ -48,12 +42,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { return suite(AST2CPPImplicitNameTests.class); } - protected BindingAssertionHelper getAssertionHelper() throws ParserException, IOException { - String code= getAboveComment(); - return new BindingAssertionHelper(code, ParserLanguage.CPP); - } - - protected IASTImplicitName[] getImplicitNames(IASTTranslationUnit tu, String contents, String section, int len) { + public IASTImplicitName[] getImplicitNames(IASTTranslationUnit tu, String contents, String section, int len) { final int offset = contents.indexOf(section); assertTrue(offset >= 0); IASTNodeSelector selector = tu.getNodeSelector(null); @@ -63,25 +52,6 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { return implicits; } - protected IASTImplicitDestructorName[] getImplicitDestructorNames(IASTTranslationUnit tu, String contents, - String section) { - return getImplicitDestructorNames(tu, contents, section, section.length()); - } - - protected IASTImplicitDestructorName[] getImplicitDestructorNames(IASTTranslationUnit tu, String contents, - String section, int len) { - final int offset = contents.indexOf(section); - assertTrue(offset >= 0); - IASTNodeSelector selector = tu.getNodeSelector(null); - IASTImplicitName firstImplicit = selector.findImplicitName(offset, len); - if (firstImplicit instanceof IASTImplicitDestructorName) { - IASTImplicitDestructorNameOwner owner = (IASTImplicitDestructorNameOwner) firstImplicit.getParent(); - IASTImplicitDestructorName[] implicits = owner.getImplicitDestructorNames(); - return implicits; - } - return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; - } - // class point { // int x, y; // public: @@ -101,7 +71,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // +p; // } public void testBinaryExpressions() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); + BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); IASTTranslationUnit tu = ba.getTranslationUnit(); NameCollector col = new NameCollector(); tu.accept(col); @@ -145,7 +115,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // *y; //2 // } public void testPointerDereference() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); + BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); ba.assertImplicitName("*x;", 1, ICPPFunction.class); ba.assertNoImplicitName("*y; //2", 1); } @@ -163,7 +133,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // X* px2 = &y; // overloaded // } public void testPointerToMember() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); + BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); IASTTranslationUnit tu = ba.getTranslationUnit(); NameCollector col = new NameCollector(); tu.accept(col); @@ -224,7 +194,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // (++p1).x; //2 // } public void testUnaryPrefixAndPostfix() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); + BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); ba.assertImplicitName("++).x; //1", 2, ICPPFunction.class); ba.assertImplicitName("++p1).x; //2", 2, ICPPMethod.class); } @@ -250,7 +220,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // test(a, b, c, d); // func // } public void testCommaOperator1() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); + BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); // expression lists are used in function calls but they should not resolve to the comma operator ba.assertNoImplicitName(", b, c, d); // func", 1); ba.assertNoImplicitName(", c, d); // func", 1); @@ -285,7 +255,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // (a, b, c, d).ee; // expr // } public void testCommaOperator2() throws Exception { - BindingAssertionHelper ba = getAssertionHelper(); + BindingAssertionHelper ba = new BindingAssertionHelper(getAboveComment(), true); IASTImplicitName opAB = ba.assertImplicitName(", b, c, d", 1, ICPPMethod.class); IASTImplicitName opCC = ba.assertImplicitName(", c, d", 1, ICPPFunction.class); @@ -316,7 +286,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // x(1, 2); // 3 // } public void testFunctionCallOperator() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); + BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); IASTTranslationUnit tu = ba.getTranslationUnit(); NameCollector col = new NameCollector(); tu.accept(col); @@ -357,7 +327,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // b = a; // should not resolve // } public void testCopyAssignmentOperator() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); + BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); ba.assertNoImplicitName("= a;", 1); } @@ -375,7 +345,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // func(y[q]); //2 // } public void testArraySubscript() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); + BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); IASTTranslationUnit tu = ba.getTranslationUnit(); NameCollector col = new NameCollector(); tu.accept(col); @@ -410,7 +380,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // delete 1; // } public void testDelete() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); + BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); IASTImplicitName[] names = ba.getImplicitNames("delete x;", 6); assertEquals(2, names.length); IASTImplicitName destructor = names[0]; @@ -444,7 +414,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // delete b; // } public void testOverloadedDelete_Bug351547() throws Exception { - BindingAssertionHelper bh= getAssertionHelper(); + BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true); IBinding m= bh.assertNonProblem("operator delete(void * a)", 15); IBinding f= bh.assertNonProblem("operator delete(void * b)", 15); @@ -471,7 +441,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // B* b = new B; // } public void testOverloadedNew_Bug354585() throws Exception { - BindingAssertionHelper bh= getAssertionHelper(); + BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true); IBinding m= bh.assertNonProblem("operator new(size_t a)", 12); IBinding f= bh.assertNonProblem("operator new(size_t b)", 12); @@ -490,7 +460,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // delete[] x; // } public void testImplicitNewAndDelete() throws Exception { - BindingAssertionHelper ba = getAssertionHelper(); + BindingAssertionHelper ba = new BindingAssertionHelper(getAboveComment(), true); ba.assertNoImplicitName("new X", 3); ba.assertNoImplicitName("delete[]", 6); } @@ -509,7 +479,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // int* p2 = new (5, 6) int[5]; // } public void testNew() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); + BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); IASTImplicitName n1 = ba.assertImplicitName("new (nothrow) X", 3, ICPPFunction.class); IASTImplicitName n2 = ba.assertImplicitName("new (nothrow) int", 3, ICPPFunction.class); IASTImplicitName n3 = ba.assertImplicitName("new (5, 6) int", 3, ICPPFunction.class); @@ -527,7 +497,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // throw; // } public void testEmptyThrow() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); + BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); ba.assertNoImplicitName("throw;", 5); } @@ -556,7 +526,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // }; // B C::t = 1; public void testConstructorCall() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); + BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); IASTTranslationUnit tu = ba.getTranslationUnit(); ICPPConstructor ctor0 = ba.assertNonProblem("A()", 1, ICPPConstructor.class); ICPPConstructor ctor1 = ba.assertNonProblem("A(int)", 1, ICPPConstructor.class); @@ -593,21 +563,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { // } // } public void testBuiltinOperators_294543() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); - IASTTranslationUnit tu = ba.getTranslationUnit(); - ICPPFunction op = ba.assertNonProblem("operator==", 0); - IASTImplicitName a = ba.assertImplicitName("==b", 2, ICPPFunction.class); - assertSame(op, a.resolveBinding()); - } - - // struct A { - // ~A(); - // int a; - // }; - // int x = A().a; - public void testDestructor() throws Exception { - BindingAssertionHelper ba= getAssertionHelper(); - XXX + BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); IASTTranslationUnit tu = ba.getTranslationUnit(); ICPPFunction op = ba.assertNonProblem("operator==", 0); IASTImplicitName a = ba.assertImplicitName("==b", 2, ICPPFunction.class); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java index 3b0a1ca078b..ebf995b598e 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java @@ -41,8 +41,6 @@ import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement; import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition; import org.eclipse.cdt.core.dom.ast.IASTIdExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorNameOwner; import org.eclipse.cdt.core.dom.ast.IASTImplicitName; import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner; import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; @@ -675,16 +673,6 @@ public class AST2TestBase extends BaseTestCase { return implicits; } - public IASTImplicitDestructorName[] getImplicitDestructotNames(String section, int len) { - final int offset = contents.indexOf(section); - assertTrue(offset >= 0); - IASTNodeSelector selector = tu.getNodeSelector(null); - IASTNode enclosingNode = selector.findStrictlyEnclosingNode(offset, len); - if (!(enclosingNode instanceof IASTImplicitDestructorNameOwner)) - return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; - return ((IASTImplicitDestructorNameOwner) enclosingNode).getImplicitDestructorNames(); - } - public IASTName findName(String section, int len) { final int offset = contents.indexOf(section); assertTrue("Section \"" + section + "\" not found", offset >= 0); @@ -708,7 +696,7 @@ public class AST2TestBase extends BaseTestCase { return findName(contents, name); } - public IASTImplicitName findImplicitName(String section, int len) { + public IASTName findImplicitName(String section, int len) { final int offset = contents.indexOf(section); assertTrue(offset >= 0); IASTNodeSelector selector = tu.getNodeSelector(null); diff --git a/core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.core.prefs b/core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.core.prefs index 11e273c7aee..4de53820811 100644 --- a/core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.core.prefs +++ b/core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.core.prefs @@ -1,3 +1,4 @@ +#Mon Oct 17 17:36:13 PDT 2011 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 @@ -80,7 +81,6 @@ org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 @@ -88,21 +88,18 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_e org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 @@ -122,7 +119,6 @@ org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line @@ -138,17 +134,11 @@ org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.comment.line_length=110 org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true @@ -166,9 +156,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert @@ -216,7 +204,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert @@ -235,14 +222,12 @@ org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invoca org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert @@ -266,7 +251,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invoc org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert @@ -294,7 +278,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert @@ -323,7 +306,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invoc org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert @@ -333,7 +315,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=inser org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -349,7 +330,7 @@ org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=110 +org.eclipse.jdt.core.formatter.lineSplit=100 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 @@ -357,8 +338,5 @@ org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.size=4 -org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true -org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.ui.prefs b/core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.ui.prefs index 59ca621b2ed..b6ac6d0fe0b 100644 --- a/core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.ui.prefs +++ b/core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.ui.prefs @@ -1,4 +1,5 @@ +#Wed Jan 28 12:19:26 CET 2009 eclipse.preferences.version=1 formatter_profile=_CDT -formatter_settings_version=12 +formatter_settings_version=11 internal.default.compliance=user diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTNameCollector.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTNameCollector.java index 0d769d291e5..bca7eb6a167 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTNameCollector.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTNameCollector.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Markus Schorn - initial API and implementation + * Markus Schorn - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.core.dom.ast; @@ -22,11 +22,12 @@ import org.eclipse.core.runtime.Assert; * @since 5.1 */ public final class ASTNameCollector extends ASTVisitor { - private final char[] fName; - private final ArrayList fFound= new ArrayList<>(4); + + private char[] fName; + private ArrayList fFound= new ArrayList(4); /** - * Constructs a name collector for the given name. + * Construct a name collector for the given name. */ public ASTNameCollector(char[] name) { Assert.isNotNull(name); @@ -35,7 +36,7 @@ public final class ASTNameCollector extends ASTVisitor { } /** - * Constructs a name collector for the given name. + * Construct a name collector for the given name. */ public ASTNameCollector(String name) { this(name.toCharArray()); @@ -52,14 +53,14 @@ public final class ASTNameCollector extends ASTVisitor { } /** - * Returns the array of matching names. + * Return the array of matching names. */ public IASTName[] getNames() { return fFound.toArray(new IASTName[fFound.size()]); } /** - * Clears the names found, such that the collector can be reused. + * Clear the names found, such that the collector can be reused. */ public void clear() { fFound.clear(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java index 6f9818254bd..812fd37948a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -172,8 +172,6 @@ public abstract class ASTVisitor { * Implicit names are created to allow implicit bindings to be resolved, * normally they are not visited, set this flag to true to visit them. * @since 5.1 - * @see #visit(IASTName) - * @see IASTImplicitName */ public boolean shouldVisitImplicitNames = false; @@ -181,21 +179,9 @@ public abstract class ASTVisitor { * Sometimes more than one implicit name is created for a binding, * set this flag to true to visit more than one name for an implicit binding. * @since 5.1 - * @see #visit(IASTName) - * @see IASTImplicitName */ public boolean shouldVisitImplicitNameAlternates = false; - /** - * Implicit destructor names are created to mark code locations where destructors of temporaries and - * variables going out of scope are called, normally they are not visited, set this flag to true to visit - * them. - * @since 5.11 - * @see #visit(IASTName) - * @see IASTImplicitDestructorName - */ - public boolean shouldVisitImplicitDestructorNames = false; - /** * Creates a visitor that does not visit any kind of node per default. */ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCompoundStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCompoundStatement.java index e11153f8a45..8e9016bd425 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCompoundStatement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCompoundStatement.java @@ -18,30 +18,33 @@ package org.eclipse.cdt.core.dom.ast; */ public interface IASTCompoundStatement extends IASTStatement { /** - * {@code NESTED_STATEMENT} represents the relationship between an {@code IASTCompoundStatement} - * and its nested {@code IASTStatement} + * NESTED_STATEMENT represents the relationship between an + * IASTCompoundStatement and its nested + * IASTStatement */ public static final ASTNodeProperty NESTED_STATEMENT = new ASTNodeProperty( "IASTCompoundStatement.NESTED_STATEMENT - nested IASTStatement for IASTCompoundStatement"); //$NON-NLS-1$ /** - * Returns the statements in this block. + * Gets the statements in this block. * * @return Array of IASTStatement */ public IASTStatement[] getStatements(); /** - * Adds a statement to the compound block. + * Add a statement to the compound block. * - * @param statement the statement to be added + * @param statement + * statement to be added */ public void addStatement(IASTStatement statement); /** - * Returns {@code IScope} node that this node eludes to in the logical tree. + * Get IScope node that this node eludes to in the logical + * tree. * - * @return the {@code IScope} + * @return the IScope */ public IScope getScope(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTDoStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTDoStatement.java index 2a8d61b4520..c7f0ba6daa7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTDoStatement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTDoStatement.java @@ -18,32 +18,33 @@ package org.eclipse.cdt.core.dom.ast; */ public interface IASTDoStatement extends IASTStatement { /** - * {@code BODY} represents the relationship between a - * {@code IASTDoStatement} and its nested body - * {@code IASTStatement}. + * BODY represents the relationship between a + * IASTDoStatement and its nested body + * IASTStatement. */ public static final ASTNodeProperty BODY = new ASTNodeProperty("IASTDoStatement.BODY - nested body for IASTDoStatement"); //$NON-NLS-1$ /** - * {@code CONDITION} represents the relationship between a - * {@code IASTDoStatement} and its condition - * {@code IASTExpression}. + * CONDITION represents the relationship between a + * IASTDoStatement and its condition + * IASTExpression. */ public static final ASTNodeProperty CONDITION = new ASTNodeProperty( "IASTDoStatement.CONDITION - IASTExpression condition for IASTDoStatement"); //$NON-NLS-1$ /** - * Returns the body of the loop. + * Get the body of the loop. * - * @return {@code IASTStatement} loop code body + * @return IASTStatement loop code body */ public IASTStatement getBody(); /** - * Sets the body of the loop. + * Set the body of the loop. * - * @param body an {@code IASTStatement} + * @param body + * an IASTStatement */ public void setBody(IASTStatement body); @@ -55,9 +56,10 @@ public interface IASTDoStatement extends IASTStatement { public IASTExpression getCondition(); /** - * Sets the condition for the loop. + * Set the condition for the loop. * - * @param condition an {@code IASTExpression} + * @param condition + * an IASTExpression */ public void setCondition(IASTExpression condition); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTExpressionList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTExpressionList.java index ea97e5c4db0..55a874a4a7b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTExpressionList.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTExpressionList.java @@ -11,7 +11,7 @@ package org.eclipse.cdt.core.dom.ast; /** - * Expression list (comma separated list of expressions). + * Expression List (Comma separated list of expressions). * * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. @@ -26,16 +26,17 @@ public interface IASTExpressionList extends IASTExpression { "IASTExpressionList.NESTED_EXPRESSION - Nested IASTExpression for IASTExpressionList"); //$NON-NLS-1$ /** - * Returns nested expressions. + * Get nested expressions. * - * @return an array of nested expressions + * @return IASTExpression[] nested expressions */ public IASTExpression[] getExpressions(); /** - * Adds nested expression. + * Add nested expression. * - * @param expression the expression to be added. + * @param expression + * IASTExpression value to be added. */ public void addExpression(IASTExpression expression); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTForStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTForStatement.java index d53b9765bba..c0020387e7a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTForStatement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTForStatement.java @@ -19,89 +19,96 @@ package org.eclipse.cdt.core.dom.ast; */ public interface IASTForStatement extends IASTStatement { /** - * {@code CONDITION} represents the relationship between a {@code IASTForStatement} and - * its {@code IASTExpression} condition. + * CONDITION represents the relationship between a + * IASTForStatement and its IASTExpression + * condition. */ public static final ASTNodeProperty CONDITION = new ASTNodeProperty( "IASTForStatement.CONDITION - IASTExpression condition of IASTForStatement"); //$NON-NLS-1$ /** - * {@code ITERATION} represents the relationship between a {@code IASTForStatement} and - * its {@code IASTExpression} iteration expression. + * ITERATION represents the relationship between a + * IASTForStatement and its IASTExpression + * iteration expression. */ public static final ASTNodeProperty ITERATION = new ASTNodeProperty( "IASTForStatement.ITERATION - IASTExpression iteration of IASTForStatement"); //$NON-NLS-1$ /** - * {@code BODY} represents the relationship between a {@code IASTForStatement} and - * its {@code IASTStatement} body. + * BODY represents the relationship between a + * IASTForStatement and its IASTStatement + * body. */ public static final ASTNodeProperty BODY = new ASTNodeProperty( "IASTForStatement.BODY - IASTStatement body of IASTForStatement"); //$NON-NLS-1$ /** - * {@code INITIALIZER} represents the relationship between a {@code IASTForStatement} and - * its {@code IASTDeclaration} initializer. + * INITIALIZER represents the relationship between a + * IASTForStatement and its IASTDeclaration + * initializer. */ public static final ASTNodeProperty INITIALIZER = new ASTNodeProperty( "IASTForStatement.INITIALIZER - initializer for IASTForStatement"); //$NON-NLS-1$ - /** - * Returns the initializer statement. - */ + public IASTStatement getInitializerStatement(); /** * @param statement */ - public void setInitializerStatement(IASTStatement statement); + public void setInitializerStatement( IASTStatement statement ); /** - * Returns the condition expression for the loop. + * Get the condition expression for the loop. * - * @return {@code IASTExpression} + * @return IASTExpression */ public IASTExpression getConditionExpression(); /** - * Sets the condition expression for the loop. + * Set the condition expression for the loop. * - * @param condition {@code IASTExpression} + * @param condition + * IASTExpression */ public void setConditionExpression(IASTExpression condition); /** - * Returns the expression that is evaluated after the completion of an iteration of the loop. + * Get the expression that is evaluated after the completion of an iteration + * of the loop. * - * @return {@code IASTExpression} + * @return IASTExpression */ public IASTExpression getIterationExpression(); /** - * Sets the expression that is evaluated after the completion of an iteration of the loop. + * Set the expression that is evaluated after the completion of an iteration + * of the loop. * - * @param iterator {@code IASTExpression} + * @param iterator + * IASTExpression */ public void setIterationExpression(IASTExpression iterator); /** - * Returns the statements that this for loop controls. + * Get the statements that this for loop controls. * - * @return {@code IASTStatement} + * @return IASTStatement */ public IASTStatement getBody(); /** - * Sets the body of the for loop. + * Set the body of the for loop. * - * @param statement {@code IASTStatement} + * @param statement + * IASTStatement */ public void setBody(IASTStatement statement); /** - * Returns the {@code IScope} represented by this for loop. + * Get the IScope represented by this for loop. * - * @return {@code IScope} + * @return IScope */ public IScope getScope(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTFunctionDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTFunctionDefinition.java index a2f693ca0e1..39aeb1bd3a9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTFunctionDefinition.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTFunctionDefinition.java @@ -18,24 +18,24 @@ package org.eclipse.cdt.core.dom.ast; */ public interface IASTFunctionDefinition extends IASTDeclaration { /** - * {@code DECL_SPECIFIER} represents the relationship between a - * {@code IASTFunctionDefinition} and its - * {@code IASTDeclSpecifier}. + * DECL_SPECIFIER represents the relationship between a + * IASTFunctionDefinition and its + * IASTDeclSpecifier. */ public static final ASTNodeProperty DECL_SPECIFIER = new ASTNodeProperty( "IASTFunctionDefinition.DECL_SPECIFIER - IASTDeclSpecifier for IASTFunctionDefinition"); //$NON-NLS-1$ /** - * {@code DECLARATOR} represents the relationship between a - * {@code IASTFunctionDefinition} and its - * {@code IASTFunctionDeclarator}. + * DECLARATOR represents the relationship between a + * IASTFunctionDefinition and its + * IASTFunctionDeclarator. */ public static final ASTNodeProperty DECLARATOR = new ASTNodeProperty( "IASTFunctionDefinition.DECLARATOR - IASTFunctionDeclarator for IASTFunctionDefinition"); //$NON-NLS-1$ /** - * {@code FUNCTION_BODY} represents the relationship between a - * {@code IASTFunctionDefinition} and its {@code IASTStatement}. + * FUNCTION_BODY represents the relationship between a + * IASTFunctionDefinition and its IASTStatement. */ public static final ASTNodeProperty FUNCTION_BODY = new ASTNodeProperty( "IASTFunctionDefinition.FUNCTION_BODY - Function Body for IASTFunctionDefinition"); //$NON-NLS-1$ @@ -73,7 +73,6 @@ public interface IASTFunctionDefinition extends IASTDeclaration { * void (f)(int a); // has nested declarator * void (f(int a)); // is nested in another declarator * - * * @param declarator */ public void setDeclarator(IASTFunctionDeclarator declarator); @@ -81,6 +80,7 @@ public interface IASTFunctionDefinition extends IASTDeclaration { /** * Returns the body of the function. This is usually a compound statement but * C++ also has a function try block. + * */ public IASTStatement getBody(); @@ -94,7 +94,7 @@ public interface IASTFunctionDefinition extends IASTDeclaration { /** * Get the logical IScope that the function definition body represents. * - * @return {@code IScope} representing function body. + * @return IScope representing function body. */ public IScope getScope(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTIfStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTIfStatement.java index f27cea5fc99..ba040b734a8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTIfStatement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTIfStatement.java @@ -18,22 +18,22 @@ package org.eclipse.cdt.core.dom.ast; */ public interface IASTIfStatement extends IASTStatement { /** - * {@code CONDITION} represents the relationship between an - * {@code IASTIfStatement} and its nested {@code IASTExpression}. + * CONDITION represents the relationship between an + * IASTIfStatement and its nested IASTExpression. */ public static final ASTNodeProperty CONDITION = new ASTNodeProperty( "IASTIfStatement.CONDITION - IASTExpression condition for IASTIfStatement"); //$NON-NLS-1$ /** - * {@code THEN} represents the relationship between an - * {@code IASTIfStatement} and its nested {@code IASTStatement} + * THEN represents the relationship between an + * IASTIfStatement and its nested IASTStatement * (then). */ public static final ASTNodeProperty THEN = new ASTNodeProperty("IASTIfStatement.THEN - IASTStatement (then) for IASTIfStatement"); //$NON-NLS-1$ /** - * {@code ELSE} represents the relationship between an - * {@code IASTIfStatement} and its nested {@code IASTStatement} + * ELSE represents the relationship between an + * IASTIfStatement and its nested IASTStatement * (else). */ public static final ASTNodeProperty ELSE = new ASTNodeProperty("IASTIfStatement.ELSE - IASTStatement (else) for IASTIfStatement"); //$NON-NLS-1$ @@ -41,7 +41,7 @@ public interface IASTIfStatement extends IASTStatement { /** * Returns the condition in the if statement. * - * @return the condition {@code IASTExpression}. May return {@code null} if the 'if' + * @return the condition IASTExpression. May return null if the 'if' * statement has condition declaration instead of condition expression * (see {@link org.eclipse.cdt.core.dom.ast.cpp.ICPPASTIfStatement}). */ @@ -50,21 +50,23 @@ public interface IASTIfStatement extends IASTStatement { /** * Sets the condition in the if statement. * - * @param condition {@code IASTExpression} + * @param condition + * IASTExpression */ public void setConditionExpression(IASTExpression condition); /** * Returns the statement that is executed if the condition is true. * - * @return the then clause {@code IASTStatement} + * @return the then clause IASTStatement */ public IASTStatement getThenClause(); /** * Sets the statement that is executed if the condition is true. * - * @param thenClause {@code IASTStatement} + * @param thenClause + * IASTStatement */ public void setThenClause(IASTStatement thenClause); @@ -72,14 +74,15 @@ public interface IASTIfStatement extends IASTStatement { * Returns the statement that is executed if the condition is false. This clause * is optional and returns null if there is none. * - * @return the else clause or {@code null} {@code IASTStatement} + * @return the else clause or null IASTStatement */ public IASTStatement getElseClause(); /** * Sets the else clause. * - * @param elseClause {@code IASTStatement} + * @param elseClause + * IASTStatement */ public void setElseClause(IASTStatement elseClause); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTImplicitDestructorName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTImplicitDestructorName.java deleted file mode 100644 index 396fe5c048a..00000000000 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTImplicitDestructorName.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Google, Inc and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Sergey Prigogin (Google) - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.core.dom.ast; - -/** - * An implicit name corresponding to a destructor call for a temporary or a variable going out of scope. - * - * @since 5.11 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IASTImplicitDestructorName extends IASTImplicitName { - public static final IASTImplicitDestructorName[] EMPTY_NAME_ARRAY = {}; - - /** - * Returns the name corresponding to the constructor call. - */ - IASTImplicitName getConstructionPoint(); -} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTImplicitDestructorNameOwner.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTImplicitDestructorNameOwner.java deleted file mode 100644 index 68c0b96303a..00000000000 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTImplicitDestructorNameOwner.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Google, Inc and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Sergey Prigogin (Google) - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.core.dom.ast; - -/** - * An AST node that may have implicit destructor names. - * @see IASTImplicitDestructorName - * - * @since 5.11 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IASTImplicitDestructorNameOwner extends IASTNode { - public static final ASTNodeProperty IMPLICIT_DESTRUCTOR_NAME = - new ASTNodeProperty("IASTImplicitDestructorNameOwner.IMPLICIT_DESTRUCTOR_NAME"); //$NON-NLS-1$ - - public IASTImplicitDestructorName[] getImplicitDestructorNames(); -} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTInitializerClause.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTInitializerClause.java index ae623bf7cf4..0829eec5795 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTInitializerClause.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTInitializerClause.java @@ -11,7 +11,7 @@ package org.eclipse.cdt.core.dom.ast; /** - * Interface for AST nodes that can nest in initializer lists. + * Interface for ast nodes that can nest in initializer lists. * @since 5.2 * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTReturnStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTReturnStatement.java index f49d7cdfa79..c8ec29969aa 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTReturnStatement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTReturnStatement.java @@ -22,25 +22,25 @@ public interface IASTReturnStatement extends IASTStatement { /** * This is the optional return value for this function. * - * @return the return expression or {@code null}. + * @return the return expression or null. */ public IASTExpression getReturnValue(); /** - * Returns the return value as {@link IASTInitializerClause}, or {@code null}. - * In C++ this can be an braced initializer list. + * Returns the return value as {@link IASTInitializerClause}, or null. + * In c++ this can be an braced initializer list. * @since 5.2 */ public IASTInitializerClause getReturnArgument(); /** - * Not allowed on frozen AST. + * Not allowed on frozen ast. * @since 5.2 */ public void setReturnArgument(IASTInitializerClause returnValue); /** - * Not allowed on frozen AST. + * Not allowed on frozen ast. */ public void setReturnValue(IASTExpression returnValue); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTypeIdInitializerExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTypeIdInitializerExpression.java index a5d13fd7a5b..1d778e5c1bf 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTypeIdInitializerExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTypeIdInitializerExpression.java @@ -24,8 +24,7 @@ public interface IASTTypeIdInitializerExpression extends IASTExpression { * IASTTypeIdInitializerExpression and * IASTTypeId. */ - public static final ASTNodeProperty TYPE_ID = - new ASTNodeProperty("IASTTypeIdInitializerExpression.TYPE_ID - IASTTypeId for IASTTypeIdInitializerExpression"); //$NON-NLS-1$ + public static final ASTNodeProperty TYPE_ID = new ASTNodeProperty("IASTTypeIdInitializerExpression.TYPE_ID - IASTTypeId for IASTTypeIdInitializerExpression"); //$NON-NLS-1$ /** * INITIALIZER represents the relationship between an diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTWhileStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTWhileStatement.java index ea7670db822..180b2eb8a78 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTWhileStatement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTWhileStatement.java @@ -18,27 +18,27 @@ package org.eclipse.cdt.core.dom.ast; */ public interface IASTWhileStatement extends IASTStatement { /** - * {@code CONDITIONEXPRESSION} represents the relationship between an {@code IASTWhileStatement} and - * it's nested {@code IASTExpression}. + * CONDITIONEXPRESSION represents the relationship between an IASTWhileStatement and + * it's nested IASTExpression. */ public static final ASTNodeProperty CONDITIONEXPRESSION = new ASTNodeProperty( "IASTWhileStatement.CONDITIONEXPRESSION - IASTExpression (condition) for IASTWhileStatement"); //$NON-NLS-1$ /** - * {@code BODY} represents the relationship between an {@code IASTWhileStatement} and - * it's nested {@code IASTStatement}. + * BODY represents the relationship between an IASTWhileStatement and + * it's nested IASTStatement. */ public static final ASTNodeProperty BODY = new ASTNodeProperty("IASTWhileStatement.BODY - IASTStatement (body) for IASTWhileStatement"); //$NON-NLS-1$ /** - * Returns the condition on the while loop + * Get the condition on the while loop * * @return expression for the condition */ public IASTExpression getCondition(); /** - * Sets the condition of the while loop. + * Set the condition of the while loop. * * @param condition */ @@ -52,7 +52,7 @@ public interface IASTWhileStatement extends IASTStatement { public IASTStatement getBody(); /** - * Sets the body of the while loop. + * Set the body of the while loop. * * @param body */ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IScope.java index 4223e2c697b..a2b76f25380 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IScope.java @@ -37,10 +37,10 @@ public interface IScope { public IName getScopeName(); /** - * Returns the first enclosing non-template scope, or {@code null} if this + * Returns the first enclosing non-template scope, or null if this * is the global scope. *

- * For scopes obtained from an index, {@code null} is returned to indicate that the + * For scopes obtained from an index, null is returned to indicate that the * scope is only enclosed by the global scope. */ public IScope getParent() throws DOMException; @@ -51,7 +51,7 @@ public interface IScope { * lookup. Constructors are not considered during this lookup and won't be returned. * No attempt is made to resolve potential ambiguities or perform access checking. * - * @param name the name of the bindings + * @param name * @return An array of bindings. */ public IBinding[] find(String name); @@ -62,9 +62,11 @@ public interface IScope { * yet been cached in this scope, or if resolve == false and the appropriate binding * has not yet been resolved. * - * @param name the name of the binding - * @param resolve whether or not to resolve the matching binding if it has not been so already. - * @return the binding in this scope that matches the name, or {@code null} + * @param name + * @param resolve + * whether or not to resolve the matching binding if it has not + * been so already. + * @return the binding in this scope that matches the name, or null */ public IBinding getBinding(IASTName name, boolean resolve); @@ -75,8 +77,10 @@ public interface IScope { * has not yet been resolved. Accepts file local bindings from the index for the files * in the given set, only. * - * @param name the name of the binding - * @param resolve whether or not to resolve the matching binding if it has not been so already. + * @param name + * @param resolve + * whether or not to resolve the matching binding if it has not + * been so already. * @param acceptLocalBindings a set of files for which to accept local bindings. * @return the binding in this scope that matches the name, or null */ @@ -136,63 +140,51 @@ public interface IScope { public final void setPrefixLookup(boolean prefixLookup) { fPrefixLookup = prefixLookup; } - public final void setResolve(boolean resolve) { fResolve = resolve; } - public final void setIgnorePointOfDeclaration(boolean ignorePointOfDeclaration) { fIgnorePointOfDeclaration = ignorePointOfDeclaration; } - public final void setLookupKey(char[] key) { fLookupKey= key; } - public final char[] getLookupKey() { return fLookupKey; } - public final IASTNode getLookupPoint() { return fLookupPoint; } - public final boolean isResolve() { return fResolve; } - public final boolean isPrefixLookup() { return fPrefixLookup; } - public final boolean isIgnorePointOfDeclaration() { return fIgnorePointOfDeclaration; } - public final IIndexFileSet getIncludedFiles() { return fTu == null ? IIndexFileSet.EMPTY : fTu.getIndexFileSet(); } - public final IIndex getIndex() { return fTu == null ? null : fTu.getIndex(); } - public final IASTName getLookupName() { return fLookupPointIsName ? (IASTName) fLookupPoint : null; } - public IASTTranslationUnit getTranslationUnit() { return fTu; } } /** - * Returns the bindings in this scope that the given name or prefix could resolve to. Could + * Get the bindings in this scope that the given name or prefix could resolve to. Could * return null if there is no matching bindings in this scope, if the bindings have not * yet been cached in this scope, or if resolve == false and the appropriate bindings * have not yet been resolved. * - * @return the bindings in this scope that match the name or prefix, or {@code null} + * @return : the bindings in this scope that match the name or prefix, or null * @since 5.5 */ public IBinding[] getBindings(ScopeLookupData lookup); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTCatchHandler.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTCatchHandler.java index ffa0dfb24da..219a1889040 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTCatchHandler.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTCatchHandler.java @@ -49,27 +49,27 @@ public interface ICPPASTCatchHandler extends IASTStatement { public boolean isCatchAll(); /** - * Sets the catch body. + * Set the catch body. */ public void setCatchBody(IASTStatement compoundStatement); /** - * Returns the catch body. + * Get the catch body. */ public IASTStatement getCatchBody(); /** - * Sets the declaration. + * Set the declaration. */ public void setDeclaration(IASTDeclaration decl); /** - * Returns the declaration. + * Get the declaration. */ public IASTDeclaration getDeclaration(); /** - * Returns the scope represented by this catch handler. + * Get the scope represented by this catch handler. * @since 5.1 */ public IScope getScope(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTExpression.java index 5514f170530..44f6cc5bd26 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. + * Copyright (c) 2012 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,23 +7,16 @@ * * Contributors: * Markus Schorn - initial API and implementation - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.core.dom.ast.cpp; import org.eclipse.cdt.core.dom.ast.IASTExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorNameOwner; /** - * Interface for C++ expressions. Any full-expressions may contain {@link IASTImplicitDestructorName}s of - * destructors called at the end of the expression to destroy temporaries created by the expression. - * A full-expression is an expression that is not a subexpression of another expression. - * - * @since 5.10 + * Interface for c++ expressions. * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. + * @since 5.5 */ -public interface ICPPASTExpression - extends IASTExpression, ICPPASTInitializerClause, IASTImplicitDestructorNameOwner { +public interface ICPPASTExpression extends IASTExpression, ICPPASTInitializerClause { } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTExpressionList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTExpressionList.java index 01ab567cb04..5718fffe893 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTExpressionList.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTExpressionList.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Mike Kucera (IBM) - Initial API and implementation + * Mike Kucera (IBM) - Initial API and implementation *******************************************************************************/ package org.eclipse.cdt.core.dom.ast.cpp; @@ -20,6 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner; * @noimplement This interface is not intended to be implemented by clients. */ public interface ICPPASTExpressionList extends IASTExpressionList, ICPPASTExpression, IASTImplicitNameOwner { + @Override public ICPPASTExpressionList copy(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFieldReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFieldReference.java index fd2e72ed8c2..645487cfa05 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFieldReference.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFieldReference.java @@ -29,7 +29,7 @@ public interface ICPPASTFieldReference extends IASTFieldReference, ICPPASTExpres public boolean isTemplate(); /** - * Sets the template keyword used. + * Set the template keyword used. * * @param value */ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFunctionCallExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFunctionCallExpression.java index c8526f0398b..dad3526b7b8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFunctionCallExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFunctionCallExpression.java @@ -32,7 +32,7 @@ public interface ICPPASTFunctionCallExpression /** * Returns the function binding for the overloaded operator() invoked by - * the function call, or {@code null} if the operator() is not overloaded. + * the function call, or null if the operator() is not overloaded. * @since 5.8 */ public ICPPFunction getOverload(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTPackExpansionExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTPackExpansionExpression.java index dbac291ad59..fb8db7606b7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTPackExpansionExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTPackExpansionExpression.java @@ -22,11 +22,11 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression; * @since 5.2 */ public interface ICPPASTPackExpansionExpression extends ICPPASTExpression { + /** * Represents the relationship between a pack-expansion and its pattern. */ - public static final ASTNodeProperty PATTERN = - new ASTNodeProperty("ICPPASTPackExpansionExpression.Pattern [IASTExpression]"); //$NON-NLS-1$ + public static final ASTNodeProperty PATTERN = new ASTNodeProperty("ICPPASTPackExpansionExpression.Pattern [IASTExpression]"); //$NON-NLS-1$ /** * Returns the pattern of the pack expansion. diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTTryBlockStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTTryBlockStatement.java index b785d8454fd..c371ef80e45 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTTryBlockStatement.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTTryBlockStatement.java @@ -14,7 +14,7 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty; import org.eclipse.cdt.core.dom.ast.IASTStatement; /** - * This interface represents the try block statement. try { //body } catch (Exc e) + * This interface represents the try block statement. try { //body } catch (Exc e ) * { // handler } catch ( ... ) { } * * @noextend This interface is not intended to be extended by clients. @@ -22,41 +22,43 @@ import org.eclipse.cdt.core.dom.ast.IASTStatement; */ public interface ICPPASTTryBlockStatement extends IASTStatement { /** - * {@code BODY} is the body of the try block. + * BODY is the body of the try block. */ public static final ASTNodeProperty BODY = new ASTNodeProperty("ICPPASTTryBlockStatement.BODY - Body of try block"); //$NON-NLS-1$ /** - * Sets the try body. + * Set try body. * - * @param tryBlock {@code IASTStatement} + * @param tryBlock + * IASTStatement */ public void setTryBody(IASTStatement tryBlock); /** - * Returns the try body. + * Get try body. * - * @return {@code IASTStatement} + * @return IASTStatement */ public IASTStatement getTryBody(); /** - * {@code CATCH_HANDLER} are the exception catching handlers. + * CATCH_HANDLER are the exception catching handlers. */ public static final ASTNodeProperty CATCH_HANDLER = new ASTNodeProperty( "ICPPASTTryBlockStatement.CATCH_HANDLER - Exception catching handlers"); //$NON-NLS-1$ /** - * Adds catch handler. + * Add catch handler. * - * @param handler {@code ICPPASTCatchHandler} + * @param handler + * ICPPASTCatchHandler */ public void addCatchHandler(ICPPASTCatchHandler handler); /** - * Returns the catch handlers. + * Get the catch handlers. * - * @return {@code ICPPASTCatchHandler[]} + * @return ICPPASTCatchHandler [] */ public ICPPASTCatchHandler[] getCatchHandlers(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java index 9713283fe41..e0952e8af99 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2015 IBM Corporation and others. + * Copyright (c) 2005, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -402,19 +402,4 @@ public abstract class ASTNode implements IASTNode { public void resolvePendingAmbiguities() { ((ASTTranslationUnit) getTranslationUnit()).resolvePendingAmbiguities(this); } - - /** - * Helper method for use in {{@link #accept(ASTVisitor)} methods. - * - * @param action the visitor to accept - * @param nodes the array of nodes accepting the visitor - * @return continue on ({@code true}) or quit ({@code false}) - */ - protected static boolean acceptByNodes(T[] nodes, ASTVisitor action) { - for (T node : nodes) { - if (!node.accept(action)) - return false; - } - return true; - } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTypeIdInitializerExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTypeIdInitializerExpression.java new file mode 100644 index 00000000000..95388dff54c --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTypeIdInitializerExpression.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (c) 2005, 2011 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * John Camelon (IBM Rational Software) - Initial API and implementation + * Yuan Zhang / Beth Tibbitts (IBM Research) + * Markus Schorn (Wind River Systems) + *******************************************************************************/ +package org.eclipse.cdt.internal.core.dom.parser; + +import org.eclipse.cdt.core.dom.ast.ASTVisitor; +import org.eclipse.cdt.core.dom.ast.IASTInitializer; +import org.eclipse.cdt.core.dom.ast.IASTTypeId; +import org.eclipse.cdt.core.dom.ast.IASTTypeIdInitializerExpression; + +/** + * Compound literals for c and c++. + */ +public abstract class ASTTypeIdInitializerExpression extends ASTNode implements IASTTypeIdInitializerExpression { + private IASTTypeId typeId; + private IASTInitializer initializer; + + public ASTTypeIdInitializerExpression() { + } + + public ASTTypeIdInitializerExpression(IASTTypeId t, IASTInitializer i) { + setTypeId(t); + setInitializer(i); + } + + protected void initializeCopy(ASTTypeIdInitializerExpression copy, CopyStyle style) { + copy.setTypeId(typeId == null ? null : typeId.copy(style)); + copy.setInitializer(initializer == null ? null : initializer.copy(style)); + copy(copy, style); + } + + @Override + public IASTTypeId getTypeId() { + return typeId; + } + + @Override + public void setTypeId(IASTTypeId typeId) { + assertNotFrozen(); + this.typeId = typeId; + if (typeId != null) { + typeId.setParent(this); + typeId.setPropertyInParent(TYPE_ID); + } + } + + @Override + public IASTInitializer getInitializer() { + return initializer; + } + + @Override + public void setInitializer(IASTInitializer initializer) { + assertNotFrozen(); + this.initializer = initializer; + if (initializer != null) { + initializer.setParent(this); + initializer.setPropertyInParent(INITIALIZER); + } + } + + @Override + public boolean accept(ASTVisitor action) { + if (action.shouldVisitExpressions) { + switch(action.visit(this)) { + case ASTVisitor.PROCESS_ABORT: return false; + case ASTVisitor.PROCESS_SKIP: return true; + default: break; + } + } + + if (typeId != null && !typeId.accept(action)) return false; + if (initializer != null && !initializer.accept(action)) return false; + + if (action.shouldVisitExpressions) { + switch(action.leave(this)) { + case ASTVisitor.PROCESS_ABORT: return false; + case ASTVisitor.PROCESS_SKIP: return true; + default: break; + } + } + return true; + } + + @Override + public final boolean isLValue() { + return false; + } + + @Override + public ValueCategory getValueCategory() { + return ValueCategory.PRVALUE; + } +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypeIdInitializerExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypeIdInitializerExpression.java index 17022dc70a8..ca900a27959 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypeIdInitializerExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypeIdInitializerExpression.java @@ -1,106 +1,35 @@ /******************************************************************************* - * Copyright (c) 2005, 2015 IBM Corporation and others. + * Copyright (c) 2005, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * John Camelon (IBM Rational Software) - Initial API and implementation - * Yuan Zhang / Beth Tibbitts (IBM Research) - * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) + * John Camelon (IBM Rational Software) - Initial API and implementation + * Yuan Zhang / Beth Tibbitts (IBM Research) + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.c; -import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTInitializer; import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression; -import org.eclipse.cdt.internal.core.dom.parser.ASTNode; +import org.eclipse.cdt.internal.core.dom.parser.ASTTypeIdInitializerExpression; /** - * Type id initializer expression for C, type-id { initializer } + * C-specific implementation adds nothing but the c-specific interface. */ -public class CASTTypeIdInitializerExpression extends ASTNode implements ICASTTypeIdInitializerExpression { - private IASTTypeId fTypeId; - private IASTInitializer fInitializer; +public class CASTTypeIdInitializerExpression extends ASTTypeIdInitializerExpression implements + ICASTTypeIdInitializerExpression { - public CASTTypeIdInitializerExpression() { + private CASTTypeIdInitializerExpression() { + super(); } - public CASTTypeIdInitializerExpression(IASTTypeId t, IASTInitializer i) { - setTypeId(t); - fInitializer = i; - } - - @Override - public IASTTypeId getTypeId() { - return fTypeId; - } - - @Override - public void setTypeId(IASTTypeId typeId) { - assertNotFrozen(); - this.fTypeId = typeId; - if (typeId != null) { - typeId.setParent(this); - typeId.setPropertyInParent(TYPE_ID); - } - } - - @Override - public IASTInitializer getInitializer() { - return fInitializer; - } - - @Override - public void setInitializer(IASTInitializer initializer) { - assertNotFrozen(); - this.fInitializer = initializer; - if (initializer != null) { - initializer.setParent(this); - initializer.setPropertyInParent(INITIALIZER); - } - } - - @Override - public boolean accept(ASTVisitor action) { - if (action.shouldVisitExpressions) { - switch (action.visit(this)) { - case ASTVisitor.PROCESS_ABORT: return false; - case ASTVisitor.PROCESS_SKIP: return true; - default: break; - } - } - - if (fTypeId != null && !fTypeId.accept(action)) return false; - if (fInitializer != null && !fInitializer.accept(action)) return false; - - if (action.shouldVisitExpressions) { - switch (action.leave(this)) { - case ASTVisitor.PROCESS_ABORT: return false; - case ASTVisitor.PROCESS_SKIP: return true; - default: break; - } - } - return true; - } - - @Override - public final boolean isLValue() { - return false; - } - - @Override - public ValueCategory getValueCategory() { - return ValueCategory.PRVALUE; - } - - @Override - public IType getExpressionType() { - return CVisitor.createType(getTypeId().getAbstractDeclarator()); + public CASTTypeIdInitializerExpression(IASTTypeId typeId, IASTInitializer initializer) { + super(typeId, initializer); } @Override @@ -110,9 +39,13 @@ public class CASTTypeIdInitializerExpression extends ASTNode implements ICASTTyp @Override public CASTTypeIdInitializerExpression copy(CopyStyle style) { - CASTTypeIdInitializerExpression copy = new CASTTypeIdInitializerExpression( - fTypeId == null ? null : fTypeId.copy(style), - fInitializer == null ? null : fInitializer.copy(style)); - return copy(copy, style); + CASTTypeIdInitializerExpression copy = new CASTTypeIdInitializerExpression(); + initializeCopy(copy, style); + return copy; + } + + @Override + public IType getExpressionType() { + return CVisitor.createType(getTypeId().getAbstractDeclarator()); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousBinaryVsCastExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousBinaryVsCastExpression.java index 455e80c260a..a7967717781 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousBinaryVsCastExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousBinaryVsCastExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2015 Wind River Systems, Inc. and others. + * Copyright (c) 2008, 2009 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,13 +7,11 @@ * * Contributors: * Markus Schorn - Initial API and implementation - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression; import org.eclipse.cdt.core.dom.ast.IASTCastExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression; import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousBinaryVsCastExpression; @@ -22,9 +20,4 @@ public class CPPASTAmbiguousBinaryVsCastExpression extends ASTAmbiguousBinaryVsC public CPPASTAmbiguousBinaryVsCastExpression(IASTBinaryExpression bexp, IASTCastExpression castExpr) { super(bexp, castExpr); } - - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - throw new UnsupportedOperationException(); - } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousCastVsFunctionCallExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousCastVsFunctionCallExpression.java index 30f49cc8d0a..c9254d33de8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousCastVsFunctionCallExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousCastVsFunctionCallExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2015 Wind River Systems, Inc. and others. + * Copyright (c) 2008 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,13 +7,11 @@ * * Contributors: * Markus Schorn - Initial API and implementation - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; import org.eclipse.cdt.core.dom.ast.IASTCastExpression; import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression; import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousCastVsFunctionCallExpression; @@ -23,9 +21,4 @@ public class CPPASTAmbiguousCastVsFunctionCallExpression public CPPASTAmbiguousCastVsFunctionCallExpression(IASTCastExpression castExpr, IASTFunctionCallExpression funcCall) { super(castExpr, funcCall); } - - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - throw new UnsupportedOperationException(); - } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousExpression.java index 7f9c96c3869..5d6969db67e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousExpression.java @@ -21,7 +21,7 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousExpression; public class CPPASTAmbiguousExpression extends ASTAmbiguousNode implements IASTAmbiguousExpression, ICPPASTExpression { private IASTExpression[] exp = new IASTExpression[2]; - private int expPos; + private int expPos= -1; public CPPASTAmbiguousExpression(IASTExpression... expressions) { for (IASTExpression e : expressions) { @@ -43,7 +43,7 @@ public class CPPASTAmbiguousExpression extends ASTAmbiguousNode public void addExpression(IASTExpression e) { assertNotFrozen(); if (e != null) { - exp = ArrayUtil.appendAt(exp, expPos++, e); + exp = ArrayUtil.appendAt(IASTExpression.class, exp, ++expPos, e); e.setParent(this); e.setPropertyInParent(SUBEXPRESSION); } @@ -51,7 +51,7 @@ public class CPPASTAmbiguousExpression extends ASTAmbiguousNode @Override public IASTExpression[] getExpressions() { - exp = ArrayUtil.trim(exp, expPos); + exp = ArrayUtil.trimAt(IASTExpression.class, exp, expPos); return exp; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java index 879a2b0351c..63daca65bbf 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -9,7 +9,6 @@ * John Camelon (IBM) - Initial API and implementation * Mike Kucera (IBM) * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -17,7 +16,6 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTImplicitName; import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; import org.eclipse.cdt.core.dom.ast.IASTNode; @@ -212,9 +210,4 @@ public class CPPASTArraySubscriptExpression extends ASTNode public boolean isLValue() { return getValueCategory() == LVALUE; } - - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; - } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java index 4e9bcf8e6d9..dc282612822 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,8 +18,6 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorNameOwner; import org.eclipse.cdt.core.dom.ast.IASTImplicitName; import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner; import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; @@ -32,7 +30,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalBinary; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed; @@ -44,7 +41,6 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr private ICPPEvaluation evaluation; private IASTImplicitName[] implicitNames; - private IASTImplicitDestructorName[] implicitDestructorNames; public CPPASTBinaryExpression() { } @@ -125,6 +121,9 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr setInitOperand2(expression); } + /** + * @see org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner#getImplicitNames() + */ @Override public IASTImplicitName[] getImplicitNames() { if (implicitNames == null) { @@ -143,15 +142,6 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr return implicitNames; } - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - if (implicitDestructorNames == null) { - implicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this); - } - - return implicitDestructorNames; - } - @Override public boolean accept(ASTVisitor action) { if (operand1 instanceof IASTBinaryExpression || operand2 instanceof IASTBinaryExpression) { @@ -169,15 +159,16 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr if (operand1 != null && !operand1.accept(action)) return false; - if (action.shouldVisitImplicitNames && !acceptByNodes(getImplicitNames(), action)) - return false; + if (action.shouldVisitImplicitNames) { + for (IASTImplicitName name : getImplicitNames()) { + if (!name.accept(action)) + return false; + } + } if (operand2 != null && !operand2.accept(action)) return false; - if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(getImplicitDestructorNames(), action)) - return false; - if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT) return false; @@ -194,7 +185,7 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr } } - private static boolean acceptWithoutRecursion(IASTBinaryExpression bexpr, ASTVisitor action) { + public static boolean acceptWithoutRecursion(IASTBinaryExpression bexpr, ASTVisitor action) { N stack= new N(bexpr); while (stack != null) { IASTBinaryExpression expr= stack.fExpression; @@ -220,10 +211,12 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr return false; } if (stack.fState == 1) { - if (action.shouldVisitImplicitNames && - !acceptByNodes(((IASTImplicitNameOwner) expr).getImplicitNames(), action)) { - return false; - } + if (action.shouldVisitImplicitNames) { + for (IASTImplicitName name : ((IASTImplicitNameOwner) expr).getImplicitNames()) { + if (!name.accept(action)) + return false; + } + } stack.fState= 2; IASTExpression op2 = expr.getOperand2(); @@ -235,10 +228,6 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr } if (op2 != null && !op2.accept(action)) return false; - if (action.shouldVisitImplicitDestructorNames && - !acceptByNodes(((IASTImplicitDestructorNameOwner) expr).getImplicitDestructorNames(), action)) { - return false; - } } if (action.shouldVisitExpressions && action.leave(expr) == ASTVisitor.PROCESS_ABORT) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryTypeIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryTypeIdExpression.java index d7dbcdc2956..1f2a8c02fd1 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryTypeIdExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryTypeIdExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * John Camelon (IBM) - Initial API and implementation * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -16,7 +15,6 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTBinaryTypeIdExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression; @@ -147,9 +145,4 @@ public class CPPASTBinaryTypeIdExpression extends ASTNode implements ICPPASTExpr public ValueCategory getValueCategory() { return PRVALUE; } - - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; // Binary type-id expressions don't call destructors. - } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCastExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCastExpression.java index 96351de76e6..265cec3cac8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCastExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCastExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * John Camelon (IBM) - Initial API and implementation * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -16,7 +15,6 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.IProblemType; @@ -33,17 +31,16 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalTypeId; * Cast expression for C++ */ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpression, IASTAmbiguityParent { - private int fOperator; - private ICPPASTExpression fOperand; - private IASTTypeId fTypeId; + private int op; + private ICPPASTExpression operand; + private IASTTypeId typeId; private ICPPEvaluation fEvaluation; - private IASTImplicitDestructorName[] fImplicitDestructorNames; public CPPASTCastExpression() { } public CPPASTCastExpression(int operator, IASTTypeId typeId, IASTExpression operand) { - fOperator = operator; + op = operator; setOperand(operand); setTypeId(typeId); } @@ -57,7 +54,7 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi public CPPASTCastExpression copy(CopyStyle style) { CPPASTCastExpression copy = new CPPASTCastExpression(); copy.setOperator(getOperator()); - copy.setTypeId(fTypeId == null ? null : fTypeId.copy(style)); + copy.setTypeId(typeId == null ? null : typeId.copy(style)); IASTExpression operand = getOperand(); copy.setOperand(operand == null ? null : operand.copy(style)); return copy(copy, style); @@ -66,7 +63,7 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi @Override public void setTypeId(IASTTypeId typeId) { assertNotFrozen(); - this.fTypeId = typeId; + this.typeId = typeId; if (typeId != null) { typeId.setParent(this); typeId.setPropertyInParent(TYPE_ID); @@ -75,44 +72,35 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi @Override public IASTTypeId getTypeId() { - return fTypeId; + return typeId; } @Override public int getOperator() { - return fOperator; + return op; } @Override public void setOperator(int operator) { assertNotFrozen(); - fOperator = operator; + op = operator; } @Override public IASTExpression getOperand() { - return fOperand; + return operand; } @Override public void setOperand(IASTExpression expression) { assertNotFrozen(); - fOperand = (ICPPASTExpression) expression; + operand = (ICPPASTExpression) expression; if (expression != null) { expression.setParent(this); expression.setPropertyInParent(OPERAND); } } - - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - if (fImplicitDestructorNames == null) { - fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this); - } - - return fImplicitDestructorNames; - } - + @Override public boolean accept(ASTVisitor action) { if (action.shouldVisitExpressions) { @@ -123,13 +111,10 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi } } - if (fTypeId != null && !fTypeId.accept(action)) return false; + if (typeId != null && !typeId.accept(action)) return false; IASTExpression op = getOperand(); if (op != null && !op.accept(action)) return false; - if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action)) - return false; - if (action.shouldVisitExpressions) { switch (action.leave(this)) { case ASTVisitor.PROCESS_ABORT: return false; @@ -142,10 +127,10 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi @Override public void replace(IASTNode child, IASTNode other) { - if (child == fOperand) { + if (child == operand) { other.setPropertyInParent(child.getPropertyInParent()); other.setParent(child.getParent()); - fOperand = (ICPPASTExpression) other; + operand = (ICPPASTExpression) other; } } @@ -159,14 +144,14 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi } private ICPPEvaluation computeEvaluation() { - if (fOperand == null) + if (operand == null) return EvalFixed.INCOMPLETE; IType type= CPPVisitor.createType(getTypeId()); if (type == null || type instanceof IProblemType) return EvalFixed.INCOMPLETE; - return new EvalTypeId(type, this, fOperand.getEvaluation()); + return new EvalTypeId(type, this, operand.getEvaluation()); } @Override diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatementExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatementExpression.java index 0b505e12ff1..cd4938fff41 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatementExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatementExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * John Camelon (IBM) - Initial API and implementation * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -17,13 +16,11 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement; import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTStatement; import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression; import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression; import org.eclipse.cdt.internal.core.dom.parser.ASTNode; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalCompound; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed; @@ -31,13 +28,12 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed; * Gnu-extension: ({ ... }) */ public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUASTCompoundStatementExpression, ICPPASTExpression { - private IASTCompoundStatement fStatement; + + private IASTCompoundStatement statement; private ICPPEvaluation fEval; - private IASTImplicitDestructorName[] fImplicitDestructorNames; public CPPASTCompoundStatementExpression() { } - @Override public ICPPEvaluation getEvaluation() { if (fEval == null) { @@ -67,54 +63,42 @@ public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUAS @Override public CPPASTCompoundStatementExpression copy(CopyStyle style) { CPPASTCompoundStatementExpression copy = new CPPASTCompoundStatementExpression(); - copy.setCompoundStatement(fStatement == null ? null : fStatement.copy(style)); + copy.setCompoundStatement(statement == null ? null : statement.copy(style)); return copy(copy, style); } @Override public IASTCompoundStatement getCompoundStatement() { - return fStatement; + return statement; } @Override public void setCompoundStatement(IASTCompoundStatement statement) { assertNotFrozen(); - this.fStatement = statement; + this.statement = statement; if (statement != null) { statement.setParent(this); statement.setPropertyInParent(STATEMENT); } } - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - if (fImplicitDestructorNames == null) { - fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this); - } - - return fImplicitDestructorNames; - } - @Override - public boolean accept(ASTVisitor action) { - if (action.shouldVisitExpressions) { - switch (action.visit(this)) { - case ASTVisitor.PROCESS_ABORT: return false; - case ASTVisitor.PROCESS_SKIP: return true; - default: break; + public boolean accept( ASTVisitor action ){ + if( action.shouldVisitExpressions ){ + switch( action.visit( this ) ){ + case ASTVisitor.PROCESS_ABORT : return false; + case ASTVisitor.PROCESS_SKIP : return true; + default : break; } } - if (fStatement != null && !fStatement.accept(action)) return false; - - if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action)) - return false; - - if (action.shouldVisitExpressions) { - switch (action.leave(this)) { - case ASTVisitor.PROCESS_ABORT: return false; - case ASTVisitor.PROCESS_SKIP: return true; - default: break; + if( statement != null ) if( !statement.accept( action ) ) return false; + + if( action.shouldVisitExpressions ){ + switch( action.leave( this ) ){ + case ASTVisitor.PROCESS_ABORT : return false; + case ASTVisitor.PROCESS_SKIP : return true; + default : break; } } return true; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConditionalExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConditionalExpression.java index 60936674ce2..c0a810ca0ce 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConditionalExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConditionalExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * John Camelon (IBM) - Initial API and implementation * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -17,24 +16,21 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression; import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression; import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalConditional; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed; -public class CPPASTConditionalExpression extends ASTNode - implements IASTConditionalExpression, ICPPASTExpression, IASTAmbiguityParent { +public class CPPASTConditionalExpression extends ASTNode implements IASTConditionalExpression, + ICPPASTExpression, IASTAmbiguityParent { private ICPPASTExpression fCondition; private ICPPASTExpression fPositive; private ICPPASTExpression fNegative; private ICPPEvaluation fEval; - private IASTImplicitDestructorName[] fImplicitDestructorNames; public CPPASTConditionalExpression() { } @@ -104,15 +100,6 @@ public class CPPASTConditionalExpression extends ASTNode } } - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - if (fImplicitDestructorNames == null) { - fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this); - } - - return fImplicitDestructorNames; - } - @Override public boolean accept(ASTVisitor action) { if (action.shouldVisitExpressions) { @@ -129,9 +116,6 @@ public class CPPASTConditionalExpression extends ASTNode return false; if (fNegative != null && !fNegative.accept(action)) return false; - - if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action)) - return false; if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT) return false; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeleteExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeleteExpression.java index 004c02e80f5..f4804bc9aed 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeleteExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeleteExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * John Camelon (IBM) - Initial API and implementation * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -19,7 +18,6 @@ import java.util.List; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTImplicitName; import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IType; @@ -29,7 +27,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; import org.eclipse.cdt.internal.core.dom.parser.Value; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed; @@ -41,7 +38,6 @@ public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpr private boolean isVectored; private IASTImplicitName[] implicitNames; - private IASTImplicitDestructorName[] fImplicitDestructorNames; public CPPASTDeleteExpression() { } @@ -106,12 +102,12 @@ public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpr } /** - * Tries to resolve both the destructor and operator delete. + * Try to resolve both the destructor and operator delete. */ @Override public IASTImplicitName[] getImplicitNames() { if (implicitNames == null) { - List names = new ArrayList<>(); + List names = new ArrayList(); if (!isVectored) { ICPPFunction destructor = CPPSemantics.findImplicitlyCalledDestructor(this); @@ -144,15 +140,6 @@ public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpr return implicitNames; } - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - if (fImplicitDestructorNames == null) { - fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this); - } - - return fImplicitDestructorNames; - } - @Override public boolean accept(ASTVisitor action) { if (action.shouldVisitExpressions) { @@ -173,9 +160,6 @@ public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpr if (operand != null && !operand.accept(action)) return false; - if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action)) - return false; - if (action.shouldVisitExpressions) { switch (action.leave(this)) { case ASTVisitor.PROCESS_ABORT: return false; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEqualsInitializer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEqualsInitializer.java index 5d3da054153..c12409a5a9c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEqualsInitializer.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEqualsInitializer.java @@ -6,8 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * John Camelon (IBM) - Initial API and implementation - * Markus Schorn (Wind River Systems) + * John Camelon (IBM) - Initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -33,7 +33,8 @@ public class CPPASTEqualsInitializer extends ASTEqualsInitializer { @Override public CPPASTEqualsInitializer copy(CopyStyle style) { IASTInitializerClause arg = getInitializerClause(); - CPPASTEqualsInitializer copy = new CPPASTEqualsInitializer(arg == null ? null : arg.copy(style)); + CPPASTEqualsInitializer copy = new CPPASTEqualsInitializer(arg == null ? null + : arg.copy(style)); return copy(copy, style); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionList.java index 9691a4e5fb8..051f7e1be7a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionList.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionList.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -9,7 +9,6 @@ * John Camelon (IBM) - Initial API and implementation * Mike Kucera (IBM) - implicit names * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -17,7 +16,6 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTImplicitName; import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IType; @@ -27,20 +25,18 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; import org.eclipse.cdt.core.parser.util.ArrayUtil; import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalComma; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed; public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionList, IASTAmbiguityParent { + private IASTExpression[] expressions = new IASTExpression[2]; /** * Caution: may contain nulls. - * @see #computeImplicitNames + * @see CPPASTExpressionList#computeImplicitNames */ - private IASTImplicitName[] fImplicitNames; - - private IASTImplicitDestructorName[] fImplicitDestructorNames; + private IASTImplicitName[] implicitNames; private ICPPEvaluation fEvaluation; @@ -52,9 +48,8 @@ public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionLi @Override public CPPASTExpressionList copy(CopyStyle style) { CPPASTExpressionList copy = new CPPASTExpressionList(); - for (IASTExpression expr : getExpressions()) { + for(IASTExpression expr : getExpressions()) copy.addExpression(expr == null ? null : expr.copy(style)); - } return copy(copy, style); } @@ -97,9 +92,6 @@ public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionLi } } } - - if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action)) - return false; if (action.shouldVisitExpressions) { switch (action.leave(this)) { @@ -112,31 +104,32 @@ public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionLi } /** - * Returns an array of implicit names where each element of the array represents a comma between - * the expression in the same index and the next expression. This array contains null elements - * as placeholders for commas that do not resolve to overloaded operators. + * Returns an array of implicit names where each element of the array + * represents a comma between the expression in the same index and the + * next expression. This array contains null elements as placeholders + * for commas that do not resolve to overloaded operators. */ private IASTImplicitName[] computeImplicitNames() { - if (fImplicitNames == null) { + if (implicitNames == null) { IASTExpression[] exprs = getExpressions(); // has to be at least two if (exprs.length < 2) - return fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; + return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; - fImplicitNames = new IASTImplicitName[exprs.length - 1]; + implicitNames = new IASTImplicitName[exprs.length - 1]; ICPPFunction[] overloads = getOverloads(); - for (int i = 0; i < overloads.length; i++) { + for(int i = 0; i < overloads.length; i++) { ICPPFunction overload = overloads[i]; if (overload != null && !(overload instanceof CPPImplicitFunction)) { CPPASTImplicitName operatorName = new CPPASTImplicitName(OverloadableOperator.COMMA, this); operatorName.setBinding(overload); operatorName.computeOperatorOffsets(exprs[i], true); - fImplicitNames[i] = operatorName; + implicitNames[i] = operatorName; } } } - return fImplicitNames; + return implicitNames; } @Override @@ -144,15 +137,6 @@ public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionLi return ArrayUtil.removeNulls(IASTImplicitName.class, computeImplicitNames()); } - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - if (fImplicitDestructorNames == null) { - fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this); - } - - return fImplicitDestructorNames; - } - private ICPPFunction[] getOverloads() { ICPPEvaluation eval = getEvaluation(); if (eval instanceof EvalComma) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java index b1153f4ed4e..03e511c30f2 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,7 +10,6 @@ * Bryan Wilkinson (QNX) * Mike Kucera (IBM) * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -22,7 +21,6 @@ import java.util.List; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IASTExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTImplicitName; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTNode; @@ -45,20 +43,18 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPFunctionSet; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalID; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalMemberAccess; public class CPPASTFieldReference extends ASTNode implements ICPPASTFieldReference, IASTAmbiguityParent, ICPPASTCompletionContext { - private boolean fIsTemplate; - private boolean fIsDeref; - private ICPPASTExpression fOwner; - private IASTName fName; - private IASTImplicitName[] fImplicitNames; + private boolean isTemplate; + private ICPPASTExpression owner; + private IASTName name; + private boolean isDeref; + private IASTImplicitName[] implicitNames; private ICPPEvaluation fEvaluation; - private IASTImplicitDestructorName[] fImplicitDestructorNames; public CPPASTFieldReference() { } @@ -76,33 +72,33 @@ public class CPPASTFieldReference extends ASTNode @Override public CPPASTFieldReference copy(CopyStyle style) { CPPASTFieldReference copy = new CPPASTFieldReference(); - copy.setFieldName(fName == null ? null : fName.copy(style)); - copy.setFieldOwner(fOwner == null ? null : fOwner.copy(style)); - copy.fIsTemplate = fIsTemplate; - copy.fIsDeref = fIsDeref; + copy.setFieldName(name == null ? null : name.copy(style)); + copy.setFieldOwner(owner == null ? null : owner.copy(style)); + copy.isTemplate = isTemplate; + copy.isDeref = isDeref; return copy(copy, style); } @Override public boolean isTemplate() { - return fIsTemplate; + return isTemplate; } @Override public void setIsTemplate(boolean value) { assertNotFrozen(); - fIsTemplate = value; + isTemplate = value; } @Override public ICPPASTExpression getFieldOwner() { - return fOwner; + return owner; } @Override public void setFieldOwner(IASTExpression expression) { assertNotFrozen(); - fOwner = (ICPPASTExpression) expression; + owner = (ICPPASTExpression) expression; if (expression != null) { expression.setParent(this); expression.setPropertyInParent(FIELD_OWNER); @@ -111,13 +107,13 @@ public class CPPASTFieldReference extends ASTNode @Override public IASTName getFieldName() { - return fName; + return name; } @Override public void setFieldName(IASTName name) { assertNotFrozen(); - this.fName = name; + this.name = name; if (name != null) { name.setParent(this); name.setPropertyInParent(FIELD_NAME); @@ -126,53 +122,44 @@ public class CPPASTFieldReference extends ASTNode @Override public boolean isPointerDereference() { - return fIsDeref; + return isDeref; } @Override public void setIsPointerDereference(boolean value) { assertNotFrozen(); - fIsDeref = value; + isDeref = value; } @Override public IASTImplicitName[] getImplicitNames() { - if (fImplicitNames == null) { - if (!fIsDeref) - return fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; + if (implicitNames == null) { + if (!isDeref) + return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; // Collect the function bindings List functionBindings = new ArrayList(); - EvalMemberAccess.getFieldOwnerType(fOwner.getExpressionType(), fIsDeref, this, functionBindings, false); + EvalMemberAccess.getFieldOwnerType(owner.getExpressionType(), isDeref, this, functionBindings, false); if (functionBindings.isEmpty()) - return fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; + return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; // Create a name to wrap each binding - fImplicitNames = new IASTImplicitName[functionBindings.size()]; + implicitNames = new IASTImplicitName[functionBindings.size()]; int i= -1; for (ICPPFunction op : functionBindings) { if (op != null && !(op instanceof CPPImplicitFunction)) { CPPASTImplicitName operatorName = new CPPASTImplicitName(OverloadableOperator.ARROW, this); operatorName.setBinding(op); - operatorName.computeOperatorOffsets(fOwner, true); - fImplicitNames[++i] = operatorName; + operatorName.computeOperatorOffsets(owner, true); + implicitNames[++i] = operatorName; } } - fImplicitNames= ArrayUtil.trimAt(IASTImplicitName.class, fImplicitNames, i); + implicitNames= ArrayUtil.trimAt(IASTImplicitName.class, implicitNames, i); } - return fImplicitNames; + return implicitNames; } - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - if (fImplicitDestructorNames == null) { - fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this); - } - - return fImplicitDestructorNames; - } - @Override public boolean accept(ASTVisitor action) { if (action.shouldVisitExpressions) { @@ -183,7 +170,7 @@ public class CPPASTFieldReference extends ASTNode } } - if (fOwner != null && !fOwner.accept(action)) + if (owner != null && !owner.accept(action)) return false; if (action.shouldVisitImplicitNames) { @@ -193,12 +180,9 @@ public class CPPASTFieldReference extends ASTNode } } - if (fName != null && !fName.accept(action)) + if (name != null && !name.accept(action)) return false; - - if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action)) - return false; - + if (action.shouldVisitExpressions) { switch (action.leave(this)) { case ASTVisitor.PROCESS_ABORT: return false; @@ -211,17 +195,17 @@ public class CPPASTFieldReference extends ASTNode @Override public int getRoleForName(IASTName n) { - if (n == fName) + if (n == name) return r_reference; return r_unclear; } @Override public void replace(IASTNode child, IASTNode other) { - if (child == fOwner) { + if (child == owner) { other.setPropertyInParent(child.getPropertyInParent()); other.setParent(child.getParent()); - fOwner = (ICPPASTExpression) other; + owner = (ICPPASTExpression) other; } } @@ -254,7 +238,7 @@ public class CPPASTFieldReference extends ASTNode */ @Override public IType getFieldOwnerType() { - return EvalMemberAccess.getFieldOwnerType(fOwner.getExpressionType(), fIsDeref, this, null, true); + return EvalMemberAccess.getFieldOwnerType(owner.getExpressionType(), isDeref, this, null, true); } @Override @@ -266,24 +250,24 @@ public class CPPASTFieldReference extends ASTNode } private ICPPEvaluation createEvaluation() { - ICPPEvaluation ownerEval = fOwner.getEvaluation(); + ICPPEvaluation ownerEval = owner.getEvaluation(); if (!ownerEval.isTypeDependent()) { - IType ownerType= EvalMemberAccess.getFieldOwnerType(ownerEval.getTypeOrFunctionSet(this), fIsDeref, this, null, false); + IType ownerType= EvalMemberAccess.getFieldOwnerType(ownerEval.getTypeOrFunctionSet(this), isDeref, this, null, false); if (ownerType != null) { - IBinding binding = fName.resolvePreBinding(); + IBinding binding = name.resolvePreBinding(); if (binding instanceof CPPFunctionSet) - binding= fName.resolveBinding(); + binding= name.resolveBinding(); if (binding instanceof IProblemBinding || binding instanceof IType || binding instanceof ICPPConstructor) return EvalFixed.INCOMPLETE; - return new EvalMemberAccess(ownerType, ownerEval.getValueCategory(this), binding, fIsDeref, this); + return new EvalMemberAccess(ownerType, ownerEval.getValueCategory(this), binding, isDeref, this); } } IBinding qualifier= null; ICPPTemplateArgument[] args= null; - IASTName n= fName; + IASTName n= name; if (n instanceof ICPPASTQualifiedName) { ICPPASTQualifiedName qn= (ICPPASTQualifiedName) n; ICPPASTNameSpecifier[] ns= qn.getQualifier(); @@ -301,7 +285,7 @@ public class CPPASTFieldReference extends ASTNode return EvalFixed.INCOMPLETE; } } - return new EvalID(ownerEval, qualifier, fName.getSimpleID(), false, true, args, this); + return new EvalID(ownerEval, qualifier, name.getSimpleID(), false, true, args, this); } @Override diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java index 0677956f2a4..67144bd24a1 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -9,7 +9,6 @@ * John Camelon (IBM) - Initial API and implementation * Mike Kucera (IBM) - implicit names * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -24,7 +23,6 @@ import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.ExpansionOverlapsBoundaryException; import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTIdExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTImplicitName; import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; import org.eclipse.cdt.core.dom.ast.IASTName; @@ -36,14 +34,12 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpressionList; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionCallExpression; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.core.parser.IToken; import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFunctionCall; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalTypeId; @@ -51,12 +47,11 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.LookupData; public class CPPASTFunctionCallExpression extends ASTNode implements ICPPASTFunctionCallExpression, IASTAmbiguityParent { - private ICPPASTExpression fFunctionName; + private ICPPASTExpression functionName; private IASTInitializerClause[] fArguments; - private IASTImplicitName[] fImplicitNames; - private ICPPEvaluation fEvaluation; - private IASTImplicitDestructorName[] fImplicitDestructorNames; + private IASTImplicitName[] implicitNames; + private ICPPEvaluation evaluation; public CPPASTFunctionCallExpression() { setArguments(null); @@ -83,19 +78,19 @@ public class CPPASTFunctionCallExpression extends ASTNode } CPPASTFunctionCallExpression copy = new CPPASTFunctionCallExpression(null, args); - copy.setFunctionNameExpression(fFunctionName == null ? null : fFunctionName.copy(style)); + copy.setFunctionNameExpression(functionName == null ? null : functionName.copy(style)); return copy(copy, style); } @Override public IASTExpression getFunctionNameExpression() { - return fFunctionName; + return functionName; } @Override public void setFunctionNameExpression(IASTExpression expression) { assertNotFrozen(); - this.fFunctionName = (ICPPASTExpression) expression; + this.functionName = (ICPPASTExpression) expression; if (expression != null) { expression.setParent(this); expression.setPropertyInParent(FUNCTION_NAME); @@ -123,21 +118,21 @@ public class CPPASTFunctionCallExpression extends ASTNode @Override public IASTImplicitName[] getImplicitNames() { - if (fImplicitNames == null) { + if (implicitNames == null) { ICPPFunction overload = getOverload(); if (overload == null) - return fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; + return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; if (getEvaluation() instanceof EvalTypeId) { CPPASTImplicitName n1 = new CPPASTImplicitName(overload.getNameCharArray(), this); - n1.setOffsetAndLength((ASTNode) fFunctionName); + n1.setOffsetAndLength((ASTNode) functionName); n1.setBinding(overload); - return fImplicitNames= new IASTImplicitName[] {n1}; + return implicitNames= new IASTImplicitName[] {n1}; } if (overload instanceof CPPImplicitFunction) { if (!(overload instanceof ICPPMethod) || ((ICPPMethod) overload).isImplicit()) { - return fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; + return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; } } @@ -150,9 +145,9 @@ public class CPPASTFunctionCallExpression extends ASTNode n2.setAlternate(true); if (fArguments.length == 0) { - int idEndOffset = ((ASTNode) fFunctionName).getOffset() + ((ASTNode) fFunctionName).getLength(); + int idEndOffset = ((ASTNode) functionName).getOffset() + ((ASTNode) functionName).getLength(); try { - IToken lparen = fFunctionName.getTrailingSyntax(); + IToken lparen = functionName.getTrailingSyntax(); IToken rparen = lparen.getNext(); if (lparen.getType() == IToken.tLPAREN) { @@ -171,24 +166,15 @@ public class CPPASTFunctionCallExpression extends ASTNode n2.setOffsetAndLength(idEndOffset, 0); } } else { - n1.computeOperatorOffsets(fFunctionName, true); + n1.computeOperatorOffsets(functionName, true); n2.computeOperatorOffsets(fArguments[fArguments.length - 1], true); } - fImplicitNames = new IASTImplicitName[] { n1, n2 }; + implicitNames = new IASTImplicitName[] { n1, n2 }; } - return fImplicitNames; + return implicitNames; } - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - if (fImplicitDestructorNames == null) { - fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this); - } - - return fImplicitDestructorNames; - } - @Override public boolean accept(ASTVisitor action) { if (action.shouldVisitExpressions) { @@ -199,7 +185,7 @@ public class CPPASTFunctionCallExpression extends ASTNode } } - if (fFunctionName != null && !fFunctionName.accept(action)) + if (functionName != null && !functionName.accept(action)) return false; IASTImplicitName[] implicits = action.shouldVisitImplicitNames ? getImplicitNames() : null; @@ -215,9 +201,6 @@ public class CPPASTFunctionCallExpression extends ASTNode if (implicits != null && implicits.length > 1 && !implicits[1].accept(action)) return false; - if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action)) - return false; - if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT) return false; @@ -226,10 +209,10 @@ public class CPPASTFunctionCallExpression extends ASTNode @Override public void replace(IASTNode child, IASTNode other) { - if (child == fFunctionName) { + if (child == functionName) { other.setPropertyInParent(child.getPropertyInParent()); other.setParent(child.getParent()); - fFunctionName = (ICPPASTExpression) other; + functionName = (ICPPASTExpression) other; } for (int i = 0; i < fArguments.length; ++i) { if (child == fArguments[i]) { @@ -240,8 +223,8 @@ public class CPPASTFunctionCallExpression extends ASTNode } } - @Deprecated @Override + @Deprecated public IASTExpression getParameterExpression() { if (fArguments.length == 0) return null; @@ -263,8 +246,8 @@ public class CPPASTFunctionCallExpression extends ASTNode return result; } - @Deprecated @Override + @Deprecated public void setParameterExpression(IASTExpression expression) { assertNotFrozen(); if (expression == null) { @@ -287,10 +270,9 @@ public class CPPASTFunctionCallExpression extends ASTNode IType t= getNestedType(((EvalTypeId) eval).getInputType(), TDEF | CVTYPE | REF); if (t instanceof ICPPClassType && !(t instanceof ICPPUnknownBinding)) { ICPPClassType cls= (ICPPClassType) t; - LookupData data= CPPSemantics.createLookupData(((IASTIdExpression) fFunctionName).getName()); + LookupData data= CPPSemantics.createLookupData(((IASTIdExpression) functionName).getName()); try { - ICPPConstructor[] constructors = ClassTypeHelper.getConstructors(cls, data.getLookupPoint()); - IBinding b= CPPSemantics.resolveFunction(data, constructors, true); + IBinding b= CPPSemantics.resolveFunction(data, ClassTypeHelper.getConstructors(cls, data.getLookupPoint()), true); if (b instanceof ICPPFunction) return (ICPPFunction) b; } catch (DOMException e) { @@ -303,14 +285,14 @@ public class CPPASTFunctionCallExpression extends ASTNode @Override public ICPPEvaluation getEvaluation() { - if (fEvaluation == null) - fEvaluation= computeEvaluation(); + if (evaluation == null) + evaluation= computeEvaluation(); - return fEvaluation; + return evaluation; } private ICPPEvaluation computeEvaluation() { - if (fFunctionName == null || fArguments == null) + if (functionName == null || fArguments == null) return EvalFixed.INCOMPLETE; ICPPEvaluation conversion= checkForExplicitTypeConversion(); @@ -318,7 +300,7 @@ public class CPPASTFunctionCallExpression extends ASTNode return conversion; ICPPEvaluation[] args= new ICPPEvaluation[fArguments.length + 1]; - args[0]= fFunctionName.getEvaluation(); + args[0]= functionName.getEvaluation(); for (int i = 1; i < args.length; i++) { args[i]= ((ICPPASTInitializerClause) fArguments[i - 1]).getEvaluation(); } @@ -326,8 +308,8 @@ public class CPPASTFunctionCallExpression extends ASTNode } private ICPPEvaluation checkForExplicitTypeConversion() { - if (fFunctionName instanceof IASTIdExpression) { - final IASTName name = ((IASTIdExpression) fFunctionName).getName(); + if (functionName instanceof IASTIdExpression) { + final IASTName name = ((IASTIdExpression) functionName).getName(); IBinding b= name.resolvePreBinding(); if (b instanceof IType) { ICPPEvaluation[] args= new ICPPEvaluation[fArguments.length]; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIdExpression.java index 7f20fa4e0d1..2e876813c79 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIdExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIdExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -9,7 +9,6 @@ * John Camelon (IBM) - Initial API and implementation * Bryan Wilkinson (QNX) * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -17,7 +16,6 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTIdExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.ICPPASTCompletionContext; @@ -27,16 +25,13 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression; import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.ProblemType; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalID; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.FunctionSetType; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil; -public class CPPASTIdExpression extends ASTNode - implements IASTIdExpression, ICPPASTExpression, ICPPASTCompletionContext { - private IASTName fName; +public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICPPASTExpression, ICPPASTCompletionContext { + private IASTName name; private ICPPEvaluation fEvaluation; - private IASTImplicitDestructorName[] fImplicitDestructorNames; public CPPASTIdExpression() { } @@ -52,34 +47,25 @@ public class CPPASTIdExpression extends ASTNode @Override public CPPASTIdExpression copy(CopyStyle style) { - CPPASTIdExpression copy = new CPPASTIdExpression(fName == null ? null : fName.copy(style)); + CPPASTIdExpression copy = new CPPASTIdExpression(name == null ? null : name.copy(style)); return copy(copy, style); } @Override public IASTName getName() { - return fName; + return name; } @Override public void setName(IASTName name) { assertNotFrozen(); - this.fName = name; + this.name = name; if (name != null) { name.setParent(this); name.setPropertyInParent(ID_NAME); } } - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - if (fImplicitDestructorNames == null) { - fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this); - } - - return fImplicitDestructorNames; - } - @Override public boolean accept(ASTVisitor action) { if (action.shouldVisitExpressions) { @@ -90,10 +76,7 @@ public class CPPASTIdExpression extends ASTNode } } - if (fName != null && !fName.accept(action)) return false; - - if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action)) - return false; + if (name != null && !name.accept(action)) return false; if (action.shouldVisitExpressions) { switch (action.leave(this)) { @@ -107,7 +90,7 @@ public class CPPASTIdExpression extends ASTNode @Override public int getRoleForName(IASTName n) { - if (fName == n) + if (name == n) return r_reference; return r_unclear; } @@ -119,7 +102,7 @@ public class CPPASTIdExpression extends ASTNode @Override public String toString() { - return fName != null ? fName.toString() : ""; //$NON-NLS-1$ + return name != null ? name.toString() : ""; //$NON-NLS-1$ } @Override @@ -139,7 +122,7 @@ public class CPPASTIdExpression extends ASTNode public IType getExpressionType() { IType type= getEvaluation().getTypeOrFunctionSet(this); if (type instanceof FunctionSetType) { - IBinding binding= fName.resolveBinding(); + IBinding binding= name.resolveBinding(); if (binding instanceof IFunction) { return SemanticUtil.mapToAST(((IFunction) binding).getType(), this); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTImplicitDestructorName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTImplicitDestructorName.java deleted file mode 100644 index cbb708dc1bd..00000000000 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTImplicitDestructorName.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Google, Inc and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Sergey Prigogin (Google) - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.core.dom.parser.cpp; - -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorNameOwner; -import org.eclipse.cdt.core.dom.ast.IASTImplicitName; -import org.eclipse.cdt.core.dom.ast.IASTNode; - - -public class CPPASTImplicitDestructorName extends CPPASTImplicitName implements IASTImplicitDestructorName { - private final IASTImplicitName constructionPoint; - - public CPPASTImplicitDestructorName(char[] name, IASTNode parent, IASTImplicitName constructionPoint) { - super(name, parent); - this.constructionPoint = constructionPoint; - setPropertyInParent(IASTImplicitDestructorNameOwner.IMPLICIT_DESTRUCTOR_NAME); - } - - @Override - public IASTImplicitName getConstructionPoint() { - return constructionPoint; - } -} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLambdaExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLambdaExpression.java index ccb71dc02d0..ad9dda4e1f2 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLambdaExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLambdaExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 Wind River Systems, Inc. and others. + * Copyright (c) 2010, 2011 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,7 +7,6 @@ * * Contributors: * Markus Schorn - initial API and implementation - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -15,7 +14,6 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTImplicitName; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCapture; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator; @@ -73,6 +71,11 @@ public class CPPASTLambdaExpression extends ASTNode implements ICPPASTLambdaExpr return copy(copy, style); } + @Override + public IASTImplicitName[] getImplicitNames() { + return new IASTImplicitName[] {getFunctionCallOperatorName()}; + } + @Override public IASTImplicitName getClosureTypeName() { if (fClosureTypeName == null) { @@ -106,16 +109,6 @@ public class CPPASTLambdaExpression extends ASTNode implements ICPPASTLambdaExpr return fImplicitFunctionCallName; } - @Override - public IASTImplicitName[] getImplicitNames() { - return new IASTImplicitName[] {getFunctionCallOperatorName()}; - } - - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; // Lambda expression is never a full-expression. - } - @Override public boolean accept(ASTVisitor visitor) { if (visitor.shouldVisitExpressions) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java index 2a7f4317047..c97b28a75a7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,6 @@ * Contributors: * John Camelon (IBM) - Initial API and implementation * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -16,7 +15,6 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE; import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE; import org.eclipse.cdt.core.dom.ast.ASTVisitor; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IBasicType; import org.eclipse.cdt.core.dom.ast.IBasicType.Kind; import org.eclipse.cdt.core.dom.ast.IScope; @@ -42,17 +40,17 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx public static final CPPASTLiteralExpression INT_ZERO = new CPPASTLiteralExpression(lk_integer_constant, new char[] {'0'}); - private int fKind; - private char[] fValue = CharArrayUtils.EMPTY; - private int fStringLiteralSize = -1; // Accounting for escape sequences and the null terminator. + private int kind; + private char[] value = CharArrayUtils.EMPTY; + private int fStringLiteralSize = -1; // accounting for escape sequences and the null terminator private ICPPEvaluation fEvaluation; public CPPASTLiteralExpression() { } public CPPASTLiteralExpression(int kind, char[] value) { - this.fKind = kind; - this.fValue = value; + this.kind = kind; + this.value = value; } @Override @@ -63,42 +61,37 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx @Override public CPPASTLiteralExpression copy(CopyStyle style) { CPPASTLiteralExpression copy = - new CPPASTLiteralExpression(fKind, fValue == null ? null : fValue.clone()); + new CPPASTLiteralExpression(kind, value == null ? null : value.clone()); return copy(copy, style); } @Override public int getKind() { - return fKind; + return kind; } @Override public void setKind(int value) { assertNotFrozen(); - fKind = value; + kind = value; } @Override public char[] getValue() { - return fValue; + return value; } @Override public void setValue(char[] value) { assertNotFrozen(); - this.fValue= value; + this.value= value; } @Override public String toString() { - return new String(fValue); + return new String(value); } - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; // Literal expression does not call destructors. - } - @Override public boolean accept(ASTVisitor action) { if (action.shouldVisitExpressions) { @@ -119,22 +112,22 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx } private int computeStringLiteralSize() { - int start = 0, end = fValue.length - 1; + int start = 0, end = value.length - 1; boolean isRaw = false; // Skip past a prefix affecting the character type. - if (fValue[0] == 'L' || fValue[0] == 'u' || fValue[0] == 'U') { + if (value[0] == 'L' || value[0] == 'u' || value[0] == 'U') { ++start; } // If there is an 'R' prefix, skip past it but take note of it. - if (fValue[start] == 'R') { + if (value[start] == 'R') { ++start; isRaw = true; } // Now we should have a quote-enclosed string. Skip past the quotes. - if (!(fValue[start] == '"' && fValue[end] == '"')) { + if (!(value[start] == '"' && value[end] == '"')) { // Unexpected! return 0; } @@ -143,13 +136,13 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx // If we have a raw string, skip past the raw prefix. if (isRaw) { - while (fValue[start] != '(' && start <= end) { + while (value[start] != '(' && start <= end) { ++start; --end; } // Now we should have a parenthesis-enclosed string. - if (!(fValue[start] == '(' && fValue[end] == ')')) { + if (!(value[start] == '(' && value[end] == ')')) { // Unexpected! return 0; } @@ -168,7 +161,7 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx if (escaping) { escaping = false; ++length; - } else if (fValue[start] == '\\') { + } else if (value[start] == '\\') { escaping = true; } else { ++length; @@ -260,7 +253,7 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx @Deprecated public void setValue(String value) { assertNotFrozen(); - this.fValue = value.toCharArray(); + this.value = value.toCharArray(); } /** @@ -279,7 +272,7 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx } private ICPPEvaluation createEvaluation() { - switch (fKind) { + switch (kind) { case lk_this: { IScope scope = CPPVisitor.getContainingScope(this); IType type= CPPVisitor.getImpliedObjectType(scope); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java index 084cf0bdcea..532377a11b6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,7 +21,6 @@ import org.eclipse.cdt.core.dom.ast.IASTArrayModifier; import org.eclipse.cdt.core.dom.ast.IASTDeclarator; import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpressionList; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTImplicitName; import org.eclipse.cdt.core.dom.ast.IASTInitializer; import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; @@ -49,16 +48,15 @@ import org.eclipse.core.runtime.Assert; * Represents a new expression [expr.new]. */ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression, IASTAmbiguityParent { - private IASTInitializerClause[] fPlacement; - private IASTTypeId fTypeId; - private IASTInitializer fInitializer; - private boolean fIsGlobal; - private boolean fIsNewTypeId; + private IASTInitializerClause[] placement; + private IASTTypeId typeId; + private IASTInitializer initializer; + private IASTImplicitName[] implicitNames; + private boolean isGlobal; + private boolean isNewTypeId; - private IASTExpression[] fCachedArraySizes; + private IASTExpression[] cachedArraySizes; private ICPPEvaluation fEvaluation; - private IASTImplicitName[] fImplicitNames; - private IASTImplicitDestructorName[] fImplicitDestructorNames; public CPPASTNewExpression() { } @@ -77,40 +75,40 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression @Override public CPPASTNewExpression copy(CopyStyle style) { CPPASTNewExpression copy = new CPPASTNewExpression(); - copy.setIsGlobal(fIsGlobal); - copy.setIsNewTypeId(fIsNewTypeId); - if (fPlacement != null) { - IASTInitializerClause[] plcmt = new IASTInitializerClause[fPlacement.length]; - for (int i = 0; i < fPlacement.length; i++) { - plcmt[i] = fPlacement[i].copy(style); + copy.setIsGlobal(isGlobal); + copy.setIsNewTypeId(isNewTypeId); + if (placement != null) { + IASTInitializerClause[] plcmt = new IASTInitializerClause[placement.length]; + for (int i = 0; i < placement.length; i++) { + plcmt[i] = placement[i].copy(style); } copy.setPlacementArguments(plcmt); } - copy.setTypeId(fTypeId == null ? null : fTypeId.copy(style)); - copy.setInitializer(fInitializer == null ? null : fInitializer.copy(style)); + copy.setTypeId(typeId == null ? null : typeId.copy(style)); + copy.setInitializer(initializer == null ? null : initializer.copy(style)); return copy(copy, style); } @Override public boolean isGlobal() { - return fIsGlobal; + return isGlobal; } @Override public void setIsGlobal(boolean value) { assertNotFrozen(); - fIsGlobal = value; + isGlobal = value; } @Override public IASTInitializerClause[] getPlacementArguments() { - return fPlacement; + return placement; } @Override public void setPlacementArguments(IASTInitializerClause[] args) { assertNotFrozen(); - fPlacement = args; + placement = args; if (args != null) { for (IASTInitializerClause arg : args) { arg.setParent(this); @@ -121,13 +119,13 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression @Override public IASTInitializer getInitializer() { - return fInitializer; + return initializer; } @Override public void setInitializer(IASTInitializer expression) { assertNotFrozen(); - fInitializer = expression; + initializer = expression; if (expression != null) { expression.setParent(this); expression.setPropertyInParent(NEW_INITIALIZER); @@ -136,13 +134,13 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression @Override public IASTTypeId getTypeId() { - return fTypeId; + return typeId; } @Override public void setTypeId(IASTTypeId typeId) { assertNotFrozen(); - fTypeId = typeId; + this.typeId = typeId; if (typeId != null) { typeId.setParent(this); typeId.setPropertyInParent(TYPE_ID); @@ -151,13 +149,13 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression @Override public boolean isNewTypeId() { - return fIsNewTypeId; + return isNewTypeId; } @Override public void setIsNewTypeId(boolean value) { assertNotFrozen(); - fIsNewTypeId = value; + isNewTypeId = value; } /** @@ -165,7 +163,7 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression */ @Override public IASTImplicitName[] getImplicitNames() { - if (fImplicitNames == null) { + if (implicitNames == null) { CPPASTImplicitName operatorName = null; ICPPFunction operatorFunction = CPPSemantics.findOverloadedOperator(this); if (operatorFunction != null && !(operatorFunction instanceof CPPImplicitFunction)) { @@ -185,31 +183,22 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression if (operatorName != null) { if (constructorName != null) { - fImplicitNames = new IASTImplicitName[] { operatorName, constructorName }; + implicitNames = new IASTImplicitName[] { operatorName, constructorName }; } else { - fImplicitNames = new IASTImplicitName[] { operatorName }; + implicitNames = new IASTImplicitName[] { operatorName }; } } else { if (constructorName != null) { - fImplicitNames = new IASTImplicitName[] { constructorName }; + implicitNames = new IASTImplicitName[] { constructorName }; } else { - fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; + implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; } } } - return fImplicitNames; + return implicitNames; } - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - if (fImplicitDestructorNames == null) { - fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this); - } - - return fImplicitDestructorNames; - } - /** * Returns true if this expression is allocating an array. * @since 5.1 @@ -243,21 +232,18 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression } } - if (fPlacement != null) { - for (IASTInitializerClause arg : fPlacement) { + if (placement != null) { + for (IASTInitializerClause arg : placement) { if (!arg.accept(action)) return false; } } - if (fTypeId != null && !fTypeId.accept(action)) + if (typeId != null && !typeId.accept(action)) return false; - if (fInitializer != null && !fInitializer.accept(action)) + if (initializer != null && !initializer.accept(action)) return false; - if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action)) - return false; - if (action.shouldVisitExpressions) { switch (action.leave(this)) { case ASTVisitor.PROCESS_ABORT: return false; @@ -270,12 +256,12 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression @Override public void replace(IASTNode child, IASTNode other) { - if (fPlacement != null) { - for (int i = 0; i < fPlacement.length; ++i) { - if (child == fPlacement[i]) { + if (placement != null) { + for (int i = 0; i < placement.length; ++i) { + if (child == placement[i]) { other.setPropertyInParent(child.getPropertyInParent()); other.setParent(child.getParent()); - fPlacement[i] = (IASTExpression) other; + placement[i] = (IASTExpression) other; } } } @@ -284,13 +270,13 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression @Override public ICPPEvaluation getEvaluation() { if (fEvaluation == null) { - IType t = fTypeId != null ? CPPVisitor.createType(fTypeId) : ProblemType.UNKNOWN_FOR_EXPRESSION; + IType t = typeId != null ? CPPVisitor.createType(typeId) : ProblemType.UNKNOWN_FOR_EXPRESSION; if (t instanceof IArrayType) { t = ((IArrayType) t).getType(); } ICPPEvaluation[] arguments = ICPPEvaluation.EMPTY_ARRAY; - if (fInitializer instanceof ICPPASTConstructorInitializer) { - IASTInitializerClause[] args = ((ICPPASTConstructorInitializer) fInitializer).getArguments(); + if (initializer instanceof ICPPASTConstructorInitializer) { + IASTInitializerClause[] args = ((ICPPASTConstructorInitializer) initializer).getArguments(); arguments= new ICPPEvaluation[args.length]; for (int i = 0; i < arguments.length; i++) { arguments[i] = ((ICPPASTInitializerClause) args[i]).getEvaluation(); @@ -319,40 +305,40 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression @Override @Deprecated public IASTExpression[] getNewTypeIdArrayExpressions() { - if (fCachedArraySizes == null) { - if (fTypeId != null) { - IASTDeclarator dtor = ASTQueries.findInnermostDeclarator(fTypeId.getAbstractDeclarator()); + if (cachedArraySizes == null) { + if (typeId != null) { + IASTDeclarator dtor = ASTQueries.findInnermostDeclarator(typeId.getAbstractDeclarator()); if (dtor instanceof IASTArrayDeclarator) { IASTArrayDeclarator ad = (IASTArrayDeclarator) dtor; IASTArrayModifier[] ams = ad.getArrayModifiers(); - fCachedArraySizes = new IASTExpression[ams.length]; + cachedArraySizes = new IASTExpression[ams.length]; for (int i = 0; i < ams.length; i++) { IASTArrayModifier am = ams[i]; - fCachedArraySizes[i] = am.getConstantExpression(); + cachedArraySizes[i] = am.getConstantExpression(); } - return fCachedArraySizes; + return cachedArraySizes; } } - fCachedArraySizes = IASTExpression.EMPTY_EXPRESSION_ARRAY; + cachedArraySizes = IASTExpression.EMPTY_EXPRESSION_ARRAY; } - return fCachedArraySizes; + return cachedArraySizes; } @Override @Deprecated public void addNewTypeIdArrayExpression(IASTExpression expression) { assertNotFrozen(); - Assert.isNotNull(fTypeId); - IASTDeclarator dtor= ASTQueries.findInnermostDeclarator(fTypeId.getAbstractDeclarator()); + Assert.isNotNull(typeId); + IASTDeclarator dtor= ASTQueries.findInnermostDeclarator(typeId.getAbstractDeclarator()); if (dtor instanceof IASTArrayDeclarator == false) { Assert.isNotNull(dtor); - Assert.isTrue(dtor.getParent() == fTypeId); + Assert.isTrue(dtor.getParent() == typeId); IASTArrayDeclarator adtor= new CPPASTArrayDeclarator(dtor.getName()); IASTPointerOperator[] ptrOps= dtor.getPointerOperators(); for (IASTPointerOperator ptr : ptrOps) { adtor.addPointerOperator(ptr); } - fTypeId.setAbstractDeclarator(adtor); + typeId.setAbstractDeclarator(adtor); dtor= adtor; } IASTArrayModifier mod= new CPPASTArrayModifier(expression); @@ -363,16 +349,16 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression @Override @Deprecated public IASTExpression getNewPlacement() { - if (fPlacement == null || fPlacement.length == 0) + if (placement == null || placement.length == 0) return null; - if (fPlacement.length == 1) { - if (fPlacement[0] instanceof IASTExpression) - return (IASTExpression) fPlacement[0]; + if (placement.length == 1) { + if (placement[0] instanceof IASTExpression) + return (IASTExpression) placement[0]; return null; } CASTExpressionList result= new CASTExpressionList(); - for (IASTInitializerClause arg : fPlacement) { + for (IASTInitializerClause arg : placement) { if (arg instanceof IASTExpression) { result.addExpression(((IASTExpression) arg).copy()); } @@ -398,11 +384,11 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression @Override @Deprecated public IASTExpression getNewInitializer() { - if (fInitializer == null || fInitializer instanceof IASTExpression) { - return (IASTExpression) fInitializer; + if (initializer == null || initializer instanceof IASTExpression) { + return (IASTExpression) initializer; } - if (fInitializer instanceof ICPPASTConstructorInitializer) { - IASTExpression expr= ((ICPPASTConstructorInitializer) fInitializer).getExpression(); + if (initializer instanceof ICPPASTConstructorInitializer) { + IASTExpression expr= ((ICPPASTConstructorInitializer) initializer).getExpression(); if (expr == null) { expr= new CPPASTExpressionList(); } else { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPackExpansionExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPackExpansionExpression.java index 7424b41b97a..8341fed79e9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPackExpansionExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPackExpansionExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 Wind River Systems, Inc. and others. + * Copyright (c) 2009, 2013 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,13 +8,11 @@ * Contributors: * Markus Schorn - initial API and implementation * Natan Ridge - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression; @@ -84,11 +82,6 @@ public class CPPASTPackExpansionExpression extends ASTNode implements ICPPASTPac return fPattern.getValueCategory(); } - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; // Pack expression is never a full-expression. - } - @Override public boolean accept(ASTVisitor visitor) { if (visitor.shouldVisitExpressions) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTProblemExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTProblemExpression.java index ec34ddbeca2..1c581ce9533 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTProblemExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTProblemExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,14 +8,12 @@ * Contributors: * John Camelon (IBM) - Initial API and implementation * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE; import org.eclipse.cdt.core.dom.ast.ASTVisitor; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTProblem; import org.eclipse.cdt.core.dom.ast.IASTProblemExpression; import org.eclipse.cdt.core.dom.ast.IType; @@ -36,18 +34,12 @@ public class CPPASTProblemExpression extends CPPASTProblemOwner implements IASTP public CPPASTProblemExpression copy() { return copy(CopyStyle.withoutLocations); } - @Override public CPPASTProblemExpression copy(CopyStyle style) { CPPASTProblemExpression copy = new CPPASTProblemExpression(); return copy(copy, style); } - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; - } - @Override public boolean accept(ASTVisitor action) { if (action.shouldVisitExpressions) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java index c464ab5b476..e5e90fc82ba 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,13 +8,11 @@ * Contributors: * John Camelon (IBM) - Initial API and implementation * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTInitializer; import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; import org.eclipse.cdt.core.dom.ast.IBasicType.Kind; @@ -35,7 +33,6 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode private ICPPASTDeclSpecifier fDeclSpec; private IASTInitializer fInitializer; private ICPPEvaluation fEvaluation; - private IASTImplicitDestructorName[] fImplicitDestructorNames; public CPPASTSimpleTypeConstructorExpression() { } @@ -125,15 +122,6 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode return false; } - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - if (fImplicitDestructorNames == null) { - fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this); - } - - return fImplicitDestructorNames; - } - @Override public boolean accept(ASTVisitor action) { if (action.shouldVisitExpressions) { @@ -150,9 +138,6 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode if (fInitializer != null && !fInitializer.accept(action)) return false; - if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action)) - return false; - if (action.shouldVisitExpressions) { switch (action.leave(this)) { case ASTVisitor.PROCESS_ABORT: return false; @@ -163,8 +148,8 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode return true; } - @Deprecated @Override + @Deprecated public int getSimpleType() { IType type= getExpressionType(); if (type instanceof ICPPBasicType) { @@ -200,8 +185,8 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode return t_unspecified; } - @Deprecated @Override + @Deprecated public void setSimpleType(int value) { CPPASTSimpleDeclSpecifier declspec = new CPPASTSimpleDeclSpecifier(); switch(value) { @@ -249,8 +234,8 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode setDeclSpecifier(declspec); } - @Deprecated @Override + @Deprecated public IASTExpression getInitialValue() { if (fInitializer instanceof ICPPASTConstructorInitializer) { return ((ICPPASTConstructorInitializer) fInitializer).getExpression(); @@ -258,8 +243,8 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode return null; } - @Deprecated @Override + @Deprecated public void setInitialValue(IASTExpression expression) { ICPPASTConstructorInitializer init= new CPPASTConstructorInitializer(); init.setExpression(expression); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateIDAmbiguity.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateIDAmbiguity.java index 6b5931de81b..973c419f862 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateIDAmbiguity.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateIDAmbiguity.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. + * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,7 +17,6 @@ import java.util.List; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IBinding; @@ -175,9 +174,4 @@ public class CPPASTTemplateIDAmbiguity extends ASTAmbiguousNode public IASTExpression[] getExpressions() { throw new UnsupportedOperationException(); } - - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - throw new UnsupportedOperationException(); - } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdExpression.java index c73a0a11ec8..fee516ec4fd 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdExpression.java @@ -14,7 +14,6 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp; import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE; import org.eclipse.cdt.core.dom.ast.ASTVisitor; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.IProblemType; import org.eclipse.cdt.core.dom.ast.IType; @@ -25,15 +24,15 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalUnaryTypeID; public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpression { - private int fOperator; - private IASTTypeId fTypeId; + private int op; + private IASTTypeId typeId; private ICPPEvaluation fEvaluation; public CPPASTTypeIdExpression() { } public CPPASTTypeIdExpression(int op, IASTTypeId typeId) { - this.fOperator = op; + this.op = op; setTypeId(typeId); } @@ -45,25 +44,25 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr @Override public CPPASTTypeIdExpression copy(CopyStyle style) { CPPASTTypeIdExpression copy = - new CPPASTTypeIdExpression(fOperator, fTypeId == null ? null : fTypeId.copy(style)); + new CPPASTTypeIdExpression(op, typeId == null ? null : typeId.copy(style)); return copy(copy, style); } @Override public int getOperator() { - return fOperator; + return op; } @Override public void setOperator(int value) { assertNotFrozen(); - fOperator = value; + this.op = value; } @Override public void setTypeId(IASTTypeId typeId) { assertNotFrozen(); - this.fTypeId = typeId; + this.typeId = typeId; if (typeId != null) { typeId.setParent(this); typeId.setPropertyInParent(TYPE_ID); @@ -72,14 +71,9 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr @Override public IASTTypeId getTypeId() { - return fTypeId; + return typeId; } - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; // Type-id expression does not call destructors. - } - @Override public boolean accept(ASTVisitor action) { if (action.shouldVisitExpressions) { @@ -90,7 +84,7 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr } } - if (fTypeId != null && !fTypeId.accept(action)) return false; + if (typeId != null && !typeId.accept(action)) return false; if (action.shouldVisitExpressions) { switch (action.leave(this)) { @@ -105,11 +99,11 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr @Override public ICPPEvaluation getEvaluation() { if (fEvaluation == null) { - IType type= CPPVisitor.createType(fTypeId); + IType type= CPPVisitor.createType(typeId); if (type == null || type instanceof IProblemType) { fEvaluation= EvalFixed.INCOMPLETE; } else { - fEvaluation= new EvalUnaryTypeID(fOperator, type, this); + fEvaluation= new EvalUnaryTypeID(op, type, this); } } return fEvaluation; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdInitializerExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdInitializerExpression.java index cbfd52225c3..7330c3f81ec 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdInitializerExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdInitializerExpression.java @@ -1,20 +1,15 @@ /******************************************************************************* - * Copyright (c) 2005, 2015 IBM Corporation and others. + * Copyright (c) 2009, 2011 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * John Camelon (IBM Rational Software) - Initial API and implementation - * Yuan Zhang / Beth Tibbitts (IBM Research) - * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) - *******************************************************************************/ + * Markus Schorn - initial API and implementation + *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; -import org.eclipse.cdt.core.dom.ast.ASTVisitor; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTInitializer; import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.IASTTypeIdInitializerExpression; @@ -22,110 +17,35 @@ import org.eclipse.cdt.core.dom.ast.IProblemType; import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause; -import org.eclipse.cdt.internal.core.dom.parser.ASTNode; +import org.eclipse.cdt.internal.core.dom.parser.ASTTypeIdInitializerExpression; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalTypeId; /** - * Type id initializer expression for C++, type-id { initializer } + * C++ variant of type id initializer expression. type-id { initializer } */ -public class CPPASTTypeIdInitializerExpression extends ASTNode - implements IASTTypeIdInitializerExpression, ICPPASTExpression { - private IASTTypeId fTypeId; - private IASTInitializer fInitializer; +public class CPPASTTypeIdInitializerExpression extends ASTTypeIdInitializerExpression implements ICPPASTExpression { + private ICPPEvaluation fEvaluation; - private IASTImplicitDestructorName[] fImplicitDestructorNames; - public CPPASTTypeIdInitializerExpression() { + private CPPASTTypeIdInitializerExpression() { } - public CPPASTTypeIdInitializerExpression(IASTTypeId t, IASTInitializer i) { - setTypeId(t); - setInitializer(i); - } - - @Override - public IASTTypeId getTypeId() { - return fTypeId; - } - - @Override - public void setTypeId(IASTTypeId typeId) { - assertNotFrozen(); - this.fTypeId = typeId; - if (typeId != null) { - typeId.setParent(this); - typeId.setPropertyInParent(TYPE_ID); - } - } - - @Override - public IASTInitializer getInitializer() { - return fInitializer; - } - - @Override - public void setInitializer(IASTInitializer initializer) { - assertNotFrozen(); - this.fInitializer = initializer; - if (initializer != null) { - initializer.setParent(this); - initializer.setPropertyInParent(INITIALIZER); - } - } - - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - if (fImplicitDestructorNames == null) { - fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this); - } - - return fImplicitDestructorNames; - } - - @Override - public boolean accept(ASTVisitor action) { - if (action.shouldVisitExpressions) { - switch (action.visit(this)) { - case ASTVisitor.PROCESS_ABORT: return false; - case ASTVisitor.PROCESS_SKIP: return true; - default: break; - } - } - - if (fTypeId != null && !fTypeId.accept(action)) return false; - if (fInitializer != null && !fInitializer.accept(action)) return false; - - if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(getImplicitDestructorNames(), action)) - return false; - - if (action.shouldVisitExpressions) { - switch (action.leave(this)) { - case ASTVisitor.PROCESS_ABORT: return false; - case ASTVisitor.PROCESS_SKIP: return true; - default: break; - } - } - return true; - } - - @Override - public final boolean isLValue() { - return false; + public CPPASTTypeIdInitializerExpression(IASTTypeId typeId, IASTInitializer initializer) { + super(typeId, initializer); } @Override public IASTTypeIdInitializerExpression copy() { return copy(CopyStyle.withoutLocations); } - + @Override public IASTTypeIdInitializerExpression copy(CopyStyle style) { - CPPASTTypeIdInitializerExpression copy =new CPPASTTypeIdInitializerExpression( - fTypeId == null ? null : fTypeId.copy(style), - fInitializer == null ? null : fInitializer.copy(style)); - return copy(copy, style); + CPPASTTypeIdInitializerExpression expr = new CPPASTTypeIdInitializerExpression(); + initializeCopy(expr, style); + return expr; } @Override @@ -135,7 +55,7 @@ public class CPPASTTypeIdInitializerExpression extends ASTNode return fEvaluation; } - + private ICPPEvaluation computeEvaluation() { final IASTInitializer initializer = getInitializer(); if (!(initializer instanceof ICPPASTInitializerClause)) @@ -148,13 +68,13 @@ public class CPPASTTypeIdInitializerExpression extends ASTNode return new EvalTypeId(type, this, ((ICPPASTInitializerClause) initializer).getEvaluation()); } - @Override + @Override public IType getExpressionType() { - return getEvaluation().getTypeOrFunctionSet(this); - } - + return getEvaluation().getTypeOrFunctionSet(this); + } + @Override public ValueCategory getValueCategory() { - return getEvaluation().getValueCategory(this); + return getEvaluation().getValueCategory(this); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java index ec5c98c99c4..1fa885297a4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. + * Copyright (c) 2004, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying masterials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,7 +10,6 @@ * Sergey Prigogin (Google) * Mike Kucera (IBM) * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -19,7 +18,6 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTIdExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; import org.eclipse.cdt.core.dom.ast.IASTImplicitName; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTNode; @@ -33,7 +31,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalUnary; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.FunctionSetType; @@ -44,9 +41,8 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.FunctionSetType; public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpression, IASTAmbiguityParent { private int fOperator; private ICPPASTExpression fOperand; - private ICPPEvaluation fEvaluation; private IASTImplicitName[] fImplicitNames; - private IASTImplicitDestructorName[] fImplicitDestructorNames; + private ICPPEvaluation fEvaluation; public CPPASTUnaryExpression() { } @@ -98,6 +94,9 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres return fOperator == op_postFixDecr || fOperator == op_postFixIncr; } + /** + * @see org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner#getImplicitNames() + */ @Override public IASTImplicitName[] getImplicitNames() { if (fImplicitNames == null) { @@ -116,15 +115,6 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres return fImplicitNames; } - @Override - public IASTImplicitDestructorName[] getImplicitDestructorNames() { - if (fImplicitDestructorNames == null) { - fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this); - } - - return fImplicitDestructorNames; - } - @Override public boolean accept(ASTVisitor action) { if (action.shouldVisitExpressions) { @@ -154,9 +144,6 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres } } - if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action)) - return false; - if (action.shouldVisitExpressions) { switch (action.leave(this)) { case ASTVisitor.PROCESS_ABORT: return false; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBlockScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBlockScope.java index d1cc1629cdc..bdce87c184f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBlockScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBlockScope.java @@ -37,7 +37,7 @@ public class CPPBlockScope extends CPPNamespaceScope implements ICPPBlockScope { if (node instanceof IASTCompoundStatement) { final IASTNode parent= node.getParent(); if (parent instanceof IASTFunctionDefinition) { - IASTDeclarator dtor= ((IASTFunctionDefinition) parent).getDeclarator(); + IASTDeclarator dtor= ((IASTFunctionDefinition)parent).getDeclarator(); dtor = ASTQueries.findInnermostDeclarator(dtor); return dtor.getName(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionScope.java index 6efde4b30f1..264924a2f77 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionScope.java @@ -52,12 +52,12 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope { @Override public void addBinding(IBinding binding) { - // 3.3.4 only labels have function scope. + //3.3.4 only labels have function scope if (!(binding instanceof ILabel)) return; if (labels == CharArrayObjectMap.EMPTY_MAP) - labels = new CharArrayObjectMap<>(2); + labels = new CharArrayObjectMap(2); labels.put(binding.getNameCharArray(), (ILabel) binding); } @@ -65,7 +65,7 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope { @Override public IBinding[] find(String name) { char[] n = name.toCharArray(); - List bindings = new ArrayList<>(); + List bindings = new ArrayList(); for (int i = 0; i < labels.size(); i++) { char[] key = labels.keyAt(i); @@ -84,8 +84,8 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope { @Override public IScope getParent() { - // We can't just resolve the function and get its parent scope, since there are cases where that - // could loop because resolving functions requires resolving their parameter types. + //we can't just resolve the function and get its parent scope, since there are cases where that + //could loop since resolving functions requires resolving their parameter types IASTFunctionDeclarator fdtor = (IASTFunctionDeclarator) getPhysicalNode(); IASTName name = fdtor.getName().getLastName(); return CPPVisitor.getContainingNonTemplateScope(name); @@ -96,9 +96,9 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope { IASTFunctionDeclarator fnDtor = (IASTFunctionDeclarator) getPhysicalNode(); IASTNode parent = fnDtor.getParent(); if (parent instanceof IASTFunctionDefinition) { - IASTStatement body = ((IASTFunctionDefinition) parent).getBody(); + IASTStatement body = ((IASTFunctionDefinition)parent).getBody(); if (body instanceof IASTCompoundStatement) - return ((IASTCompoundStatement) body).getScope(); + return ((IASTCompoundStatement)body).getScope(); } return null; } @@ -107,7 +107,7 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope { public IName getScopeName() { IASTNode node = getPhysicalNode(); if (node instanceof IASTDeclarator) { - return ((IASTDeclarator) node).getName(); + return ((IASTDeclarator)node).getName(); } return null; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/DestructorCallCollector.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/DestructorCallCollector.java deleted file mode 100644 index 714c601b843..00000000000 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/DestructorCallCollector.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Google, Inc and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Sergey Prigogin (Google) - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics; - -import org.eclipse.cdt.core.dom.ast.ASTVisitor; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorNameOwner; -import org.eclipse.cdt.core.dom.ast.IASTImplicitName; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; -import org.eclipse.cdt.core.parser.util.ArrayUtil; -import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTImplicitDestructorName; -import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper; -import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper.MethodKind; - -/** - * A visitor that collects temporaries that have destructors. - */ -public class DestructableTemporariesCollector extends ASTVisitor { - private final IASTImplicitDestructorNameOwner owner; - private IASTImplicitDestructorName[] destructorNames = IASTImplicitDestructorName.EMPTY_NAME_ARRAY; - - public DestructableTemporariesCollector(IASTImplicitDestructorNameOwner owner) { - this.owner = owner; - shouldVisitImplicitNames = true; - } - - @Override - public int visit(IASTName name) { - if (name instanceof IASTImplicitName) { - IBinding binding = name.resolveBinding(); - if (binding instanceof ICPPConstructor) { - ICPPClassType classType = ((ICPPConstructor) binding).getClassOwner(); - ICPPMethod destructor = ClassTypeHelper.getMethodInClass(classType, MethodKind.DTOR, name); - if (destructor != null) { - CPPASTImplicitDestructorName destructorName = - new CPPASTImplicitDestructorName(destructor.getNameCharArray(), owner, (IASTImplicitName) name); - destructorNames = ArrayUtil.append(destructorNames, destructorName); - } - } - } - return PROCESS_CONTINUE; - } - - public IASTImplicitDestructorName[] getDestructorCalls() { - destructorNames = ArrayUtil.trim(destructorNames); - return destructorNames; - } -} diff --git a/core/org.eclipse.cdt.ui/.settings/org.eclipse.jdt.core.prefs b/core/org.eclipse.cdt.ui/.settings/org.eclipse.jdt.core.prefs index 3933fad1414..715475fbf4c 100644 --- a/core/org.eclipse.cdt.ui/.settings/org.eclipse.jdt.core.prefs +++ b/core/org.eclipse.cdt.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,3 +1,4 @@ +#Mon Oct 17 17:37:10 PDT 2011 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 @@ -81,7 +82,6 @@ org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 @@ -89,21 +89,18 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_e org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 @@ -123,7 +120,6 @@ org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line @@ -139,17 +135,11 @@ org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.comment.line_length=110 org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true @@ -167,9 +157,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert @@ -217,7 +205,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert @@ -236,14 +223,12 @@ org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invoca org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert @@ -267,7 +252,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invoc org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert @@ -295,7 +279,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert @@ -324,7 +307,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invoc org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert @@ -334,7 +316,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=inser org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -358,8 +339,5 @@ org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.size=4 -org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true -org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/core/org.eclipse.cdt.ui/.settings/org.eclipse.jdt.ui.prefs b/core/org.eclipse.cdt.ui/.settings/org.eclipse.jdt.ui.prefs index 875055bcc00..5e6cb98166c 100644 --- a/core/org.eclipse.cdt.ui/.settings/org.eclipse.jdt.ui.prefs +++ b/core/org.eclipse.cdt.ui/.settings/org.eclipse.jdt.ui.prefs @@ -1,6 +1,7 @@ +#Wed Jan 28 12:19:09 CET 2009 eclipse.preferences.version=1 formatter_profile=_CDT -formatter_settings_version=12 +formatter_settings_version=11 org.eclipse.jdt.ui.ignorelowercasenames=true org.eclipse.jdt.ui.importorder=java;javax;org;com;org.eclipse.cdt;org.eclipse.cdt.internal;org.eclipse.cdt.internal.ui; org.eclipse.jdt.ui.ondemandthreshold=99