forked from qt-creator/qt-creator
C++11: More (expression-list) or brace-init-list.
This time in the 'new' expression. Changed it to make
new C(1, abc...) and new C{1, abc}
work.
Change-Id: I7232798fd083b653ee04ef9ede386d6536133e16
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
26
src/libs/3rdparty/cplusplus/AST.cpp
vendored
26
src/libs/3rdparty/cplusplus/AST.cpp
vendored
@@ -2052,32 +2052,6 @@ unsigned NewExpressionAST::lastToken() const
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \generated */
|
|
||||||
unsigned NewInitializerAST::firstToken() const
|
|
||||||
{
|
|
||||||
if (lparen_token)
|
|
||||||
return lparen_token;
|
|
||||||
if (expression)
|
|
||||||
if (unsigned candidate = expression->firstToken())
|
|
||||||
return candidate;
|
|
||||||
if (rparen_token)
|
|
||||||
return rparen_token;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \generated */
|
|
||||||
unsigned NewInitializerAST::lastToken() const
|
|
||||||
{
|
|
||||||
if (rparen_token)
|
|
||||||
return rparen_token + 1;
|
|
||||||
if (expression)
|
|
||||||
if (unsigned candidate = expression->lastToken())
|
|
||||||
return candidate;
|
|
||||||
if (lparen_token)
|
|
||||||
return lparen_token + 1;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \generated */
|
/** \generated */
|
||||||
unsigned ExpressionListParenAST::firstToken() const
|
unsigned ExpressionListParenAST::firstToken() const
|
||||||
{
|
{
|
||||||
|
|||||||
29
src/libs/3rdparty/cplusplus/AST.h
vendored
29
src/libs/3rdparty/cplusplus/AST.h
vendored
@@ -198,7 +198,6 @@ public:
|
|||||||
virtual NestedNameSpecifierAST *asNestedNameSpecifier() { return 0; }
|
virtual NestedNameSpecifierAST *asNestedNameSpecifier() { return 0; }
|
||||||
virtual NewArrayDeclaratorAST *asNewArrayDeclarator() { return 0; }
|
virtual NewArrayDeclaratorAST *asNewArrayDeclarator() { return 0; }
|
||||||
virtual NewExpressionAST *asNewExpression() { return 0; }
|
virtual NewExpressionAST *asNewExpression() { return 0; }
|
||||||
virtual NewInitializerAST *asNewInitializer() { return 0; }
|
|
||||||
virtual NewTypeIdAST *asNewTypeId() { return 0; }
|
virtual NewTypeIdAST *asNewTypeId() { return 0; }
|
||||||
virtual NoExceptSpecificationAST *asNoExceptSpecification() { return 0; }
|
virtual NoExceptSpecificationAST *asNoExceptSpecification() { return 0; }
|
||||||
virtual NumericLiteralAST *asNumericLiteral() { return 0; }
|
virtual NumericLiteralAST *asNumericLiteral() { return 0; }
|
||||||
@@ -2502,7 +2501,7 @@ public:
|
|||||||
|
|
||||||
NewTypeIdAST *new_type_id;
|
NewTypeIdAST *new_type_id;
|
||||||
|
|
||||||
NewInitializerAST *new_initializer;
|
ExpressionAST *new_initializer; // either ExpressionListParenAST or BracedInitializerAST
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NewExpressionAST()
|
NewExpressionAST()
|
||||||
@@ -2528,32 +2527,6 @@ protected:
|
|||||||
virtual bool match0(AST *, ASTMatcher *);
|
virtual bool match0(AST *, ASTMatcher *);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPLUSPLUS_EXPORT NewInitializerAST: public AST
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
unsigned lparen_token;
|
|
||||||
ExpressionAST *expression;
|
|
||||||
unsigned rparen_token;
|
|
||||||
|
|
||||||
public:
|
|
||||||
NewInitializerAST()
|
|
||||||
: lparen_token(0)
|
|
||||||
, expression(0)
|
|
||||||
, rparen_token(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
virtual NewInitializerAST *asNewInitializer() { return this; }
|
|
||||||
|
|
||||||
virtual unsigned firstToken() const;
|
|
||||||
virtual unsigned lastToken() const;
|
|
||||||
|
|
||||||
virtual NewInitializerAST *clone(MemoryPool *pool) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void accept0(ASTVisitor *visitor);
|
|
||||||
virtual bool match0(AST *, ASTMatcher *);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CPLUSPLUS_EXPORT NewTypeIdAST: public AST
|
class CPLUSPLUS_EXPORT NewTypeIdAST: public AST
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
10
src/libs/3rdparty/cplusplus/ASTClone.cpp
vendored
10
src/libs/3rdparty/cplusplus/ASTClone.cpp
vendored
@@ -930,16 +930,6 @@ NewExpressionAST *NewExpressionAST::clone(MemoryPool *pool) const
|
|||||||
return ast;
|
return ast;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewInitializerAST *NewInitializerAST::clone(MemoryPool *pool) const
|
|
||||||
{
|
|
||||||
NewInitializerAST *ast = new (pool) NewInitializerAST;
|
|
||||||
ast->lparen_token = lparen_token;
|
|
||||||
if (expression)
|
|
||||||
ast->expression = expression->clone(pool);
|
|
||||||
ast->rparen_token = rparen_token;
|
|
||||||
return ast;
|
|
||||||
}
|
|
||||||
|
|
||||||
NewTypeIdAST *NewTypeIdAST::clone(MemoryPool *pool) const
|
NewTypeIdAST *NewTypeIdAST::clone(MemoryPool *pool) const
|
||||||
{
|
{
|
||||||
NewTypeIdAST *ast = new (pool) NewTypeIdAST;
|
NewTypeIdAST *ast = new (pool) NewTypeIdAST;
|
||||||
|
|||||||
8
src/libs/3rdparty/cplusplus/ASTMatch0.cpp
vendored
8
src/libs/3rdparty/cplusplus/ASTMatch0.cpp
vendored
@@ -624,14 +624,6 @@ bool NewExpressionAST::match0(AST *pattern, ASTMatcher *matcher)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NewInitializerAST::match0(AST *pattern, ASTMatcher *matcher)
|
|
||||||
{
|
|
||||||
if (NewInitializerAST *_other = pattern->asNewInitializer())
|
|
||||||
return matcher->match(this, _other);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NewTypeIdAST::match0(AST *pattern, ASTMatcher *matcher)
|
bool NewTypeIdAST::match0(AST *pattern, ASTMatcher *matcher)
|
||||||
{
|
{
|
||||||
if (NewTypeIdAST *_other = pattern->asNewTypeId())
|
if (NewTypeIdAST *_other = pattern->asNewTypeId())
|
||||||
|
|||||||
17
src/libs/3rdparty/cplusplus/ASTMatcher.cpp
vendored
17
src/libs/3rdparty/cplusplus/ASTMatcher.cpp
vendored
@@ -1585,23 +1585,6 @@ bool ASTMatcher::match(NewExpressionAST *node, NewExpressionAST *pattern)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ASTMatcher::match(NewInitializerAST *node, NewInitializerAST *pattern)
|
|
||||||
{
|
|
||||||
(void) node;
|
|
||||||
(void) pattern;
|
|
||||||
|
|
||||||
pattern->lparen_token = node->lparen_token;
|
|
||||||
|
|
||||||
if (! pattern->expression)
|
|
||||||
pattern->expression = node->expression;
|
|
||||||
else if (! AST::match(node->expression, pattern->expression, this))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
pattern->rparen_token = node->rparen_token;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTMatcher::match(NewTypeIdAST *node, NewTypeIdAST *pattern)
|
bool ASTMatcher::match(NewTypeIdAST *node, NewTypeIdAST *pattern)
|
||||||
{
|
{
|
||||||
(void) node;
|
(void) node;
|
||||||
|
|||||||
1
src/libs/3rdparty/cplusplus/ASTMatcher.h
vendored
1
src/libs/3rdparty/cplusplus/ASTMatcher.h
vendored
@@ -100,7 +100,6 @@ public:
|
|||||||
virtual bool match(NestedNameSpecifierAST *node, NestedNameSpecifierAST *pattern);
|
virtual bool match(NestedNameSpecifierAST *node, NestedNameSpecifierAST *pattern);
|
||||||
virtual bool match(NewArrayDeclaratorAST *node, NewArrayDeclaratorAST *pattern);
|
virtual bool match(NewArrayDeclaratorAST *node, NewArrayDeclaratorAST *pattern);
|
||||||
virtual bool match(NewExpressionAST *node, NewExpressionAST *pattern);
|
virtual bool match(NewExpressionAST *node, NewExpressionAST *pattern);
|
||||||
virtual bool match(NewInitializerAST *node, NewInitializerAST *pattern);
|
|
||||||
virtual bool match(NewTypeIdAST *node, NewTypeIdAST *pattern);
|
virtual bool match(NewTypeIdAST *node, NewTypeIdAST *pattern);
|
||||||
virtual bool match(NoExceptSpecificationAST *node, NoExceptSpecificationAST *pattern);
|
virtual bool match(NoExceptSpecificationAST *node, NoExceptSpecificationAST *pattern);
|
||||||
virtual bool match(NumericLiteralAST *node, NumericLiteralAST *pattern);
|
virtual bool match(NumericLiteralAST *node, NumericLiteralAST *pattern);
|
||||||
|
|||||||
@@ -599,7 +599,7 @@ public:
|
|||||||
return __ast;
|
return __ast;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewExpressionAST *NewExpression(ExpressionListParenAST *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, ExpressionAST *new_initializer = 0)
|
||||||
{
|
{
|
||||||
NewExpressionAST *__ast = new (&pool) NewExpressionAST;
|
NewExpressionAST *__ast = new (&pool) NewExpressionAST;
|
||||||
__ast->new_placement = new_placement;
|
__ast->new_placement = new_placement;
|
||||||
@@ -609,13 +609,6 @@ public:
|
|||||||
return __ast;
|
return __ast;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewInitializerAST *NewInitializer(ExpressionAST *expression = 0)
|
|
||||||
{
|
|
||||||
NewInitializerAST *__ast = new (&pool) NewInitializerAST;
|
|
||||||
__ast->expression = expression;
|
|
||||||
return __ast;
|
|
||||||
}
|
|
||||||
|
|
||||||
NewTypeIdAST *NewTypeId(SpecifierListAST *type_specifier_list = 0, PtrOperatorListAST *ptr_operator_list = 0, NewArrayDeclaratorListAST *new_array_declarator_list = 0)
|
NewTypeIdAST *NewTypeId(SpecifierListAST *type_specifier_list = 0, PtrOperatorListAST *ptr_operator_list = 0, NewArrayDeclaratorListAST *new_array_declarator_list = 0)
|
||||||
{
|
{
|
||||||
NewTypeIdAST *__ast = new (&pool) NewTypeIdAST;
|
NewTypeIdAST *__ast = new (&pool) NewTypeIdAST;
|
||||||
|
|||||||
8
src/libs/3rdparty/cplusplus/ASTVisit.cpp
vendored
8
src/libs/3rdparty/cplusplus/ASTVisit.cpp
vendored
@@ -671,14 +671,6 @@ void NewExpressionAST::accept0(ASTVisitor *visitor)
|
|||||||
visitor->endVisit(this);
|
visitor->endVisit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewInitializerAST::accept0(ASTVisitor *visitor)
|
|
||||||
{
|
|
||||||
if (visitor->visit(this)) {
|
|
||||||
accept(expression, visitor);
|
|
||||||
}
|
|
||||||
visitor->endVisit(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void NewTypeIdAST::accept0(ASTVisitor *visitor)
|
void NewTypeIdAST::accept0(ASTVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
|
|||||||
2
src/libs/3rdparty/cplusplus/ASTVisitor.h
vendored
2
src/libs/3rdparty/cplusplus/ASTVisitor.h
vendored
@@ -142,7 +142,6 @@ public:
|
|||||||
virtual bool visit(NestedNameSpecifierAST *) { return true; }
|
virtual bool visit(NestedNameSpecifierAST *) { return true; }
|
||||||
virtual bool visit(NewArrayDeclaratorAST *) { return true; }
|
virtual bool visit(NewArrayDeclaratorAST *) { return true; }
|
||||||
virtual bool visit(NewExpressionAST *) { return true; }
|
virtual bool visit(NewExpressionAST *) { return true; }
|
||||||
virtual bool visit(NewInitializerAST *) { return true; }
|
|
||||||
virtual bool visit(NewTypeIdAST *) { return true; }
|
virtual bool visit(NewTypeIdAST *) { return true; }
|
||||||
virtual bool visit(NoExceptSpecificationAST *) { return true; }
|
virtual bool visit(NoExceptSpecificationAST *) { return true; }
|
||||||
virtual bool visit(NumericLiteralAST *) { return true; }
|
virtual bool visit(NumericLiteralAST *) { return true; }
|
||||||
@@ -288,7 +287,6 @@ public:
|
|||||||
virtual void endVisit(NestedNameSpecifierAST *) {}
|
virtual void endVisit(NestedNameSpecifierAST *) {}
|
||||||
virtual void endVisit(NewArrayDeclaratorAST *) {}
|
virtual void endVisit(NewArrayDeclaratorAST *) {}
|
||||||
virtual void endVisit(NewExpressionAST *) {}
|
virtual void endVisit(NewExpressionAST *) {}
|
||||||
virtual void endVisit(NewInitializerAST *) {}
|
|
||||||
virtual void endVisit(NewTypeIdAST *) {}
|
virtual void endVisit(NewTypeIdAST *) {}
|
||||||
virtual void endVisit(NoExceptSpecificationAST *) {}
|
virtual void endVisit(NoExceptSpecificationAST *) {}
|
||||||
virtual void endVisit(NumericLiteralAST *) {}
|
virtual void endVisit(NumericLiteralAST *) {}
|
||||||
|
|||||||
1
src/libs/3rdparty/cplusplus/ASTfwd.h
vendored
1
src/libs/3rdparty/cplusplus/ASTfwd.h
vendored
@@ -105,7 +105,6 @@ class NestedExpressionAST;
|
|||||||
class NestedNameSpecifierAST;
|
class NestedNameSpecifierAST;
|
||||||
class NewArrayDeclaratorAST;
|
class NewArrayDeclaratorAST;
|
||||||
class NewExpressionAST;
|
class NewExpressionAST;
|
||||||
class NewInitializerAST;
|
|
||||||
class NewTypeIdAST;
|
class NewTypeIdAST;
|
||||||
class NoExceptSpecificationAST;
|
class NoExceptSpecificationAST;
|
||||||
class NumericLiteralAST;
|
class NumericLiteralAST;
|
||||||
|
|||||||
19
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
19
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
@@ -580,23 +580,6 @@ FullySpecifiedType Bind::newArrayDeclarator(NewArrayDeclaratorAST *ast, const Fu
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Bind::visit(NewInitializerAST *ast)
|
|
||||||
{
|
|
||||||
(void) ast;
|
|
||||||
assert(!"unreachable");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Bind::newInitializer(NewInitializerAST *ast)
|
|
||||||
{
|
|
||||||
if (! ast)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// unsigned lparen_token = ast->lparen_token;
|
|
||||||
ExpressionTy expression = this->expression(ast->expression);
|
|
||||||
// unsigned rparen_token = ast->rparen_token;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Bind::visit(NewTypeIdAST *ast)
|
bool Bind::visit(NewTypeIdAST *ast)
|
||||||
{
|
{
|
||||||
(void) ast;
|
(void) ast;
|
||||||
@@ -1637,7 +1620,7 @@ bool Bind::visit(NewExpressionAST *ast)
|
|||||||
ExpressionTy type_id = this->expression(ast->type_id);
|
ExpressionTy type_id = this->expression(ast->type_id);
|
||||||
// unsigned rparen_token = ast->rparen_token;
|
// unsigned rparen_token = ast->rparen_token;
|
||||||
this->newTypeId(ast->new_type_id);
|
this->newTypeId(ast->new_type_id);
|
||||||
this->newInitializer(ast->new_initializer);
|
this->expression(ast->new_initializer);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
src/libs/3rdparty/cplusplus/Bind.h
vendored
2
src/libs/3rdparty/cplusplus/Bind.h
vendored
@@ -87,7 +87,6 @@ protected:
|
|||||||
const Name *nestedNameSpecifier(NestedNameSpecifierAST *ast);
|
const Name *nestedNameSpecifier(NestedNameSpecifierAST *ast);
|
||||||
void newPlacement(ExpressionListParenAST *ast);
|
void newPlacement(ExpressionListParenAST *ast);
|
||||||
FullySpecifiedType newArrayDeclarator(NewArrayDeclaratorAST *ast, const FullySpecifiedType &init);
|
FullySpecifiedType newArrayDeclarator(NewArrayDeclaratorAST *ast, const FullySpecifiedType &init);
|
||||||
void newInitializer(NewInitializerAST *ast);
|
|
||||||
FullySpecifiedType newTypeId(NewTypeIdAST *ast);
|
FullySpecifiedType newTypeId(NewTypeIdAST *ast);
|
||||||
OperatorNameId::Kind cppOperator(OperatorAST *ast);
|
OperatorNameId::Kind cppOperator(OperatorAST *ast);
|
||||||
void parameterDeclarationClause(ParameterDeclarationClauseAST *ast, unsigned lparen_token, Function *fun);
|
void parameterDeclarationClause(ParameterDeclarationClauseAST *ast, unsigned lparen_token, Function *fun);
|
||||||
@@ -123,7 +122,6 @@ protected:
|
|||||||
virtual bool visit(MemInitializerAST *ast);
|
virtual bool visit(MemInitializerAST *ast);
|
||||||
virtual bool visit(NestedNameSpecifierAST *ast);
|
virtual bool visit(NestedNameSpecifierAST *ast);
|
||||||
virtual bool visit(NewArrayDeclaratorAST *ast);
|
virtual bool visit(NewArrayDeclaratorAST *ast);
|
||||||
virtual bool visit(NewInitializerAST *ast);
|
|
||||||
virtual bool visit(NewTypeIdAST *ast);
|
virtual bool visit(NewTypeIdAST *ast);
|
||||||
virtual bool visit(OperatorAST *ast);
|
virtual bool visit(OperatorAST *ast);
|
||||||
virtual bool visit(ParameterDeclarationClauseAST *ast);
|
virtual bool visit(ParameterDeclarationClauseAST *ast);
|
||||||
|
|||||||
15
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
15
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
@@ -5091,20 +5091,13 @@ bool Parser::parseNewArrayDeclarator(NewArrayDeclaratorListAST *&node)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Parser::parseNewInitializer(NewInitializerAST *&node)
|
bool Parser::parseNewInitializer(ExpressionAST *&node)
|
||||||
{
|
{
|
||||||
DEBUG_THIS_RULE();
|
DEBUG_THIS_RULE();
|
||||||
if (LA() == T_LPAREN) {
|
if (LA() == T_LPAREN) {
|
||||||
unsigned lparen_token = consumeToken();
|
return parseExpressionListParen(node);
|
||||||
ExpressionAST *expression = 0;
|
} else if (_cxx0xEnabled && LA() == T_LBRACE) {
|
||||||
if (LA() == T_RPAREN || parseExpression(expression)) {
|
return parseBracedInitList0x(node);
|
||||||
NewInitializerAST *ast = new (_pool) NewInitializerAST;
|
|
||||||
ast->lparen_token = lparen_token;
|
|
||||||
ast->expression = expression;
|
|
||||||
match(T_RPAREN, &ast->rparen_token);
|
|
||||||
node = ast;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
2
src/libs/3rdparty/cplusplus/Parser.h
vendored
2
src/libs/3rdparty/cplusplus/Parser.h
vendored
@@ -133,7 +133,7 @@ public:
|
|||||||
bool parseNewArrayDeclarator(NewArrayDeclaratorListAST *&node);
|
bool parseNewArrayDeclarator(NewArrayDeclaratorListAST *&node);
|
||||||
bool parseNewExpression(ExpressionAST *&node);
|
bool parseNewExpression(ExpressionAST *&node);
|
||||||
bool parseExpressionListParen(ExpressionAST *&node);
|
bool parseExpressionListParen(ExpressionAST *&node);
|
||||||
bool parseNewInitializer(NewInitializerAST *&node);
|
bool parseNewInitializer(ExpressionAST *&node);
|
||||||
bool parseNewTypeId(NewTypeIdAST *&node);
|
bool parseNewTypeId(NewTypeIdAST *&node);
|
||||||
bool parseOperator(OperatorAST *&node);
|
bool parseOperator(OperatorAST *&node);
|
||||||
bool parseConversionFunctionId(NameAST *&node);
|
bool parseConversionFunctionId(NameAST *&node);
|
||||||
|
|||||||
@@ -594,23 +594,6 @@ void FindUsages::newArrayDeclarator(NewArrayDeclaratorAST *ast)
|
|||||||
// unsigned rbracket_token = ast->rbracket_token;
|
// unsigned rbracket_token = ast->rbracket_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindUsages::visit(NewInitializerAST *ast)
|
|
||||||
{
|
|
||||||
(void) ast;
|
|
||||||
Q_ASSERT(!"unreachable");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FindUsages::newInitializer(NewInitializerAST *ast)
|
|
||||||
{
|
|
||||||
if (! ast)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// unsigned lparen_token = ast->lparen_token;
|
|
||||||
this->expression(ast->expression);
|
|
||||||
// unsigned rparen_token = ast->rparen_token;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FindUsages::visit(NewTypeIdAST *ast)
|
bool FindUsages::visit(NewTypeIdAST *ast)
|
||||||
{
|
{
|
||||||
(void) ast;
|
(void) ast;
|
||||||
@@ -1295,7 +1278,7 @@ bool FindUsages::visit(NewExpressionAST *ast)
|
|||||||
this->expression(ast->type_id);
|
this->expression(ast->type_id);
|
||||||
// unsigned rparen_token = ast->rparen_token;
|
// unsigned rparen_token = ast->rparen_token;
|
||||||
this->newTypeId(ast->new_type_id);
|
this->newTypeId(ast->new_type_id);
|
||||||
this->newInitializer(ast->new_initializer);
|
this->expression(ast->new_initializer);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ protected:
|
|||||||
void nestedNameSpecifier(NestedNameSpecifierAST *ast);
|
void nestedNameSpecifier(NestedNameSpecifierAST *ast);
|
||||||
void newPlacement(ExpressionListParenAST *ast);
|
void newPlacement(ExpressionListParenAST *ast);
|
||||||
void newArrayDeclarator(NewArrayDeclaratorAST *ast);
|
void newArrayDeclarator(NewArrayDeclaratorAST *ast);
|
||||||
void newInitializer(NewInitializerAST *ast);
|
|
||||||
void newTypeId(NewTypeIdAST *ast);
|
void newTypeId(NewTypeIdAST *ast);
|
||||||
void cppOperator(OperatorAST *ast);
|
void cppOperator(OperatorAST *ast);
|
||||||
void parameterDeclarationClause(ParameterDeclarationClauseAST *ast);
|
void parameterDeclarationClause(ParameterDeclarationClauseAST *ast);
|
||||||
@@ -138,7 +137,6 @@ protected:
|
|||||||
virtual bool visit(MemInitializerAST *ast);
|
virtual bool visit(MemInitializerAST *ast);
|
||||||
virtual bool visit(NestedNameSpecifierAST *ast);
|
virtual bool visit(NestedNameSpecifierAST *ast);
|
||||||
virtual bool visit(NewArrayDeclaratorAST *ast);
|
virtual bool visit(NewArrayDeclaratorAST *ast);
|
||||||
virtual bool visit(NewInitializerAST *ast);
|
|
||||||
virtual bool visit(NewTypeIdAST *ast);
|
virtual bool visit(NewTypeIdAST *ast);
|
||||||
virtual bool visit(OperatorAST *ast);
|
virtual bool visit(OperatorAST *ast);
|
||||||
virtual bool visit(ParameterDeclarationClauseAST *ast);
|
virtual bool visit(ParameterDeclarationClauseAST *ast);
|
||||||
|
|||||||
@@ -663,13 +663,14 @@ bool CheckSymbols::visit(NewExpressionAST *ast)
|
|||||||
if (binding && nameAST) {
|
if (binding && nameAST) {
|
||||||
int arguments = 0;
|
int arguments = 0;
|
||||||
if (ast->new_initializer) {
|
if (ast->new_initializer) {
|
||||||
if (ExpressionAST *expr = ast->new_initializer->expression) {
|
ExpressionListAST *list = 0;
|
||||||
while (BinaryExpressionAST *binExpr = expr->asBinaryExpression()) {
|
if (ExpressionListParenAST *exprListParen = ast->new_initializer->asExpressionListParen()) {
|
||||||
expr = binExpr->right_expression;
|
list = exprListParen->expression_list;
|
||||||
++arguments;
|
} else if (BracedInitializerAST *braceInit = ast->new_initializer->asBracedInitializer()) {
|
||||||
}
|
list = braceInit->expression_list;
|
||||||
}
|
}
|
||||||
|
for (ExpressionListAST *it = list; it; it = it->next)
|
||||||
|
++arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
Scope *scope = enclosingScope();
|
Scope *scope = enclosingScope();
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
auto x = int{};
|
auto x = int{};
|
||||||
auto y = Foo{};
|
auto y = Foo{};
|
||||||
auto z = typename Foo<T>{};
|
auto z = typename Foo<T>{};
|
||||||
|
|
||||||
|
auto d = new C(1, abc...);
|
||||||
|
auto e = new C{1, 2, 3};
|
||||||
|
|||||||
@@ -906,16 +906,6 @@ virtual bool visit(NewExpressionAST *ast)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool visit(NewInitializerAST *ast)
|
|
||||||
{
|
|
||||||
if (ast->lparen_token)
|
|
||||||
terminal(ast->lparen_token, ast);
|
|
||||||
nonterminal(ast->expression);
|
|
||||||
if (ast->rparen_token)
|
|
||||||
terminal(ast->rparen_token, ast);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool visit(NewTypeIdAST *ast)
|
virtual bool visit(NewTypeIdAST *ast)
|
||||||
{
|
{
|
||||||
for (SpecifierListAST *iter = ast->type_specifier_list; iter; iter = iter->next)
|
for (SpecifierListAST *iter = ast->type_specifier_list; iter; iter = iter->next)
|
||||||
|
|||||||
Reference in New Issue
Block a user