Removed TemplateArgumentList

This commit is contained in:
Roberto Raggi
2010-08-11 15:02:08 +02:00
parent f3746289b9
commit 8a32c41f6f
7 changed files with 17 additions and 19 deletions

View File

@@ -1830,7 +1830,7 @@ bool FindUsages::visit(QualifiedNameAST *ast)
template_id = class_or_namespace_name->asTemplateId(); template_id = class_or_namespace_name->asTemplateId();
if (template_id) { if (template_id) {
for (TemplateArgumentListAST *arg_it = template_id->template_argument_list; arg_it; arg_it = arg_it->next) { for (ExpressionListAST *arg_it = template_id->template_argument_list; arg_it; arg_it = arg_it->next) {
this->expression(arg_it->value); this->expression(arg_it->value);
} }
} }
@@ -1863,7 +1863,7 @@ bool FindUsages::visit(QualifiedNameAST *ast)
if (template_id) { if (template_id) {
identifier_token = template_id->identifier_token; identifier_token = template_id->identifier_token;
for (TemplateArgumentListAST *template_arguments = template_id->template_argument_list; for (ExpressionListAST *template_arguments = template_id->template_argument_list;
template_arguments; template_arguments = template_arguments->next) { template_arguments; template_arguments = template_arguments->next) {
this->expression(template_arguments->value); this->expression(template_arguments->value);
} }

View File

@@ -2216,7 +2216,7 @@ class CPLUSPLUS_EXPORT TemplateIdAST: public NameAST
public: public:
unsigned identifier_token; unsigned identifier_token;
unsigned less_token; unsigned less_token;
TemplateArgumentListAST *template_argument_list; ExpressionListAST *template_argument_list;
unsigned greater_token; unsigned greater_token;
public: public:

View File

@@ -804,9 +804,9 @@ TemplateIdAST *TemplateIdAST::clone(MemoryPool *pool) const
TemplateIdAST *ast = new (pool) TemplateIdAST; TemplateIdAST *ast = new (pool) TemplateIdAST;
ast->identifier_token = identifier_token; ast->identifier_token = identifier_token;
ast->less_token = less_token; ast->less_token = less_token;
for (TemplateArgumentListAST *iter = template_argument_list, **ast_iter = &ast->template_argument_list; for (ExpressionListAST *iter = template_argument_list, **ast_iter = &ast->template_argument_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next) iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
*ast_iter = new (pool) TemplateArgumentListAST((iter->value) ? iter->value->clone(pool) : 0); *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0);
ast->greater_token = greater_token; ast->greater_token = greater_token;
return ast; return ast;
} }

View File

@@ -234,8 +234,6 @@ typedef List<ObjCPropertyAttributeAST *> ObjCPropertyAttributeListAST;
typedef List<ObjCMessageArgumentDeclarationAST *> ObjCMessageArgumentDeclarationListAST; typedef List<ObjCMessageArgumentDeclarationAST *> ObjCMessageArgumentDeclarationListAST;
typedef List<ObjCSynthesizedPropertyAST *> ObjCSynthesizedPropertyListAST; typedef List<ObjCSynthesizedPropertyAST *> ObjCSynthesizedPropertyListAST;
typedef ExpressionListAST TemplateArgumentListAST;
} // end of namespace CPlusPlus } // end of namespace CPlusPlus

View File

@@ -356,7 +356,7 @@ bool CheckName::visit(TemplateIdAST *ast)
{ {
const Identifier *id = identifier(ast->identifier_token); const Identifier *id = identifier(ast->identifier_token);
std::vector<FullySpecifiedType> templateArguments; std::vector<FullySpecifiedType> templateArguments;
for (TemplateArgumentListAST *it = ast->template_argument_list; it; for (ExpressionListAST *it = ast->template_argument_list; it;
it = it->next) { it = it->next) {
ExpressionAST *arg = it->value; ExpressionAST *arg = it->value;
FullySpecifiedType exprTy = semantic()->check(arg, _scope); FullySpecifiedType exprTy = semantic()->check(arg, _scope);

View File

@@ -818,7 +818,7 @@ Parser::TemplateArgumentListEntry *Parser::templateArgumentListEntry(unsigned to
return 0; return 0;
} }
bool Parser::parseTemplateArgumentList(TemplateArgumentListAST *&node) bool Parser::parseTemplateArgumentList(ExpressionListAST *&node)
{ {
DEBUG_THIS_RULE(); DEBUG_THIS_RULE();
@@ -830,10 +830,10 @@ bool Parser::parseTemplateArgumentList(TemplateArgumentListAST *&node)
unsigned start = cursor(); unsigned start = cursor();
TemplateArgumentListAST **template_argument_ptr = &node; ExpressionListAST **template_argument_ptr = &node;
ExpressionAST *template_argument = 0; ExpressionAST *template_argument = 0;
if (parseTemplateArgument(template_argument)) { if (parseTemplateArgument(template_argument)) {
*template_argument_ptr = new (_pool) TemplateArgumentListAST; *template_argument_ptr = new (_pool) ExpressionListAST;
(*template_argument_ptr)->value = template_argument; (*template_argument_ptr)->value = template_argument;
template_argument_ptr = &(*template_argument_ptr)->next; template_argument_ptr = &(*template_argument_ptr)->next;
@@ -844,7 +844,7 @@ bool Parser::parseTemplateArgumentList(TemplateArgumentListAST *&node)
consumeToken(); // consume T_COMMA consumeToken(); // consume T_COMMA
if (parseTemplateArgument(template_argument)) { if (parseTemplateArgument(template_argument)) {
*template_argument_ptr = new (_pool) TemplateArgumentListAST; *template_argument_ptr = new (_pool) ExpressionListAST;
(*template_argument_ptr)->value = template_argument; (*template_argument_ptr)->value = template_argument;
template_argument_ptr = &(*template_argument_ptr)->next; template_argument_ptr = &(*template_argument_ptr)->next;
@@ -855,10 +855,10 @@ bool Parser::parseTemplateArgumentList(TemplateArgumentListAST *&node)
if (_pool != _translationUnit->memoryPool()) { if (_pool != _translationUnit->memoryPool()) {
MemoryPool *pool = _translationUnit->memoryPool(); MemoryPool *pool = _translationUnit->memoryPool();
TemplateArgumentListAST *template_argument_list = node; ExpressionListAST *template_argument_list = node;
for (TemplateArgumentListAST *iter = template_argument_list, **ast_iter = &node; for (ExpressionListAST *iter = template_argument_list, **ast_iter = &node;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next) iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
*ast_iter = new (pool) TemplateArgumentListAST((iter->value) ? iter->value->clone(pool) : 0); *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0);
} }
_templateArgumentList.insert(std::make_pair(start, TemplateArgumentListEntry(start, cursor(), node))); _templateArgumentList.insert(std::make_pair(start, TemplateArgumentListEntry(start, cursor(), node)));
@@ -4117,7 +4117,7 @@ bool Parser::parseNameId(NameAST *&name)
else if (LA() == T_LPAREN) { else if (LA() == T_LPAREN) {
// a template-id followed by a T_LPAREN // a template-id followed by a T_LPAREN
if (TemplateArgumentListAST *template_arguments = template_id->template_argument_list) { if (ExpressionListAST *template_arguments = template_id->template_argument_list) {
if (! template_arguments->next && template_arguments->value && if (! template_arguments->next && template_arguments->value &&
template_arguments->value->asBinaryExpression()) { template_arguments->value->asBinaryExpression()) {

View File

@@ -184,7 +184,7 @@ public:
bool parseStringLiteral(ExpressionAST *&node); bool parseStringLiteral(ExpressionAST *&node);
bool parseSwitchStatement(StatementAST *&node); bool parseSwitchStatement(StatementAST *&node);
bool parseTemplateArgument(ExpressionAST *&node); bool parseTemplateArgument(ExpressionAST *&node);
bool parseTemplateArgumentList(TemplateArgumentListAST *&node); bool parseTemplateArgumentList(ExpressionListAST *&node);
bool parseTemplateDeclaration(DeclarationAST *&node); bool parseTemplateDeclaration(DeclarationAST *&node);
bool parseTemplateParameter(DeclarationAST *&node); bool parseTemplateParameter(DeclarationAST *&node);
bool parseTemplateParameterList(DeclarationListAST *&node); bool parseTemplateParameterList(DeclarationListAST *&node);
@@ -319,9 +319,9 @@ public:
struct TemplateArgumentListEntry { struct TemplateArgumentListEntry {
unsigned index; unsigned index;
unsigned cursor; unsigned cursor;
TemplateArgumentListAST *ast; ExpressionListAST *ast;
TemplateArgumentListEntry(unsigned index = 0, unsigned cursor = 0, TemplateArgumentListAST *ast = 0) TemplateArgumentListEntry(unsigned index = 0, unsigned cursor = 0, ExpressionListAST *ast = 0)
: index(index), cursor(cursor), ast(ast) {} : index(index), cursor(cursor), ast(ast) {}
}; };