1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Cosmetics

This commit is contained in:
Sergey Prigogin 2015-03-08 00:09:28 -08:00
parent 14f7d3e16c
commit 4d1b8a8e26
66 changed files with 1238 additions and 656 deletions

View file

@ -169,7 +169,7 @@ public final class CxxAstUtils {
* For any BinaryExpression, guess the type from the other operand. (A good * For any BinaryExpression, guess the type from the other operand. (A good
* guess for =, ==; hard to get a better guess for others) * guess for =, ==; hard to get a better guess for others)
* *
* @return inferred type or null if couldn't infer * @return inferred type or {@code null} if couldn't infer
*/ */
private static IType tryInferTypeFromBinaryExpr(IASTName astName) { private static IType tryInferTypeFromBinaryExpr(IASTName astName) {
if (astName.getParent() instanceof IASTIdExpression && astName.getParent().getParent() instanceof IASTBinaryExpression) { if (astName.getParent() instanceof IASTIdExpression && astName.getParent().getParent() instanceof IASTBinaryExpression) {
@ -188,9 +188,8 @@ public final class CxxAstUtils {
* For a function call, tries to find a matching function declaration. * For a function call, tries to find a matching function declaration.
* Checks the argument count. * Checks the argument count.
* *
* @param index * @param index the index
* * @return a generated declaration or {@code null} if not suitable
* @return a generated declaration or null if not suitable
*/ */
private static IASTSimpleDeclaration tryInferTypeFromFunctionCall(IASTName astName, INodeFactory factory, IIndex index) { private static IASTSimpleDeclaration tryInferTypeFromFunctionCall(IASTName astName, INodeFactory factory, IIndex index) {
if (astName.getParent() instanceof IASTIdExpression && astName.getParent().getParent() instanceof IASTFunctionCallExpression if (astName.getParent() instanceof IASTIdExpression && astName.getParent().getParent() instanceof IASTFunctionCallExpression
@ -303,13 +302,11 @@ public final class CxxAstUtils {
/** /**
* If the function definition belongs to a class, returns the class. * If the function definition belongs to a class, returns the class.
* Otherwise, returns null. * Otherwise, returns {@code null}.
* *
* @param function * @param function the function definition to check
* the function definition to check * @param index the index to use for name lookup
* @param index * @return either a type specifier or {@code null}
* the index to use for name lookup
* @return Either a type specifier or null
*/ */
public static IASTCompositeTypeSpecifier getCompositeTypeFromFunction(final IASTFunctionDefinition function, final IIndex index) { public static IASTCompositeTypeSpecifier getCompositeTypeFromFunction(final IASTFunctionDefinition function, final IIndex index) {
// Return value to be set via visitor. // Return value to be set via visitor.
@ -371,19 +368,19 @@ public final class CxxAstUtils {
return returnSpecifier[0]; return returnSpecifier[0];
} }
public static boolean isThrowStatement(IASTNode body) { public static boolean isThrowStatement(IASTNode statement) {
if (!(body instanceof IASTExpressionStatement)) if (!(statement instanceof IASTExpressionStatement))
return false; return false;
IASTExpression expression = ((IASTExpressionStatement) body).getExpression(); IASTExpression expression = ((IASTExpressionStatement) statement).getExpression();
if (!(expression instanceof IASTUnaryExpression)) if (!(expression instanceof IASTUnaryExpression))
return false; return false;
return ((IASTUnaryExpression) expression).getOperator() == IASTUnaryExpression.op_throw; return ((IASTUnaryExpression) expression).getOperator() == IASTUnaryExpression.op_throw;
} }
public static boolean isExitStatement(IASTNode body) { public static boolean isExitStatement(IASTNode statement) {
if (!(body instanceof IASTExpressionStatement)) if (!(statement instanceof IASTExpressionStatement))
return false; return false;
IASTExpression expression = ((IASTExpressionStatement) body).getExpression(); IASTExpression expression = ((IASTExpressionStatement) statement).getExpression();
if (!(expression instanceof IASTFunctionCallExpression)) if (!(expression instanceof IASTFunctionCallExpression))
return false; return false;
IASTExpression functionNameExpression = ((IASTFunctionCallExpression) expression).getFunctionNameExpression(); IASTExpression functionNameExpression = ((IASTFunctionCallExpression) expression).getFunctionNameExpression();

View file

@ -22,7 +22,7 @@ import org.eclipse.core.resources.IResource;
public interface IProblemLocation { public interface IProblemLocation {
/** /**
* *
* @return File for the problem - absolute full paths * @return the file where the problem occurred
*/ */
IResource getFile(); IResource getFile();
@ -49,7 +49,7 @@ public interface IProblemLocation {
/** /**
* *
* @return extra data for problem location, checker specific, can be * @return extra data for the problem location, checker specific, can be
* backtrace for example * backtrace for example
*/ */
Object getData(); Object getData();

View file

@ -80,6 +80,7 @@ org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false 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_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_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_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
@ -87,18 +88,21 @@ 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_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 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_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 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_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_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=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_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_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=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_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_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_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_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_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_field=0
@ -118,6 +122,7 @@ 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_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_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_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_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_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
@ -133,11 +138,17 @@ 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.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_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=110 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.compact_else_if=true org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=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_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_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_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@ -155,7 +166,9 @@ 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_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_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_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_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_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_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
@ -203,6 +216,7 @@ 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_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=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_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_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_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@ -221,12 +235,14 @@ 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_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_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_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_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_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_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_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not 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_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_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_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
@ -250,6 +266,7 @@ 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_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_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_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_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_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
@ -277,6 +294,7 @@ 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_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_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_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_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_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@ -305,6 +323,7 @@ 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_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_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_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_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_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
@ -314,6 +333,7 @@ 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_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=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_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_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_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@ -329,7 +349,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_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_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=100 org.eclipse.jdt.core.formatter.lineSplit=110
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false 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.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
@ -337,5 +357,8 @@ 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.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4 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.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true 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

View file

@ -1,5 +1,4 @@
#Wed Jan 28 12:19:26 CET 2009
eclipse.preferences.version=1 eclipse.preferences.version=1
formatter_profile=_CDT formatter_profile=_CDT
formatter_settings_version=11 formatter_settings_version=12
internal.default.compliance=user internal.default.compliance=user

View file

@ -18,11 +18,11 @@ import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import junit.framework.Assert;
import junit.framework.AssertionFailedError; import junit.framework.AssertionFailedError;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.junit.Assert;
public class ASTComparer extends Assert { public class ASTComparer extends Assert {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corporation and others. * Copyright (c) 2009, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,8 +13,12 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.parser.tests.ast2; package org.eclipse.cdt.core.parser.tests.ast2;
import java.io.IOException;
import junit.framework.TestSuite; 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.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner; import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
import org.eclipse.cdt.core.dom.ast.IASTNodeSelector; import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
@ -25,9 +29,11 @@ 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.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
import org.eclipse.cdt.core.parser.ParserLanguage; import org.eclipse.cdt.core.parser.ParserLanguage;
import org.eclipse.cdt.internal.core.parser.ParserException;
/** /**
* Tests for classes implementing IASTImplicitNameOwner interface. * Tests for classes implementing {@link IASTImplicitNameOwner} and {@link IASTImplicitDestructorNameOwner}
* interfaces.
*/ */
public class AST2CPPImplicitNameTests extends AST2TestBase { public class AST2CPPImplicitNameTests extends AST2TestBase {
@ -42,7 +48,12 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
return suite(AST2CPPImplicitNameTests.class); return suite(AST2CPPImplicitNameTests.class);
} }
public IASTImplicitName[] getImplicitNames(IASTTranslationUnit tu, String contents, String section, int len) { 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) {
final int offset = contents.indexOf(section); final int offset = contents.indexOf(section);
assertTrue(offset >= 0); assertTrue(offset >= 0);
IASTNodeSelector selector = tu.getNodeSelector(null); IASTNodeSelector selector = tu.getNodeSelector(null);
@ -52,6 +63,25 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
return implicits; 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 { // class point {
// int x, y; // int x, y;
// public: // public:
@ -71,7 +101,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// +p; // +p;
// } // }
public void testBinaryExpressions() throws Exception { public void testBinaryExpressions() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); BindingAssertionHelper ba= getAssertionHelper();
IASTTranslationUnit tu = ba.getTranslationUnit(); IASTTranslationUnit tu = ba.getTranslationUnit();
NameCollector col = new NameCollector(); NameCollector col = new NameCollector();
tu.accept(col); tu.accept(col);
@ -115,7 +145,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// *y; //2 // *y; //2
// } // }
public void testPointerDereference() throws Exception { public void testPointerDereference() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); BindingAssertionHelper ba= getAssertionHelper();
ba.assertImplicitName("*x;", 1, ICPPFunction.class); ba.assertImplicitName("*x;", 1, ICPPFunction.class);
ba.assertNoImplicitName("*y; //2", 1); ba.assertNoImplicitName("*y; //2", 1);
} }
@ -133,7 +163,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// X* px2 = &y; // overloaded // X* px2 = &y; // overloaded
// } // }
public void testPointerToMember() throws Exception { public void testPointerToMember() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); BindingAssertionHelper ba= getAssertionHelper();
IASTTranslationUnit tu = ba.getTranslationUnit(); IASTTranslationUnit tu = ba.getTranslationUnit();
NameCollector col = new NameCollector(); NameCollector col = new NameCollector();
tu.accept(col); tu.accept(col);
@ -194,7 +224,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// (++p1).x; //2 // (++p1).x; //2
// } // }
public void testUnaryPrefixAndPostfix() throws Exception { public void testUnaryPrefixAndPostfix() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); BindingAssertionHelper ba= getAssertionHelper();
ba.assertImplicitName("++).x; //1", 2, ICPPFunction.class); ba.assertImplicitName("++).x; //1", 2, ICPPFunction.class);
ba.assertImplicitName("++p1).x; //2", 2, ICPPMethod.class); ba.assertImplicitName("++p1).x; //2", 2, ICPPMethod.class);
} }
@ -220,7 +250,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// test(a, b, c, d); // func // test(a, b, c, d); // func
// } // }
public void testCommaOperator1() throws Exception { public void testCommaOperator1() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); BindingAssertionHelper ba= getAssertionHelper();
// expression lists are used in function calls but they should not resolve to the comma operator // 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(", b, c, d); // func", 1);
ba.assertNoImplicitName(", c, d); // func", 1); ba.assertNoImplicitName(", c, d); // func", 1);
@ -255,7 +285,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// (a, b, c, d).ee; // expr // (a, b, c, d).ee; // expr
// } // }
public void testCommaOperator2() throws Exception { public void testCommaOperator2() throws Exception {
BindingAssertionHelper ba = new BindingAssertionHelper(getAboveComment(), true); BindingAssertionHelper ba = getAssertionHelper();
IASTImplicitName opAB = ba.assertImplicitName(", b, c, d", 1, ICPPMethod.class); IASTImplicitName opAB = ba.assertImplicitName(", b, c, d", 1, ICPPMethod.class);
IASTImplicitName opCC = ba.assertImplicitName(", c, d", 1, ICPPFunction.class); IASTImplicitName opCC = ba.assertImplicitName(", c, d", 1, ICPPFunction.class);
@ -286,7 +316,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// x(1, 2); // 3 // x(1, 2); // 3
// } // }
public void testFunctionCallOperator() throws Exception { public void testFunctionCallOperator() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); BindingAssertionHelper ba= getAssertionHelper();
IASTTranslationUnit tu = ba.getTranslationUnit(); IASTTranslationUnit tu = ba.getTranslationUnit();
NameCollector col = new NameCollector(); NameCollector col = new NameCollector();
tu.accept(col); tu.accept(col);
@ -327,7 +357,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// b = a; // should not resolve // b = a; // should not resolve
// } // }
public void testCopyAssignmentOperator() throws Exception { public void testCopyAssignmentOperator() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); BindingAssertionHelper ba= getAssertionHelper();
ba.assertNoImplicitName("= a;", 1); ba.assertNoImplicitName("= a;", 1);
} }
@ -345,7 +375,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// func(y[q]); //2 // func(y[q]); //2
// } // }
public void testArraySubscript() throws Exception { public void testArraySubscript() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); BindingAssertionHelper ba= getAssertionHelper();
IASTTranslationUnit tu = ba.getTranslationUnit(); IASTTranslationUnit tu = ba.getTranslationUnit();
NameCollector col = new NameCollector(); NameCollector col = new NameCollector();
tu.accept(col); tu.accept(col);
@ -380,7 +410,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// delete 1; // delete 1;
// } // }
public void testDelete() throws Exception { public void testDelete() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); BindingAssertionHelper ba= getAssertionHelper();
IASTImplicitName[] names = ba.getImplicitNames("delete x;", 6); IASTImplicitName[] names = ba.getImplicitNames("delete x;", 6);
assertEquals(2, names.length); assertEquals(2, names.length);
IASTImplicitName destructor = names[0]; IASTImplicitName destructor = names[0];
@ -414,7 +444,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// delete b; // delete b;
// } // }
public void testOverloadedDelete_Bug351547() throws Exception { public void testOverloadedDelete_Bug351547() throws Exception {
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true); BindingAssertionHelper bh= getAssertionHelper();
IBinding m= bh.assertNonProblem("operator delete(void * a)", 15); IBinding m= bh.assertNonProblem("operator delete(void * a)", 15);
IBinding f= bh.assertNonProblem("operator delete(void * b)", 15); IBinding f= bh.assertNonProblem("operator delete(void * b)", 15);
@ -441,7 +471,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// B* b = new B; // B* b = new B;
// } // }
public void testOverloadedNew_Bug354585() throws Exception { public void testOverloadedNew_Bug354585() throws Exception {
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true); BindingAssertionHelper bh= getAssertionHelper();
IBinding m= bh.assertNonProblem("operator new(size_t a)", 12); IBinding m= bh.assertNonProblem("operator new(size_t a)", 12);
IBinding f= bh.assertNonProblem("operator new(size_t b)", 12); IBinding f= bh.assertNonProblem("operator new(size_t b)", 12);
@ -460,7 +490,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// delete[] x; // delete[] x;
// } // }
public void testImplicitNewAndDelete() throws Exception { public void testImplicitNewAndDelete() throws Exception {
BindingAssertionHelper ba = new BindingAssertionHelper(getAboveComment(), true); BindingAssertionHelper ba = getAssertionHelper();
ba.assertNoImplicitName("new X", 3); ba.assertNoImplicitName("new X", 3);
ba.assertNoImplicitName("delete[]", 6); ba.assertNoImplicitName("delete[]", 6);
} }
@ -479,7 +509,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// int* p2 = new (5, 6) int[5]; // int* p2 = new (5, 6) int[5];
// } // }
public void testNew() throws Exception { public void testNew() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); BindingAssertionHelper ba= getAssertionHelper();
IASTImplicitName n1 = ba.assertImplicitName("new (nothrow) X", 3, ICPPFunction.class); IASTImplicitName n1 = ba.assertImplicitName("new (nothrow) X", 3, ICPPFunction.class);
IASTImplicitName n2 = ba.assertImplicitName("new (nothrow) int", 3, ICPPFunction.class); IASTImplicitName n2 = ba.assertImplicitName("new (nothrow) int", 3, ICPPFunction.class);
IASTImplicitName n3 = ba.assertImplicitName("new (5, 6) int", 3, ICPPFunction.class); IASTImplicitName n3 = ba.assertImplicitName("new (5, 6) int", 3, ICPPFunction.class);
@ -497,7 +527,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// throw; // throw;
// } // }
public void testEmptyThrow() throws Exception { public void testEmptyThrow() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); BindingAssertionHelper ba= getAssertionHelper();
ba.assertNoImplicitName("throw;", 5); ba.assertNoImplicitName("throw;", 5);
} }
@ -526,7 +556,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// }; // };
// B C::t = 1; // B C::t = 1;
public void testConstructorCall() throws Exception { public void testConstructorCall() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); BindingAssertionHelper ba= getAssertionHelper();
IASTTranslationUnit tu = ba.getTranslationUnit(); IASTTranslationUnit tu = ba.getTranslationUnit();
ICPPConstructor ctor0 = ba.assertNonProblem("A()", 1, ICPPConstructor.class); ICPPConstructor ctor0 = ba.assertNonProblem("A()", 1, ICPPConstructor.class);
ICPPConstructor ctor1 = ba.assertNonProblem("A(int)", 1, ICPPConstructor.class); ICPPConstructor ctor1 = ba.assertNonProblem("A(int)", 1, ICPPConstructor.class);
@ -563,7 +593,21 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// } // }
// } // }
public void testBuiltinOperators_294543() throws Exception { public void testBuiltinOperators_294543() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); 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
IASTTranslationUnit tu = ba.getTranslationUnit(); IASTTranslationUnit tu = ba.getTranslationUnit();
ICPPFunction op = ba.assertNonProblem("operator==", 0); ICPPFunction op = ba.assertNonProblem("operator==", 0);
IASTImplicitName a = ba.assertImplicitName("==b", 2, ICPPFunction.class); IASTImplicitName a = ba.assertImplicitName("==b", 2, ICPPFunction.class);

View file

@ -41,6 +41,8 @@ import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition; import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTIdExpression; 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.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner; import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
@ -673,6 +675,16 @@ public class AST2TestBase extends BaseTestCase {
return implicits; 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) { public IASTName findName(String section, int len) {
final int offset = contents.indexOf(section); final int offset = contents.indexOf(section);
assertTrue("Section \"" + section + "\" not found", offset >= 0); assertTrue("Section \"" + section + "\" not found", offset >= 0);
@ -696,7 +708,7 @@ public class AST2TestBase extends BaseTestCase {
return findName(contents, name); return findName(contents, name);
} }
public IASTName findImplicitName(String section, int len) { public IASTImplicitName findImplicitName(String section, int len) {
final int offset = contents.indexOf(section); final int offset = contents.indexOf(section);
assertTrue(offset >= 0); assertTrue(offset >= 0);
IASTNodeSelector selector = tu.getNodeSelector(null); IASTNodeSelector selector = tu.getNodeSelector(null);

View file

@ -1,4 +1,3 @@
#Mon Oct 17 17:36:13 PDT 2011
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
@ -81,6 +80,7 @@ org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false 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_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_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_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
@ -88,18 +88,21 @@ 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_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 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_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 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_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_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=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_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_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=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_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_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_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_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_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_field=0
@ -119,6 +122,7 @@ 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_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_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_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_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_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
@ -134,11 +138,17 @@ 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.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_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=110 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.compact_else_if=true org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=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_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_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_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@ -156,7 +166,9 @@ 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_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_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_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_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_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_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
@ -204,6 +216,7 @@ 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_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=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_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_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_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@ -222,12 +235,14 @@ 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_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_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_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_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_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_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_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not 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_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_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_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
@ -251,6 +266,7 @@ 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_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_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_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_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_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
@ -278,6 +294,7 @@ 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_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_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_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_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_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@ -306,6 +323,7 @@ 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_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_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_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_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_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
@ -315,6 +333,7 @@ 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_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=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_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_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_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@ -330,7 +349,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_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_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=100 org.eclipse.jdt.core.formatter.lineSplit=110
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false 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.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
@ -338,5 +357,8 @@ 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.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4 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.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true 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

View file

@ -1,5 +1,4 @@
#Wed Jan 28 12:19:26 CET 2009
eclipse.preferences.version=1 eclipse.preferences.version=1
formatter_profile=_CDT formatter_profile=_CDT
formatter_settings_version=11 formatter_settings_version=12
internal.default.compliance=user internal.default.compliance=user

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.core; singleton:=true Bundle-SymbolicName: org.eclipse.cdt.core; singleton:=true
Bundle-Version: 5.10.0.qualifier Bundle-Version: 5.11.0.qualifier
Bundle-Activator: org.eclipse.cdt.core.CCorePlugin Bundle-Activator: org.eclipse.cdt.core.CCorePlugin
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-Localization: plugin Bundle-Localization: plugin

View file

@ -22,12 +22,11 @@ import org.eclipse.core.runtime.Assert;
* @since 5.1 * @since 5.1
*/ */
public final class ASTNameCollector extends ASTVisitor { public final class ASTNameCollector extends ASTVisitor {
private final char[] fName;
private char[] fName; private final ArrayList<IASTName> fFound= new ArrayList<>(4);
private ArrayList<IASTName> fFound= new ArrayList<IASTName>(4);
/** /**
* Construct a name collector for the given name. * Constructs a name collector for the given name.
*/ */
public ASTNameCollector(char[] name) { public ASTNameCollector(char[] name) {
Assert.isNotNull(name); Assert.isNotNull(name);
@ -36,7 +35,7 @@ public final class ASTNameCollector extends ASTVisitor {
} }
/** /**
* Construct a name collector for the given name. * Constructs a name collector for the given name.
*/ */
public ASTNameCollector(String name) { public ASTNameCollector(String name) {
this(name.toCharArray()); this(name.toCharArray());
@ -53,14 +52,14 @@ public final class ASTNameCollector extends ASTVisitor {
} }
/** /**
* Return the array of matching names. * Returns the array of matching names.
*/ */
public IASTName[] getNames() { public IASTName[] getNames() {
return fFound.toArray(new IASTName[fFound.size()]); return fFound.toArray(new IASTName[fFound.size()]);
} }
/** /**
* Clear the names found, such that the collector can be reused. * Clears the names found, such that the collector can be reused.
*/ */
public void clear() { public void clear() {
fFound.clear(); fFound.clear();

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2012 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -172,6 +172,8 @@ public abstract class ASTVisitor {
* Implicit names are created to allow implicit bindings to be resolved, * Implicit names are created to allow implicit bindings to be resolved,
* normally they are not visited, set this flag to true to visit them. * normally they are not visited, set this flag to true to visit them.
* @since 5.1 * @since 5.1
* @see #visit(IASTName)
* @see IASTImplicitName
*/ */
public boolean shouldVisitImplicitNames = false; public boolean shouldVisitImplicitNames = false;
@ -179,9 +181,21 @@ public abstract class ASTVisitor {
* Sometimes more than one implicit name is created for a binding, * 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. * set this flag to true to visit more than one name for an implicit binding.
* @since 5.1 * @since 5.1
* @see #visit(IASTName)
* @see IASTImplicitName
*/ */
public boolean shouldVisitImplicitNameAlternates = false; 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. * Creates a visitor that does not visit any kind of node per default.
*/ */

View file

@ -18,33 +18,30 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTCompoundStatement extends IASTStatement { public interface IASTCompoundStatement extends IASTStatement {
/** /**
* <code>NESTED_STATEMENT</code> represents the relationship between an * {@code NESTED_STATEMENT} represents the relationship between an {@code IASTCompoundStatement}
* <code>IASTCompoundStatement</code> and its nested * and its nested {@code IASTStatement}
* <code>IASTStatement</code>
*/ */
public static final ASTNodeProperty NESTED_STATEMENT = new ASTNodeProperty( public static final ASTNodeProperty NESTED_STATEMENT = new ASTNodeProperty(
"IASTCompoundStatement.NESTED_STATEMENT - nested IASTStatement for IASTCompoundStatement"); //$NON-NLS-1$ "IASTCompoundStatement.NESTED_STATEMENT - nested IASTStatement for IASTCompoundStatement"); //$NON-NLS-1$
/** /**
* Gets the statements in this block. * Returns the statements in this block.
* *
* @return Array of IASTStatement * @return Array of IASTStatement
*/ */
public IASTStatement[] getStatements(); public IASTStatement[] getStatements();
/** /**
* Add a statement to the compound block. * Adds a statement to the compound block.
* *
* @param statement * @param statement the statement to be added
* statement to be added
*/ */
public void addStatement(IASTStatement statement); public void addStatement(IASTStatement statement);
/** /**
* Get <code>IScope</code> node that this node eludes to in the logical * Returns {@code IScope} node that this node eludes to in the logical tree.
* tree.
* *
* @return the <code>IScope</code> * @return the {@code IScope}
*/ */
public IScope getScope(); public IScope getScope();

View file

@ -18,33 +18,32 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTDoStatement extends IASTStatement { public interface IASTDoStatement extends IASTStatement {
/** /**
* <code>BODY</code> represents the relationship between a * {@code BODY} represents the relationship between a
* <code>IASTDoStatement</code> and its nested body * {@code IASTDoStatement} and its nested body
* <code>IASTStatement</code>. * {@code IASTStatement}.
*/ */
public static final ASTNodeProperty BODY = public static final ASTNodeProperty BODY =
new ASTNodeProperty("IASTDoStatement.BODY - nested body for IASTDoStatement"); //$NON-NLS-1$ new ASTNodeProperty("IASTDoStatement.BODY - nested body for IASTDoStatement"); //$NON-NLS-1$
/** /**
* <code>CONDITION</code> represents the relationship between a * {@code CONDITION} represents the relationship between a
* <code>IASTDoStatement</code> and its condition * {@code IASTDoStatement} and its condition
* <code>IASTExpression</code>. * {@code IASTExpression}.
*/ */
public static final ASTNodeProperty CONDITION = new ASTNodeProperty( public static final ASTNodeProperty CONDITION = new ASTNodeProperty(
"IASTDoStatement.CONDITION - IASTExpression condition for IASTDoStatement"); //$NON-NLS-1$ "IASTDoStatement.CONDITION - IASTExpression condition for IASTDoStatement"); //$NON-NLS-1$
/** /**
* Get the body of the loop. * Returns the body of the loop.
* *
* @return <code>IASTStatement</code> loop code body * @return {@code IASTStatement} loop code body
*/ */
public IASTStatement getBody(); public IASTStatement getBody();
/** /**
* Set the body of the loop. * Sets the body of the loop.
* *
* @param body * @param body an {@code IASTStatement}
* an <code>IASTStatement</code>
*/ */
public void setBody(IASTStatement body); public void setBody(IASTStatement body);
@ -56,10 +55,9 @@ public interface IASTDoStatement extends IASTStatement {
public IASTExpression getCondition(); public IASTExpression getCondition();
/** /**
* Set the condition for the loop. * Sets the condition for the loop.
* *
* @param condition * @param condition an {@code IASTExpression}
* an IASTExpression
*/ */
public void setCondition(IASTExpression condition); public void setCondition(IASTExpression condition);

View file

@ -11,7 +11,7 @@
package org.eclipse.cdt.core.dom.ast; 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. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
@ -26,17 +26,16 @@ public interface IASTExpressionList extends IASTExpression {
"IASTExpressionList.NESTED_EXPRESSION - Nested IASTExpression for IASTExpressionList"); //$NON-NLS-1$ "IASTExpressionList.NESTED_EXPRESSION - Nested IASTExpression for IASTExpressionList"); //$NON-NLS-1$
/** /**
* Get nested expressions. * Returns nested expressions.
* *
* @return <code>IASTExpression[] </code> nested expressions * @return an array of nested expressions
*/ */
public IASTExpression[] getExpressions(); public IASTExpression[] getExpressions();
/** /**
* Add nested expression. * Adds nested expression.
* *
* @param expression * @param expression the expression to be added.
* <code>IASTExpression</code> value to be added.
*/ */
public void addExpression(IASTExpression expression); public void addExpression(IASTExpression expression);

View file

@ -19,38 +19,36 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTForStatement extends IASTStatement { public interface IASTForStatement extends IASTStatement {
/** /**
* <code>CONDITION</code> represents the relationship between a * {@code CONDITION} represents the relationship between a {@code IASTForStatement} and
* <code>IASTForStatement</code> and its <code>IASTExpression</code> * its {@code IASTExpression} condition.
* condition.
*/ */
public static final ASTNodeProperty CONDITION = new ASTNodeProperty( public static final ASTNodeProperty CONDITION = new ASTNodeProperty(
"IASTForStatement.CONDITION - IASTExpression condition of IASTForStatement"); //$NON-NLS-1$ "IASTForStatement.CONDITION - IASTExpression condition of IASTForStatement"); //$NON-NLS-1$
/** /**
* <code>ITERATION</code> represents the relationship between a * {@code ITERATION} represents the relationship between a {@code IASTForStatement} and
* <code>IASTForStatement</code> and its <code>IASTExpression</code> * its {@code IASTExpression} iteration expression.
* iteration expression.
*/ */
public static final ASTNodeProperty ITERATION = new ASTNodeProperty( public static final ASTNodeProperty ITERATION = new ASTNodeProperty(
"IASTForStatement.ITERATION - IASTExpression iteration of IASTForStatement"); //$NON-NLS-1$ "IASTForStatement.ITERATION - IASTExpression iteration of IASTForStatement"); //$NON-NLS-1$
/** /**
* <code>BODY</code> represents the relationship between a * {@code BODY} represents the relationship between a {@code IASTForStatement} and
* <code>IASTForStatement</code> and its <code>IASTStatement</code> * its {@code IASTStatement} body.
* body.
*/ */
public static final ASTNodeProperty BODY = new ASTNodeProperty( public static final ASTNodeProperty BODY = new ASTNodeProperty(
"IASTForStatement.BODY - IASTStatement body of IASTForStatement"); //$NON-NLS-1$ "IASTForStatement.BODY - IASTStatement body of IASTForStatement"); //$NON-NLS-1$
/** /**
* <code>INITIALIZER</code> represents the relationship between a * {@code INITIALIZER} represents the relationship between a {@code IASTForStatement} and
* <code>IASTForStatement</code> and its <code>IASTDeclaration</code> * its {@code IASTDeclaration} initializer.
* initializer.
*/ */
public static final ASTNodeProperty INITIALIZER = new ASTNodeProperty( public static final ASTNodeProperty INITIALIZER = new ASTNodeProperty(
"IASTForStatement.INITIALIZER - initializer for IASTForStatement"); //$NON-NLS-1$ "IASTForStatement.INITIALIZER - initializer for IASTForStatement"); //$NON-NLS-1$
/**
* Returns the initializer statement.
*/
public IASTStatement getInitializerStatement(); public IASTStatement getInitializerStatement();
/** /**
@ -59,56 +57,51 @@ public interface IASTForStatement extends IASTStatement {
public void setInitializerStatement(IASTStatement statement); public void setInitializerStatement(IASTStatement statement);
/** /**
* Get the condition expression for the loop. * Returns the condition expression for the loop.
* *
* @return <code>IASTExpression</code> * @return {@code IASTExpression}
*/ */
public IASTExpression getConditionExpression(); public IASTExpression getConditionExpression();
/** /**
* Set the condition expression for the loop. * Sets the condition expression for the loop.
* *
* @param condition * @param condition {@code IASTExpression}
* <code>IASTExpression</code>
*/ */
public void setConditionExpression(IASTExpression condition); public void setConditionExpression(IASTExpression condition);
/** /**
* Get the expression that is evaluated after the completion of an iteration * Returns the expression that is evaluated after the completion of an iteration of the loop.
* of the loop.
* *
* @return <code>IASTExpression</code> * @return {@code IASTExpression}
*/ */
public IASTExpression getIterationExpression(); public IASTExpression getIterationExpression();
/** /**
* Set the expression that is evaluated after the completion of an iteration * Sets the expression that is evaluated after the completion of an iteration of the loop.
* of the loop.
* *
* @param iterator * @param iterator {@code IASTExpression}
* <code>IASTExpression</code>
*/ */
public void setIterationExpression(IASTExpression iterator); public void setIterationExpression(IASTExpression iterator);
/** /**
* Get the statements that this for loop controls. * Returns the statements that this for loop controls.
* *
* @return <code>IASTStatement</code> * @return {@code IASTStatement}
*/ */
public IASTStatement getBody(); public IASTStatement getBody();
/** /**
* Set the body of the for loop. * Sets the body of the for loop.
* *
* @param statement * @param statement {@code IASTStatement}
* <code>IASTStatement</code>
*/ */
public void setBody(IASTStatement statement); public void setBody(IASTStatement statement);
/** /**
* Get the <code>IScope</code> represented by this for loop. * Returns the {@code IScope} represented by this for loop.
* *
* @return <code>IScope</code> * @return {@code IScope}
*/ */
public IScope getScope(); public IScope getScope();

View file

@ -18,24 +18,24 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTFunctionDefinition extends IASTDeclaration { public interface IASTFunctionDefinition extends IASTDeclaration {
/** /**
* <code>DECL_SPECIFIER</code> represents the relationship between a * {@code DECL_SPECIFIER} represents the relationship between a
* <code>IASTFunctionDefinition</code> and its * {@code IASTFunctionDefinition} and its
* <code>IASTDeclSpecifier</code>. * {@code IASTDeclSpecifier}.
*/ */
public static final ASTNodeProperty DECL_SPECIFIER = new ASTNodeProperty( public static final ASTNodeProperty DECL_SPECIFIER = new ASTNodeProperty(
"IASTFunctionDefinition.DECL_SPECIFIER - IASTDeclSpecifier for IASTFunctionDefinition"); //$NON-NLS-1$ "IASTFunctionDefinition.DECL_SPECIFIER - IASTDeclSpecifier for IASTFunctionDefinition"); //$NON-NLS-1$
/** /**
* <code>DECLARATOR</code> represents the relationship between a * {@code DECLARATOR} represents the relationship between a
* <code>IASTFunctionDefinition</code> and its * {@code IASTFunctionDefinition} and its
* <code>IASTFunctionDeclarator</code>. * {@code IASTFunctionDeclarator}.
*/ */
public static final ASTNodeProperty DECLARATOR = new ASTNodeProperty( public static final ASTNodeProperty DECLARATOR = new ASTNodeProperty(
"IASTFunctionDefinition.DECLARATOR - IASTFunctionDeclarator for IASTFunctionDefinition"); //$NON-NLS-1$ "IASTFunctionDefinition.DECLARATOR - IASTFunctionDeclarator for IASTFunctionDefinition"); //$NON-NLS-1$
/** /**
* <code>FUNCTION_BODY</code> represents the relationship between a * {@code FUNCTION_BODY} represents the relationship between a
* <code>IASTFunctionDefinition</code> and its <code>IASTStatement</code>. * {@code IASTFunctionDefinition} and its {@code IASTStatement}.
*/ */
public static final ASTNodeProperty FUNCTION_BODY = new ASTNodeProperty( public static final ASTNodeProperty FUNCTION_BODY = new ASTNodeProperty(
"IASTFunctionDefinition.FUNCTION_BODY - Function Body for IASTFunctionDefinition"); //$NON-NLS-1$ "IASTFunctionDefinition.FUNCTION_BODY - Function Body for IASTFunctionDefinition"); //$NON-NLS-1$
@ -73,6 +73,7 @@ public interface IASTFunctionDefinition extends IASTDeclaration {
* void (f)(int a); // has nested declarator * void (f)(int a); // has nested declarator
* void (f(int a)); // is nested in another declarator * void (f(int a)); // is nested in another declarator
* </pre> * </pre>
*
* @param declarator * @param declarator
*/ */
public void setDeclarator(IASTFunctionDeclarator declarator); public void setDeclarator(IASTFunctionDeclarator declarator);
@ -80,7 +81,6 @@ public interface IASTFunctionDefinition extends IASTDeclaration {
/** /**
* Returns the body of the function. This is usually a compound statement but * Returns the body of the function. This is usually a compound statement but
* C++ also has a function try block. * C++ also has a function try block.
*
*/ */
public IASTStatement getBody(); public IASTStatement getBody();
@ -94,7 +94,7 @@ public interface IASTFunctionDefinition extends IASTDeclaration {
/** /**
* Get the logical IScope that the function definition body represents. * Get the logical IScope that the function definition body represents.
* *
* @return <code>IScope</code> representing function body. * @return {@code IScope} representing function body.
*/ */
public IScope getScope(); public IScope getScope();

View file

@ -18,22 +18,22 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTIfStatement extends IASTStatement { public interface IASTIfStatement extends IASTStatement {
/** /**
* <code>CONDITION</code> represents the relationship between an * {@code CONDITION} represents the relationship between an
* <code>IASTIfStatement</code> and its nested <code>IASTExpression</code>. * {@code IASTIfStatement} and its nested {@code IASTExpression}.
*/ */
public static final ASTNodeProperty CONDITION = new ASTNodeProperty( public static final ASTNodeProperty CONDITION = new ASTNodeProperty(
"IASTIfStatement.CONDITION - IASTExpression condition for IASTIfStatement"); //$NON-NLS-1$ "IASTIfStatement.CONDITION - IASTExpression condition for IASTIfStatement"); //$NON-NLS-1$
/** /**
* <code>THEN</code> represents the relationship between an * {@code THEN} represents the relationship between an
* <code>IASTIfStatement</code> and its nested <code>IASTStatement</code> * {@code IASTIfStatement} and its nested {@code IASTStatement}
* (then). * (then).
*/ */
public static final ASTNodeProperty THEN = new ASTNodeProperty("IASTIfStatement.THEN - IASTStatement (then) for IASTIfStatement"); //$NON-NLS-1$ public static final ASTNodeProperty THEN = new ASTNodeProperty("IASTIfStatement.THEN - IASTStatement (then) for IASTIfStatement"); //$NON-NLS-1$
/** /**
* <code>ELSE</code> represents the relationship between an * {@code ELSE} represents the relationship between an
* <code>IASTIfStatement</code> and its nested <code>IASTStatement</code> * {@code IASTIfStatement} and its nested {@code IASTStatement}
* (else). * (else).
*/ */
public static final ASTNodeProperty ELSE = new ASTNodeProperty("IASTIfStatement.ELSE - IASTStatement (else) for IASTIfStatement"); //$NON-NLS-1$ 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. * Returns the condition in the if statement.
* *
* @return the condition <code>IASTExpression</code>. May return <code>null</code> if the 'if' * @return the condition {@code IASTExpression}. May return {@code null} if the 'if'
* statement has condition declaration instead of condition expression * statement has condition declaration instead of condition expression
* (see {@link org.eclipse.cdt.core.dom.ast.cpp.ICPPASTIfStatement}). * (see {@link org.eclipse.cdt.core.dom.ast.cpp.ICPPASTIfStatement}).
*/ */
@ -50,23 +50,21 @@ public interface IASTIfStatement extends IASTStatement {
/** /**
* Sets the condition in the if statement. * Sets the condition in the if statement.
* *
* @param condition * @param condition {@code IASTExpression}
* <code>IASTExpression</code>
*/ */
public void setConditionExpression(IASTExpression condition); public void setConditionExpression(IASTExpression condition);
/** /**
* Returns the statement that is executed if the condition is true. * Returns the statement that is executed if the condition is true.
* *
* @return the then clause <code>IASTStatement</code> * @return the then clause {@code IASTStatement}
*/ */
public IASTStatement getThenClause(); public IASTStatement getThenClause();
/** /**
* Sets the statement that is executed if the condition is true. * Sets the statement that is executed if the condition is true.
* *
* @param thenClause * @param thenClause {@code IASTStatement}
* <code>IASTStatement</code>
*/ */
public void setThenClause(IASTStatement thenClause); public void setThenClause(IASTStatement thenClause);
@ -74,15 +72,14 @@ public interface IASTIfStatement extends IASTStatement {
* Returns the statement that is executed if the condition is false. This clause * Returns the statement that is executed if the condition is false. This clause
* is optional and returns null if there is none. * is optional and returns null if there is none.
* *
* @return the else clause or null <code>IASTStatement</code> * @return the else clause or {@code null} {@code IASTStatement}
*/ */
public IASTStatement getElseClause(); public IASTStatement getElseClause();
/** /**
* Sets the else clause. * Sets the else clause.
* *
* @param elseClause * @param elseClause {@code IASTStatement}
* <code>IASTStatement</code>
*/ */
public void setElseClause(IASTStatement elseClause); public void setElseClause(IASTStatement elseClause);

View file

@ -0,0 +1,27 @@
/*******************************************************************************
* 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();
}

View file

@ -0,0 +1,26 @@
/*******************************************************************************
* 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();
}

View file

@ -11,7 +11,7 @@
package org.eclipse.cdt.core.dom.ast; 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 * @since 5.2
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.

View file

@ -22,25 +22,25 @@ public interface IASTReturnStatement extends IASTStatement {
/** /**
* This is the optional return value for this function. * This is the optional return value for this function.
* *
* @return the return expression or null. * @return the return expression or {@code null}.
*/ */
public IASTExpression getReturnValue(); public IASTExpression getReturnValue();
/** /**
* Returns the return value as {@link IASTInitializerClause}, or <code>null</code>. * Returns the return value as {@link IASTInitializerClause}, or {@code null}.
* In c++ this can be an braced initializer list. * In C++ this can be an braced initializer list.
* @since 5.2 * @since 5.2
*/ */
public IASTInitializerClause getReturnArgument(); public IASTInitializerClause getReturnArgument();
/** /**
* Not allowed on frozen ast. * Not allowed on frozen AST.
* @since 5.2 * @since 5.2
*/ */
public void setReturnArgument(IASTInitializerClause returnValue); public void setReturnArgument(IASTInitializerClause returnValue);
/** /**
* Not allowed on frozen ast. * Not allowed on frozen AST.
*/ */
public void setReturnValue(IASTExpression returnValue); public void setReturnValue(IASTExpression returnValue);

View file

@ -24,7 +24,8 @@ public interface IASTTypeIdInitializerExpression extends IASTExpression {
* <code>IASTTypeIdInitializerExpression</code> and * <code>IASTTypeIdInitializerExpression</code> and
* <code>IASTTypeId</code>. * <code>IASTTypeId</code>.
*/ */
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$
/** /**
* <code>INITIALIZER</code> represents the relationship between an * <code>INITIALIZER</code> represents the relationship between an

View file

@ -18,27 +18,27 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTWhileStatement extends IASTStatement { public interface IASTWhileStatement extends IASTStatement {
/** /**
* <code>CONDITIONEXPRESSION</code> represents the relationship between an <code>IASTWhileStatement</code> and * {@code CONDITIONEXPRESSION} represents the relationship between an {@code IASTWhileStatement} and
* it's nested <code>IASTExpression</code>. * it's nested {@code IASTExpression}.
*/ */
public static final ASTNodeProperty CONDITIONEXPRESSION = new ASTNodeProperty( public static final ASTNodeProperty CONDITIONEXPRESSION = new ASTNodeProperty(
"IASTWhileStatement.CONDITIONEXPRESSION - IASTExpression (condition) for IASTWhileStatement"); //$NON-NLS-1$ "IASTWhileStatement.CONDITIONEXPRESSION - IASTExpression (condition) for IASTWhileStatement"); //$NON-NLS-1$
/** /**
* <code>BODY</code> represents the relationship between an <code>IASTWhileStatement</code> and * {@code BODY} represents the relationship between an {@code IASTWhileStatement} and
* it's nested <code>IASTStatement</code>. * it's nested {@code IASTStatement}.
*/ */
public static final ASTNodeProperty BODY = new ASTNodeProperty("IASTWhileStatement.BODY - IASTStatement (body) for IASTWhileStatement"); //$NON-NLS-1$ public static final ASTNodeProperty BODY = new ASTNodeProperty("IASTWhileStatement.BODY - IASTStatement (body) for IASTWhileStatement"); //$NON-NLS-1$
/** /**
* Get the condition on the while loop * Returns the condition on the while loop
* *
* @return expression for the condition * @return expression for the condition
*/ */
public IASTExpression getCondition(); public IASTExpression getCondition();
/** /**
* Set the condition of the while loop. * Sets the condition of the while loop.
* *
* @param condition * @param condition
*/ */
@ -52,7 +52,7 @@ public interface IASTWhileStatement extends IASTStatement {
public IASTStatement getBody(); public IASTStatement getBody();
/** /**
* Set the body of the while loop. * Sets the body of the while loop.
* *
* @param body * @param body
*/ */

View file

@ -37,10 +37,10 @@ public interface IScope {
public IName getScopeName(); public IName getScopeName();
/** /**
* Returns the first enclosing non-template scope, or <code>null</code> if this * Returns the first enclosing non-template scope, or {@code null} if this
* is the global scope. * is the global scope.
* <p> * <p>
* For scopes obtained from an index, <code>null</code> is returned to indicate that the * For scopes obtained from an index, {@code null} is returned to indicate that the
* scope is only enclosed by the global scope. * scope is only enclosed by the global scope.
*/ */
public IScope getParent() throws DOMException; 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. * 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. * No attempt is made to resolve potential ambiguities or perform access checking.
* *
* @param name * @param name the name of the bindings
* @return An array of bindings. * @return An array of bindings.
*/ */
public IBinding[] find(String name); public IBinding[] find(String name);
@ -62,11 +62,9 @@ public interface IScope {
* yet been cached in this scope, or if resolve == false and the appropriate binding * yet been cached in this scope, or if resolve == false and the appropriate binding
* has not yet been resolved. * has not yet been resolved.
* *
* @param name * @param name the name of the binding
* @param resolve * @param resolve whether or not to resolve the matching binding if it has not been so already.
* whether or not to resolve the matching binding if it has not * @return the binding in this scope that matches the name, or {@code null}
* been so already.
* @return the binding in this scope that matches the name, or null
*/ */
public IBinding getBinding(IASTName name, boolean resolve); public IBinding getBinding(IASTName name, boolean resolve);
@ -77,10 +75,8 @@ public interface IScope {
* has not yet been resolved. Accepts file local bindings from the index for the files * has not yet been resolved. Accepts file local bindings from the index for the files
* in the given set, only. * in the given set, only.
* *
* @param name * @param name the name of the binding
* @param resolve * @param resolve whether or not to resolve the matching binding if it has not been so already.
* 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. * @param acceptLocalBindings a set of files for which to accept local bindings.
* @return the binding in this scope that matches the name, or null * @return the binding in this scope that matches the name, or null
*/ */
@ -140,51 +136,63 @@ public interface IScope {
public final void setPrefixLookup(boolean prefixLookup) { public final void setPrefixLookup(boolean prefixLookup) {
fPrefixLookup = prefixLookup; fPrefixLookup = prefixLookup;
} }
public final void setResolve(boolean resolve) { public final void setResolve(boolean resolve) {
fResolve = resolve; fResolve = resolve;
} }
public final void setIgnorePointOfDeclaration(boolean ignorePointOfDeclaration) { public final void setIgnorePointOfDeclaration(boolean ignorePointOfDeclaration) {
fIgnorePointOfDeclaration = ignorePointOfDeclaration; fIgnorePointOfDeclaration = ignorePointOfDeclaration;
} }
public final void setLookupKey(char[] key) { public final void setLookupKey(char[] key) {
fLookupKey= key; fLookupKey= key;
} }
public final char[] getLookupKey() { public final char[] getLookupKey() {
return fLookupKey; return fLookupKey;
} }
public final IASTNode getLookupPoint() { public final IASTNode getLookupPoint() {
return fLookupPoint; return fLookupPoint;
} }
public final boolean isResolve() { public final boolean isResolve() {
return fResolve; return fResolve;
} }
public final boolean isPrefixLookup() { public final boolean isPrefixLookup() {
return fPrefixLookup; return fPrefixLookup;
} }
public final boolean isIgnorePointOfDeclaration() { public final boolean isIgnorePointOfDeclaration() {
return fIgnorePointOfDeclaration; return fIgnorePointOfDeclaration;
} }
public final IIndexFileSet getIncludedFiles() { public final IIndexFileSet getIncludedFiles() {
return fTu == null ? IIndexFileSet.EMPTY : fTu.getIndexFileSet(); return fTu == null ? IIndexFileSet.EMPTY : fTu.getIndexFileSet();
} }
public final IIndex getIndex() { public final IIndex getIndex() {
return fTu == null ? null : fTu.getIndex(); return fTu == null ? null : fTu.getIndex();
} }
public final IASTName getLookupName() { public final IASTName getLookupName() {
return fLookupPointIsName ? (IASTName) fLookupPoint : null; return fLookupPointIsName ? (IASTName) fLookupPoint : null;
} }
public IASTTranslationUnit getTranslationUnit() { public IASTTranslationUnit getTranslationUnit() {
return fTu; return fTu;
} }
} }
/** /**
* Get the bindings in this scope that the given name or prefix could resolve to. Could * Returns 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 * 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 * yet been cached in this scope, or if resolve == false and the appropriate bindings
* have not yet been resolved. * have not yet been resolved.
* *
* @return : the bindings in this scope that match the name or prefix, or null * @return the bindings in this scope that match the name or prefix, or {@code null}
* @since 5.5 * @since 5.5
*/ */
public IBinding[] getBindings(ScopeLookupData lookup); public IBinding[] getBindings(ScopeLookupData lookup);

View file

@ -49,27 +49,27 @@ public interface ICPPASTCatchHandler extends IASTStatement {
public boolean isCatchAll(); public boolean isCatchAll();
/** /**
* Set the catch body. * Sets the catch body.
*/ */
public void setCatchBody(IASTStatement compoundStatement); public void setCatchBody(IASTStatement compoundStatement);
/** /**
* Get the catch body. * Returns the catch body.
*/ */
public IASTStatement getCatchBody(); public IASTStatement getCatchBody();
/** /**
* Set the declaration. * Sets the declaration.
*/ */
public void setDeclaration(IASTDeclaration decl); public void setDeclaration(IASTDeclaration decl);
/** /**
* Get the declaration. * Returns the declaration.
*/ */
public IASTDeclaration getDeclaration(); public IASTDeclaration getDeclaration();
/** /**
* Get the scope represented by this catch handler. * Returns the scope represented by this catch handler.
* @since 5.1 * @since 5.1
*/ */
public IScope getScope(); public IScope getScope();

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2012 Wind River Systems, Inc. and others. * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,16 +7,23 @@
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp; package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.IASTExpression; 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. * 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
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
* @since 5.5
*/ */
public interface ICPPASTExpression extends IASTExpression, ICPPASTInitializerClause { public interface ICPPASTExpression
extends IASTExpression, ICPPASTInitializerClause, IASTImplicitDestructorNameOwner {
} }

View file

@ -20,7 +20,6 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTExpressionList extends IASTExpressionList, ICPPASTExpression, IASTImplicitNameOwner { public interface ICPPASTExpressionList extends IASTExpressionList, ICPPASTExpression, IASTImplicitNameOwner {
@Override @Override
public ICPPASTExpressionList copy(); public ICPPASTExpressionList copy();

View file

@ -29,7 +29,7 @@ public interface ICPPASTFieldReference extends IASTFieldReference, ICPPASTExpres
public boolean isTemplate(); public boolean isTemplate();
/** /**
* Set the template keyword used. * Sets the template keyword used.
* *
* @param value * @param value
*/ */

View file

@ -32,7 +32,7 @@ public interface ICPPASTFunctionCallExpression
/** /**
* Returns the function binding for the overloaded operator() invoked by * Returns the function binding for the overloaded operator() invoked by
* the function call, or <code>null</code> if the operator() is not overloaded. * the function call, or {@code null} if the operator() is not overloaded.
* @since 5.8 * @since 5.8
*/ */
public ICPPFunction getOverload(); public ICPPFunction getOverload();

View file

@ -22,11 +22,11 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression;
* @since 5.2 * @since 5.2
*/ */
public interface ICPPASTPackExpansionExpression extends ICPPASTExpression { public interface ICPPASTPackExpansionExpression extends ICPPASTExpression {
/** /**
* Represents the relationship between a pack-expansion and its pattern. * 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. * Returns the pattern of the pack expansion.

View file

@ -22,43 +22,41 @@ import org.eclipse.cdt.core.dom.ast.IASTStatement;
*/ */
public interface ICPPASTTryBlockStatement extends IASTStatement { public interface ICPPASTTryBlockStatement extends IASTStatement {
/** /**
* <code>BODY</code> is the body of the try block. * {@code BODY} is the body of the try block.
*/ */
public static final ASTNodeProperty BODY = new ASTNodeProperty("ICPPASTTryBlockStatement.BODY - Body of try block"); //$NON-NLS-1$ public static final ASTNodeProperty BODY = new ASTNodeProperty("ICPPASTTryBlockStatement.BODY - Body of try block"); //$NON-NLS-1$
/** /**
* Set try body. * Sets the try body.
* *
* @param tryBlock * @param tryBlock {@code IASTStatement}
* <code>IASTStatement</code>
*/ */
public void setTryBody(IASTStatement tryBlock); public void setTryBody(IASTStatement tryBlock);
/** /**
* Get try body. * Returns the try body.
* *
* @return <code>IASTStatement</code> * @return {@code IASTStatement}
*/ */
public IASTStatement getTryBody(); public IASTStatement getTryBody();
/** /**
* <code>CATCH_HANDLER</code> are the exception catching handlers. * {@code CATCH_HANDLER} are the exception catching handlers.
*/ */
public static final ASTNodeProperty CATCH_HANDLER = new ASTNodeProperty( public static final ASTNodeProperty CATCH_HANDLER = new ASTNodeProperty(
"ICPPASTTryBlockStatement.CATCH_HANDLER - Exception catching handlers"); //$NON-NLS-1$ "ICPPASTTryBlockStatement.CATCH_HANDLER - Exception catching handlers"); //$NON-NLS-1$
/** /**
* Add catch handler. * Adds catch handler.
* *
* @param handler * @param handler {@code ICPPASTCatchHandler}
* <code>ICPPASTCatchHandler</code>
*/ */
public void addCatchHandler(ICPPASTCatchHandler handler); public void addCatchHandler(ICPPASTCatchHandler handler);
/** /**
* Get the catch handlers. * Returns the catch handlers.
* *
* @return <code>ICPPASTCatchHandler []</code> * @return {@code ICPPASTCatchHandler[]}
*/ */
public ICPPASTCatchHandler[] getCatchHandlers(); public ICPPASTCatchHandler[] getCatchHandlers();

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2011 IBM Corporation and others. * Copyright (c) 2005, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -402,4 +402,19 @@ public abstract class ASTNode implements IASTNode {
public void resolvePendingAmbiguities() { public void resolvePendingAmbiguities() {
((ASTTranslationUnit) getTranslationUnit()).resolvePendingAmbiguities(this); ((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 <T extends IASTNode> boolean acceptByNodes(T[] nodes, ASTVisitor action) {
for (T node : nodes) {
if (!node.accept(action))
return false;
}
return true;
}
} }

View file

@ -1,103 +0,0 @@
/*******************************************************************************
* 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;
}
}

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2011 IBM Corporation and others. * Copyright (c) 2005, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -9,27 +9,98 @@
* John Camelon (IBM Rational Software) - Initial API and implementation * John Camelon (IBM Rational Software) - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research) * Yuan Zhang / Beth Tibbitts (IBM Research)
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c; 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.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression; import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTTypeIdInitializerExpression; import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
/** /**
* C-specific implementation adds nothing but the c-specific interface. * Type id initializer expression for C, type-id { initializer }
*/ */
public class CASTTypeIdInitializerExpression extends ASTTypeIdInitializerExpression implements public class CASTTypeIdInitializerExpression extends ASTNode implements ICASTTypeIdInitializerExpression {
ICASTTypeIdInitializerExpression { private IASTTypeId fTypeId;
private IASTInitializer fInitializer;
private CASTTypeIdInitializerExpression() { public CASTTypeIdInitializerExpression() {
super();
} }
public CASTTypeIdInitializerExpression(IASTTypeId typeId, IASTInitializer initializer) { public CASTTypeIdInitializerExpression(IASTTypeId t, IASTInitializer i) {
super(typeId, initializer); 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());
} }
@Override @Override
@ -39,13 +110,9 @@ public class CASTTypeIdInitializerExpression extends ASTTypeIdInitializerExpress
@Override @Override
public CASTTypeIdInitializerExpression copy(CopyStyle style) { public CASTTypeIdInitializerExpression copy(CopyStyle style) {
CASTTypeIdInitializerExpression copy = new CASTTypeIdInitializerExpression(); CASTTypeIdInitializerExpression copy = new CASTTypeIdInitializerExpression(
initializeCopy(copy, style); fTypeId == null ? null : fTypeId.copy(style),
return copy; fInitializer == null ? null : fInitializer.copy(style));
} return copy(copy, style);
@Override
public IType getExpressionType() {
return CVisitor.createType(getTypeId().getAbstractDeclarator());
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008, 2009 Wind River Systems, Inc. and others. * Copyright (c) 2008, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,11 +7,13 @@
* *
* Contributors: * Contributors:
* Markus Schorn - Initial API and implementation * Markus Schorn - Initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression; import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTCastExpression; 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.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousBinaryVsCastExpression; import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousBinaryVsCastExpression;
@ -20,4 +22,9 @@ public class CPPASTAmbiguousBinaryVsCastExpression extends ASTAmbiguousBinaryVsC
public CPPASTAmbiguousBinaryVsCastExpression(IASTBinaryExpression bexp, IASTCastExpression castExpr) { public CPPASTAmbiguousBinaryVsCastExpression(IASTBinaryExpression bexp, IASTCastExpression castExpr) {
super(bexp, castExpr); super(bexp, castExpr);
} }
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
throw new UnsupportedOperationException();
}
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008 Wind River Systems, Inc. and others. * Copyright (c) 2008, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,11 +7,13 @@
* *
* Contributors: * Contributors:
* Markus Schorn - Initial API and implementation * Markus Schorn - Initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.IASTCastExpression; import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; 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.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousCastVsFunctionCallExpression; import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousCastVsFunctionCallExpression;
@ -21,4 +23,9 @@ public class CPPASTAmbiguousCastVsFunctionCallExpression
public CPPASTAmbiguousCastVsFunctionCallExpression(IASTCastExpression castExpr, IASTFunctionCallExpression funcCall) { public CPPASTAmbiguousCastVsFunctionCallExpression(IASTCastExpression castExpr, IASTFunctionCallExpression funcCall) {
super(castExpr, funcCall); super(castExpr, funcCall);
} }
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
throw new UnsupportedOperationException();
}
} }

View file

@ -21,7 +21,7 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousExpression;
public class CPPASTAmbiguousExpression extends ASTAmbiguousNode public class CPPASTAmbiguousExpression extends ASTAmbiguousNode
implements IASTAmbiguousExpression, ICPPASTExpression { implements IASTAmbiguousExpression, ICPPASTExpression {
private IASTExpression[] exp = new IASTExpression[2]; private IASTExpression[] exp = new IASTExpression[2];
private int expPos= -1; private int expPos;
public CPPASTAmbiguousExpression(IASTExpression... expressions) { public CPPASTAmbiguousExpression(IASTExpression... expressions) {
for (IASTExpression e : expressions) { for (IASTExpression e : expressions) {
@ -43,7 +43,7 @@ public class CPPASTAmbiguousExpression extends ASTAmbiguousNode
public void addExpression(IASTExpression e) { public void addExpression(IASTExpression e) {
assertNotFrozen(); assertNotFrozen();
if (e != null) { if (e != null) {
exp = ArrayUtil.appendAt(IASTExpression.class, exp, ++expPos, e); exp = ArrayUtil.appendAt(exp, expPos++, e);
e.setParent(this); e.setParent(this);
e.setPropertyInParent(SUBEXPRESSION); e.setPropertyInParent(SUBEXPRESSION);
} }
@ -51,7 +51,7 @@ public class CPPASTAmbiguousExpression extends ASTAmbiguousNode
@Override @Override
public IASTExpression[] getExpressions() { public IASTExpression[] getExpressions() {
exp = ArrayUtil.trimAt(IASTExpression.class, exp, expPos); exp = ArrayUtil.trim(exp, expPos);
return exp; return exp;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2012 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -9,6 +9,7 @@
* John Camelon (IBM) - Initial API and implementation * John Camelon (IBM) - Initial API and implementation
* Mike Kucera (IBM) * Mike Kucera (IBM)
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -16,6 +17,7 @@ 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.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression; 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.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
@ -210,4 +212,9 @@ public class CPPASTArraySubscriptExpression extends ASTNode
public boolean isLValue() { public boolean isLValue() {
return getValueCategory() == LVALUE; return getValueCategory() == LVALUE;
} }
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
return IASTImplicitDestructorName.EMPTY_NAME_ARRAY;
}
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -18,6 +18,8 @@ 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.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression; import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpression; 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.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner; import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
@ -30,6 +32,7 @@ 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.ICPPMethod;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode; 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.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.EvalBinary;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
@ -41,6 +44,7 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
private ICPPEvaluation evaluation; private ICPPEvaluation evaluation;
private IASTImplicitName[] implicitNames; private IASTImplicitName[] implicitNames;
private IASTImplicitDestructorName[] implicitDestructorNames;
public CPPASTBinaryExpression() { public CPPASTBinaryExpression() {
} }
@ -121,9 +125,6 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
setInitOperand2(expression); setInitOperand2(expression);
} }
/**
* @see org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner#getImplicitNames()
*/
@Override @Override
public IASTImplicitName[] getImplicitNames() { public IASTImplicitName[] getImplicitNames() {
if (implicitNames == null) { if (implicitNames == null) {
@ -142,6 +143,15 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
return implicitNames; return implicitNames;
} }
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (implicitDestructorNames == null) {
implicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return implicitDestructorNames;
}
@Override @Override
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (operand1 instanceof IASTBinaryExpression || operand2 instanceof IASTBinaryExpression) { if (operand1 instanceof IASTBinaryExpression || operand2 instanceof IASTBinaryExpression) {
@ -159,16 +169,15 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
if (operand1 != null && !operand1.accept(action)) if (operand1 != null && !operand1.accept(action))
return false; return false;
if (action.shouldVisitImplicitNames) { if (action.shouldVisitImplicitNames && !acceptByNodes(getImplicitNames(), action))
for (IASTImplicitName name : getImplicitNames()) {
if (!name.accept(action))
return false; return false;
}
}
if (operand2 != null && !operand2.accept(action)) if (operand2 != null && !operand2.accept(action))
return false; return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(getImplicitDestructorNames(), action))
return false;
if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT) if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT)
return false; return false;
@ -185,7 +194,7 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
} }
} }
public static boolean acceptWithoutRecursion(IASTBinaryExpression bexpr, ASTVisitor action) { private static boolean acceptWithoutRecursion(IASTBinaryExpression bexpr, ASTVisitor action) {
N stack= new N(bexpr); N stack= new N(bexpr);
while (stack != null) { while (stack != null) {
IASTBinaryExpression expr= stack.fExpression; IASTBinaryExpression expr= stack.fExpression;
@ -211,12 +220,10 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
return false; return false;
} }
if (stack.fState == 1) { if (stack.fState == 1) {
if (action.shouldVisitImplicitNames) { if (action.shouldVisitImplicitNames &&
for (IASTImplicitName name : ((IASTImplicitNameOwner) expr).getImplicitNames()) { !acceptByNodes(((IASTImplicitNameOwner) expr).getImplicitNames(), action)) {
if (!name.accept(action))
return false; return false;
} }
}
stack.fState= 2; stack.fState= 2;
IASTExpression op2 = expr.getOperand2(); IASTExpression op2 = expr.getOperand2();
@ -228,6 +235,10 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
} }
if (op2 != null && !op2.accept(action)) if (op2 != null && !op2.accept(action))
return false; return false;
if (action.shouldVisitImplicitDestructorNames &&
!acceptByNodes(((IASTImplicitDestructorNameOwner) expr).getImplicitDestructorNames(), action)) {
return false;
}
} }
if (action.shouldVisitExpressions && action.leave(expr) == ASTVisitor.PROCESS_ABORT) if (action.shouldVisitExpressions && action.leave(expr) == ASTVisitor.PROCESS_ABORT)

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2013 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors: * Contributors:
* John Camelon (IBM) - Initial API and implementation * John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -15,6 +16,7 @@ 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.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTBinaryTypeIdExpression; 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.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IType; 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.ICPPASTExpression;
@ -145,4 +147,9 @@ public class CPPASTBinaryTypeIdExpression extends ASTNode implements ICPPASTExpr
public ValueCategory getValueCategory() { public ValueCategory getValueCategory() {
return PRVALUE; return PRVALUE;
} }
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; // Binary type-id expressions don't call destructors.
}
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors: * Contributors:
* John Camelon (IBM) - Initial API and implementation * John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -15,6 +16,7 @@ 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.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression; 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.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IProblemType; import org.eclipse.cdt.core.dom.ast.IProblemType;
@ -31,16 +33,17 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalTypeId;
* Cast expression for C++ * Cast expression for C++
*/ */
public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpression, IASTAmbiguityParent { public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpression, IASTAmbiguityParent {
private int op; private int fOperator;
private ICPPASTExpression operand; private ICPPASTExpression fOperand;
private IASTTypeId typeId; private IASTTypeId fTypeId;
private ICPPEvaluation fEvaluation; private ICPPEvaluation fEvaluation;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTCastExpression() { public CPPASTCastExpression() {
} }
public CPPASTCastExpression(int operator, IASTTypeId typeId, IASTExpression operand) { public CPPASTCastExpression(int operator, IASTTypeId typeId, IASTExpression operand) {
op = operator; fOperator = operator;
setOperand(operand); setOperand(operand);
setTypeId(typeId); setTypeId(typeId);
} }
@ -54,7 +57,7 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi
public CPPASTCastExpression copy(CopyStyle style) { public CPPASTCastExpression copy(CopyStyle style) {
CPPASTCastExpression copy = new CPPASTCastExpression(); CPPASTCastExpression copy = new CPPASTCastExpression();
copy.setOperator(getOperator()); copy.setOperator(getOperator());
copy.setTypeId(typeId == null ? null : typeId.copy(style)); copy.setTypeId(fTypeId == null ? null : fTypeId.copy(style));
IASTExpression operand = getOperand(); IASTExpression operand = getOperand();
copy.setOperand(operand == null ? null : operand.copy(style)); copy.setOperand(operand == null ? null : operand.copy(style));
return copy(copy, style); return copy(copy, style);
@ -63,7 +66,7 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi
@Override @Override
public void setTypeId(IASTTypeId typeId) { public void setTypeId(IASTTypeId typeId) {
assertNotFrozen(); assertNotFrozen();
this.typeId = typeId; this.fTypeId = typeId;
if (typeId != null) { if (typeId != null) {
typeId.setParent(this); typeId.setParent(this);
typeId.setPropertyInParent(TYPE_ID); typeId.setPropertyInParent(TYPE_ID);
@ -72,35 +75,44 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi
@Override @Override
public IASTTypeId getTypeId() { public IASTTypeId getTypeId() {
return typeId; return fTypeId;
} }
@Override @Override
public int getOperator() { public int getOperator() {
return op; return fOperator;
} }
@Override @Override
public void setOperator(int operator) { public void setOperator(int operator) {
assertNotFrozen(); assertNotFrozen();
op = operator; fOperator = operator;
} }
@Override @Override
public IASTExpression getOperand() { public IASTExpression getOperand() {
return operand; return fOperand;
} }
@Override @Override
public void setOperand(IASTExpression expression) { public void setOperand(IASTExpression expression) {
assertNotFrozen(); assertNotFrozen();
operand = (ICPPASTExpression) expression; fOperand = (ICPPASTExpression) expression;
if (expression != null) { if (expression != null) {
expression.setParent(this); expression.setParent(this);
expression.setPropertyInParent(OPERAND); expression.setPropertyInParent(OPERAND);
} }
} }
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (fImplicitDestructorNames == null) {
fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return fImplicitDestructorNames;
}
@Override @Override
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
@ -111,10 +123,13 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi
} }
} }
if (typeId != null && !typeId.accept(action)) return false; if (fTypeId != null && !fTypeId.accept(action)) return false;
IASTExpression op = getOperand(); IASTExpression op = getOperand();
if (op != null && !op.accept(action)) return false; if (op != null && !op.accept(action)) return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false;
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
switch (action.leave(this)) { switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false; case ASTVisitor.PROCESS_ABORT: return false;
@ -127,10 +142,10 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if (child == operand) { if (child == fOperand) {
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
operand = (ICPPASTExpression) other; fOperand = (ICPPASTExpression) other;
} }
} }
@ -144,14 +159,14 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi
} }
private ICPPEvaluation computeEvaluation() { private ICPPEvaluation computeEvaluation() {
if (operand == null) if (fOperand == null)
return EvalFixed.INCOMPLETE; return EvalFixed.INCOMPLETE;
IType type= CPPVisitor.createType(getTypeId()); IType type= CPPVisitor.createType(getTypeId());
if (type == null || type instanceof IProblemType) if (type == null || type instanceof IProblemType)
return EvalFixed.INCOMPLETE; return EvalFixed.INCOMPLETE;
return new EvalTypeId(type, this, operand.getEvaluation()); return new EvalTypeId(type, this, fOperand.getEvaluation());
} }
@Override @Override

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors: * Contributors:
* John Camelon (IBM) - Initial API and implementation * John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -16,11 +17,13 @@ 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.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement; import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement; 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.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IType; 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.ICPPASTExpression;
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression; 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.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.EvalCompound;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
@ -28,12 +31,13 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
* Gnu-extension: ({ ... }) * Gnu-extension: ({ ... })
*/ */
public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUASTCompoundStatementExpression, ICPPASTExpression { public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUASTCompoundStatementExpression, ICPPASTExpression {
private IASTCompoundStatement fStatement;
private IASTCompoundStatement statement;
private ICPPEvaluation fEval; private ICPPEvaluation fEval;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTCompoundStatementExpression() { public CPPASTCompoundStatementExpression() {
} }
@Override @Override
public ICPPEvaluation getEvaluation() { public ICPPEvaluation getEvaluation() {
if (fEval == null) { if (fEval == null) {
@ -63,25 +67,34 @@ public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUAS
@Override @Override
public CPPASTCompoundStatementExpression copy(CopyStyle style) { public CPPASTCompoundStatementExpression copy(CopyStyle style) {
CPPASTCompoundStatementExpression copy = new CPPASTCompoundStatementExpression(); CPPASTCompoundStatementExpression copy = new CPPASTCompoundStatementExpression();
copy.setCompoundStatement(statement == null ? null : statement.copy(style)); copy.setCompoundStatement(fStatement == null ? null : fStatement.copy(style));
return copy(copy, style); return copy(copy, style);
} }
@Override @Override
public IASTCompoundStatement getCompoundStatement() { public IASTCompoundStatement getCompoundStatement() {
return statement; return fStatement;
} }
@Override @Override
public void setCompoundStatement(IASTCompoundStatement statement) { public void setCompoundStatement(IASTCompoundStatement statement) {
assertNotFrozen(); assertNotFrozen();
this.statement = statement; this.fStatement = statement;
if (statement != null) { if (statement != null) {
statement.setParent(this); statement.setParent(this);
statement.setPropertyInParent(STATEMENT); statement.setPropertyInParent(STATEMENT);
} }
} }
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (fImplicitDestructorNames == null) {
fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return fImplicitDestructorNames;
}
@Override @Override
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
@ -92,7 +105,10 @@ public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUAS
} }
} }
if( statement != null ) if( !statement.accept( action ) ) return false; if (fStatement != null && !fStatement.accept(action)) return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false;
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
switch (action.leave(this)) { switch (action.leave(this)) {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2012 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors: * Contributors:
* John Camelon (IBM) - Initial API and implementation * John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -16,21 +17,24 @@ 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.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression; import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpression; 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.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression; import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IType; 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.ICPPASTExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode; 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.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.EvalConditional;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
public class CPPASTConditionalExpression extends ASTNode implements IASTConditionalExpression, public class CPPASTConditionalExpression extends ASTNode
ICPPASTExpression, IASTAmbiguityParent { implements IASTConditionalExpression, ICPPASTExpression, IASTAmbiguityParent {
private ICPPASTExpression fCondition; private ICPPASTExpression fCondition;
private ICPPASTExpression fPositive; private ICPPASTExpression fPositive;
private ICPPASTExpression fNegative; private ICPPASTExpression fNegative;
private ICPPEvaluation fEval; private ICPPEvaluation fEval;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTConditionalExpression() { public CPPASTConditionalExpression() {
} }
@ -100,6 +104,15 @@ public class CPPASTConditionalExpression extends ASTNode implements IASTConditio
} }
} }
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (fImplicitDestructorNames == null) {
fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return fImplicitDestructorNames;
}
@Override @Override
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
@ -117,6 +130,9 @@ public class CPPASTConditionalExpression extends ASTNode implements IASTConditio
if (fNegative != null && !fNegative.accept(action)) if (fNegative != null && !fNegative.accept(action))
return false; return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false;
if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT) if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT)
return false; return false;

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors: * Contributors:
* John Camelon (IBM) - Initial API and implementation * John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -18,6 +19,7 @@ import java.util.List;
import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression; 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.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
@ -27,6 +29,7 @@ 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.IASTAmbiguityParent;
import org.eclipse.cdt.internal.core.dom.parser.Value; 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.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.EvalFixed;
@ -38,6 +41,7 @@ public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpr
private boolean isVectored; private boolean isVectored;
private IASTImplicitName[] implicitNames; private IASTImplicitName[] implicitNames;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTDeleteExpression() { public CPPASTDeleteExpression() {
} }
@ -102,12 +106,12 @@ public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpr
} }
/** /**
* Try to resolve both the destructor and operator delete. * Tries to resolve both the destructor and operator delete.
*/ */
@Override @Override
public IASTImplicitName[] getImplicitNames() { public IASTImplicitName[] getImplicitNames() {
if (implicitNames == null) { if (implicitNames == null) {
List<IASTImplicitName> names = new ArrayList<IASTImplicitName>(); List<IASTImplicitName> names = new ArrayList<>();
if (!isVectored) { if (!isVectored) {
ICPPFunction destructor = CPPSemantics.findImplicitlyCalledDestructor(this); ICPPFunction destructor = CPPSemantics.findImplicitlyCalledDestructor(this);
@ -140,6 +144,15 @@ public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpr
return implicitNames; return implicitNames;
} }
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (fImplicitDestructorNames == null) {
fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return fImplicitDestructorNames;
}
@Override @Override
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
@ -160,6 +173,9 @@ public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpr
if (operand != null && !operand.accept(action)) if (operand != null && !operand.accept(action))
return false; return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false;
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
switch (action.leave(this)) { switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false; case ASTVisitor.PROCESS_ABORT: return false;

View file

@ -33,8 +33,7 @@ public class CPPASTEqualsInitializer extends ASTEqualsInitializer {
@Override @Override
public CPPASTEqualsInitializer copy(CopyStyle style) { public CPPASTEqualsInitializer copy(CopyStyle style) {
IASTInitializerClause arg = getInitializerClause(); IASTInitializerClause arg = getInitializerClause();
CPPASTEqualsInitializer copy = new CPPASTEqualsInitializer(arg == null ? null CPPASTEqualsInitializer copy = new CPPASTEqualsInitializer(arg == null ? null : arg.copy(style));
: arg.copy(style));
return copy(copy, style); return copy(copy, style);
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -9,6 +9,7 @@
* John Camelon (IBM) - Initial API and implementation * John Camelon (IBM) - Initial API and implementation
* Mike Kucera (IBM) - implicit names * Mike Kucera (IBM) - implicit names
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -16,6 +17,7 @@ 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.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression; 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.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
@ -25,18 +27,20 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.parser.util.ArrayUtil; 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.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; 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.EvalComma;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionList, IASTAmbiguityParent { public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionList, IASTAmbiguityParent {
private IASTExpression[] expressions = new IASTExpression[2]; private IASTExpression[] expressions = new IASTExpression[2];
/** /**
* Caution: may contain nulls. * Caution: may contain nulls.
* @see CPPASTExpressionList#computeImplicitNames * @see #computeImplicitNames
*/ */
private IASTImplicitName[] implicitNames; private IASTImplicitName[] fImplicitNames;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
private ICPPEvaluation fEvaluation; private ICPPEvaluation fEvaluation;
@ -48,8 +52,9 @@ public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionLi
@Override @Override
public CPPASTExpressionList copy(CopyStyle style) { public CPPASTExpressionList copy(CopyStyle style) {
CPPASTExpressionList copy = new CPPASTExpressionList(); CPPASTExpressionList copy = new CPPASTExpressionList();
for(IASTExpression expr : getExpressions()) for (IASTExpression expr : getExpressions()) {
copy.addExpression(expr == null ? null : expr.copy(style)); copy.addExpression(expr == null ? null : expr.copy(style));
}
return copy(copy, style); return copy(copy, style);
} }
@ -93,6 +98,9 @@ public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionLi
} }
} }
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false;
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
switch (action.leave(this)) { switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false; case ASTVisitor.PROCESS_ABORT: return false;
@ -104,18 +112,17 @@ public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionLi
} }
/** /**
* Returns an array of implicit names where each element of the array * Returns an array of implicit names where each element of the array represents a comma between
* represents a comma between the expression in the same index and the * the expression in the same index and the next expression. This array contains null elements
* next expression. This array contains null elements as placeholders * as placeholders for commas that do not resolve to overloaded operators.
* for commas that do not resolve to overloaded operators.
*/ */
private IASTImplicitName[] computeImplicitNames() { private IASTImplicitName[] computeImplicitNames() {
if (implicitNames == null) { if (fImplicitNames == null) {
IASTExpression[] exprs = getExpressions(); // has to be at least two IASTExpression[] exprs = getExpressions(); // has to be at least two
if (exprs.length < 2) if (exprs.length < 2)
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; return fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
implicitNames = new IASTImplicitName[exprs.length - 1]; fImplicitNames = new IASTImplicitName[exprs.length - 1];
ICPPFunction[] overloads = getOverloads(); ICPPFunction[] overloads = getOverloads();
for (int i = 0; i < overloads.length; i++) { for (int i = 0; i < overloads.length; i++) {
@ -124,12 +131,12 @@ public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionLi
CPPASTImplicitName operatorName = new CPPASTImplicitName(OverloadableOperator.COMMA, this); CPPASTImplicitName operatorName = new CPPASTImplicitName(OverloadableOperator.COMMA, this);
operatorName.setBinding(overload); operatorName.setBinding(overload);
operatorName.computeOperatorOffsets(exprs[i], true); operatorName.computeOperatorOffsets(exprs[i], true);
implicitNames[i] = operatorName; fImplicitNames[i] = operatorName;
} }
} }
} }
return implicitNames; return fImplicitNames;
} }
@Override @Override
@ -137,6 +144,15 @@ public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionLi
return ArrayUtil.removeNulls(IASTImplicitName.class, computeImplicitNames()); return ArrayUtil.removeNulls(IASTImplicitName.class, computeImplicitNames());
} }
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (fImplicitDestructorNames == null) {
fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return fImplicitDestructorNames;
}
private ICPPFunction[] getOverloads() { private ICPPFunction[] getOverloads() {
ICPPEvaluation eval = getEvaluation(); ICPPEvaluation eval = getEvaluation();
if (eval instanceof EvalComma) { if (eval instanceof EvalComma) {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,6 +10,7 @@
* Bryan Wilkinson (QNX) * Bryan Wilkinson (QNX)
* Mike Kucera (IBM) * Mike Kucera (IBM)
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -21,6 +22,7 @@ import java.util.List;
import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression; 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.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
@ -43,18 +45,20 @@ 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.CPPFunctionSet;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics; 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.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.EvalFixed;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalID; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalID;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalMemberAccess; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalMemberAccess;
public class CPPASTFieldReference extends ASTNode public class CPPASTFieldReference extends ASTNode
implements ICPPASTFieldReference, IASTAmbiguityParent, ICPPASTCompletionContext { implements ICPPASTFieldReference, IASTAmbiguityParent, ICPPASTCompletionContext {
private boolean isTemplate; private boolean fIsTemplate;
private ICPPASTExpression owner; private boolean fIsDeref;
private IASTName name; private ICPPASTExpression fOwner;
private boolean isDeref; private IASTName fName;
private IASTImplicitName[] implicitNames; private IASTImplicitName[] fImplicitNames;
private ICPPEvaluation fEvaluation; private ICPPEvaluation fEvaluation;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTFieldReference() { public CPPASTFieldReference() {
} }
@ -72,33 +76,33 @@ public class CPPASTFieldReference extends ASTNode
@Override @Override
public CPPASTFieldReference copy(CopyStyle style) { public CPPASTFieldReference copy(CopyStyle style) {
CPPASTFieldReference copy = new CPPASTFieldReference(); CPPASTFieldReference copy = new CPPASTFieldReference();
copy.setFieldName(name == null ? null : name.copy(style)); copy.setFieldName(fName == null ? null : fName.copy(style));
copy.setFieldOwner(owner == null ? null : owner.copy(style)); copy.setFieldOwner(fOwner == null ? null : fOwner.copy(style));
copy.isTemplate = isTemplate; copy.fIsTemplate = fIsTemplate;
copy.isDeref = isDeref; copy.fIsDeref = fIsDeref;
return copy(copy, style); return copy(copy, style);
} }
@Override @Override
public boolean isTemplate() { public boolean isTemplate() {
return isTemplate; return fIsTemplate;
} }
@Override @Override
public void setIsTemplate(boolean value) { public void setIsTemplate(boolean value) {
assertNotFrozen(); assertNotFrozen();
isTemplate = value; fIsTemplate = value;
} }
@Override @Override
public ICPPASTExpression getFieldOwner() { public ICPPASTExpression getFieldOwner() {
return owner; return fOwner;
} }
@Override @Override
public void setFieldOwner(IASTExpression expression) { public void setFieldOwner(IASTExpression expression) {
assertNotFrozen(); assertNotFrozen();
owner = (ICPPASTExpression) expression; fOwner = (ICPPASTExpression) expression;
if (expression != null) { if (expression != null) {
expression.setParent(this); expression.setParent(this);
expression.setPropertyInParent(FIELD_OWNER); expression.setPropertyInParent(FIELD_OWNER);
@ -107,13 +111,13 @@ public class CPPASTFieldReference extends ASTNode
@Override @Override
public IASTName getFieldName() { public IASTName getFieldName() {
return name; return fName;
} }
@Override @Override
public void setFieldName(IASTName name) { public void setFieldName(IASTName name) {
assertNotFrozen(); assertNotFrozen();
this.name = name; this.fName = name;
if (name != null) { if (name != null) {
name.setParent(this); name.setParent(this);
name.setPropertyInParent(FIELD_NAME); name.setPropertyInParent(FIELD_NAME);
@ -122,42 +126,51 @@ public class CPPASTFieldReference extends ASTNode
@Override @Override
public boolean isPointerDereference() { public boolean isPointerDereference() {
return isDeref; return fIsDeref;
} }
@Override @Override
public void setIsPointerDereference(boolean value) { public void setIsPointerDereference(boolean value) {
assertNotFrozen(); assertNotFrozen();
isDeref = value; fIsDeref = value;
} }
@Override @Override
public IASTImplicitName[] getImplicitNames() { public IASTImplicitName[] getImplicitNames() {
if (implicitNames == null) { if (fImplicitNames == null) {
if (!isDeref) if (!fIsDeref)
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; return fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
// Collect the function bindings // Collect the function bindings
List<ICPPFunction> functionBindings = new ArrayList<ICPPFunction>(); List<ICPPFunction> functionBindings = new ArrayList<ICPPFunction>();
EvalMemberAccess.getFieldOwnerType(owner.getExpressionType(), isDeref, this, functionBindings, false); EvalMemberAccess.getFieldOwnerType(fOwner.getExpressionType(), fIsDeref, this, functionBindings, false);
if (functionBindings.isEmpty()) if (functionBindings.isEmpty())
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; return fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
// Create a name to wrap each binding // Create a name to wrap each binding
implicitNames = new IASTImplicitName[functionBindings.size()]; fImplicitNames = new IASTImplicitName[functionBindings.size()];
int i= -1; int i= -1;
for (ICPPFunction op : functionBindings) { for (ICPPFunction op : functionBindings) {
if (op != null && !(op instanceof CPPImplicitFunction)) { if (op != null && !(op instanceof CPPImplicitFunction)) {
CPPASTImplicitName operatorName = new CPPASTImplicitName(OverloadableOperator.ARROW, this); CPPASTImplicitName operatorName = new CPPASTImplicitName(OverloadableOperator.ARROW, this);
operatorName.setBinding(op); operatorName.setBinding(op);
operatorName.computeOperatorOffsets(owner, true); operatorName.computeOperatorOffsets(fOwner, true);
implicitNames[++i] = operatorName; fImplicitNames[++i] = operatorName;
} }
} }
implicitNames= ArrayUtil.trimAt(IASTImplicitName.class, implicitNames, i); fImplicitNames= ArrayUtil.trimAt(IASTImplicitName.class, fImplicitNames, i);
} }
return implicitNames; return fImplicitNames;
}
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (fImplicitDestructorNames == null) {
fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return fImplicitDestructorNames;
} }
@Override @Override
@ -170,7 +183,7 @@ public class CPPASTFieldReference extends ASTNode
} }
} }
if (owner != null && !owner.accept(action)) if (fOwner != null && !fOwner.accept(action))
return false; return false;
if (action.shouldVisitImplicitNames) { if (action.shouldVisitImplicitNames) {
@ -180,7 +193,10 @@ public class CPPASTFieldReference extends ASTNode
} }
} }
if (name != null && !name.accept(action)) if (fName != null && !fName.accept(action))
return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false; return false;
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
@ -195,17 +211,17 @@ public class CPPASTFieldReference extends ASTNode
@Override @Override
public int getRoleForName(IASTName n) { public int getRoleForName(IASTName n) {
if (n == name) if (n == fName)
return r_reference; return r_reference;
return r_unclear; return r_unclear;
} }
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if (child == owner) { if (child == fOwner) {
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
owner = (ICPPASTExpression) other; fOwner = (ICPPASTExpression) other;
} }
} }
@ -238,7 +254,7 @@ public class CPPASTFieldReference extends ASTNode
*/ */
@Override @Override
public IType getFieldOwnerType() { public IType getFieldOwnerType() {
return EvalMemberAccess.getFieldOwnerType(owner.getExpressionType(), isDeref, this, null, true); return EvalMemberAccess.getFieldOwnerType(fOwner.getExpressionType(), fIsDeref, this, null, true);
} }
@Override @Override
@ -250,24 +266,24 @@ public class CPPASTFieldReference extends ASTNode
} }
private ICPPEvaluation createEvaluation() { private ICPPEvaluation createEvaluation() {
ICPPEvaluation ownerEval = owner.getEvaluation(); ICPPEvaluation ownerEval = fOwner.getEvaluation();
if (!ownerEval.isTypeDependent()) { if (!ownerEval.isTypeDependent()) {
IType ownerType= EvalMemberAccess.getFieldOwnerType(ownerEval.getTypeOrFunctionSet(this), isDeref, this, null, false); IType ownerType= EvalMemberAccess.getFieldOwnerType(ownerEval.getTypeOrFunctionSet(this), fIsDeref, this, null, false);
if (ownerType != null) { if (ownerType != null) {
IBinding binding = name.resolvePreBinding(); IBinding binding = fName.resolvePreBinding();
if (binding instanceof CPPFunctionSet) if (binding instanceof CPPFunctionSet)
binding= name.resolveBinding(); binding= fName.resolveBinding();
if (binding instanceof IProblemBinding || binding instanceof IType || binding instanceof ICPPConstructor) if (binding instanceof IProblemBinding || binding instanceof IType || binding instanceof ICPPConstructor)
return EvalFixed.INCOMPLETE; return EvalFixed.INCOMPLETE;
return new EvalMemberAccess(ownerType, ownerEval.getValueCategory(this), binding, isDeref, this); return new EvalMemberAccess(ownerType, ownerEval.getValueCategory(this), binding, fIsDeref, this);
} }
} }
IBinding qualifier= null; IBinding qualifier= null;
ICPPTemplateArgument[] args= null; ICPPTemplateArgument[] args= null;
IASTName n= name; IASTName n= fName;
if (n instanceof ICPPASTQualifiedName) { if (n instanceof ICPPASTQualifiedName) {
ICPPASTQualifiedName qn= (ICPPASTQualifiedName) n; ICPPASTQualifiedName qn= (ICPPASTQualifiedName) n;
ICPPASTNameSpecifier[] ns= qn.getQualifier(); ICPPASTNameSpecifier[] ns= qn.getQualifier();
@ -285,7 +301,7 @@ public class CPPASTFieldReference extends ASTNode
return EvalFixed.INCOMPLETE; return EvalFixed.INCOMPLETE;
} }
} }
return new EvalID(ownerEval, qualifier, name.getSimpleID(), false, true, args, this); return new EvalID(ownerEval, qualifier, fName.getSimpleID(), false, true, args, this);
} }
@Override @Override

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2012 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -9,6 +9,7 @@
* John Camelon (IBM) - Initial API and implementation * John Camelon (IBM) - Initial API and implementation
* Mike Kucera (IBM) - implicit names * Mike Kucera (IBM) - implicit names
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -23,6 +24,7 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.ExpansionOverlapsBoundaryException; import org.eclipse.cdt.core.dom.ast.ExpansionOverlapsBoundaryException;
import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTIdExpression; 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.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
@ -34,12 +36,14 @@ 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.ICPPASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause; 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.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.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.parser.IToken; import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode; 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.IASTAmbiguityParent;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics; 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.EvalFixed;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFunctionCall; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFunctionCall;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalTypeId; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalTypeId;
@ -47,11 +51,12 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.LookupData;
public class CPPASTFunctionCallExpression extends ASTNode public class CPPASTFunctionCallExpression extends ASTNode
implements ICPPASTFunctionCallExpression, IASTAmbiguityParent { implements ICPPASTFunctionCallExpression, IASTAmbiguityParent {
private ICPPASTExpression functionName; private ICPPASTExpression fFunctionName;
private IASTInitializerClause[] fArguments; private IASTInitializerClause[] fArguments;
private IASTImplicitName[] implicitNames; private IASTImplicitName[] fImplicitNames;
private ICPPEvaluation evaluation; private ICPPEvaluation fEvaluation;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTFunctionCallExpression() { public CPPASTFunctionCallExpression() {
setArguments(null); setArguments(null);
@ -78,19 +83,19 @@ public class CPPASTFunctionCallExpression extends ASTNode
} }
CPPASTFunctionCallExpression copy = new CPPASTFunctionCallExpression(null, args); CPPASTFunctionCallExpression copy = new CPPASTFunctionCallExpression(null, args);
copy.setFunctionNameExpression(functionName == null ? null : functionName.copy(style)); copy.setFunctionNameExpression(fFunctionName == null ? null : fFunctionName.copy(style));
return copy(copy, style); return copy(copy, style);
} }
@Override @Override
public IASTExpression getFunctionNameExpression() { public IASTExpression getFunctionNameExpression() {
return functionName; return fFunctionName;
} }
@Override @Override
public void setFunctionNameExpression(IASTExpression expression) { public void setFunctionNameExpression(IASTExpression expression) {
assertNotFrozen(); assertNotFrozen();
this.functionName = (ICPPASTExpression) expression; this.fFunctionName = (ICPPASTExpression) expression;
if (expression != null) { if (expression != null) {
expression.setParent(this); expression.setParent(this);
expression.setPropertyInParent(FUNCTION_NAME); expression.setPropertyInParent(FUNCTION_NAME);
@ -118,21 +123,21 @@ public class CPPASTFunctionCallExpression extends ASTNode
@Override @Override
public IASTImplicitName[] getImplicitNames() { public IASTImplicitName[] getImplicitNames() {
if (implicitNames == null) { if (fImplicitNames == null) {
ICPPFunction overload = getOverload(); ICPPFunction overload = getOverload();
if (overload == null) if (overload == null)
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; return fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
if (getEvaluation() instanceof EvalTypeId) { if (getEvaluation() instanceof EvalTypeId) {
CPPASTImplicitName n1 = new CPPASTImplicitName(overload.getNameCharArray(), this); CPPASTImplicitName n1 = new CPPASTImplicitName(overload.getNameCharArray(), this);
n1.setOffsetAndLength((ASTNode) functionName); n1.setOffsetAndLength((ASTNode) fFunctionName);
n1.setBinding(overload); n1.setBinding(overload);
return implicitNames= new IASTImplicitName[] {n1}; return fImplicitNames= new IASTImplicitName[] {n1};
} }
if (overload instanceof CPPImplicitFunction) { if (overload instanceof CPPImplicitFunction) {
if (!(overload instanceof ICPPMethod) || ((ICPPMethod) overload).isImplicit()) { if (!(overload instanceof ICPPMethod) || ((ICPPMethod) overload).isImplicit()) {
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; return fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
} }
} }
@ -145,9 +150,9 @@ public class CPPASTFunctionCallExpression extends ASTNode
n2.setAlternate(true); n2.setAlternate(true);
if (fArguments.length == 0) { if (fArguments.length == 0) {
int idEndOffset = ((ASTNode) functionName).getOffset() + ((ASTNode) functionName).getLength(); int idEndOffset = ((ASTNode) fFunctionName).getOffset() + ((ASTNode) fFunctionName).getLength();
try { try {
IToken lparen = functionName.getTrailingSyntax(); IToken lparen = fFunctionName.getTrailingSyntax();
IToken rparen = lparen.getNext(); IToken rparen = lparen.getNext();
if (lparen.getType() == IToken.tLPAREN) { if (lparen.getType() == IToken.tLPAREN) {
@ -166,13 +171,22 @@ public class CPPASTFunctionCallExpression extends ASTNode
n2.setOffsetAndLength(idEndOffset, 0); n2.setOffsetAndLength(idEndOffset, 0);
} }
} else { } else {
n1.computeOperatorOffsets(functionName, true); n1.computeOperatorOffsets(fFunctionName, true);
n2.computeOperatorOffsets(fArguments[fArguments.length - 1], true); n2.computeOperatorOffsets(fArguments[fArguments.length - 1], true);
} }
implicitNames = new IASTImplicitName[] { n1, n2 }; fImplicitNames = new IASTImplicitName[] { n1, n2 };
} }
return implicitNames; return fImplicitNames;
}
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (fImplicitDestructorNames == null) {
fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return fImplicitDestructorNames;
} }
@Override @Override
@ -185,7 +199,7 @@ public class CPPASTFunctionCallExpression extends ASTNode
} }
} }
if (functionName != null && !functionName.accept(action)) if (fFunctionName != null && !fFunctionName.accept(action))
return false; return false;
IASTImplicitName[] implicits = action.shouldVisitImplicitNames ? getImplicitNames() : null; IASTImplicitName[] implicits = action.shouldVisitImplicitNames ? getImplicitNames() : null;
@ -201,6 +215,9 @@ public class CPPASTFunctionCallExpression extends ASTNode
if (implicits != null && implicits.length > 1 && !implicits[1].accept(action)) if (implicits != null && implicits.length > 1 && !implicits[1].accept(action))
return false; return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false;
if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT) if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT)
return false; return false;
@ -209,10 +226,10 @@ public class CPPASTFunctionCallExpression extends ASTNode
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if (child == functionName) { if (child == fFunctionName) {
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
functionName = (ICPPASTExpression) other; fFunctionName = (ICPPASTExpression) other;
} }
for (int i = 0; i < fArguments.length; ++i) { for (int i = 0; i < fArguments.length; ++i) {
if (child == fArguments[i]) { if (child == fArguments[i]) {
@ -223,8 +240,8 @@ public class CPPASTFunctionCallExpression extends ASTNode
} }
} }
@Override
@Deprecated @Deprecated
@Override
public IASTExpression getParameterExpression() { public IASTExpression getParameterExpression() {
if (fArguments.length == 0) if (fArguments.length == 0)
return null; return null;
@ -246,8 +263,8 @@ public class CPPASTFunctionCallExpression extends ASTNode
return result; return result;
} }
@Override
@Deprecated @Deprecated
@Override
public void setParameterExpression(IASTExpression expression) { public void setParameterExpression(IASTExpression expression) {
assertNotFrozen(); assertNotFrozen();
if (expression == null) { if (expression == null) {
@ -270,9 +287,10 @@ public class CPPASTFunctionCallExpression extends ASTNode
IType t= getNestedType(((EvalTypeId) eval).getInputType(), TDEF | CVTYPE | REF); IType t= getNestedType(((EvalTypeId) eval).getInputType(), TDEF | CVTYPE | REF);
if (t instanceof ICPPClassType && !(t instanceof ICPPUnknownBinding)) { if (t instanceof ICPPClassType && !(t instanceof ICPPUnknownBinding)) {
ICPPClassType cls= (ICPPClassType) t; ICPPClassType cls= (ICPPClassType) t;
LookupData data= CPPSemantics.createLookupData(((IASTIdExpression) functionName).getName()); LookupData data= CPPSemantics.createLookupData(((IASTIdExpression) fFunctionName).getName());
try { try {
IBinding b= CPPSemantics.resolveFunction(data, ClassTypeHelper.getConstructors(cls, data.getLookupPoint()), true); ICPPConstructor[] constructors = ClassTypeHelper.getConstructors(cls, data.getLookupPoint());
IBinding b= CPPSemantics.resolveFunction(data, constructors, true);
if (b instanceof ICPPFunction) if (b instanceof ICPPFunction)
return (ICPPFunction) b; return (ICPPFunction) b;
} catch (DOMException e) { } catch (DOMException e) {
@ -285,14 +303,14 @@ public class CPPASTFunctionCallExpression extends ASTNode
@Override @Override
public ICPPEvaluation getEvaluation() { public ICPPEvaluation getEvaluation() {
if (evaluation == null) if (fEvaluation == null)
evaluation= computeEvaluation(); fEvaluation= computeEvaluation();
return evaluation; return fEvaluation;
} }
private ICPPEvaluation computeEvaluation() { private ICPPEvaluation computeEvaluation() {
if (functionName == null || fArguments == null) if (fFunctionName == null || fArguments == null)
return EvalFixed.INCOMPLETE; return EvalFixed.INCOMPLETE;
ICPPEvaluation conversion= checkForExplicitTypeConversion(); ICPPEvaluation conversion= checkForExplicitTypeConversion();
@ -300,7 +318,7 @@ public class CPPASTFunctionCallExpression extends ASTNode
return conversion; return conversion;
ICPPEvaluation[] args= new ICPPEvaluation[fArguments.length + 1]; ICPPEvaluation[] args= new ICPPEvaluation[fArguments.length + 1];
args[0]= functionName.getEvaluation(); args[0]= fFunctionName.getEvaluation();
for (int i = 1; i < args.length; i++) { for (int i = 1; i < args.length; i++) {
args[i]= ((ICPPASTInitializerClause) fArguments[i - 1]).getEvaluation(); args[i]= ((ICPPASTInitializerClause) fArguments[i - 1]).getEvaluation();
} }
@ -308,8 +326,8 @@ public class CPPASTFunctionCallExpression extends ASTNode
} }
private ICPPEvaluation checkForExplicitTypeConversion() { private ICPPEvaluation checkForExplicitTypeConversion() {
if (functionName instanceof IASTIdExpression) { if (fFunctionName instanceof IASTIdExpression) {
final IASTName name = ((IASTIdExpression) functionName).getName(); final IASTName name = ((IASTIdExpression) fFunctionName).getName();
IBinding b= name.resolvePreBinding(); IBinding b= name.resolvePreBinding();
if (b instanceof IType) { if (b instanceof IType) {
ICPPEvaluation[] args= new ICPPEvaluation[fArguments.length]; ICPPEvaluation[] args= new ICPPEvaluation[fArguments.length];

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -9,6 +9,7 @@
* John Camelon (IBM) - Initial API and implementation * John Camelon (IBM) - Initial API and implementation
* Bryan Wilkinson (QNX) * Bryan Wilkinson (QNX)
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -16,6 +17,7 @@ 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.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTIdExpression; 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.IASTName;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICPPASTCompletionContext; import org.eclipse.cdt.core.dom.ast.ICPPASTCompletionContext;
@ -25,13 +27,16 @@ 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.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.ProblemType; 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.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.EvalID;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.FunctionSetType; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.FunctionSetType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICPPASTExpression, ICPPASTCompletionContext { public class CPPASTIdExpression extends ASTNode
private IASTName name; implements IASTIdExpression, ICPPASTExpression, ICPPASTCompletionContext {
private IASTName fName;
private ICPPEvaluation fEvaluation; private ICPPEvaluation fEvaluation;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTIdExpression() { public CPPASTIdExpression() {
} }
@ -47,25 +52,34 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICP
@Override @Override
public CPPASTIdExpression copy(CopyStyle style) { public CPPASTIdExpression copy(CopyStyle style) {
CPPASTIdExpression copy = new CPPASTIdExpression(name == null ? null : name.copy(style)); CPPASTIdExpression copy = new CPPASTIdExpression(fName == null ? null : fName.copy(style));
return copy(copy, style); return copy(copy, style);
} }
@Override @Override
public IASTName getName() { public IASTName getName() {
return name; return fName;
} }
@Override @Override
public void setName(IASTName name) { public void setName(IASTName name) {
assertNotFrozen(); assertNotFrozen();
this.name = name; this.fName = name;
if (name != null) { if (name != null) {
name.setParent(this); name.setParent(this);
name.setPropertyInParent(ID_NAME); name.setPropertyInParent(ID_NAME);
} }
} }
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (fImplicitDestructorNames == null) {
fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return fImplicitDestructorNames;
}
@Override @Override
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
@ -76,7 +90,10 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICP
} }
} }
if (name != null && !name.accept(action)) return false; if (fName != null && !fName.accept(action)) return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false;
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
switch (action.leave(this)) { switch (action.leave(this)) {
@ -90,7 +107,7 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICP
@Override @Override
public int getRoleForName(IASTName n) { public int getRoleForName(IASTName n) {
if (name == n) if (fName == n)
return r_reference; return r_reference;
return r_unclear; return r_unclear;
} }
@ -102,7 +119,7 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICP
@Override @Override
public String toString() { public String toString() {
return name != null ? name.toString() : "<unnamed>"; //$NON-NLS-1$ return fName != null ? fName.toString() : "<unnamed>"; //$NON-NLS-1$
} }
@Override @Override
@ -122,7 +139,7 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICP
public IType getExpressionType() { public IType getExpressionType() {
IType type= getEvaluation().getTypeOrFunctionSet(this); IType type= getEvaluation().getTypeOrFunctionSet(this);
if (type instanceof FunctionSetType) { if (type instanceof FunctionSetType) {
IBinding binding= name.resolveBinding(); IBinding binding= fName.resolveBinding();
if (binding instanceof IFunction) { if (binding instanceof IFunction) {
return SemanticUtil.mapToAST(((IFunction) binding).getType(), this); return SemanticUtil.mapToAST(((IFunction) binding).getType(), this);
} }

View file

@ -0,0 +1,32 @@
/*******************************************************************************
* 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;
}
}

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2010, 2011 Wind River Systems, Inc. and others. * Copyright (c) 2010, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -14,6 +15,7 @@ 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.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement; 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.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCapture; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCapture;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
@ -71,11 +73,6 @@ public class CPPASTLambdaExpression extends ASTNode implements ICPPASTLambdaExpr
return copy(copy, style); return copy(copy, style);
} }
@Override
public IASTImplicitName[] getImplicitNames() {
return new IASTImplicitName[] {getFunctionCallOperatorName()};
}
@Override @Override
public IASTImplicitName getClosureTypeName() { public IASTImplicitName getClosureTypeName() {
if (fClosureTypeName == null) { if (fClosureTypeName == null) {
@ -109,6 +106,16 @@ public class CPPASTLambdaExpression extends ASTNode implements ICPPASTLambdaExpr
return fImplicitFunctionCallName; 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 @Override
public boolean accept(ASTVisitor visitor) { public boolean accept(ASTVisitor visitor) {
if (visitor.shouldVisitExpressions) { if (visitor.shouldVisitExpressions) {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors: * Contributors:
* John Camelon (IBM) - Initial API and implementation * John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -15,6 +16,7 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE; 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.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;
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind; import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.IScope; import org.eclipse.cdt.core.dom.ast.IScope;
@ -40,17 +42,17 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
public static final CPPASTLiteralExpression INT_ZERO = public static final CPPASTLiteralExpression INT_ZERO =
new CPPASTLiteralExpression(lk_integer_constant, new char[] {'0'}); new CPPASTLiteralExpression(lk_integer_constant, new char[] {'0'});
private int kind; private int fKind;
private char[] value = CharArrayUtils.EMPTY; private char[] fValue = CharArrayUtils.EMPTY;
private int fStringLiteralSize = -1; // accounting for escape sequences and the null terminator private int fStringLiteralSize = -1; // Accounting for escape sequences and the null terminator.
private ICPPEvaluation fEvaluation; private ICPPEvaluation fEvaluation;
public CPPASTLiteralExpression() { public CPPASTLiteralExpression() {
} }
public CPPASTLiteralExpression(int kind, char[] value) { public CPPASTLiteralExpression(int kind, char[] value) {
this.kind = kind; this.fKind = kind;
this.value = value; this.fValue = value;
} }
@Override @Override
@ -61,35 +63,40 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
@Override @Override
public CPPASTLiteralExpression copy(CopyStyle style) { public CPPASTLiteralExpression copy(CopyStyle style) {
CPPASTLiteralExpression copy = CPPASTLiteralExpression copy =
new CPPASTLiteralExpression(kind, value == null ? null : value.clone()); new CPPASTLiteralExpression(fKind, fValue == null ? null : fValue.clone());
return copy(copy, style); return copy(copy, style);
} }
@Override @Override
public int getKind() { public int getKind() {
return kind; return fKind;
} }
@Override @Override
public void setKind(int value) { public void setKind(int value) {
assertNotFrozen(); assertNotFrozen();
kind = value; fKind = value;
} }
@Override @Override
public char[] getValue() { public char[] getValue() {
return value; return fValue;
} }
@Override @Override
public void setValue(char[] value) { public void setValue(char[] value) {
assertNotFrozen(); assertNotFrozen();
this.value= value; this.fValue= value;
} }
@Override @Override
public String toString() { public String toString() {
return new String(value); return new String(fValue);
}
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; // Literal expression does not call destructors.
} }
@Override @Override
@ -112,22 +119,22 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
} }
private int computeStringLiteralSize() { private int computeStringLiteralSize() {
int start = 0, end = value.length - 1; int start = 0, end = fValue.length - 1;
boolean isRaw = false; boolean isRaw = false;
// Skip past a prefix affecting the character type. // Skip past a prefix affecting the character type.
if (value[0] == 'L' || value[0] == 'u' || value[0] == 'U') { if (fValue[0] == 'L' || fValue[0] == 'u' || fValue[0] == 'U') {
++start; ++start;
} }
// If there is an 'R' prefix, skip past it but take note of it. // If there is an 'R' prefix, skip past it but take note of it.
if (value[start] == 'R') { if (fValue[start] == 'R') {
++start; ++start;
isRaw = true; isRaw = true;
} }
// Now we should have a quote-enclosed string. Skip past the quotes. // Now we should have a quote-enclosed string. Skip past the quotes.
if (!(value[start] == '"' && value[end] == '"')) { if (!(fValue[start] == '"' && fValue[end] == '"')) {
// Unexpected! // Unexpected!
return 0; return 0;
} }
@ -136,13 +143,13 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
// If we have a raw string, skip past the raw prefix. // If we have a raw string, skip past the raw prefix.
if (isRaw) { if (isRaw) {
while (value[start] != '(' && start <= end) { while (fValue[start] != '(' && start <= end) {
++start; ++start;
--end; --end;
} }
// Now we should have a parenthesis-enclosed string. // Now we should have a parenthesis-enclosed string.
if (!(value[start] == '(' && value[end] == ')')) { if (!(fValue[start] == '(' && fValue[end] == ')')) {
// Unexpected! // Unexpected!
return 0; return 0;
} }
@ -161,7 +168,7 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
if (escaping) { if (escaping) {
escaping = false; escaping = false;
++length; ++length;
} else if (value[start] == '\\') { } else if (fValue[start] == '\\') {
escaping = true; escaping = true;
} else { } else {
++length; ++length;
@ -253,7 +260,7 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
@Deprecated @Deprecated
public void setValue(String value) { public void setValue(String value) {
assertNotFrozen(); assertNotFrozen();
this.value = value.toCharArray(); this.fValue = value.toCharArray();
} }
/** /**
@ -272,7 +279,7 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
} }
private ICPPEvaluation createEvaluation() { private ICPPEvaluation createEvaluation() {
switch (kind) { switch (fKind) {
case lk_this: { case lk_this: {
IScope scope = CPPVisitor.getContainingScope(this); IScope scope = CPPVisitor.getContainingScope(this);
IType type= CPPVisitor.getImpliedObjectType(scope); IType type= CPPVisitor.getImpliedObjectType(scope);

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2014 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -21,6 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator; import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpressionList; 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.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTInitializer; import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
@ -48,15 +49,16 @@ import org.eclipse.core.runtime.Assert;
* Represents a new expression [expr.new]. * Represents a new expression [expr.new].
*/ */
public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression, IASTAmbiguityParent { public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression, IASTAmbiguityParent {
private IASTInitializerClause[] placement; private IASTInitializerClause[] fPlacement;
private IASTTypeId typeId; private IASTTypeId fTypeId;
private IASTInitializer initializer; private IASTInitializer fInitializer;
private IASTImplicitName[] implicitNames; private boolean fIsGlobal;
private boolean isGlobal; private boolean fIsNewTypeId;
private boolean isNewTypeId;
private IASTExpression[] cachedArraySizes; private IASTExpression[] fCachedArraySizes;
private ICPPEvaluation fEvaluation; private ICPPEvaluation fEvaluation;
private IASTImplicitName[] fImplicitNames;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTNewExpression() { public CPPASTNewExpression() {
} }
@ -75,40 +77,40 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override @Override
public CPPASTNewExpression copy(CopyStyle style) { public CPPASTNewExpression copy(CopyStyle style) {
CPPASTNewExpression copy = new CPPASTNewExpression(); CPPASTNewExpression copy = new CPPASTNewExpression();
copy.setIsGlobal(isGlobal); copy.setIsGlobal(fIsGlobal);
copy.setIsNewTypeId(isNewTypeId); copy.setIsNewTypeId(fIsNewTypeId);
if (placement != null) { if (fPlacement != null) {
IASTInitializerClause[] plcmt = new IASTInitializerClause[placement.length]; IASTInitializerClause[] plcmt = new IASTInitializerClause[fPlacement.length];
for (int i = 0; i < placement.length; i++) { for (int i = 0; i < fPlacement.length; i++) {
plcmt[i] = placement[i].copy(style); plcmt[i] = fPlacement[i].copy(style);
} }
copy.setPlacementArguments(plcmt); copy.setPlacementArguments(plcmt);
} }
copy.setTypeId(typeId == null ? null : typeId.copy(style)); copy.setTypeId(fTypeId == null ? null : fTypeId.copy(style));
copy.setInitializer(initializer == null ? null : initializer.copy(style)); copy.setInitializer(fInitializer == null ? null : fInitializer.copy(style));
return copy(copy, style); return copy(copy, style);
} }
@Override @Override
public boolean isGlobal() { public boolean isGlobal() {
return isGlobal; return fIsGlobal;
} }
@Override @Override
public void setIsGlobal(boolean value) { public void setIsGlobal(boolean value) {
assertNotFrozen(); assertNotFrozen();
isGlobal = value; fIsGlobal = value;
} }
@Override @Override
public IASTInitializerClause[] getPlacementArguments() { public IASTInitializerClause[] getPlacementArguments() {
return placement; return fPlacement;
} }
@Override @Override
public void setPlacementArguments(IASTInitializerClause[] args) { public void setPlacementArguments(IASTInitializerClause[] args) {
assertNotFrozen(); assertNotFrozen();
placement = args; fPlacement = args;
if (args != null) { if (args != null) {
for (IASTInitializerClause arg : args) { for (IASTInitializerClause arg : args) {
arg.setParent(this); arg.setParent(this);
@ -119,13 +121,13 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override @Override
public IASTInitializer getInitializer() { public IASTInitializer getInitializer() {
return initializer; return fInitializer;
} }
@Override @Override
public void setInitializer(IASTInitializer expression) { public void setInitializer(IASTInitializer expression) {
assertNotFrozen(); assertNotFrozen();
initializer = expression; fInitializer = expression;
if (expression != null) { if (expression != null) {
expression.setParent(this); expression.setParent(this);
expression.setPropertyInParent(NEW_INITIALIZER); expression.setPropertyInParent(NEW_INITIALIZER);
@ -134,13 +136,13 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override @Override
public IASTTypeId getTypeId() { public IASTTypeId getTypeId() {
return typeId; return fTypeId;
} }
@Override @Override
public void setTypeId(IASTTypeId typeId) { public void setTypeId(IASTTypeId typeId) {
assertNotFrozen(); assertNotFrozen();
this.typeId = typeId; fTypeId = typeId;
if (typeId != null) { if (typeId != null) {
typeId.setParent(this); typeId.setParent(this);
typeId.setPropertyInParent(TYPE_ID); typeId.setPropertyInParent(TYPE_ID);
@ -149,13 +151,13 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override @Override
public boolean isNewTypeId() { public boolean isNewTypeId() {
return isNewTypeId; return fIsNewTypeId;
} }
@Override @Override
public void setIsNewTypeId(boolean value) { public void setIsNewTypeId(boolean value) {
assertNotFrozen(); assertNotFrozen();
isNewTypeId = value; fIsNewTypeId = value;
} }
/** /**
@ -163,7 +165,7 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
*/ */
@Override @Override
public IASTImplicitName[] getImplicitNames() { public IASTImplicitName[] getImplicitNames() {
if (implicitNames == null) { if (fImplicitNames == null) {
CPPASTImplicitName operatorName = null; CPPASTImplicitName operatorName = null;
ICPPFunction operatorFunction = CPPSemantics.findOverloadedOperator(this); ICPPFunction operatorFunction = CPPSemantics.findOverloadedOperator(this);
if (operatorFunction != null && !(operatorFunction instanceof CPPImplicitFunction)) { if (operatorFunction != null && !(operatorFunction instanceof CPPImplicitFunction)) {
@ -183,20 +185,29 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
if (operatorName != null) { if (operatorName != null) {
if (constructorName != null) { if (constructorName != null) {
implicitNames = new IASTImplicitName[] { operatorName, constructorName }; fImplicitNames = new IASTImplicitName[] { operatorName, constructorName };
} else { } else {
implicitNames = new IASTImplicitName[] { operatorName }; fImplicitNames = new IASTImplicitName[] { operatorName };
} }
} else { } else {
if (constructorName != null) { if (constructorName != null) {
implicitNames = new IASTImplicitName[] { constructorName }; fImplicitNames = new IASTImplicitName[] { constructorName };
} else { } else {
implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
} }
} }
} }
return implicitNames; return fImplicitNames;
}
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (fImplicitDestructorNames == null) {
fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return fImplicitDestructorNames;
} }
/** /**
@ -232,16 +243,19 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
} }
} }
if (placement != null) { if (fPlacement != null) {
for (IASTInitializerClause arg : placement) { for (IASTInitializerClause arg : fPlacement) {
if (!arg.accept(action)) if (!arg.accept(action))
return false; return false;
} }
} }
if (typeId != null && !typeId.accept(action)) if (fTypeId != null && !fTypeId.accept(action))
return false; return false;
if (initializer != null && !initializer.accept(action)) if (fInitializer != null && !fInitializer.accept(action))
return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false; return false;
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
@ -256,12 +270,12 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if (placement != null) { if (fPlacement != null) {
for (int i = 0; i < placement.length; ++i) { for (int i = 0; i < fPlacement.length; ++i) {
if (child == placement[i]) { if (child == fPlacement[i]) {
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
placement[i] = (IASTExpression) other; fPlacement[i] = (IASTExpression) other;
} }
} }
} }
@ -270,13 +284,13 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override @Override
public ICPPEvaluation getEvaluation() { public ICPPEvaluation getEvaluation() {
if (fEvaluation == null) { if (fEvaluation == null) {
IType t = typeId != null ? CPPVisitor.createType(typeId) : ProblemType.UNKNOWN_FOR_EXPRESSION; IType t = fTypeId != null ? CPPVisitor.createType(fTypeId) : ProblemType.UNKNOWN_FOR_EXPRESSION;
if (t instanceof IArrayType) { if (t instanceof IArrayType) {
t = ((IArrayType) t).getType(); t = ((IArrayType) t).getType();
} }
ICPPEvaluation[] arguments = ICPPEvaluation.EMPTY_ARRAY; ICPPEvaluation[] arguments = ICPPEvaluation.EMPTY_ARRAY;
if (initializer instanceof ICPPASTConstructorInitializer) { if (fInitializer instanceof ICPPASTConstructorInitializer) {
IASTInitializerClause[] args = ((ICPPASTConstructorInitializer) initializer).getArguments(); IASTInitializerClause[] args = ((ICPPASTConstructorInitializer) fInitializer).getArguments();
arguments= new ICPPEvaluation[args.length]; arguments= new ICPPEvaluation[args.length];
for (int i = 0; i < arguments.length; i++) { for (int i = 0; i < arguments.length; i++) {
arguments[i] = ((ICPPASTInitializerClause) args[i]).getEvaluation(); arguments[i] = ((ICPPASTInitializerClause) args[i]).getEvaluation();
@ -305,40 +319,40 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override @Override
@Deprecated @Deprecated
public IASTExpression[] getNewTypeIdArrayExpressions() { public IASTExpression[] getNewTypeIdArrayExpressions() {
if (cachedArraySizes == null) { if (fCachedArraySizes == null) {
if (typeId != null) { if (fTypeId != null) {
IASTDeclarator dtor = ASTQueries.findInnermostDeclarator(typeId.getAbstractDeclarator()); IASTDeclarator dtor = ASTQueries.findInnermostDeclarator(fTypeId.getAbstractDeclarator());
if (dtor instanceof IASTArrayDeclarator) { if (dtor instanceof IASTArrayDeclarator) {
IASTArrayDeclarator ad = (IASTArrayDeclarator) dtor; IASTArrayDeclarator ad = (IASTArrayDeclarator) dtor;
IASTArrayModifier[] ams = ad.getArrayModifiers(); IASTArrayModifier[] ams = ad.getArrayModifiers();
cachedArraySizes = new IASTExpression[ams.length]; fCachedArraySizes = new IASTExpression[ams.length];
for (int i = 0; i < ams.length; i++) { for (int i = 0; i < ams.length; i++) {
IASTArrayModifier am = ams[i]; IASTArrayModifier am = ams[i];
cachedArraySizes[i] = am.getConstantExpression(); fCachedArraySizes[i] = am.getConstantExpression();
} }
return cachedArraySizes; return fCachedArraySizes;
} }
} }
cachedArraySizes = IASTExpression.EMPTY_EXPRESSION_ARRAY; fCachedArraySizes = IASTExpression.EMPTY_EXPRESSION_ARRAY;
} }
return cachedArraySizes; return fCachedArraySizes;
} }
@Override @Override
@Deprecated @Deprecated
public void addNewTypeIdArrayExpression(IASTExpression expression) { public void addNewTypeIdArrayExpression(IASTExpression expression) {
assertNotFrozen(); assertNotFrozen();
Assert.isNotNull(typeId); Assert.isNotNull(fTypeId);
IASTDeclarator dtor= ASTQueries.findInnermostDeclarator(typeId.getAbstractDeclarator()); IASTDeclarator dtor= ASTQueries.findInnermostDeclarator(fTypeId.getAbstractDeclarator());
if (dtor instanceof IASTArrayDeclarator == false) { if (dtor instanceof IASTArrayDeclarator == false) {
Assert.isNotNull(dtor); Assert.isNotNull(dtor);
Assert.isTrue(dtor.getParent() == typeId); Assert.isTrue(dtor.getParent() == fTypeId);
IASTArrayDeclarator adtor= new CPPASTArrayDeclarator(dtor.getName()); IASTArrayDeclarator adtor= new CPPASTArrayDeclarator(dtor.getName());
IASTPointerOperator[] ptrOps= dtor.getPointerOperators(); IASTPointerOperator[] ptrOps= dtor.getPointerOperators();
for (IASTPointerOperator ptr : ptrOps) { for (IASTPointerOperator ptr : ptrOps) {
adtor.addPointerOperator(ptr); adtor.addPointerOperator(ptr);
} }
typeId.setAbstractDeclarator(adtor); fTypeId.setAbstractDeclarator(adtor);
dtor= adtor; dtor= adtor;
} }
IASTArrayModifier mod= new CPPASTArrayModifier(expression); IASTArrayModifier mod= new CPPASTArrayModifier(expression);
@ -349,16 +363,16 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override @Override
@Deprecated @Deprecated
public IASTExpression getNewPlacement() { public IASTExpression getNewPlacement() {
if (placement == null || placement.length == 0) if (fPlacement == null || fPlacement.length == 0)
return null; return null;
if (placement.length == 1) { if (fPlacement.length == 1) {
if (placement[0] instanceof IASTExpression) if (fPlacement[0] instanceof IASTExpression)
return (IASTExpression) placement[0]; return (IASTExpression) fPlacement[0];
return null; return null;
} }
CASTExpressionList result= new CASTExpressionList(); CASTExpressionList result= new CASTExpressionList();
for (IASTInitializerClause arg : placement) { for (IASTInitializerClause arg : fPlacement) {
if (arg instanceof IASTExpression) { if (arg instanceof IASTExpression) {
result.addExpression(((IASTExpression) arg).copy()); result.addExpression(((IASTExpression) arg).copy());
} }
@ -384,11 +398,11 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override @Override
@Deprecated @Deprecated
public IASTExpression getNewInitializer() { public IASTExpression getNewInitializer() {
if (initializer == null || initializer instanceof IASTExpression) { if (fInitializer == null || fInitializer instanceof IASTExpression) {
return (IASTExpression) initializer; return (IASTExpression) fInitializer;
} }
if (initializer instanceof ICPPASTConstructorInitializer) { if (fInitializer instanceof ICPPASTConstructorInitializer) {
IASTExpression expr= ((ICPPASTConstructorInitializer) initializer).getExpression(); IASTExpression expr= ((ICPPASTConstructorInitializer) fInitializer).getExpression();
if (expr == null) { if (expr == null) {
expr= new CPPASTExpressionList(); expr= new CPPASTExpressionList();
} else { } else {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009, 2013 Wind River Systems, Inc. and others. * Copyright (c) 2009, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,11 +8,13 @@
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* Natan Ridge * Natan Ridge
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression; 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.IASTNode;
import org.eclipse.cdt.core.dom.ast.IType; 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.ICPPASTExpression;
@ -82,6 +84,11 @@ public class CPPASTPackExpansionExpression extends ASTNode implements ICPPASTPac
return fPattern.getValueCategory(); return fPattern.getValueCategory();
} }
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; // Pack expression is never a full-expression.
}
@Override @Override
public boolean accept(ASTVisitor visitor) { public boolean accept(ASTVisitor visitor) {
if (visitor.shouldVisitExpressions) { if (visitor.shouldVisitExpressions) {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,12 +8,14 @@
* Contributors: * Contributors:
* John Camelon (IBM) - Initial API and implementation * John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE; 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.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTProblem; import org.eclipse.cdt.core.dom.ast.IASTProblem;
import org.eclipse.cdt.core.dom.ast.IASTProblemExpression; import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
@ -34,12 +36,18 @@ public class CPPASTProblemExpression extends CPPASTProblemOwner implements IASTP
public CPPASTProblemExpression copy() { public CPPASTProblemExpression copy() {
return copy(CopyStyle.withoutLocations); return copy(CopyStyle.withoutLocations);
} }
@Override @Override
public CPPASTProblemExpression copy(CopyStyle style) { public CPPASTProblemExpression copy(CopyStyle style) {
CPPASTProblemExpression copy = new CPPASTProblemExpression(); CPPASTProblemExpression copy = new CPPASTProblemExpression();
return copy(copy, style); return copy(copy, style);
} }
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
return IASTImplicitDestructorName.EMPTY_NAME_ARRAY;
}
@Override @Override
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -8,11 +8,13 @@
* Contributors: * Contributors:
* John Camelon (IBM) - Initial API and implementation * John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression; 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.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind; import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
@ -33,6 +35,7 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode
private ICPPASTDeclSpecifier fDeclSpec; private ICPPASTDeclSpecifier fDeclSpec;
private IASTInitializer fInitializer; private IASTInitializer fInitializer;
private ICPPEvaluation fEvaluation; private ICPPEvaluation fEvaluation;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTSimpleTypeConstructorExpression() { public CPPASTSimpleTypeConstructorExpression() {
} }
@ -122,6 +125,15 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode
return false; return false;
} }
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (fImplicitDestructorNames == null) {
fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return fImplicitDestructorNames;
}
@Override @Override
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
@ -138,6 +150,9 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode
if (fInitializer != null && !fInitializer.accept(action)) if (fInitializer != null && !fInitializer.accept(action))
return false; return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false;
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
switch (action.leave(this)) { switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false; case ASTVisitor.PROCESS_ABORT: return false;
@ -148,8 +163,8 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode
return true; return true;
} }
@Override
@Deprecated @Deprecated
@Override
public int getSimpleType() { public int getSimpleType() {
IType type= getExpressionType(); IType type= getExpressionType();
if (type instanceof ICPPBasicType) { if (type instanceof ICPPBasicType) {
@ -185,8 +200,8 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode
return t_unspecified; return t_unspecified;
} }
@Override
@Deprecated @Deprecated
@Override
public void setSimpleType(int value) { public void setSimpleType(int value) {
CPPASTSimpleDeclSpecifier declspec = new CPPASTSimpleDeclSpecifier(); CPPASTSimpleDeclSpecifier declspec = new CPPASTSimpleDeclSpecifier();
switch(value) { switch(value) {
@ -234,8 +249,8 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode
setDeclSpecifier(declspec); setDeclSpecifier(declspec);
} }
@Override
@Deprecated @Deprecated
@Override
public IASTExpression getInitialValue() { public IASTExpression getInitialValue() {
if (fInitializer instanceof ICPPASTConstructorInitializer) { if (fInitializer instanceof ICPPASTConstructorInitializer) {
return ((ICPPASTConstructorInitializer) fInitializer).getExpression(); return ((ICPPASTConstructorInitializer) fInitializer).getExpression();
@ -243,8 +258,8 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode
return null; return null;
} }
@Override
@Deprecated @Deprecated
@Override
public void setInitialValue(IASTExpression expression) { public void setInitialValue(IASTExpression expression) {
ICPPASTConstructorInitializer init= new CPPASTConstructorInitializer(); ICPPASTConstructorInitializer init= new CPPASTConstructorInitializer();
init.setExpression(expression); init.setExpression(expression);

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -17,6 +17,7 @@ import java.util.List;
import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression; 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.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
@ -174,4 +175,9 @@ public class CPPASTTemplateIDAmbiguity extends ASTAmbiguousNode
public IASTExpression[] getExpressions() { public IASTExpression[] getExpressions() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
throw new UnsupportedOperationException();
}
} }

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE; 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.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IProblemType; import org.eclipse.cdt.core.dom.ast.IProblemType;
import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.IType;
@ -24,15 +25,15 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalUnaryTypeID; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalUnaryTypeID;
public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpression { public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpression {
private int op; private int fOperator;
private IASTTypeId typeId; private IASTTypeId fTypeId;
private ICPPEvaluation fEvaluation; private ICPPEvaluation fEvaluation;
public CPPASTTypeIdExpression() { public CPPASTTypeIdExpression() {
} }
public CPPASTTypeIdExpression(int op, IASTTypeId typeId) { public CPPASTTypeIdExpression(int op, IASTTypeId typeId) {
this.op = op; this.fOperator = op;
setTypeId(typeId); setTypeId(typeId);
} }
@ -44,25 +45,25 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
@Override @Override
public CPPASTTypeIdExpression copy(CopyStyle style) { public CPPASTTypeIdExpression copy(CopyStyle style) {
CPPASTTypeIdExpression copy = CPPASTTypeIdExpression copy =
new CPPASTTypeIdExpression(op, typeId == null ? null : typeId.copy(style)); new CPPASTTypeIdExpression(fOperator, fTypeId == null ? null : fTypeId.copy(style));
return copy(copy, style); return copy(copy, style);
} }
@Override @Override
public int getOperator() { public int getOperator() {
return op; return fOperator;
} }
@Override @Override
public void setOperator(int value) { public void setOperator(int value) {
assertNotFrozen(); assertNotFrozen();
this.op = value; fOperator = value;
} }
@Override @Override
public void setTypeId(IASTTypeId typeId) { public void setTypeId(IASTTypeId typeId) {
assertNotFrozen(); assertNotFrozen();
this.typeId = typeId; this.fTypeId = typeId;
if (typeId != null) { if (typeId != null) {
typeId.setParent(this); typeId.setParent(this);
typeId.setPropertyInParent(TYPE_ID); typeId.setPropertyInParent(TYPE_ID);
@ -71,7 +72,12 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
@Override @Override
public IASTTypeId getTypeId() { public IASTTypeId getTypeId() {
return typeId; return fTypeId;
}
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; // Type-id expression does not call destructors.
} }
@Override @Override
@ -84,7 +90,7 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
} }
} }
if (typeId != null && !typeId.accept(action)) return false; if (fTypeId != null && !fTypeId.accept(action)) return false;
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
switch (action.leave(this)) { switch (action.leave(this)) {
@ -99,11 +105,11 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
@Override @Override
public ICPPEvaluation getEvaluation() { public ICPPEvaluation getEvaluation() {
if (fEvaluation == null) { if (fEvaluation == null) {
IType type= CPPVisitor.createType(typeId); IType type= CPPVisitor.createType(fTypeId);
if (type == null || type instanceof IProblemType) { if (type == null || type instanceof IProblemType) {
fEvaluation= EvalFixed.INCOMPLETE; fEvaluation= EvalFixed.INCOMPLETE;
} else { } else {
fEvaluation= new EvalUnaryTypeID(op, type, this); fEvaluation= new EvalUnaryTypeID(fOperator, type, this);
} }
} }
return fEvaluation; return fEvaluation;

View file

@ -1,15 +1,20 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009, 2011 Wind River Systems, Inc. and others. * Copyright (c) 2005, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * John Camelon (IBM Rational Software) - Initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IASTTypeIdInitializerExpression; import org.eclipse.cdt.core.dom.ast.IASTTypeIdInitializerExpression;
@ -17,23 +22,97 @@ import org.eclipse.cdt.core.dom.ast.IProblemType;
import org.eclipse.cdt.core.dom.ast.IType; 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.ICPPASTExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause;
import org.eclipse.cdt.internal.core.dom.parser.ASTTypeIdInitializerExpression; 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.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalTypeId; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalTypeId;
/** /**
* C++ variant of type id initializer expression. type-id { initializer } * Type id initializer expression for C++, type-id { initializer }
*/ */
public class CPPASTTypeIdInitializerExpression extends ASTTypeIdInitializerExpression implements ICPPASTExpression { public class CPPASTTypeIdInitializerExpression extends ASTNode
implements IASTTypeIdInitializerExpression, ICPPASTExpression {
private IASTTypeId fTypeId;
private IASTInitializer fInitializer;
private ICPPEvaluation fEvaluation; private ICPPEvaluation fEvaluation;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
private CPPASTTypeIdInitializerExpression() { public CPPASTTypeIdInitializerExpression() {
} }
public CPPASTTypeIdInitializerExpression(IASTTypeId typeId, IASTInitializer initializer) { public CPPASTTypeIdInitializerExpression(IASTTypeId t, IASTInitializer i) {
super(typeId, initializer); 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;
} }
@Override @Override
@ -43,9 +122,10 @@ public class CPPASTTypeIdInitializerExpression extends ASTTypeIdInitializerExpre
@Override @Override
public IASTTypeIdInitializerExpression copy(CopyStyle style) { public IASTTypeIdInitializerExpression copy(CopyStyle style) {
CPPASTTypeIdInitializerExpression expr = new CPPASTTypeIdInitializerExpression(); CPPASTTypeIdInitializerExpression copy =new CPPASTTypeIdInitializerExpression(
initializeCopy(expr, style); fTypeId == null ? null : fTypeId.copy(style),
return expr; fInitializer == null ? null : fInitializer.copy(style));
return copy(copy, style);
} }
@Override @Override

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2012 IBM Corporation and others. * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying masterials * All rights reserved. This program and the accompanying masterials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -10,6 +10,7 @@
* Sergey Prigogin (Google) * Sergey Prigogin (Google)
* Mike Kucera (IBM) * Mike Kucera (IBM)
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -18,6 +19,7 @@ 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.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTIdExpression; 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.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
@ -31,6 +33,7 @@ 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.ICPPMethod;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode; 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.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.EvalFixed;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalUnary; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalUnary;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.FunctionSetType; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.FunctionSetType;
@ -41,8 +44,9 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.FunctionSetType;
public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpression, IASTAmbiguityParent { public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpression, IASTAmbiguityParent {
private int fOperator; private int fOperator;
private ICPPASTExpression fOperand; private ICPPASTExpression fOperand;
private IASTImplicitName[] fImplicitNames;
private ICPPEvaluation fEvaluation; private ICPPEvaluation fEvaluation;
private IASTImplicitName[] fImplicitNames;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTUnaryExpression() { public CPPASTUnaryExpression() {
} }
@ -94,9 +98,6 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
return fOperator == op_postFixDecr || fOperator == op_postFixIncr; return fOperator == op_postFixDecr || fOperator == op_postFixIncr;
} }
/**
* @see org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner#getImplicitNames()
*/
@Override @Override
public IASTImplicitName[] getImplicitNames() { public IASTImplicitName[] getImplicitNames() {
if (fImplicitNames == null) { if (fImplicitNames == null) {
@ -115,6 +116,15 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
return fImplicitNames; return fImplicitNames;
} }
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (fImplicitDestructorNames == null) {
fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return fImplicitDestructorNames;
}
@Override @Override
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
@ -144,6 +154,9 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
} }
} }
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false;
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
switch (action.leave(this)) { switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false; case ASTVisitor.PROCESS_ABORT: return false;

View file

@ -52,12 +52,12 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
@Override @Override
public void addBinding(IBinding binding) { 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)) if (!(binding instanceof ILabel))
return; return;
if (labels == CharArrayObjectMap.EMPTY_MAP) if (labels == CharArrayObjectMap.EMPTY_MAP)
labels = new CharArrayObjectMap<ILabel>(2); labels = new CharArrayObjectMap<>(2);
labels.put(binding.getNameCharArray(), (ILabel) binding); labels.put(binding.getNameCharArray(), (ILabel) binding);
} }
@ -65,7 +65,7 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
@Override @Override
public IBinding[] find(String name) { public IBinding[] find(String name) {
char[] n = name.toCharArray(); char[] n = name.toCharArray();
List<IBinding> bindings = new ArrayList<IBinding>(); List<IBinding> bindings = new ArrayList<>();
for (int i = 0; i < labels.size(); i++) { for (int i = 0; i < labels.size(); i++) {
char[] key = labels.keyAt(i); char[] key = labels.keyAt(i);
@ -84,8 +84,8 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
@Override @Override
public IScope getParent() { public IScope getParent() {
//we can't just resolve the function and get its parent scope, since there are cases where that // 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 // could loop because resolving functions requires resolving their parameter types.
IASTFunctionDeclarator fdtor = (IASTFunctionDeclarator) getPhysicalNode(); IASTFunctionDeclarator fdtor = (IASTFunctionDeclarator) getPhysicalNode();
IASTName name = fdtor.getName().getLastName(); IASTName name = fdtor.getName().getLastName();
return CPPVisitor.getContainingNonTemplateScope(name); return CPPVisitor.getContainingNonTemplateScope(name);

View file

@ -0,0 +1,60 @@
/*******************************************************************************
* 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;
}
}

View file

@ -1,4 +1,3 @@
#Mon Oct 17 17:37:10 PDT 2011
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
@ -82,6 +81,7 @@ org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false 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_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_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_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
@ -89,18 +89,21 @@ 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_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 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_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 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_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_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=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_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_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=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_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_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_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_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_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_field=0
@ -120,6 +123,7 @@ 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_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_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_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_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_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
@ -135,11 +139,17 @@ 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.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_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=110 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.compact_else_if=true org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=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_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_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_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@ -157,7 +167,9 @@ 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_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_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_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_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_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_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
@ -205,6 +217,7 @@ 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_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=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_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_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_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@ -223,12 +236,14 @@ 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_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_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_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_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_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_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_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not 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_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_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_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
@ -252,6 +267,7 @@ 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_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_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_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_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_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
@ -279,6 +295,7 @@ 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_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_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_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_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_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@ -307,6 +324,7 @@ 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_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_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_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_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_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
@ -316,6 +334,7 @@ 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_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=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_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_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_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@ -339,5 +358,8 @@ 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.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4 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.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true 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

View file

@ -1,7 +1,6 @@
#Wed Jan 28 12:19:09 CET 2009
eclipse.preferences.version=1 eclipse.preferences.version=1
formatter_profile=_CDT formatter_profile=_CDT
formatter_settings_version=11 formatter_settings_version=12
org.eclipse.jdt.ui.ignorelowercasenames=true 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.importorder=java;javax;org;com;org.eclipse.cdt;org.eclipse.cdt.internal;org.eclipse.cdt.internal.ui;
org.eclipse.jdt.ui.ondemandthreshold=99 org.eclipse.jdt.ui.ondemandthreshold=99