forked from qt-creator/qt-creator
C++: Add support for C++11 range-based 'for' loops
Change-Id: I7eef048a7952a79f031ae3d0abba68e3c5ffbfb8 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
committed by
Roberto Raggi
parent
7f943caedb
commit
da2aa0df72
@@ -1050,6 +1050,23 @@ bool FindUsages::visit(ForeachStatementAST *ast)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FindUsages::visit(RangeBasedForStatementAST *ast)
|
||||
{
|
||||
Scope *previousScope = switchScope(ast->symbol);
|
||||
for (SpecifierListAST *it = ast->type_specifier_list; it; it = it->next) {
|
||||
this->specifier(it->value);
|
||||
}
|
||||
this->declarator(ast->declarator);
|
||||
this->expression(ast->initializer);
|
||||
// unsigned comma_token = ast->comma_token;
|
||||
this->expression(ast->expression);
|
||||
// unsigned rparen_token = ast->rparen_token;
|
||||
this->statement(ast->statement);
|
||||
// Block *symbol = ast->symbol;
|
||||
(void) switchScope(previousScope);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FindUsages::visit(ForStatementAST *ast)
|
||||
{
|
||||
// unsigned for_token = ast->for_token;
|
||||
@@ -2215,5 +2232,3 @@ bool FindUsages::visit(ArrayDeclaratorAST *ast)
|
||||
// unsigned rbracket_token = ast->rbracket_token;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -171,6 +171,7 @@ protected:
|
||||
virtual bool visit(ExpressionOrDeclarationStatementAST *ast);
|
||||
virtual bool visit(ExpressionStatementAST *ast);
|
||||
virtual bool visit(ForeachStatementAST *ast);
|
||||
virtual bool visit(RangeBasedForStatementAST *ast);
|
||||
virtual bool visit(ForStatementAST *ast);
|
||||
virtual bool visit(IfStatementAST *ast);
|
||||
virtual bool visit(LabeledStatementAST *ast);
|
||||
|
||||
@@ -144,6 +144,15 @@ bool FindCdbBreakpoint::visit(ForeachStatementAST *ast)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FindCdbBreakpoint::visit(RangeBasedForStatementAST *ast)
|
||||
{
|
||||
if (m_initialLine <= endLine(ast->rparen_token))
|
||||
foundLine(ast->rparen_token);
|
||||
|
||||
accept(ast->statement);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FindCdbBreakpoint::visit(ForStatementAST *ast)
|
||||
{
|
||||
if (m_initialLine <= endLine(ast->rparen_token))
|
||||
|
||||
@@ -78,6 +78,7 @@ protected:
|
||||
bool visit(DoStatementAST *ast);
|
||||
bool visit(ExpressionStatementAST *ast);
|
||||
bool visit(ForeachStatementAST *ast);
|
||||
bool visit(RangeBasedForStatementAST *ast);
|
||||
bool visit(ForStatementAST *ast);
|
||||
bool visit(IfStatementAST *ast);
|
||||
bool visit(LabeledStatementAST *ast);
|
||||
|
||||
Reference in New Issue
Block a user