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
45
src/libs/3rdparty/cplusplus/AST.h
vendored
45
src/libs/3rdparty/cplusplus/AST.h
vendored
@@ -247,6 +247,7 @@ public:
|
||||
virtual QtPropertyDeclarationAST *asQtPropertyDeclaration() { return 0; }
|
||||
virtual QtPropertyDeclarationItemAST *asQtPropertyDeclarationItem() { return 0; }
|
||||
virtual QualifiedNameAST *asQualifiedName() { return 0; }
|
||||
virtual RangeBasedForStatementAST *asRangeBasedForStatement() { return 0; }
|
||||
virtual ReferenceAST *asReference() { return 0; }
|
||||
virtual ReturnStatementAST *asReturnStatement() { return 0; }
|
||||
virtual SimpleDeclarationAST *asSimpleDeclaration() { return 0; }
|
||||
@@ -1906,6 +1907,50 @@ protected:
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT RangeBasedForStatementAST : public StatementAST
|
||||
{
|
||||
public:
|
||||
unsigned for_token;
|
||||
unsigned lparen_token;
|
||||
// declaration
|
||||
SpecifierListAST *type_specifier_list;
|
||||
DeclaratorAST *declarator;
|
||||
// or an expression
|
||||
ExpressionAST *initializer;
|
||||
unsigned colon_token;
|
||||
ExpressionAST *expression;
|
||||
unsigned rparen_token;
|
||||
StatementAST *statement;
|
||||
|
||||
public: // annotations
|
||||
Block *symbol;
|
||||
|
||||
public:
|
||||
RangeBasedForStatementAST()
|
||||
: for_token(0)
|
||||
, lparen_token(0)
|
||||
, type_specifier_list(0)
|
||||
, declarator(0)
|
||||
, initializer(0)
|
||||
, colon_token(0)
|
||||
, expression(0)
|
||||
, rparen_token(0)
|
||||
, statement(0)
|
||||
, symbol(0)
|
||||
{}
|
||||
|
||||
virtual RangeBasedForStatementAST *asRangeBasedForStatement() { return this; }
|
||||
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual RangeBasedForStatementAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT ForStatementAST: public StatementAST
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user