forked from qt-creator/qt-creator
Cleanup specifiers.
This commit is contained in:
@@ -244,9 +244,8 @@ void CheckUndefinedSymbols::endVisit(FunctionDeclaratorAST *)
|
||||
_functionDeclaratorStack.removeLast();
|
||||
}
|
||||
|
||||
bool CheckUndefinedSymbols::visit(TypeofSpecifierAST *ast)
|
||||
bool CheckUndefinedSymbols::visit(TypeofSpecifierAST *)
|
||||
{
|
||||
accept(ast->next);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -425,9 +424,9 @@ bool CheckUndefinedSymbols::visit(CastExpressionAST *ast)
|
||||
{
|
||||
if (ast->lparen_token && ast->type_id && ast->rparen_token && ast->expression) {
|
||||
if (TypeIdAST *cast_type_id = ast->type_id->asTypeId()) {
|
||||
SpecifierAST *type_specifier = cast_type_id->type_specifier;
|
||||
SpecifierListAST *type_specifier = cast_type_id->type_specifier;
|
||||
if (! cast_type_id->declarator && type_specifier && ! type_specifier->next &&
|
||||
type_specifier->asNamedTypeSpecifier() && ast->expression &&
|
||||
type_specifier->value->asNamedTypeSpecifier() && ast->expression &&
|
||||
ast->expression->asUnaryExpression()) {
|
||||
// this ast node is ambigious, e.g.
|
||||
// (a) + b
|
||||
@@ -448,9 +447,9 @@ bool CheckUndefinedSymbols::visit(SizeofExpressionAST *ast)
|
||||
{
|
||||
if (ast->lparen_token && ast->expression && ast->rparen_token) {
|
||||
if (TypeIdAST *type_id = ast->expression->asTypeId()) {
|
||||
SpecifierAST *type_specifier = type_id->type_specifier;
|
||||
SpecifierListAST *type_specifier = type_id->type_specifier;
|
||||
if (! type_id->declarator && type_specifier && ! type_specifier->next &&
|
||||
type_specifier->asNamedTypeSpecifier()) {
|
||||
type_specifier->value->asNamedTypeSpecifier()) {
|
||||
// this sizeof expression is ambiguos, e.g.
|
||||
// sizeof (a)
|
||||
// `a' can be a typeid or a nested-expression.
|
||||
|
||||
@@ -402,16 +402,15 @@ bool FindUsages::visit(TemplateIdAST *ast)
|
||||
|
||||
bool FindUsages::visit(ParameterDeclarationAST *ast)
|
||||
{
|
||||
for (SpecifierAST *spec = ast->type_specifier; spec; spec = spec->next)
|
||||
accept(spec);
|
||||
for (SpecifierListAST *it = ast->type_specifier; it; it = it->next)
|
||||
accept(it->value);
|
||||
|
||||
if (DeclaratorAST *declarator = ast->declarator) {
|
||||
for (SpecifierAST *attr = declarator->attributes; attr; attr = attr->next)
|
||||
accept(attr);
|
||||
|
||||
for (PtrOperatorListAST *it = declarator->ptr_operators; it; it = it->next) {
|
||||
for (SpecifierListAST *it = declarator->attributes; it; it = it->next)
|
||||
accept(it->value);
|
||||
|
||||
for (PtrOperatorListAST *it = declarator->ptr_operators; it; it = it->next)
|
||||
accept(it->value);
|
||||
}
|
||||
|
||||
if (! _inSimpleDeclaration) // visit the core declarator only if we are not in simple-declaration.
|
||||
accept(declarator->core_declarator);
|
||||
@@ -419,8 +418,8 @@ bool FindUsages::visit(ParameterDeclarationAST *ast)
|
||||
for (PostfixDeclaratorListAST *it = declarator->postfix_declarators; it; it = it->next)
|
||||
accept(it->value);
|
||||
|
||||
for (SpecifierAST *spec = declarator->post_attributes; spec; spec = spec->next)
|
||||
accept(spec);
|
||||
for (SpecifierListAST *it = declarator->post_attributes; it; it = it->next)
|
||||
accept(it->value);
|
||||
|
||||
accept(declarator->initializer);
|
||||
}
|
||||
@@ -439,8 +438,8 @@ bool FindUsages::visit(FunctionDeclaratorAST *ast)
|
||||
{
|
||||
accept(ast->parameters);
|
||||
|
||||
for (SpecifierAST *spec = ast->cv_qualifier_seq; spec; spec = spec->next)
|
||||
accept(spec);
|
||||
for (SpecifierListAST *it = ast->cv_qualifier_seq; it; it = it->next)
|
||||
accept(it->value);
|
||||
|
||||
accept(ast->exception_specification);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user