forked from qt-creator/qt-creator
C++: Rename NewPlacementAST to ExpressionListParenAST.
It'll be reused as the initializer expression for declarators that are followed by "( expression-list )". Change-Id: I6c76a76641941874ef1ed21daa7b6e057c6d170f Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
4
src/libs/3rdparty/cplusplus/AST.cpp
vendored
4
src/libs/3rdparty/cplusplus/AST.cpp
vendored
@@ -2069,7 +2069,7 @@ unsigned NewInitializerAST::lastToken() const
|
||||
}
|
||||
|
||||
/** \generated */
|
||||
unsigned NewPlacementAST::firstToken() const
|
||||
unsigned ExpressionListParenAST::firstToken() const
|
||||
{
|
||||
if (lparen_token)
|
||||
return lparen_token;
|
||||
@@ -2082,7 +2082,7 @@ unsigned NewPlacementAST::firstToken() const
|
||||
}
|
||||
|
||||
/** \generated */
|
||||
unsigned NewPlacementAST::lastToken() const
|
||||
unsigned ExpressionListParenAST::lastToken() const
|
||||
{
|
||||
if (rparen_token)
|
||||
return rparen_token + 1;
|
||||
|
||||
12
src/libs/3rdparty/cplusplus/AST.h
vendored
12
src/libs/3rdparty/cplusplus/AST.h
vendored
@@ -168,6 +168,7 @@ public:
|
||||
virtual ExceptionDeclarationAST *asExceptionDeclaration() { return 0; }
|
||||
virtual ExceptionSpecificationAST *asExceptionSpecification() { return 0; }
|
||||
virtual ExpressionAST *asExpression() { return 0; }
|
||||
virtual ExpressionListParenAST *asExpressionListParen() { return 0; }
|
||||
virtual ExpressionOrDeclarationStatementAST *asExpressionOrDeclarationStatement() { return 0; }
|
||||
virtual ExpressionStatementAST *asExpressionStatement() { return 0; }
|
||||
virtual ForStatementAST *asForStatement() { return 0; }
|
||||
@@ -196,7 +197,6 @@ public:
|
||||
virtual NewArrayDeclaratorAST *asNewArrayDeclarator() { return 0; }
|
||||
virtual NewExpressionAST *asNewExpression() { return 0; }
|
||||
virtual NewInitializerAST *asNewInitializer() { return 0; }
|
||||
virtual NewPlacementAST *asNewPlacement() { return 0; }
|
||||
virtual NewTypeIdAST *asNewTypeId() { return 0; }
|
||||
virtual NoExceptSpecificationAST *asNoExceptSpecification() { return 0; }
|
||||
virtual NumericLiteralAST *asNumericLiteral() { return 0; }
|
||||
@@ -2402,7 +2402,7 @@ protected:
|
||||
virtual bool match0(AST *, ASTMatcher *);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NewPlacementAST: public AST
|
||||
class CPLUSPLUS_EXPORT ExpressionListParenAST: public ExpressionAST
|
||||
{
|
||||
public:
|
||||
unsigned lparen_token;
|
||||
@@ -2410,18 +2410,18 @@ public:
|
||||
unsigned rparen_token;
|
||||
|
||||
public:
|
||||
NewPlacementAST()
|
||||
ExpressionListParenAST()
|
||||
: lparen_token(0)
|
||||
, expression_list(0)
|
||||
, rparen_token(0)
|
||||
{}
|
||||
|
||||
virtual NewPlacementAST *asNewPlacement() { return this; }
|
||||
virtual ExpressionListParenAST *asExpressionListParen() { return this; }
|
||||
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
virtual NewPlacementAST *clone(MemoryPool *pool) const;
|
||||
virtual ExpressionListParenAST *clone(MemoryPool *pool) const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
@@ -2459,7 +2459,7 @@ class CPLUSPLUS_EXPORT NewExpressionAST: public ExpressionAST
|
||||
public:
|
||||
unsigned scope_token;
|
||||
unsigned new_token;
|
||||
NewPlacementAST *new_placement;
|
||||
ExpressionListParenAST *new_placement;
|
||||
|
||||
unsigned lparen_token;
|
||||
ExpressionAST *type_id;
|
||||
|
||||
4
src/libs/3rdparty/cplusplus/ASTClone.cpp
vendored
4
src/libs/3rdparty/cplusplus/ASTClone.cpp
vendored
@@ -878,9 +878,9 @@ NamespaceAliasDefinitionAST *NamespaceAliasDefinitionAST::clone(MemoryPool *pool
|
||||
return ast;
|
||||
}
|
||||
|
||||
NewPlacementAST *NewPlacementAST::clone(MemoryPool *pool) const
|
||||
ExpressionListParenAST *ExpressionListParenAST::clone(MemoryPool *pool) const
|
||||
{
|
||||
NewPlacementAST *ast = new (pool) NewPlacementAST;
|
||||
ExpressionListParenAST *ast = new (pool) ExpressionListParenAST;
|
||||
ast->lparen_token = lparen_token;
|
||||
for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list;
|
||||
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
|
||||
|
||||
4
src/libs/3rdparty/cplusplus/ASTMatch0.cpp
vendored
4
src/libs/3rdparty/cplusplus/ASTMatch0.cpp
vendored
@@ -592,9 +592,9 @@ bool NamespaceAliasDefinitionAST::match0(AST *pattern, ASTMatcher *matcher)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NewPlacementAST::match0(AST *pattern, ASTMatcher *matcher)
|
||||
bool ExpressionListParenAST::match0(AST *pattern, ASTMatcher *matcher)
|
||||
{
|
||||
if (NewPlacementAST *_other = pattern->asNewPlacement())
|
||||
if (ExpressionListParenAST *_other = pattern->asExpressionListParen())
|
||||
return matcher->match(this, _other);
|
||||
|
||||
return false;
|
||||
|
||||
2
src/libs/3rdparty/cplusplus/ASTMatcher.cpp
vendored
2
src/libs/3rdparty/cplusplus/ASTMatcher.cpp
vendored
@@ -1492,7 +1492,7 @@ bool ASTMatcher::match(NamespaceAliasDefinitionAST *node, NamespaceAliasDefiniti
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTMatcher::match(NewPlacementAST *node, NewPlacementAST *pattern)
|
||||
bool ASTMatcher::match(ExpressionListParenAST *node, ExpressionListParenAST *pattern)
|
||||
{
|
||||
(void) node;
|
||||
(void) pattern;
|
||||
|
||||
2
src/libs/3rdparty/cplusplus/ASTMatcher.h
vendored
2
src/libs/3rdparty/cplusplus/ASTMatcher.h
vendored
@@ -71,6 +71,7 @@ public:
|
||||
virtual bool match(EnumSpecifierAST *node, EnumSpecifierAST *pattern);
|
||||
virtual bool match(EnumeratorAST *node, EnumeratorAST *pattern);
|
||||
virtual bool match(ExceptionDeclarationAST *node, ExceptionDeclarationAST *pattern);
|
||||
virtual bool match(ExpressionListParenAST *node, ExpressionListParenAST *pattern);
|
||||
virtual bool match(ExpressionOrDeclarationStatementAST *node, ExpressionOrDeclarationStatementAST *pattern);
|
||||
virtual bool match(ExpressionStatementAST *node, ExpressionStatementAST *pattern);
|
||||
virtual bool match(ForStatementAST *node, ForStatementAST *pattern);
|
||||
@@ -98,7 +99,6 @@ public:
|
||||
virtual bool match(NewArrayDeclaratorAST *node, NewArrayDeclaratorAST *pattern);
|
||||
virtual bool match(NewExpressionAST *node, NewExpressionAST *pattern);
|
||||
virtual bool match(NewInitializerAST *node, NewInitializerAST *pattern);
|
||||
virtual bool match(NewPlacementAST *node, NewPlacementAST *pattern);
|
||||
virtual bool match(NewTypeIdAST *node, NewTypeIdAST *pattern);
|
||||
virtual bool match(NoExceptSpecificationAST *node, NoExceptSpecificationAST *pattern);
|
||||
virtual bool match(NumericLiteralAST *node, NumericLiteralAST *pattern);
|
||||
|
||||
@@ -578,9 +578,9 @@ public:
|
||||
return __ast;
|
||||
}
|
||||
|
||||
NewPlacementAST *NewPlacement(ExpressionListAST *expression_list = 0)
|
||||
ExpressionListParenAST *ExpressionListParen(ExpressionListAST *expression_list = 0)
|
||||
{
|
||||
NewPlacementAST *__ast = new (&pool) NewPlacementAST;
|
||||
ExpressionListParenAST *__ast = new (&pool) ExpressionListParenAST;
|
||||
__ast->expression_list = expression_list;
|
||||
return __ast;
|
||||
}
|
||||
@@ -592,7 +592,7 @@ public:
|
||||
return __ast;
|
||||
}
|
||||
|
||||
NewExpressionAST *NewExpression(NewPlacementAST *new_placement = 0, ExpressionAST *type_id = 0, NewTypeIdAST *new_type_id = 0, NewInitializerAST *new_initializer = 0)
|
||||
NewExpressionAST *NewExpression(ExpressionListParenAST *new_placement = 0, ExpressionAST *type_id = 0, NewTypeIdAST *new_type_id = 0, NewInitializerAST *new_initializer = 0)
|
||||
{
|
||||
NewExpressionAST *__ast = new (&pool) NewExpressionAST;
|
||||
__ast->new_placement = new_placement;
|
||||
|
||||
2
src/libs/3rdparty/cplusplus/ASTVisit.cpp
vendored
2
src/libs/3rdparty/cplusplus/ASTVisit.cpp
vendored
@@ -636,7 +636,7 @@ void NamespaceAliasDefinitionAST::accept0(ASTVisitor *visitor)
|
||||
visitor->endVisit(this);
|
||||
}
|
||||
|
||||
void NewPlacementAST::accept0(ASTVisitor *visitor)
|
||||
void ExpressionListParenAST::accept0(ASTVisitor *visitor)
|
||||
{
|
||||
if (visitor->visit(this)) {
|
||||
accept(expression_list, visitor);
|
||||
|
||||
4
src/libs/3rdparty/cplusplus/ASTVisitor.h
vendored
4
src/libs/3rdparty/cplusplus/ASTVisitor.h
vendored
@@ -113,6 +113,7 @@ public:
|
||||
virtual bool visit(EnumSpecifierAST *) { return true; }
|
||||
virtual bool visit(EnumeratorAST *) { return true; }
|
||||
virtual bool visit(ExceptionDeclarationAST *) { return true; }
|
||||
virtual bool visit(ExpressionListParenAST *) { return true; }
|
||||
virtual bool visit(ExpressionOrDeclarationStatementAST *) { return true; }
|
||||
virtual bool visit(ExpressionStatementAST *) { return true; }
|
||||
virtual bool visit(ForStatementAST *) { return true; }
|
||||
@@ -140,7 +141,6 @@ public:
|
||||
virtual bool visit(NewArrayDeclaratorAST *) { return true; }
|
||||
virtual bool visit(NewExpressionAST *) { return true; }
|
||||
virtual bool visit(NewInitializerAST *) { return true; }
|
||||
virtual bool visit(NewPlacementAST *) { return true; }
|
||||
virtual bool visit(NewTypeIdAST *) { return true; }
|
||||
virtual bool visit(NoExceptSpecificationAST *) { return true; }
|
||||
virtual bool visit(NumericLiteralAST *) { return true; }
|
||||
@@ -257,6 +257,7 @@ public:
|
||||
virtual void endVisit(EnumSpecifierAST *) {}
|
||||
virtual void endVisit(EnumeratorAST *) {}
|
||||
virtual void endVisit(ExceptionDeclarationAST *) {}
|
||||
virtual void endVisit(ExpressionListParenAST *) {}
|
||||
virtual void endVisit(ExpressionOrDeclarationStatementAST *) {}
|
||||
virtual void endVisit(ExpressionStatementAST *) {}
|
||||
virtual void endVisit(ForStatementAST *) {}
|
||||
@@ -284,7 +285,6 @@ public:
|
||||
virtual void endVisit(NewArrayDeclaratorAST *) {}
|
||||
virtual void endVisit(NewExpressionAST *) {}
|
||||
virtual void endVisit(NewInitializerAST *) {}
|
||||
virtual void endVisit(NewPlacementAST *) {}
|
||||
virtual void endVisit(NewTypeIdAST *) {}
|
||||
virtual void endVisit(NoExceptSpecificationAST *) {}
|
||||
virtual void endVisit(NumericLiteralAST *) {}
|
||||
|
||||
2
src/libs/3rdparty/cplusplus/ASTfwd.h
vendored
2
src/libs/3rdparty/cplusplus/ASTfwd.h
vendored
@@ -75,6 +75,7 @@ class EnumeratorAST;
|
||||
class ExceptionDeclarationAST;
|
||||
class ExceptionSpecificationAST;
|
||||
class ExpressionAST;
|
||||
class ExpressionListParenAST;
|
||||
class ExpressionOrDeclarationStatementAST;
|
||||
class ExpressionStatementAST;
|
||||
class ForStatementAST;
|
||||
@@ -103,7 +104,6 @@ class NestedNameSpecifierAST;
|
||||
class NewArrayDeclaratorAST;
|
||||
class NewExpressionAST;
|
||||
class NewInitializerAST;
|
||||
class NewPlacementAST;
|
||||
class NewTypeIdAST;
|
||||
class NoExceptSpecificationAST;
|
||||
class NumericLiteralAST;
|
||||
|
||||
4
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
4
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
@@ -539,14 +539,14 @@ const Name *Bind::nestedNameSpecifier(NestedNameSpecifierAST *ast)
|
||||
return class_or_namespace_name;
|
||||
}
|
||||
|
||||
bool Bind::visit(NewPlacementAST *ast)
|
||||
bool Bind::visit(ExpressionListParenAST *ast)
|
||||
{
|
||||
(void) ast;
|
||||
assert(!"unreachable");
|
||||
return false;
|
||||
}
|
||||
|
||||
void Bind::newPlacement(NewPlacementAST *ast)
|
||||
void Bind::newPlacement(ExpressionListParenAST *ast)
|
||||
{
|
||||
if (! ast)
|
||||
return;
|
||||
|
||||
4
src/libs/3rdparty/cplusplus/Bind.h
vendored
4
src/libs/3rdparty/cplusplus/Bind.h
vendored
@@ -85,7 +85,7 @@ protected:
|
||||
FullySpecifiedType exceptionSpecification(ExceptionSpecificationAST *ast, const FullySpecifiedType &init);
|
||||
void memInitializer(MemInitializerAST *ast, Function *fun);
|
||||
const Name *nestedNameSpecifier(NestedNameSpecifierAST *ast);
|
||||
void newPlacement(NewPlacementAST *ast);
|
||||
void newPlacement(ExpressionListParenAST *ast);
|
||||
FullySpecifiedType newArrayDeclarator(NewArrayDeclaratorAST *ast, const FullySpecifiedType &init);
|
||||
void newInitializer(NewInitializerAST *ast);
|
||||
FullySpecifiedType newTypeId(NewTypeIdAST *ast);
|
||||
@@ -122,7 +122,7 @@ protected:
|
||||
virtual bool visit(DynamicExceptionSpecificationAST *ast);
|
||||
virtual bool visit(MemInitializerAST *ast);
|
||||
virtual bool visit(NestedNameSpecifierAST *ast);
|
||||
virtual bool visit(NewPlacementAST *ast);
|
||||
virtual bool visit(ExpressionListParenAST *ast);
|
||||
virtual bool visit(NewArrayDeclaratorAST *ast);
|
||||
virtual bool visit(NewInitializerAST *ast);
|
||||
virtual bool visit(NewTypeIdAST *ast);
|
||||
|
||||
14
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
14
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
@@ -2731,6 +2731,8 @@ bool Parser::parseTypeIdList(ExpressionListAST *&node)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Note that this function doesn't parse a C++11-style expression-list
|
||||
// yet, so it doesn't allow for brace-initializers.
|
||||
bool Parser::parseExpressionList(ExpressionListAST *&node)
|
||||
{
|
||||
DEBUG_THIS_RULE();
|
||||
@@ -4827,7 +4829,7 @@ bool Parser::parseUnaryExpression(ExpressionAST *&node)
|
||||
}
|
||||
|
||||
// new-placement ::= T_LPAREN expression-list T_RPAREN
|
||||
bool Parser::parseNewPlacement(NewPlacementAST *&node)
|
||||
bool Parser::parseExpressionListParen(ExpressionListParenAST *&node)
|
||||
{
|
||||
DEBUG_THIS_RULE();
|
||||
if (LA() == T_LPAREN) {
|
||||
@@ -4835,7 +4837,7 @@ bool Parser::parseNewPlacement(NewPlacementAST *&node)
|
||||
ExpressionListAST *expression_list = 0;
|
||||
if (parseExpressionList(expression_list) && expression_list && LA() == T_RPAREN) {
|
||||
unsigned rparen_token = consumeToken();
|
||||
NewPlacementAST *ast = new (_pool) NewPlacementAST;
|
||||
ExpressionListParenAST *ast = new (_pool) ExpressionListParenAST;
|
||||
ast->lparen_token = lparen_token;
|
||||
ast->expression_list = expression_list;
|
||||
ast->rparen_token = rparen_token;
|
||||
@@ -4863,14 +4865,14 @@ bool Parser::parseNewExpression(ExpressionAST *&node)
|
||||
|
||||
ast->new_token = consumeToken();
|
||||
|
||||
NewPlacementAST *new_placement = 0;
|
||||
ExpressionListParenAST *parenExpressionList = 0;
|
||||
|
||||
if (parseNewPlacement(new_placement)) {
|
||||
if (parseExpressionListParen(parenExpressionList)) {
|
||||
unsigned after_new_placement = cursor();
|
||||
|
||||
NewTypeIdAST *new_type_id = 0;
|
||||
if (parseNewTypeId(new_type_id)) {
|
||||
ast->new_placement = new_placement;
|
||||
ast->new_placement = parenExpressionList;
|
||||
ast->new_type_id = new_type_id;
|
||||
parseNewInitializer(ast->new_initializer);
|
||||
// recognized new-placement.opt new-type-id new-initializer.opt
|
||||
@@ -4883,7 +4885,7 @@ bool Parser::parseNewExpression(ExpressionAST *&node)
|
||||
unsigned lparen_token = consumeToken();
|
||||
ExpressionAST *type_id = 0;
|
||||
if (parseTypeId(type_id) && LA() == T_RPAREN) {
|
||||
ast->new_placement = new_placement;
|
||||
ast->new_placement = parenExpressionList;
|
||||
ast->lparen_token = lparen_token;
|
||||
ast->type_id = type_id;
|
||||
ast->rparen_token = consumeToken();
|
||||
|
||||
2
src/libs/3rdparty/cplusplus/Parser.h
vendored
2
src/libs/3rdparty/cplusplus/Parser.h
vendored
@@ -131,7 +131,7 @@ public:
|
||||
bool parseNamespaceAliasDefinition(DeclarationAST *&node);
|
||||
bool parseNewArrayDeclarator(NewArrayDeclaratorListAST *&node);
|
||||
bool parseNewExpression(ExpressionAST *&node);
|
||||
bool parseNewPlacement(NewPlacementAST *&node);
|
||||
bool parseExpressionListParen(ExpressionListParenAST *&node);
|
||||
bool parseNewInitializer(NewInitializerAST *&node);
|
||||
bool parseNewTypeId(NewTypeIdAST *&node);
|
||||
bool parseOperator(OperatorAST *&node);
|
||||
|
||||
Reference in New Issue
Block a user