CppTools: modernize

Change-Id: Iaf02e4d026f1ac8b216833d83cd7a735e21ff60a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Alessandro Portale
2019-01-14 01:40:53 +01:00
parent 845af92889
commit 1d3d18a969
116 changed files with 461 additions and 555 deletions

View File

@@ -58,17 +58,10 @@ static int ordering(InsertionPointLocator::AccessSpec xsSpec)
struct AccessRange
{
unsigned start;
unsigned end;
InsertionPointLocator::AccessSpec xsSpec;
unsigned colonToken;
AccessRange()
: start(0)
, end(0)
, xsSpec(InsertionPointLocator::Invalid)
, colonToken(0)
{}
unsigned start = 0;
unsigned end = 0;
InsertionPointLocator::AccessSpec xsSpec = InsertionPointLocator::Invalid;
unsigned colonToken = 0;
AccessRange(unsigned start, unsigned end, InsertionPointLocator::AccessSpec xsSpec, unsigned colonToken)
: start(start)
@@ -107,7 +100,7 @@ public:
protected:
using ASTVisitor::visit;
bool visit(ClassSpecifierAST *ast)
bool visit(ClassSpecifierAST *ast) override
{
if (!ast->lbrace_token || !ast->rbrace_token)
return true;
@@ -358,7 +351,7 @@ class FindMethodDefinitionInsertPoint : protected ASTVisitor
HighestValue<int, unsigned> _bestToken;
public:
FindMethodDefinitionInsertPoint(TranslationUnit *translationUnit)
explicit FindMethodDefinitionInsertPoint(TranslationUnit *translationUnit)
: ASTVisitor(translationUnit)
{}
@@ -388,12 +381,12 @@ public:
}
protected:
bool preVisit(AST *ast)
bool preVisit(AST *ast) override
{
return ast->asNamespace() || ast->asTranslationUnit() || ast->asLinkageBody();
}
bool visit(NamespaceAST *ast)
bool visit(NamespaceAST *ast) override
{
if (_currentDepth >= _namespaceNames.size())
return false;
@@ -423,7 +416,7 @@ class FindFunctionDefinition : protected ASTVisitor
unsigned _line = 0;
unsigned _column = 0;
public:
FindFunctionDefinition(TranslationUnit *translationUnit)
explicit FindFunctionDefinition(TranslationUnit *translationUnit)
: ASTVisitor(translationUnit)
{
}
@@ -438,7 +431,7 @@ public:
}
protected:
bool preVisit(AST *ast)
bool preVisit(AST *ast) override
{
if (_result)
return false;
@@ -452,7 +445,7 @@ protected:
return true;
}
bool visit(FunctionDefinitionAST *ast)
bool visit(FunctionDefinitionAST *ast) override
{
_result = ast;
return false;
@@ -464,13 +457,13 @@ protected:
static Declaration *isNonVirtualFunctionDeclaration(Symbol *s)
{
if (!s)
return 0;
return nullptr;
Declaration *declaration = s->asDeclaration();
if (!declaration)
return 0;
return nullptr;
Function *type = s->type()->asFunctionType();
if (!type || type->isPureVirtual())
return 0;
return nullptr;
return declaration;
}
@@ -497,9 +490,9 @@ static InsertionLocation nextToSurroundingDefinitions(Symbol *declaration,
// scan preceding declarations for a function declaration (and see if it is defined)
SymbolFinder symbolFinder;
Function *definitionFunction = 0;
Function *definitionFunction = nullptr;
QString prefix, suffix;
Declaration *surroundingFunctionDecl = 0;
Declaration *surroundingFunctionDecl = nullptr;
for (int i = declIndex - 1; i >= 0; --i) {
Symbol *s = klass->memberAt(i);
if (s->isGenerated() || !(surroundingFunctionDecl = isNonVirtualFunctionDeclaration(s)))
@@ -512,7 +505,7 @@ static InsertionLocation nextToSurroundingDefinitions(Symbol *declaration,
prefix = QLatin1String("\n\n");
break;
}
definitionFunction = 0;
definitionFunction = nullptr;
}
}
if (!definitionFunction) {
@@ -530,7 +523,7 @@ static InsertionLocation nextToSurroundingDefinitions(Symbol *declaration,
suffix = QLatin1String("\n\n");
break;
}
definitionFunction = 0;
definitionFunction = nullptr;
}
}
}