mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 16:56:04 +02:00
fixed member initializer bug, and a couple others
This commit is contained in:
parent
1c53e978a3
commit
1eac4740d0
13 changed files with 8605 additions and 8542 deletions
|
@ -67,11 +67,52 @@ public class C99CompleteParser2Tests extends CompleteParser2Tests {
|
|||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public void testBug102376() throws Exception { // gcc extension
|
||||
try {
|
||||
super.testBug102376();
|
||||
fail();
|
||||
} catch(AssertionFailedError _) { }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test158192_declspec_in_declarator() throws Exception {
|
||||
try {
|
||||
super.test158192_declspec_in_declarator();
|
||||
fail();
|
||||
} catch(AssertionFailedError _) { }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test158192_declspec_on_class() throws Exception {
|
||||
try {
|
||||
super.test158192_declspec_on_class();
|
||||
fail();
|
||||
} catch(AssertionFailedError _) { }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test158192_declspec_on_variable() throws Exception {
|
||||
try {
|
||||
super.test158192_declspec_on_variable();
|
||||
fail();
|
||||
} catch(AssertionFailedError _) { }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testPredefinedSymbol_bug70928() throws Exception {
|
||||
try {
|
||||
super.testPredefinedSymbol_bug70928();
|
||||
fail();
|
||||
} catch(AssertionFailedError _) { }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testBug64010() throws Exception { // 10000 else-ifs, busts LPG's stack
|
||||
try {
|
||||
super.testBug64010();
|
||||
fail();
|
||||
} catch(AssertionFailedError _) { }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -572,16 +572,12 @@ unary_expression
|
|||
new_expression -- done
|
||||
::= dcolon_opt 'new' new_placement_opt new_type_id <openscope-ast> new_array_expressions_opt new_initializer_opt
|
||||
/. $Build consumeExpressionNew(true); $EndBuild ./
|
||||
| dcolon_opt 'new' new_placement_opt '(' type_id ')' new_initializer_opt
|
||||
| dcolon_opt 'new' new_placement_opt '(' type_id ')' <openscope-ast> new_array_expressions_opt new_initializer_opt
|
||||
/. $Build consumeExpressionNew(false); $EndBuild ./
|
||||
|
||||
|
||||
new_placement -- done
|
||||
new_placement_opt
|
||||
::= '(' expression_list ')'
|
||||
|
||||
|
||||
new_placement_opt -- done
|
||||
::= new_placement
|
||||
| $empty
|
||||
/. $Build consumeEmpty(); $EndBuild ./
|
||||
|
||||
|
@ -613,11 +609,11 @@ new_array_expressions_opt
|
|||
| $empty
|
||||
|
||||
|
||||
new_initializer -- done
|
||||
new_initializer
|
||||
::= '(' expression_list_opt ')' -- even if the parens are there we get null in the AST
|
||||
|
||||
|
||||
new_initializer_opt -- done
|
||||
new_initializer_opt
|
||||
::= new_initializer
|
||||
| $empty
|
||||
/. $Build consumeEmpty(); $EndBuild ./
|
||||
|
@ -1334,6 +1330,7 @@ type_id
|
|||
|
||||
|
||||
-- more lenient than spec, but easier to deal with
|
||||
-- TODO are conflicts resolved by using the more strict rule?
|
||||
type_specifier_seq
|
||||
::= declaration_specifiers
|
||||
|
||||
|
@ -1554,6 +1551,7 @@ bit_field_declarator
|
|||
|
||||
constant_initializer
|
||||
::= '=' constant_expression
|
||||
/. $Build consumeInitializer(); $EndBuild ./
|
||||
|
||||
|
||||
base_clause
|
||||
|
|
|
@ -251,8 +251,7 @@ public abstract class BuildASTParserAction {
|
|||
protected static void setOffsetAndLength(IASTNode node, int offset, int length) {
|
||||
((ASTNode)node).setOffsetAndLength(offset, length);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates a IASTName node from an identifier token.
|
||||
|
@ -871,7 +870,6 @@ public abstract class BuildASTParserAction {
|
|||
// these two expressions may be null, see consumeExpressionOptional()
|
||||
IASTExpression expr3 = (IASTExpression) astStack.pop();
|
||||
IASTExpression expr2 = (IASTExpression) astStack.pop();
|
||||
|
||||
IASTNode node = (IASTNode) astStack.pop(); // may be an expression or a declaration
|
||||
|
||||
IASTStatement initializer;
|
||||
|
@ -882,6 +880,8 @@ public abstract class BuildASTParserAction {
|
|||
else // its null
|
||||
initializer = nodeFactory.newNullStatement();
|
||||
|
||||
setOffsetAndLength(initializer, offset(node), length(node));
|
||||
|
||||
IASTForStatement forStat = nodeFactory.newForStatement(initializer, expr2, expr3, body);
|
||||
setOffsetAndLength(forStat);
|
||||
astStack.push(forStat);
|
||||
|
@ -1284,10 +1284,10 @@ public abstract class BuildASTParserAction {
|
|||
public void consumeInitializer() {
|
||||
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
|
||||
|
||||
IASTExpression assignmentExpr = (IASTExpression) astStack.pop();
|
||||
IASTInitializerExpression expr = nodeFactory.newInitializerExpression(assignmentExpr);
|
||||
setOffsetAndLength(expr);
|
||||
astStack.push(expr);
|
||||
IASTExpression expr = (IASTExpression) astStack.pop();
|
||||
IASTInitializerExpression initializer = nodeFactory.newInitializerExpression(expr);
|
||||
setOffsetAndLength(initializer);
|
||||
astStack.push(initializer);
|
||||
|
||||
if(TRACE_AST_STACK) System.out.println(astStack);
|
||||
}
|
||||
|
|
|
@ -146,30 +146,23 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
|
|||
/**
|
||||
* new_expression
|
||||
* ::= dcolon_opt 'new' new_placement_opt new_type_id <openscope-ast> new_array_expressions_op new_initializer_opt
|
||||
* | dcolon_opt 'new' new_placement_opt '(' type_id ')' new_initializer_opt
|
||||
* | dcolon_opt 'new' new_placement_opt '(' type_id ')' <openscope-ast> new_array_expressions_op new_initializer_opt
|
||||
*/
|
||||
public void consumeExpressionNew(boolean isNewTypeId) {
|
||||
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
|
||||
|
||||
IASTExpression initializer = (IASTExpression) astStack.pop(); // may be null
|
||||
|
||||
List<Object> arrayExpressions = Collections.emptyList();
|
||||
if(isNewTypeId) {
|
||||
arrayExpressions = astStack.closeScope();
|
||||
}
|
||||
|
||||
List<Object> arrayExpressions = astStack.closeScope();
|
||||
IASTTypeId typeId = (IASTTypeId) astStack.pop();
|
||||
IASTExpression placement = (IASTExpression) astStack.pop(); // may be null
|
||||
|
||||
boolean hasDoubleColon = astStack.pop() == PLACE_HOLDER;
|
||||
|
||||
ICPPASTNewExpression newExpression = nodeFactory.newCPPNewExpression(placement, initializer, typeId);
|
||||
newExpression.setIsGlobal(hasDoubleColon);
|
||||
newExpression.setIsNewTypeId(isNewTypeId);
|
||||
|
||||
for(Object expr : arrayExpressions) {
|
||||
for(Object expr : arrayExpressions)
|
||||
newExpression.addNewTypeIdArrayExpression((IASTExpression)expr);
|
||||
}
|
||||
|
||||
setOffsetAndLength(newExpression);
|
||||
astStack.push(newExpression);
|
||||
|
@ -188,9 +181,8 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
|
|||
IASTName name = nodeFactory.newName();
|
||||
IASTDeclarator declarator = nodeFactory.newDeclarator(name);
|
||||
|
||||
for(Object pointer : astStack.closeScope()) {
|
||||
for(Object pointer : astStack.closeScope())
|
||||
declarator.addPointerOperator((IASTPointerOperator)pointer);
|
||||
}
|
||||
|
||||
setOffsetAndLength(declarator);
|
||||
astStack.push(declarator);
|
||||
|
|
|
@ -37,7 +37,6 @@ class BindingCheckVisitor extends CASTVisitor {
|
|||
shouldVisitEnumerators = true;
|
||||
shouldVisitTranslationUnit = true;
|
||||
shouldVisitProblems = false;
|
||||
shouldVisitDesignators = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue