1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-21 21:52:10 +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
* 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) {
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.
* Checks the argument count.
*
* @param index
*
* @return a generated declaration or null if not suitable
* @param index the index
* @return a generated declaration or {@code null} if not suitable
*/
private static IASTSimpleDeclaration tryInferTypeFromFunctionCall(IASTName astName, INodeFactory factory, IIndex index) {
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.
* Otherwise, returns null.
* Otherwise, returns {@code null}.
*
* @param function
* the function definition to check
* @param index
* the index to use for name lookup
* @return Either a type specifier or null
* @param function the function definition to check
* @param index the index to use for name lookup
* @return either a type specifier or {@code null}
*/
public static IASTCompositeTypeSpecifier getCompositeTypeFromFunction(final IASTFunctionDefinition function, final IIndex index) {
// Return value to be set via visitor.
@ -371,19 +368,19 @@ public final class CxxAstUtils {
return returnSpecifier[0];
}
public static boolean isThrowStatement(IASTNode body) {
if (!(body instanceof IASTExpressionStatement))
public static boolean isThrowStatement(IASTNode statement) {
if (!(statement instanceof IASTExpressionStatement))
return false;
IASTExpression expression = ((IASTExpressionStatement) body).getExpression();
IASTExpression expression = ((IASTExpressionStatement) statement).getExpression();
if (!(expression instanceof IASTUnaryExpression))
return false;
return ((IASTUnaryExpression) expression).getOperator() == IASTUnaryExpression.op_throw;
}
public static boolean isExitStatement(IASTNode body) {
if (!(body instanceof IASTExpressionStatement))
public static boolean isExitStatement(IASTNode statement) {
if (!(statement instanceof IASTExpressionStatement))
return false;
IASTExpression expression = ((IASTExpressionStatement) body).getExpression();
IASTExpression expression = ((IASTExpressionStatement) statement).getExpression();
if (!(expression instanceof IASTFunctionCallExpression))
return false;
IASTExpression functionNameExpression = ((IASTFunctionCallExpression) expression).getFunctionNameExpression();

View file

@ -1,55 +1,55 @@
/*******************************************************************************
* Copyright (c) 2009, 2010 Alena Laskavaia
* Copyright (c) 2009, 2010 Alena Laskavaia
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alena Laskavaia - initial API and implementation
* Alena Laskavaia - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.core.model;
import org.eclipse.core.resources.IResource;
/**
* Interface to describe problem location. Usually contains file and linenumber,
* Interface to describe problem location. Usually contains file and line number,
* also supports character positions for sophisticated errors.
*
*
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IProblemLocation {
/**
*
* @return File for the problem - absolute full paths
*
* @return the file where the problem occurred
*/
IResource getFile();
/**
*
*
* @return Primary line for the problem, lines start with 1 for file. If -1
* char position would be used.
*/
int getLineNumber();
/**
*
*
* @return character position where problem starts within file, first char
* is 0, inclusive, tab count as one. If unknown return -1.
*/
int getStartingChar();
/**
*
*
* @return character position where problem ends within file, first char is
* 0, exclusive, tab count as one. If unknown return -1.
*/
int getEndingChar();
/**
*
* @return extra data for problem location, checker specific, can be
*
* @return extra data for the problem location, checker specific, can be
* backtrace for example
*/
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.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
@ -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_binary_expression=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_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
@ -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_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
@ -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.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=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.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@ -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_parameter=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
@ -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_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@ -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_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
@ -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_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
@ -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_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@ -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_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
@ -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_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@ -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_imple_if_on_one_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_line_comments_on_first_column=false
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.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true

View file

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

View file

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

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -13,8 +13,12 @@
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.ast2;
import java.io.IOException;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorNameOwner;
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
@ -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.ICPPTemplateInstance;
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 {
@ -42,7 +48,12 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
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);
assertTrue(offset >= 0);
IASTNodeSelector selector = tu.getNodeSelector(null);
@ -52,6 +63,25 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
return implicits;
}
protected IASTImplicitDestructorName[] getImplicitDestructorNames(IASTTranslationUnit tu, String contents,
String section) {
return getImplicitDestructorNames(tu, contents, section, section.length());
}
protected IASTImplicitDestructorName[] getImplicitDestructorNames(IASTTranslationUnit tu, String contents,
String section, int len) {
final int offset = contents.indexOf(section);
assertTrue(offset >= 0);
IASTNodeSelector selector = tu.getNodeSelector(null);
IASTImplicitName firstImplicit = selector.findImplicitName(offset, len);
if (firstImplicit instanceof IASTImplicitDestructorName) {
IASTImplicitDestructorNameOwner owner = (IASTImplicitDestructorNameOwner) firstImplicit.getParent();
IASTImplicitDestructorName[] implicits = owner.getImplicitDestructorNames();
return implicits;
}
return IASTImplicitDestructorName.EMPTY_NAME_ARRAY;
}
// class point {
// int x, y;
// public:
@ -71,7 +101,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// +p;
// }
public void testBinaryExpressions() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
BindingAssertionHelper ba= getAssertionHelper();
IASTTranslationUnit tu = ba.getTranslationUnit();
NameCollector col = new NameCollector();
tu.accept(col);
@ -115,7 +145,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// *y; //2
// }
public void testPointerDereference() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
BindingAssertionHelper ba= getAssertionHelper();
ba.assertImplicitName("*x;", 1, ICPPFunction.class);
ba.assertNoImplicitName("*y; //2", 1);
}
@ -133,7 +163,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// X* px2 = &y; // overloaded
// }
public void testPointerToMember() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
BindingAssertionHelper ba= getAssertionHelper();
IASTTranslationUnit tu = ba.getTranslationUnit();
NameCollector col = new NameCollector();
tu.accept(col);
@ -194,7 +224,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// (++p1).x; //2
// }
public void testUnaryPrefixAndPostfix() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
BindingAssertionHelper ba= getAssertionHelper();
ba.assertImplicitName("++).x; //1", 2, ICPPFunction.class);
ba.assertImplicitName("++p1).x; //2", 2, ICPPMethod.class);
}
@ -220,7 +250,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// test(a, b, c, d); // func
// }
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
ba.assertNoImplicitName(", b, 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
// }
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 opCC = ba.assertImplicitName(", c, d", 1, ICPPFunction.class);
@ -286,7 +316,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// x(1, 2); // 3
// }
public void testFunctionCallOperator() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
BindingAssertionHelper ba= getAssertionHelper();
IASTTranslationUnit tu = ba.getTranslationUnit();
NameCollector col = new NameCollector();
tu.accept(col);
@ -327,7 +357,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// b = a; // should not resolve
// }
public void testCopyAssignmentOperator() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
BindingAssertionHelper ba= getAssertionHelper();
ba.assertNoImplicitName("= a;", 1);
}
@ -345,7 +375,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// func(y[q]); //2
// }
public void testArraySubscript() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
BindingAssertionHelper ba= getAssertionHelper();
IASTTranslationUnit tu = ba.getTranslationUnit();
NameCollector col = new NameCollector();
tu.accept(col);
@ -380,7 +410,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// delete 1;
// }
public void testDelete() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
BindingAssertionHelper ba= getAssertionHelper();
IASTImplicitName[] names = ba.getImplicitNames("delete x;", 6);
assertEquals(2, names.length);
IASTImplicitName destructor = names[0];
@ -414,7 +444,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// delete b;
// }
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 f= bh.assertNonProblem("operator delete(void * b)", 15);
@ -441,7 +471,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// B* b = new B;
// }
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 f= bh.assertNonProblem("operator new(size_t b)", 12);
@ -460,7 +490,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// delete[] x;
// }
public void testImplicitNewAndDelete() throws Exception {
BindingAssertionHelper ba = new BindingAssertionHelper(getAboveComment(), true);
BindingAssertionHelper ba = getAssertionHelper();
ba.assertNoImplicitName("new X", 3);
ba.assertNoImplicitName("delete[]", 6);
}
@ -479,7 +509,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// int* p2 = new (5, 6) int[5];
// }
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 n2 = ba.assertImplicitName("new (nothrow) 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;
// }
public void testEmptyThrow() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
BindingAssertionHelper ba= getAssertionHelper();
ba.assertNoImplicitName("throw;", 5);
}
@ -526,7 +556,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase {
// };
// B C::t = 1;
public void testConstructorCall() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
BindingAssertionHelper ba= getAssertionHelper();
IASTTranslationUnit tu = ba.getTranslationUnit();
ICPPConstructor ctor0 = ba.assertNonProblem("A()", 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 {
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();
ICPPFunction op = ba.assertNonProblem("operator==", 0);
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.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorNameOwner;
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
@ -673,6 +675,16 @@ public class AST2TestBase extends BaseTestCase {
return implicits;
}
public IASTImplicitDestructorName[] getImplicitDestructotNames(String section, int len) {
final int offset = contents.indexOf(section);
assertTrue(offset >= 0);
IASTNodeSelector selector = tu.getNodeSelector(null);
IASTNode enclosingNode = selector.findStrictlyEnclosingNode(offset, len);
if (!(enclosingNode instanceof IASTImplicitDestructorNameOwner))
return IASTImplicitDestructorName.EMPTY_NAME_ARRAY;
return ((IASTImplicitDestructorNameOwner) enclosingNode).getImplicitDestructorNames();
}
public IASTName findName(String section, int len) {
final int offset = contents.indexOf(section);
assertTrue("Section \"" + section + "\" not found", offset >= 0);
@ -696,7 +708,7 @@ public class AST2TestBase extends BaseTestCase {
return findName(contents, name);
}
public IASTName findImplicitName(String section, int len) {
public IASTImplicitName findImplicitName(String section, int len) {
final int offset = contents.indexOf(section);
assertTrue(offset >= 0);
IASTNodeSelector selector = tu.getNodeSelector(null);

View file

@ -1,4 +1,3 @@
#Mon Oct 17 17:36:13 PDT 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
@ -81,6 +80,7 @@ org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
@ -88,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_binary_expression=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_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
@ -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_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
@ -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.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=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.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@ -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_parameter=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
@ -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_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@ -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_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
@ -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_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
@ -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_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@ -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_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
@ -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_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@ -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_imple_if_on_one_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_line_comments_on_first_column=false
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.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true

View file

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

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
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-Vendor: %providerName
Bundle-Localization: plugin

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Schorn - initial API and implementation
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast;
@ -22,12 +22,11 @@ import org.eclipse.core.runtime.Assert;
* @since 5.1
*/
public final class ASTNameCollector extends ASTVisitor {
private char[] fName;
private ArrayList<IASTName> fFound= new ArrayList<IASTName>(4);
private final char[] fName;
private final ArrayList<IASTName> fFound= new ArrayList<>(4);
/**
* Construct a name collector for the given name.
* Constructs a name collector for the given name.
*/
public ASTNameCollector(char[] 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) {
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() {
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() {
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
* are made available under the terms of the Eclipse Public License v1.0
* 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,
* normally they are not visited, set this flag to true to visit them.
* @since 5.1
* @see #visit(IASTName)
* @see IASTImplicitName
*/
public boolean shouldVisitImplicitNames = false;
@ -179,9 +181,21 @@ public abstract class ASTVisitor {
* Sometimes more than one implicit name is created for a binding,
* set this flag to true to visit more than one name for an implicit binding.
* @since 5.1
* @see #visit(IASTName)
* @see IASTImplicitName
*/
public boolean shouldVisitImplicitNameAlternates = false;
/**
* Implicit destructor names are created to mark code locations where destructors of temporaries and
* variables going out of scope are called, normally they are not visited, set this flag to true to visit
* them.
* @since 5.11
* @see #visit(IASTName)
* @see IASTImplicitDestructorName
*/
public boolean shouldVisitImplicitDestructorNames = false;
/**
* Creates a visitor that does not visit any kind of node per default.
*/

View file

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

View file

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

View file

@ -11,7 +11,7 @@
package org.eclipse.cdt.core.dom.ast;
/**
* Expression List (Comma separated list of expressions).
* Expression list (comma separated list of expressions).
*
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
@ -26,17 +26,16 @@ public interface IASTExpressionList extends IASTExpression {
"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();
/**
* Add nested expression.
* Adds nested expression.
*
* @param expression
* <code>IASTExpression</code> value to be added.
* @param expression the expression to be added.
*/
public void addExpression(IASTExpression expression);

View file

@ -19,96 +19,89 @@ package org.eclipse.cdt.core.dom.ast;
*/
public interface IASTForStatement extends IASTStatement {
/**
* <code>CONDITION</code> represents the relationship between a
* <code>IASTForStatement</code> and its <code>IASTExpression</code>
* condition.
* {@code CONDITION} represents the relationship between a {@code IASTForStatement} and
* its {@code IASTExpression} condition.
*/
public static final ASTNodeProperty CONDITION = new ASTNodeProperty(
"IASTForStatement.CONDITION - IASTExpression condition of IASTForStatement"); //$NON-NLS-1$
/**
* <code>ITERATION</code> represents the relationship between a
* <code>IASTForStatement</code> and its <code>IASTExpression</code>
* iteration expression.
* {@code ITERATION} represents the relationship between a {@code IASTForStatement} and
* its {@code IASTExpression} iteration expression.
*/
public static final ASTNodeProperty ITERATION = new ASTNodeProperty(
"IASTForStatement.ITERATION - IASTExpression iteration of IASTForStatement"); //$NON-NLS-1$
/**
* <code>BODY</code> represents the relationship between a
* <code>IASTForStatement</code> and its <code>IASTStatement</code>
* body.
* {@code BODY} represents the relationship between a {@code IASTForStatement} and
* its {@code IASTStatement} body.
*/
public static final ASTNodeProperty BODY = new ASTNodeProperty(
"IASTForStatement.BODY - IASTStatement body of IASTForStatement"); //$NON-NLS-1$
/**
* <code>INITIALIZER</code> represents the relationship between a
* <code>IASTForStatement</code> and its <code>IASTDeclaration</code>
* initializer.
* {@code INITIALIZER} represents the relationship between a {@code IASTForStatement} and
* its {@code IASTDeclaration} initializer.
*/
public static final ASTNodeProperty INITIALIZER = new ASTNodeProperty(
"IASTForStatement.INITIALIZER - initializer for IASTForStatement"); //$NON-NLS-1$
/**
* Returns the initializer statement.
*/
public IASTStatement getInitializerStatement();
/**
* @param statement
*/
public void setInitializerStatement( IASTStatement statement );
public void setInitializerStatement(IASTStatement statement);
/**
* Get the condition expression for the loop.
* Returns the condition expression for the loop.
*
* @return <code>IASTExpression</code>
* @return {@code IASTExpression}
*/
public IASTExpression getConditionExpression();
/**
* Set the condition expression for the loop.
* Sets the condition expression for the loop.
*
* @param condition
* <code>IASTExpression</code>
* @param condition {@code IASTExpression}
*/
public void setConditionExpression(IASTExpression condition);
/**
* Get the expression that is evaluated after the completion of an iteration
* of the loop.
* Returns the expression that is evaluated after the completion of an iteration of the loop.
*
* @return <code>IASTExpression</code>
* @return {@code IASTExpression}
*/
public IASTExpression getIterationExpression();
/**
* Set the expression that is evaluated after the completion of an iteration
* of the loop.
* Sets the expression that is evaluated after the completion of an iteration of the loop.
*
* @param iterator
* <code>IASTExpression</code>
* @param iterator {@code IASTExpression}
*/
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();
/**
* Set the body of the for loop.
* Sets the body of the for loop.
*
* @param statement
* <code>IASTStatement</code>
* @param statement {@code IASTStatement}
*/
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();

View file

@ -18,24 +18,24 @@ package org.eclipse.cdt.core.dom.ast;
*/
public interface IASTFunctionDefinition extends IASTDeclaration {
/**
* <code>DECL_SPECIFIER</code> represents the relationship between a
* <code>IASTFunctionDefinition</code> and its
* <code>IASTDeclSpecifier</code>.
* {@code DECL_SPECIFIER} represents the relationship between a
* {@code IASTFunctionDefinition} and its
* {@code IASTDeclSpecifier}.
*/
public static final ASTNodeProperty DECL_SPECIFIER = new ASTNodeProperty(
"IASTFunctionDefinition.DECL_SPECIFIER - IASTDeclSpecifier for IASTFunctionDefinition"); //$NON-NLS-1$
/**
* <code>DECLARATOR</code> represents the relationship between a
* <code>IASTFunctionDefinition</code> and its
* <code>IASTFunctionDeclarator</code>.
* {@code DECLARATOR} represents the relationship between a
* {@code IASTFunctionDefinition} and its
* {@code IASTFunctionDeclarator}.
*/
public static final ASTNodeProperty DECLARATOR = new ASTNodeProperty(
"IASTFunctionDefinition.DECLARATOR - IASTFunctionDeclarator for IASTFunctionDefinition"); //$NON-NLS-1$
/**
* <code>FUNCTION_BODY</code> represents the relationship between a
* <code>IASTFunctionDefinition</code> and its <code>IASTStatement</code>.
* {@code FUNCTION_BODY} represents the relationship between a
* {@code IASTFunctionDefinition} and its {@code IASTStatement}.
*/
public static final ASTNodeProperty FUNCTION_BODY = new ASTNodeProperty(
"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)); // is nested in another declarator
* </pre>
*
* @param 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
* C++ also has a function try block.
*
*/
public IASTStatement getBody();
@ -94,7 +94,7 @@ public interface IASTFunctionDefinition extends IASTDeclaration {
/**
* Get the logical IScope that the function definition body represents.
*
* @return <code>IScope</code> representing function body.
* @return {@code IScope} representing function body.
*/
public IScope getScope();

View file

@ -18,22 +18,22 @@ package org.eclipse.cdt.core.dom.ast;
*/
public interface IASTIfStatement extends IASTStatement {
/**
* <code>CONDITION</code> represents the relationship between an
* <code>IASTIfStatement</code> and its nested <code>IASTExpression</code>.
* {@code CONDITION} represents the relationship between an
* {@code IASTIfStatement} and its nested {@code IASTExpression}.
*/
public static final ASTNodeProperty CONDITION = new ASTNodeProperty(
"IASTIfStatement.CONDITION - IASTExpression condition for IASTIfStatement"); //$NON-NLS-1$
/**
* <code>THEN</code> represents the relationship between an
* <code>IASTIfStatement</code> and its nested <code>IASTStatement</code>
* {@code THEN} represents the relationship between an
* {@code IASTIfStatement} and its nested {@code IASTStatement}
* (then).
*/
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>IASTIfStatement</code> and its nested <code>IASTStatement</code>
* {@code ELSE} represents the relationship between an
* {@code IASTIfStatement} and its nested {@code IASTStatement}
* (else).
*/
public static final ASTNodeProperty ELSE = new ASTNodeProperty("IASTIfStatement.ELSE - IASTStatement (else) for IASTIfStatement"); //$NON-NLS-1$
@ -41,7 +41,7 @@ public interface IASTIfStatement extends IASTStatement {
/**
* Returns the condition in the if statement.
*
* @return the condition <code>IASTExpression</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
* (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.
*
* @param condition
* <code>IASTExpression</code>
* @param condition {@code IASTExpression}
*/
public void setConditionExpression(IASTExpression condition);
/**
* 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();
/**
* Sets the statement that is executed if the condition is true.
*
* @param thenClause
* <code>IASTStatement</code>
* @param thenClause {@code IASTStatement}
*/
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
* 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();
/**
* Sets the else clause.
*
* @param elseClause
* <code>IASTStatement</code>
* @param elseClause {@code IASTStatement}
*/
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;
/**
* Interface for ast nodes that can nest in initializer lists.
* Interface for AST nodes that can nest in initializer lists.
* @since 5.2
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.

View file

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

View file

@ -24,7 +24,8 @@ public interface IASTTypeIdInitializerExpression extends IASTExpression {
* <code>IASTTypeIdInitializerExpression</code> and
* <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

View file

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

View file

@ -37,10 +37,10 @@ public interface IScope {
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.
* <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.
*/
public IScope getParent() throws DOMException;
@ -51,7 +51,7 @@ public interface IScope {
* lookup. Constructors are not considered during this lookup and won't be returned.
* No attempt is made to resolve potential ambiguities or perform access checking.
*
* @param name
* @param name the name of the bindings
* @return An array of bindings.
*/
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
* has not yet been resolved.
*
* @param name
* @param resolve
* whether or not to resolve the matching binding if it has not
* been so already.
* @return the binding in this scope that matches the name, or null
* @param name the name of the binding
* @param resolve whether or not to resolve the matching binding if it has not been so already.
* @return the binding in this scope that matches the name, or {@code null}
*/
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
* in the given set, only.
*
* @param name
* @param resolve
* whether or not to resolve the matching binding if it has not
* been so already.
* @param name the name of the binding
* @param resolve whether or not to resolve the matching binding if it has not been so already.
* @param acceptLocalBindings a set of files for which to accept local bindings.
* @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) {
fPrefixLookup = prefixLookup;
}
public final void setResolve(boolean resolve) {
fResolve = resolve;
}
public final void setIgnorePointOfDeclaration(boolean ignorePointOfDeclaration) {
fIgnorePointOfDeclaration = ignorePointOfDeclaration;
}
public final void setLookupKey(char[] key) {
fLookupKey= key;
}
public final char[] getLookupKey() {
return fLookupKey;
}
public final IASTNode getLookupPoint() {
return fLookupPoint;
}
public final boolean isResolve() {
return fResolve;
}
public final boolean isPrefixLookup() {
return fPrefixLookup;
}
public final boolean isIgnorePointOfDeclaration() {
return fIgnorePointOfDeclaration;
}
public final IIndexFileSet getIncludedFiles() {
return fTu == null ? IIndexFileSet.EMPTY : fTu.getIndexFileSet();
}
public final IIndex getIndex() {
return fTu == null ? null : fTu.getIndex();
}
public final IASTName getLookupName() {
return fLookupPointIsName ? (IASTName) fLookupPoint : null;
}
public IASTTranslationUnit getTranslationUnit() {
return fTu;
}
}
/**
* 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
* yet been cached in this scope, or if resolve == false and the appropriate bindings
* have not yet been resolved.
*
* @return : the bindings in this scope that match the name or prefix, or null
* @return the bindings in this scope that match the name or prefix, or {@code null}
* @since 5.5
*/
public IBinding[] getBindings(ScopeLookupData lookup);

View file

@ -49,27 +49,27 @@ public interface ICPPASTCatchHandler extends IASTStatement {
public boolean isCatchAll();
/**
* Set the catch body.
* Sets the catch body.
*/
public void setCatchBody(IASTStatement compoundStatement);
/**
* Get the catch body.
* Returns the catch body.
*/
public IASTStatement getCatchBody();
/**
* Set the declaration.
* Sets the declaration.
*/
public void setDeclaration(IASTDeclaration decl);
/**
* Get the declaration.
* Returns the declaration.
*/
public IASTDeclaration getDeclaration();
/**
* Get the scope represented by this catch handler.
* Returns the scope represented by this catch handler.
* @since 5.1
*/
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,16 +7,23 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorNameOwner;
/**
* Interface for c++ expressions.
* 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.
* @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

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Mike Kucera (IBM) - Initial API and implementation
* Mike Kucera (IBM) - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
@ -20,7 +20,6 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTExpressionList extends IASTExpressionList, ICPPASTExpression, IASTImplicitNameOwner {
@Override
public ICPPASTExpressionList copy();

View file

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

View file

@ -32,7 +32,7 @@ public interface ICPPASTFunctionCallExpression
/**
* 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
*/
public ICPPFunction getOverload();

View file

@ -22,11 +22,11 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression;
* @since 5.2
*/
public interface ICPPASTPackExpansionExpression extends ICPPASTExpression {
/**
* Represents the relationship between a pack-expansion and its pattern.
*/
public static final ASTNodeProperty PATTERN = new ASTNodeProperty("ICPPASTPackExpansionExpression.Pattern [IASTExpression]"); //$NON-NLS-1$
public static final ASTNodeProperty PATTERN =
new ASTNodeProperty("ICPPASTPackExpansionExpression.Pattern [IASTExpression]"); //$NON-NLS-1$
/**
* Returns the pattern of the pack expansion.

View file

@ -14,7 +14,7 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
/**
* This interface represents the try block statement. try { //body } catch (Exc e )
* This interface represents the try block statement. try { //body } catch (Exc e)
* { // handler } catch ( ... ) { }
*
* @noextend This interface is not intended to be extended by clients.
@ -22,43 +22,41 @@ import org.eclipse.cdt.core.dom.ast.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$
/**
* Set try body.
* Sets the try body.
*
* @param tryBlock
* <code>IASTStatement</code>
* @param tryBlock {@code IASTStatement}
*/
public void setTryBody(IASTStatement tryBlock);
/**
* Get try body.
* Returns the try body.
*
* @return <code>IASTStatement</code>
* @return {@code IASTStatement}
*/
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(
"ICPPASTTryBlockStatement.CATCH_HANDLER - Exception catching handlers"); //$NON-NLS-1$
/**
* Add catch handler.
* Adds catch handler.
*
* @param handler
* <code>ICPPASTCatchHandler</code>
* @param handler {@code ICPPASTCatchHandler}
*/
public void addCatchHandler(ICPPASTCatchHandler handler);
/**
* Get the catch handlers.
* Returns the catch handlers.
*
* @return <code>ICPPASTCatchHandler []</code>
* @return {@code ICPPASTCatchHandler[]}
*/
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -402,4 +402,19 @@ public abstract class ASTNode implements IASTNode {
public void resolvePendingAmbiguities() {
((ASTTranslationUnit) getTranslationUnit()).resolvePendingAmbiguities(this);
}
/**
* Helper method for use in {{@link #accept(ASTVisitor)} methods.
*
* @param action the visitor to accept
* @param nodes the array of nodes accepting the visitor
* @return continue on ({@code true}) or quit ({@code false})
*/
protected static <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,35 +1,106 @@
/*******************************************************************************
* 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
* 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)
* 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.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
import org.eclipse.cdt.internal.core.dom.parser.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
ICASTTypeIdInitializerExpression {
public class CASTTypeIdInitializerExpression extends ASTNode implements ICASTTypeIdInitializerExpression {
private IASTTypeId fTypeId;
private IASTInitializer fInitializer;
private CASTTypeIdInitializerExpression() {
super();
public CASTTypeIdInitializerExpression() {
}
public CASTTypeIdInitializerExpression(IASTTypeId typeId, IASTInitializer initializer) {
super(typeId, initializer);
public CASTTypeIdInitializerExpression(IASTTypeId t, IASTInitializer i) {
setTypeId(t);
fInitializer = i;
}
@Override
public IASTTypeId getTypeId() {
return fTypeId;
}
@Override
public void setTypeId(IASTTypeId typeId) {
assertNotFrozen();
this.fTypeId = typeId;
if (typeId != null) {
typeId.setParent(this);
typeId.setPropertyInParent(TYPE_ID);
}
}
@Override
public IASTInitializer getInitializer() {
return fInitializer;
}
@Override
public void setInitializer(IASTInitializer initializer) {
assertNotFrozen();
this.fInitializer = initializer;
if (initializer != null) {
initializer.setParent(this);
initializer.setPropertyInParent(INITIALIZER);
}
}
@Override
public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if (fTypeId != null && !fTypeId.accept(action)) return false;
if (fInitializer != null && !fInitializer.accept(action)) return false;
if (action.shouldVisitExpressions) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;
}
@Override
public final boolean isLValue() {
return false;
}
@Override
public ValueCategory getValueCategory() {
return ValueCategory.PRVALUE;
}
@Override
public IType getExpressionType() {
return CVisitor.createType(getTypeId().getAbstractDeclarator());
}
@Override
@ -39,13 +110,9 @@ public class CASTTypeIdInitializerExpression extends ASTTypeIdInitializerExpress
@Override
public CASTTypeIdInitializerExpression copy(CopyStyle style) {
CASTTypeIdInitializerExpression copy = new CASTTypeIdInitializerExpression();
initializeCopy(copy, style);
return copy;
}
@Override
public IType getExpressionType() {
return CVisitor.createType(getTypeId().getAbstractDeclarator());
CASTTypeIdInitializerExpression copy = new CASTTypeIdInitializerExpression(
fTypeId == null ? null : fTypeId.copy(style),
fInitializer == null ? null : fInitializer.copy(style));
return copy(copy, style);
}
}

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,11 +7,13 @@
*
* Contributors:
* Markus Schorn - Initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousBinaryVsCastExpression;
@ -20,4 +22,9 @@ public class CPPASTAmbiguousBinaryVsCastExpression extends ASTAmbiguousBinaryVsC
public CPPASTAmbiguousBinaryVsCastExpression(IASTBinaryExpression bexp, IASTCastExpression 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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,11 +7,13 @@
*
* Contributors:
* Markus Schorn - Initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousCastVsFunctionCallExpression;
@ -21,4 +23,9 @@ public class CPPASTAmbiguousCastVsFunctionCallExpression
public CPPASTAmbiguousCastVsFunctionCallExpression(IASTCastExpression castExpr, IASTFunctionCallExpression 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
implements IASTAmbiguousExpression, ICPPASTExpression {
private IASTExpression[] exp = new IASTExpression[2];
private int expPos= -1;
private int expPos;
public CPPASTAmbiguousExpression(IASTExpression... expressions) {
for (IASTExpression e : expressions) {
@ -43,7 +43,7 @@ public class CPPASTAmbiguousExpression extends ASTAmbiguousNode
public void addExpression(IASTExpression e) {
assertNotFrozen();
if (e != null) {
exp = ArrayUtil.appendAt(IASTExpression.class, exp, ++expPos, e);
exp = ArrayUtil.appendAt(exp, expPos++, e);
e.setParent(this);
e.setPropertyInParent(SUBEXPRESSION);
}
@ -51,7 +51,7 @@ public class CPPASTAmbiguousExpression extends ASTAmbiguousNode
@Override
public IASTExpression[] getExpressions() {
exp = ArrayUtil.trimAt(IASTExpression.class, exp, expPos);
exp = ArrayUtil.trim(exp, expPos);
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -9,6 +9,7 @@
* John Camelon (IBM) - Initial API and implementation
* Mike Kucera (IBM)
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -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.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.IASTNode;
@ -210,4 +212,9 @@ public class CPPASTArraySubscriptExpression extends ASTNode
public boolean isLValue() {
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
* are made available under the terms of the Eclipse Public License v1.0
* 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.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorNameOwner;
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
@ -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.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalBinary;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
@ -41,6 +44,7 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
private ICPPEvaluation evaluation;
private IASTImplicitName[] implicitNames;
private IASTImplicitDestructorName[] implicitDestructorNames;
public CPPASTBinaryExpression() {
}
@ -121,9 +125,6 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
setInitOperand2(expression);
}
/**
* @see org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner#getImplicitNames()
*/
@Override
public IASTImplicitName[] getImplicitNames() {
if (implicitNames == null) {
@ -142,6 +143,15 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
return implicitNames;
}
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (implicitDestructorNames == null) {
implicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return implicitDestructorNames;
}
@Override
public boolean accept(ASTVisitor action) {
if (operand1 instanceof IASTBinaryExpression || operand2 instanceof IASTBinaryExpression) {
@ -159,16 +169,15 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
if (operand1 != null && !operand1.accept(action))
return false;
if (action.shouldVisitImplicitNames) {
for (IASTImplicitName name : getImplicitNames()) {
if (!name.accept(action))
return false;
}
}
if (action.shouldVisitImplicitNames && !acceptByNodes(getImplicitNames(), action))
return false;
if (operand2 != null && !operand2.accept(action))
return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(getImplicitDestructorNames(), action))
return false;
if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT)
return false;
@ -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);
while (stack != null) {
IASTBinaryExpression expr= stack.fExpression;
@ -211,12 +220,10 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
return false;
}
if (stack.fState == 1) {
if (action.shouldVisitImplicitNames) {
for (IASTImplicitName name : ((IASTImplicitNameOwner) expr).getImplicitNames()) {
if (!name.accept(action))
return false;
}
}
if (action.shouldVisitImplicitNames &&
!acceptByNodes(((IASTImplicitNameOwner) expr).getImplicitNames(), action)) {
return false;
}
stack.fState= 2;
IASTExpression op2 = expr.getOperand2();
@ -228,6 +235,10 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
}
if (op2 != null && !op2.accept(action))
return false;
if (action.shouldVisitImplicitDestructorNames &&
!acceptByNodes(((IASTImplicitDestructorNameOwner) expr).getImplicitDestructorNames(), action)) {
return false;
}
}
if (action.shouldVisitExpressions && action.leave(expr) == ASTVisitor.PROCESS_ABORT)

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

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -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.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IProblemType;
@ -31,16 +33,17 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalTypeId;
* Cast expression for C++
*/
public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpression, IASTAmbiguityParent {
private int op;
private ICPPASTExpression operand;
private IASTTypeId typeId;
private int fOperator;
private ICPPASTExpression fOperand;
private IASTTypeId fTypeId;
private ICPPEvaluation fEvaluation;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTCastExpression() {
}
public CPPASTCastExpression(int operator, IASTTypeId typeId, IASTExpression operand) {
op = operator;
fOperator = operator;
setOperand(operand);
setTypeId(typeId);
}
@ -54,7 +57,7 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi
public CPPASTCastExpression copy(CopyStyle style) {
CPPASTCastExpression copy = new CPPASTCastExpression();
copy.setOperator(getOperator());
copy.setTypeId(typeId == null ? null : typeId.copy(style));
copy.setTypeId(fTypeId == null ? null : fTypeId.copy(style));
IASTExpression operand = getOperand();
copy.setOperand(operand == null ? null : operand.copy(style));
return copy(copy, style);
@ -63,7 +66,7 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi
@Override
public void setTypeId(IASTTypeId typeId) {
assertNotFrozen();
this.typeId = typeId;
this.fTypeId = typeId;
if (typeId != null) {
typeId.setParent(this);
typeId.setPropertyInParent(TYPE_ID);
@ -72,35 +75,44 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi
@Override
public IASTTypeId getTypeId() {
return typeId;
return fTypeId;
}
@Override
public int getOperator() {
return op;
return fOperator;
}
@Override
public void setOperator(int operator) {
assertNotFrozen();
op = operator;
fOperator = operator;
}
@Override
public IASTExpression getOperand() {
return operand;
return fOperand;
}
@Override
public void setOperand(IASTExpression expression) {
assertNotFrozen();
operand = (ICPPASTExpression) expression;
fOperand = (ICPPASTExpression) expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(OPERAND);
}
}
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (fImplicitDestructorNames == null) {
fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return fImplicitDestructorNames;
}
@Override
public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) {
@ -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();
if (op != null && !op.accept(action)) return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false;
if (action.shouldVisitExpressions) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
@ -127,10 +142,10 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi
@Override
public void replace(IASTNode child, IASTNode other) {
if (child == operand) {
if (child == fOperand) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
operand = (ICPPASTExpression) other;
fOperand = (ICPPASTExpression) other;
}
}
@ -144,14 +159,14 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi
}
private ICPPEvaluation computeEvaluation() {
if (operand == null)
if (fOperand == null)
return EvalFixed.INCOMPLETE;
IType type= CPPVisitor.createType(getTypeId());
if (type == null || type instanceof IProblemType)
return EvalFixed.INCOMPLETE;
return new EvalTypeId(type, this, operand.getEvaluation());
return new EvalTypeId(type, this, fOperand.getEvaluation());
}
@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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -16,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.IASTCompoundStatement;
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalCompound;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
@ -28,12 +31,13 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
* Gnu-extension: ({ ... })
*/
public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUASTCompoundStatementExpression, ICPPASTExpression {
private IASTCompoundStatement statement;
private IASTCompoundStatement fStatement;
private ICPPEvaluation fEval;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTCompoundStatementExpression() {
}
@Override
public ICPPEvaluation getEvaluation() {
if (fEval == null) {
@ -63,42 +67,54 @@ public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUAS
@Override
public CPPASTCompoundStatementExpression copy(CopyStyle style) {
CPPASTCompoundStatementExpression copy = new CPPASTCompoundStatementExpression();
copy.setCompoundStatement(statement == null ? null : statement.copy(style));
copy.setCompoundStatement(fStatement == null ? null : fStatement.copy(style));
return copy(copy, style);
}
@Override
public IASTCompoundStatement getCompoundStatement() {
return statement;
return fStatement;
}
@Override
public void setCompoundStatement(IASTCompoundStatement statement) {
assertNotFrozen();
this.statement = statement;
this.fStatement = statement;
if (statement != null) {
statement.setParent(this);
statement.setPropertyInParent(STATEMENT);
}
}
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (fImplicitDestructorNames == null) {
fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return fImplicitDestructorNames;
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitExpressions ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if( statement != null ) if( !statement.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (fStatement != null && !fStatement.accept(action)) return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false;
if (action.shouldVisitExpressions) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -16,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.IASTConditionalExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalConditional;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
public class CPPASTConditionalExpression extends ASTNode implements IASTConditionalExpression,
ICPPASTExpression, IASTAmbiguityParent {
public class CPPASTConditionalExpression extends ASTNode
implements IASTConditionalExpression, ICPPASTExpression, IASTAmbiguityParent {
private ICPPASTExpression fCondition;
private ICPPASTExpression fPositive;
private ICPPASTExpression fNegative;
private ICPPEvaluation fEval;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTConditionalExpression() {
}
@ -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
public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) {
@ -116,6 +129,9 @@ public class CPPASTConditionalExpression extends ASTNode implements IASTConditio
return false;
if (fNegative != null && !fNegative.accept(action))
return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false;
if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT)
return false;

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

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -33,8 +33,7 @@ public class CPPASTEqualsInitializer extends ASTEqualsInitializer {
@Override
public CPPASTEqualsInitializer copy(CopyStyle style) {
IASTInitializerClause arg = getInitializerClause();
CPPASTEqualsInitializer copy = new CPPASTEqualsInitializer(arg == null ? null
: arg.copy(style));
CPPASTEqualsInitializer copy = new CPPASTEqualsInitializer(arg == null ? null : arg.copy(style));
return copy(copy, style);
}
}

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

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

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -9,6 +9,7 @@
* John Camelon (IBM) - Initial API and implementation
* Mike Kucera (IBM) - implicit names
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -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.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.IASTName;
@ -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.ICPPASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFunctionCall;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalTypeId;
@ -47,11 +51,12 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.LookupData;
public class CPPASTFunctionCallExpression extends ASTNode
implements ICPPASTFunctionCallExpression, IASTAmbiguityParent {
private ICPPASTExpression functionName;
private ICPPASTExpression fFunctionName;
private IASTInitializerClause[] fArguments;
private IASTImplicitName[] implicitNames;
private ICPPEvaluation evaluation;
private IASTImplicitName[] fImplicitNames;
private ICPPEvaluation fEvaluation;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTFunctionCallExpression() {
setArguments(null);
@ -78,19 +83,19 @@ public class CPPASTFunctionCallExpression extends ASTNode
}
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);
}
@Override
public IASTExpression getFunctionNameExpression() {
return functionName;
return fFunctionName;
}
@Override
public void setFunctionNameExpression(IASTExpression expression) {
assertNotFrozen();
this.functionName = (ICPPASTExpression) expression;
this.fFunctionName = (ICPPASTExpression) expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(FUNCTION_NAME);
@ -118,21 +123,21 @@ public class CPPASTFunctionCallExpression extends ASTNode
@Override
public IASTImplicitName[] getImplicitNames() {
if (implicitNames == null) {
if (fImplicitNames == null) {
ICPPFunction overload = getOverload();
if (overload == null)
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
return fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
if (getEvaluation() instanceof EvalTypeId) {
CPPASTImplicitName n1 = new CPPASTImplicitName(overload.getNameCharArray(), this);
n1.setOffsetAndLength((ASTNode) functionName);
n1.setOffsetAndLength((ASTNode) fFunctionName);
n1.setBinding(overload);
return implicitNames= new IASTImplicitName[] {n1};
return fImplicitNames= new IASTImplicitName[] {n1};
}
if (overload instanceof CPPImplicitFunction) {
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);
if (fArguments.length == 0) {
int idEndOffset = ((ASTNode) functionName).getOffset() + ((ASTNode) functionName).getLength();
int idEndOffset = ((ASTNode) fFunctionName).getOffset() + ((ASTNode) fFunctionName).getLength();
try {
IToken lparen = functionName.getTrailingSyntax();
IToken lparen = fFunctionName.getTrailingSyntax();
IToken rparen = lparen.getNext();
if (lparen.getType() == IToken.tLPAREN) {
@ -166,15 +171,24 @@ public class CPPASTFunctionCallExpression extends ASTNode
n2.setOffsetAndLength(idEndOffset, 0);
}
} else {
n1.computeOperatorOffsets(functionName, true);
n1.computeOperatorOffsets(fFunctionName, 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
public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) {
@ -185,7 +199,7 @@ public class CPPASTFunctionCallExpression extends ASTNode
}
}
if (functionName != null && !functionName.accept(action))
if (fFunctionName != null && !fFunctionName.accept(action))
return false;
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))
return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false;
if (action.shouldVisitExpressions && action.leave(this) == ASTVisitor.PROCESS_ABORT)
return false;
@ -209,10 +226,10 @@ public class CPPASTFunctionCallExpression extends ASTNode
@Override
public void replace(IASTNode child, IASTNode other) {
if (child == functionName) {
if (child == fFunctionName) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
functionName = (ICPPASTExpression) other;
fFunctionName = (ICPPASTExpression) other;
}
for (int i = 0; i < fArguments.length; ++i) {
if (child == fArguments[i]) {
@ -223,8 +240,8 @@ public class CPPASTFunctionCallExpression extends ASTNode
}
}
@Override
@Deprecated
@Override
public IASTExpression getParameterExpression() {
if (fArguments.length == 0)
return null;
@ -246,8 +263,8 @@ public class CPPASTFunctionCallExpression extends ASTNode
return result;
}
@Override
@Deprecated
@Override
public void setParameterExpression(IASTExpression expression) {
assertNotFrozen();
if (expression == null) {
@ -270,9 +287,10 @@ public class CPPASTFunctionCallExpression extends ASTNode
IType t= getNestedType(((EvalTypeId) eval).getInputType(), TDEF | CVTYPE | REF);
if (t instanceof ICPPClassType && !(t instanceof ICPPUnknownBinding)) {
ICPPClassType cls= (ICPPClassType) t;
LookupData data= CPPSemantics.createLookupData(((IASTIdExpression) functionName).getName());
LookupData data= CPPSemantics.createLookupData(((IASTIdExpression) fFunctionName).getName());
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)
return (ICPPFunction) b;
} catch (DOMException e) {
@ -285,14 +303,14 @@ public class CPPASTFunctionCallExpression extends ASTNode
@Override
public ICPPEvaluation getEvaluation() {
if (evaluation == null)
evaluation= computeEvaluation();
if (fEvaluation == null)
fEvaluation= computeEvaluation();
return evaluation;
return fEvaluation;
}
private ICPPEvaluation computeEvaluation() {
if (functionName == null || fArguments == null)
if (fFunctionName == null || fArguments == null)
return EvalFixed.INCOMPLETE;
ICPPEvaluation conversion= checkForExplicitTypeConversion();
@ -300,7 +318,7 @@ public class CPPASTFunctionCallExpression extends ASTNode
return conversion;
ICPPEvaluation[] args= new ICPPEvaluation[fArguments.length + 1];
args[0]= functionName.getEvaluation();
args[0]= fFunctionName.getEvaluation();
for (int i = 1; i < args.length; i++) {
args[i]= ((ICPPASTInitializerClause) fArguments[i - 1]).getEvaluation();
}
@ -308,8 +326,8 @@ public class CPPASTFunctionCallExpression extends ASTNode
}
private ICPPEvaluation checkForExplicitTypeConversion() {
if (functionName instanceof IASTIdExpression) {
final IASTName name = ((IASTIdExpression) functionName).getName();
if (fFunctionName instanceof IASTIdExpression) {
final IASTName name = ((IASTIdExpression) fFunctionName).getName();
IBinding b= name.resolvePreBinding();
if (b instanceof IType) {
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -9,6 +9,7 @@
* John Camelon (IBM) - Initial API and implementation
* Bryan Wilkinson (QNX)
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -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.IASTIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICPPASTCompletionContext;
@ -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.ProblemType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalID;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.FunctionSetType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICPPASTExpression, ICPPASTCompletionContext {
private IASTName name;
public class CPPASTIdExpression extends ASTNode
implements IASTIdExpression, ICPPASTExpression, ICPPASTCompletionContext {
private IASTName fName;
private ICPPEvaluation fEvaluation;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTIdExpression() {
}
@ -47,25 +52,34 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICP
@Override
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);
}
@Override
public IASTName getName() {
return name;
return fName;
}
@Override
public void setName(IASTName name) {
assertNotFrozen();
this.name = name;
this.fName = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(ID_NAME);
}
}
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (fImplicitDestructorNames == null) {
fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return fImplicitDestructorNames;
}
@Override
public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) {
@ -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) {
switch (action.leave(this)) {
@ -90,7 +107,7 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICP
@Override
public int getRoleForName(IASTName n) {
if (name == n)
if (fName == n)
return r_reference;
return r_unclear;
}
@ -102,7 +119,7 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICP
@Override
public String toString() {
return name != null ? name.toString() : "<unnamed>"; //$NON-NLS-1$
return fName != null ? fName.toString() : "<unnamed>"; //$NON-NLS-1$
}
@Override
@ -122,7 +139,7 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICP
public IType getExpressionType() {
IType type= getEvaluation().getTypeOrFunctionSet(this);
if (type instanceof FunctionSetType) {
IBinding binding= name.resolveBinding();
IBinding binding= fName.resolveBinding();
if (binding instanceof IFunction) {
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/
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.IASTCompoundStatement;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCapture;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
@ -71,11 +73,6 @@ public class CPPASTLambdaExpression extends ASTNode implements ICPPASTLambdaExpr
return copy(copy, style);
}
@Override
public IASTImplicitName[] getImplicitNames() {
return new IASTImplicitName[] {getFunctionCallOperatorName()};
}
@Override
public IASTImplicitName getClosureTypeName() {
if (fClosureTypeName == null) {
@ -109,6 +106,16 @@ public class CPPASTLambdaExpression extends ASTNode implements ICPPASTLambdaExpr
return fImplicitFunctionCallName;
}
@Override
public IASTImplicitName[] getImplicitNames() {
return new IASTImplicitName[] {getFunctionCallOperatorName()};
}
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; // Lambda expression is never a full-expression.
}
@Override
public boolean accept(ASTVisitor visitor) {
if (visitor.shouldVisitExpressions) {

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -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 org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.IScope;
@ -40,17 +42,17 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
public static final CPPASTLiteralExpression INT_ZERO =
new CPPASTLiteralExpression(lk_integer_constant, new char[] {'0'});
private int kind;
private char[] value = CharArrayUtils.EMPTY;
private int fStringLiteralSize = -1; // accounting for escape sequences and the null terminator
private int fKind;
private char[] fValue = CharArrayUtils.EMPTY;
private int fStringLiteralSize = -1; // Accounting for escape sequences and the null terminator.
private ICPPEvaluation fEvaluation;
public CPPASTLiteralExpression() {
}
public CPPASTLiteralExpression(int kind, char[] value) {
this.kind = kind;
this.value = value;
this.fKind = kind;
this.fValue = value;
}
@Override
@ -61,37 +63,42 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
@Override
public CPPASTLiteralExpression copy(CopyStyle style) {
CPPASTLiteralExpression copy =
new CPPASTLiteralExpression(kind, value == null ? null : value.clone());
new CPPASTLiteralExpression(fKind, fValue == null ? null : fValue.clone());
return copy(copy, style);
}
@Override
public int getKind() {
return kind;
return fKind;
}
@Override
public void setKind(int value) {
assertNotFrozen();
kind = value;
fKind = value;
}
@Override
public char[] getValue() {
return value;
return fValue;
}
@Override
public void setValue(char[] value) {
assertNotFrozen();
this.value= value;
this.fValue= value;
}
@Override
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
public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) {
@ -112,22 +119,22 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
}
private int computeStringLiteralSize() {
int start = 0, end = value.length - 1;
int start = 0, end = fValue.length - 1;
boolean isRaw = false;
// 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;
}
// If there is an 'R' prefix, skip past it but take note of it.
if (value[start] == 'R') {
if (fValue[start] == 'R') {
++start;
isRaw = true;
}
// Now we should have a quote-enclosed string. Skip past the quotes.
if (!(value[start] == '"' && value[end] == '"')) {
if (!(fValue[start] == '"' && fValue[end] == '"')) {
// Unexpected!
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 (isRaw) {
while (value[start] != '(' && start <= end) {
while (fValue[start] != '(' && start <= end) {
++start;
--end;
}
// Now we should have a parenthesis-enclosed string.
if (!(value[start] == '(' && value[end] == ')')) {
if (!(fValue[start] == '(' && fValue[end] == ')')) {
// Unexpected!
return 0;
}
@ -161,7 +168,7 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
if (escaping) {
escaping = false;
++length;
} else if (value[start] == '\\') {
} else if (fValue[start] == '\\') {
escaping = true;
} else {
++length;
@ -253,7 +260,7 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
@Deprecated
public void setValue(String value) {
assertNotFrozen();
this.value = value.toCharArray();
this.fValue = value.toCharArray();
}
/**
@ -272,7 +279,7 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
}
private ICPPEvaluation createEvaluation() {
switch (kind) {
switch (fKind) {
case lk_this: {
IScope scope = CPPVisitor.getContainingScope(this);
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
* are made available under the terms of the Eclipse Public License v1.0
* 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.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
@ -48,15 +49,16 @@ import org.eclipse.core.runtime.Assert;
* Represents a new expression [expr.new].
*/
public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression, IASTAmbiguityParent {
private IASTInitializerClause[] placement;
private IASTTypeId typeId;
private IASTInitializer initializer;
private IASTImplicitName[] implicitNames;
private boolean isGlobal;
private boolean isNewTypeId;
private IASTInitializerClause[] fPlacement;
private IASTTypeId fTypeId;
private IASTInitializer fInitializer;
private boolean fIsGlobal;
private boolean fIsNewTypeId;
private IASTExpression[] cachedArraySizes;
private IASTExpression[] fCachedArraySizes;
private ICPPEvaluation fEvaluation;
private IASTImplicitName[] fImplicitNames;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTNewExpression() {
}
@ -75,40 +77,40 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override
public CPPASTNewExpression copy(CopyStyle style) {
CPPASTNewExpression copy = new CPPASTNewExpression();
copy.setIsGlobal(isGlobal);
copy.setIsNewTypeId(isNewTypeId);
if (placement != null) {
IASTInitializerClause[] plcmt = new IASTInitializerClause[placement.length];
for (int i = 0; i < placement.length; i++) {
plcmt[i] = placement[i].copy(style);
copy.setIsGlobal(fIsGlobal);
copy.setIsNewTypeId(fIsNewTypeId);
if (fPlacement != null) {
IASTInitializerClause[] plcmt = new IASTInitializerClause[fPlacement.length];
for (int i = 0; i < fPlacement.length; i++) {
plcmt[i] = fPlacement[i].copy(style);
}
copy.setPlacementArguments(plcmt);
}
copy.setTypeId(typeId == null ? null : typeId.copy(style));
copy.setInitializer(initializer == null ? null : initializer.copy(style));
copy.setTypeId(fTypeId == null ? null : fTypeId.copy(style));
copy.setInitializer(fInitializer == null ? null : fInitializer.copy(style));
return copy(copy, style);
}
@Override
public boolean isGlobal() {
return isGlobal;
return fIsGlobal;
}
@Override
public void setIsGlobal(boolean value) {
assertNotFrozen();
isGlobal = value;
fIsGlobal = value;
}
@Override
public IASTInitializerClause[] getPlacementArguments() {
return placement;
return fPlacement;
}
@Override
public void setPlacementArguments(IASTInitializerClause[] args) {
assertNotFrozen();
placement = args;
fPlacement = args;
if (args != null) {
for (IASTInitializerClause arg : args) {
arg.setParent(this);
@ -119,13 +121,13 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override
public IASTInitializer getInitializer() {
return initializer;
return fInitializer;
}
@Override
public void setInitializer(IASTInitializer expression) {
assertNotFrozen();
initializer = expression;
fInitializer = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(NEW_INITIALIZER);
@ -134,13 +136,13 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override
public IASTTypeId getTypeId() {
return typeId;
return fTypeId;
}
@Override
public void setTypeId(IASTTypeId typeId) {
assertNotFrozen();
this.typeId = typeId;
fTypeId = typeId;
if (typeId != null) {
typeId.setParent(this);
typeId.setPropertyInParent(TYPE_ID);
@ -149,13 +151,13 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override
public boolean isNewTypeId() {
return isNewTypeId;
return fIsNewTypeId;
}
@Override
public void setIsNewTypeId(boolean value) {
assertNotFrozen();
isNewTypeId = value;
fIsNewTypeId = value;
}
/**
@ -163,7 +165,7 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
*/
@Override
public IASTImplicitName[] getImplicitNames() {
if (implicitNames == null) {
if (fImplicitNames == null) {
CPPASTImplicitName operatorName = null;
ICPPFunction operatorFunction = CPPSemantics.findOverloadedOperator(this);
if (operatorFunction != null && !(operatorFunction instanceof CPPImplicitFunction)) {
@ -183,22 +185,31 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
if (operatorName != null) {
if (constructorName != null) {
implicitNames = new IASTImplicitName[] { operatorName, constructorName };
fImplicitNames = new IASTImplicitName[] { operatorName, constructorName };
} else {
implicitNames = new IASTImplicitName[] { operatorName };
fImplicitNames = new IASTImplicitName[] { operatorName };
}
} else {
if (constructorName != null) {
implicitNames = new IASTImplicitName[] { constructorName };
fImplicitNames = new IASTImplicitName[] { constructorName };
} 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;
}
/**
* Returns true if this expression is allocating an array.
* @since 5.1
@ -232,18 +243,21 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
}
}
if (placement != null) {
for (IASTInitializerClause arg : placement) {
if (fPlacement != null) {
for (IASTInitializerClause arg : fPlacement) {
if (!arg.accept(action))
return false;
}
}
if (typeId != null && !typeId.accept(action))
if (fTypeId != null && !fTypeId.accept(action))
return false;
if (initializer != null && !initializer.accept(action))
if (fInitializer != null && !fInitializer.accept(action))
return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false;
if (action.shouldVisitExpressions) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
@ -256,12 +270,12 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override
public void replace(IASTNode child, IASTNode other) {
if (placement != null) {
for (int i = 0; i < placement.length; ++i) {
if (child == placement[i]) {
if (fPlacement != null) {
for (int i = 0; i < fPlacement.length; ++i) {
if (child == fPlacement[i]) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
placement[i] = (IASTExpression) other;
fPlacement[i] = (IASTExpression) other;
}
}
}
@ -270,13 +284,13 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override
public ICPPEvaluation getEvaluation() {
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) {
t = ((IArrayType) t).getType();
}
ICPPEvaluation[] arguments = ICPPEvaluation.EMPTY_ARRAY;
if (initializer instanceof ICPPASTConstructorInitializer) {
IASTInitializerClause[] args = ((ICPPASTConstructorInitializer) initializer).getArguments();
if (fInitializer instanceof ICPPASTConstructorInitializer) {
IASTInitializerClause[] args = ((ICPPASTConstructorInitializer) fInitializer).getArguments();
arguments= new ICPPEvaluation[args.length];
for (int i = 0; i < arguments.length; i++) {
arguments[i] = ((ICPPASTInitializerClause) args[i]).getEvaluation();
@ -305,40 +319,40 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override
@Deprecated
public IASTExpression[] getNewTypeIdArrayExpressions() {
if (cachedArraySizes == null) {
if (typeId != null) {
IASTDeclarator dtor = ASTQueries.findInnermostDeclarator(typeId.getAbstractDeclarator());
if (fCachedArraySizes == null) {
if (fTypeId != null) {
IASTDeclarator dtor = ASTQueries.findInnermostDeclarator(fTypeId.getAbstractDeclarator());
if (dtor instanceof IASTArrayDeclarator) {
IASTArrayDeclarator ad = (IASTArrayDeclarator) dtor;
IASTArrayModifier[] ams = ad.getArrayModifiers();
cachedArraySizes = new IASTExpression[ams.length];
fCachedArraySizes = new IASTExpression[ams.length];
for (int i = 0; i < ams.length; 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
@Deprecated
public void addNewTypeIdArrayExpression(IASTExpression expression) {
assertNotFrozen();
Assert.isNotNull(typeId);
IASTDeclarator dtor= ASTQueries.findInnermostDeclarator(typeId.getAbstractDeclarator());
Assert.isNotNull(fTypeId);
IASTDeclarator dtor= ASTQueries.findInnermostDeclarator(fTypeId.getAbstractDeclarator());
if (dtor instanceof IASTArrayDeclarator == false) {
Assert.isNotNull(dtor);
Assert.isTrue(dtor.getParent() == typeId);
Assert.isTrue(dtor.getParent() == fTypeId);
IASTArrayDeclarator adtor= new CPPASTArrayDeclarator(dtor.getName());
IASTPointerOperator[] ptrOps= dtor.getPointerOperators();
for (IASTPointerOperator ptr : ptrOps) {
adtor.addPointerOperator(ptr);
}
typeId.setAbstractDeclarator(adtor);
fTypeId.setAbstractDeclarator(adtor);
dtor= adtor;
}
IASTArrayModifier mod= new CPPASTArrayModifier(expression);
@ -349,16 +363,16 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override
@Deprecated
public IASTExpression getNewPlacement() {
if (placement == null || placement.length == 0)
if (fPlacement == null || fPlacement.length == 0)
return null;
if (placement.length == 1) {
if (placement[0] instanceof IASTExpression)
return (IASTExpression) placement[0];
if (fPlacement.length == 1) {
if (fPlacement[0] instanceof IASTExpression)
return (IASTExpression) fPlacement[0];
return null;
}
CASTExpressionList result= new CASTExpressionList();
for (IASTInitializerClause arg : placement) {
for (IASTInitializerClause arg : fPlacement) {
if (arg instanceof IASTExpression) {
result.addExpression(((IASTExpression) arg).copy());
}
@ -384,11 +398,11 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override
@Deprecated
public IASTExpression getNewInitializer() {
if (initializer == null || initializer instanceof IASTExpression) {
return (IASTExpression) initializer;
if (fInitializer == null || fInitializer instanceof IASTExpression) {
return (IASTExpression) fInitializer;
}
if (initializer instanceof ICPPASTConstructorInitializer) {
IASTExpression expr= ((ICPPASTConstructorInitializer) initializer).getExpression();
if (fInitializer instanceof ICPPASTConstructorInitializer) {
IASTExpression expr= ((ICPPASTConstructorInitializer) fInitializer).getExpression();
if (expr == null) {
expr= new CPPASTExpressionList();
} 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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -8,11 +8,13 @@
* Contributors:
* Markus Schorn - initial API and implementation
* Natan Ridge
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
@ -82,6 +84,11 @@ public class CPPASTPackExpansionExpression extends ASTNode implements ICPPASTPac
return fPattern.getValueCategory();
}
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; // Pack expression is never a full-expression.
}
@Override
public boolean accept(ASTVisitor visitor) {
if (visitor.shouldVisitExpressions) {

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

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -8,11 +8,13 @@
* Contributors:
* John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
@ -33,6 +35,7 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode
private ICPPASTDeclSpecifier fDeclSpec;
private IASTInitializer fInitializer;
private ICPPEvaluation fEvaluation;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTSimpleTypeConstructorExpression() {
}
@ -122,6 +125,15 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode
return false;
}
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (fImplicitDestructorNames == null) {
fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return fImplicitDestructorNames;
}
@Override
public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) {
@ -138,6 +150,9 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode
if (fInitializer != null && !fInitializer.accept(action))
return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(fImplicitDestructorNames, action))
return false;
if (action.shouldVisitExpressions) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
@ -148,8 +163,8 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode
return true;
}
@Override
@Deprecated
@Override
public int getSimpleType() {
IType type= getExpressionType();
if (type instanceof ICPPBasicType) {
@ -185,8 +200,8 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode
return t_unspecified;
}
@Override
@Deprecated
@Override
public void setSimpleType(int value) {
CPPASTSimpleDeclSpecifier declspec = new CPPASTSimpleDeclSpecifier();
switch(value) {
@ -234,8 +249,8 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode
setDeclSpecifier(declspec);
}
@Override
@Deprecated
@Override
public IASTExpression getInitialValue() {
if (fInitializer instanceof ICPPASTConstructorInitializer) {
return ((ICPPASTConstructorInitializer) fInitializer).getExpression();
@ -243,8 +258,8 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode
return null;
}
@Override
@Deprecated
@Override
public void setInitialValue(IASTExpression expression) {
ICPPASTConstructorInitializer init= new CPPASTConstructorInitializer();
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
* are made available under the terms of the Eclipse Public License v1.0
* 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.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
@ -174,4 +175,9 @@ public class CPPASTTemplateIDAmbiguity extends ASTAmbiguousNode
public IASTExpression[] getExpressions() {
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 org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IProblemType;
import org.eclipse.cdt.core.dom.ast.IType;
@ -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;
public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpression {
private int op;
private IASTTypeId typeId;
private int fOperator;
private IASTTypeId fTypeId;
private ICPPEvaluation fEvaluation;
public CPPASTTypeIdExpression() {
}
public CPPASTTypeIdExpression(int op, IASTTypeId typeId) {
this.op = op;
this.fOperator = op;
setTypeId(typeId);
}
@ -44,25 +45,25 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
@Override
public CPPASTTypeIdExpression copy(CopyStyle style) {
CPPASTTypeIdExpression copy =
new CPPASTTypeIdExpression(op, typeId == null ? null : typeId.copy(style));
new CPPASTTypeIdExpression(fOperator, fTypeId == null ? null : fTypeId.copy(style));
return copy(copy, style);
}
@Override
public int getOperator() {
return op;
return fOperator;
}
@Override
public void setOperator(int value) {
assertNotFrozen();
this.op = value;
fOperator = value;
}
@Override
public void setTypeId(IASTTypeId typeId) {
assertNotFrozen();
this.typeId = typeId;
this.fTypeId = typeId;
if (typeId != null) {
typeId.setParent(this);
typeId.setPropertyInParent(TYPE_ID);
@ -71,9 +72,14 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
@Override
public IASTTypeId getTypeId() {
return typeId;
return fTypeId;
}
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; // Type-id expression does not call destructors.
}
@Override
public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) {
@ -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) {
switch (action.leave(this)) {
@ -99,11 +105,11 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
@Override
public ICPPEvaluation getEvaluation() {
if (fEvaluation == null) {
IType type= CPPVisitor.createType(typeId);
IType type= CPPVisitor.createType(fTypeId);
if (type == null || type instanceof IProblemType) {
fEvaluation= EvalFixed.INCOMPLETE;
} else {
fEvaluation= new EvalUnaryTypeID(op, type, this);
fEvaluation= new EvalUnaryTypeID(fOperator, type, this);
}
}
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
* 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:
* 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;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName;
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IASTTypeIdInitializerExpression;
@ -17,35 +22,110 @@ import org.eclipse.cdt.core.dom.ast.IProblemType;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause;
import org.eclipse.cdt.internal.core.dom.parser.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.EvalFixed;
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 IASTImplicitDestructorName[] fImplicitDestructorNames;
private CPPASTTypeIdInitializerExpression() {
public CPPASTTypeIdInitializerExpression() {
}
public CPPASTTypeIdInitializerExpression(IASTTypeId typeId, IASTInitializer initializer) {
super(typeId, initializer);
public CPPASTTypeIdInitializerExpression(IASTTypeId t, IASTInitializer i) {
setTypeId(t);
setInitializer(i);
}
@Override
public IASTTypeId getTypeId() {
return fTypeId;
}
@Override
public void setTypeId(IASTTypeId typeId) {
assertNotFrozen();
this.fTypeId = typeId;
if (typeId != null) {
typeId.setParent(this);
typeId.setPropertyInParent(TYPE_ID);
}
}
@Override
public IASTInitializer getInitializer() {
return fInitializer;
}
@Override
public void setInitializer(IASTInitializer initializer) {
assertNotFrozen();
this.fInitializer = initializer;
if (initializer != null) {
initializer.setParent(this);
initializer.setPropertyInParent(INITIALIZER);
}
}
@Override
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
if (fImplicitDestructorNames == null) {
fImplicitDestructorNames = CPPVisitor.getTemporariesDestructorCalls(this);
}
return fImplicitDestructorNames;
}
@Override
public boolean accept(ASTVisitor action) {
if (action.shouldVisitExpressions) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if (fTypeId != null && !fTypeId.accept(action)) return false;
if (fInitializer != null && !fInitializer.accept(action)) return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(getImplicitDestructorNames(), action))
return false;
if (action.shouldVisitExpressions) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;
}
@Override
public final boolean isLValue() {
return false;
}
@Override
public IASTTypeIdInitializerExpression copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public IASTTypeIdInitializerExpression copy(CopyStyle style) {
CPPASTTypeIdInitializerExpression expr = new CPPASTTypeIdInitializerExpression();
initializeCopy(expr, style);
return expr;
CPPASTTypeIdInitializerExpression copy =new CPPASTTypeIdInitializerExpression(
fTypeId == null ? null : fTypeId.copy(style),
fInitializer == null ? null : fInitializer.copy(style));
return copy(copy, style);
}
@Override
@ -55,7 +135,7 @@ public class CPPASTTypeIdInitializerExpression extends ASTTypeIdInitializerExpre
return fEvaluation;
}
private ICPPEvaluation computeEvaluation() {
final IASTInitializer initializer = getInitializer();
if (!(initializer instanceof ICPPASTInitializerClause))
@ -68,13 +148,13 @@ public class CPPASTTypeIdInitializerExpression extends ASTTypeIdInitializerExpre
return new EvalTypeId(type, this, ((ICPPASTInitializerClause) initializer).getEvaluation());
}
@Override
@Override
public IType getExpressionType() {
return getEvaluation().getTypeOrFunctionSet(this);
}
return getEvaluation().getTypeOrFunctionSet(this);
}
@Override
public ValueCategory getValueCategory() {
return getEvaluation().getValueCategory(this);
return getEvaluation().getValueCategory(this);
}
}

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

View file

@ -37,7 +37,7 @@ public class CPPBlockScope extends CPPNamespaceScope implements ICPPBlockScope {
if (node instanceof IASTCompoundStatement) {
final IASTNode parent= node.getParent();
if (parent instanceof IASTFunctionDefinition) {
IASTDeclarator dtor= ((IASTFunctionDefinition)parent).getDeclarator();
IASTDeclarator dtor= ((IASTFunctionDefinition) parent).getDeclarator();
dtor = ASTQueries.findInnermostDeclarator(dtor);
return dtor.getName();
}

View file

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

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
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
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.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
@ -89,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_binary_expression=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_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
@ -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_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
@ -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.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=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.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@ -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_parameter=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
@ -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_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@ -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_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
@ -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_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
@ -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_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@ -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_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
@ -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_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@ -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.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true

View file

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