forked from qt-creator/qt-creator
Check for unnecessary semicolons after function definitions.
This commit is contained in:
@@ -347,8 +347,17 @@ bool CheckSpecifier::visit(ClassSpecifierAST *ast)
|
|||||||
int previousVisibility = semantic()->switchVisibility(visibility);
|
int previousVisibility = semantic()->switchVisibility(visibility);
|
||||||
int previousMethodKey = semantic()->switchMethodKey(Function::NormalMethod);
|
int previousMethodKey = semantic()->switchMethodKey(Function::NormalMethod);
|
||||||
|
|
||||||
for (DeclarationListAST *member = ast->member_specifier_list; member; member = member->next) {
|
DeclarationAST *previousDeclaration = 0;
|
||||||
semantic()->check(member->value, klass->members());
|
for (DeclarationListAST *it = ast->member_specifier_list; it; it = it->next) {
|
||||||
|
DeclarationAST *declaration = it->value;
|
||||||
|
semantic()->check(declaration, klass->members());
|
||||||
|
|
||||||
|
if (previousDeclaration && declaration &&
|
||||||
|
declaration->asEmptyDeclaration() != 0 &&
|
||||||
|
previousDeclaration->asFunctionDefinition() != 0)
|
||||||
|
translationUnit()->warning(declaration->firstToken(), "unnecessary semicolon after function body");
|
||||||
|
|
||||||
|
previousDeclaration = declaration;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) semantic()->switchMethodKey(previousMethodKey);
|
(void) semantic()->switchMethodKey(previousMethodKey);
|
||||||
|
Reference in New Issue
Block a user