forked from qt-creator/qt-creator
		
	Prefer using 'override' instead of 'virtual'
warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [modernize-use-override] Change-Id: I6dac7a62b627fa1353b4455e1af92f869c2571cc Reviewed-by: Marco Benelli <marco.benelli@qt.io>
This commit is contained in:
		@@ -123,7 +123,7 @@ public:
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    virtual bool preVisit(AST *ast)
 | 
			
		||||
    bool preVisit(AST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (m_functionDefinition)
 | 
			
		||||
            return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -161,29 +161,29 @@ protected:
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // nothing to do
 | 
			
		||||
    virtual bool visit(UsingNamespaceDirective *) { return true; }
 | 
			
		||||
    virtual bool visit(UsingDeclaration *) { return true; }
 | 
			
		||||
    virtual bool visit(Argument *) { return true; }
 | 
			
		||||
    virtual bool visit(BaseClass *) { return true; }
 | 
			
		||||
    bool visit(UsingNamespaceDirective *) override { return true; }
 | 
			
		||||
    bool visit(UsingDeclaration *) override { return true; }
 | 
			
		||||
    bool visit(Argument *) override { return true; }
 | 
			
		||||
    bool visit(BaseClass *) override { return true; }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(Function *symbol)
 | 
			
		||||
    bool visit(Function *symbol) override
 | 
			
		||||
    {
 | 
			
		||||
        addFunction(symbol->name());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(Block *)
 | 
			
		||||
    bool visit(Block *) override
 | 
			
		||||
    {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(NamespaceAlias *symbol)
 | 
			
		||||
    bool visit(NamespaceAlias *symbol) override
 | 
			
		||||
    {
 | 
			
		||||
        addType(symbol->name());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(Declaration *symbol)
 | 
			
		||||
    bool visit(Declaration *symbol) override
 | 
			
		||||
    {
 | 
			
		||||
        if (symbol->enclosingEnum() != 0)
 | 
			
		||||
            addStatic(symbol->name());
 | 
			
		||||
@@ -199,66 +199,66 @@ protected:
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(TypenameArgument *symbol)
 | 
			
		||||
    bool visit(TypenameArgument *symbol) override
 | 
			
		||||
    {
 | 
			
		||||
        addType(symbol->name());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(Enum *symbol)
 | 
			
		||||
    bool visit(Enum *symbol) override
 | 
			
		||||
    {
 | 
			
		||||
        addType(symbol->name());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(Namespace *symbol)
 | 
			
		||||
    bool visit(Namespace *symbol) override
 | 
			
		||||
    {
 | 
			
		||||
        addType(symbol->name());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(Template *)
 | 
			
		||||
    bool visit(Template *) override
 | 
			
		||||
    {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(Class *symbol)
 | 
			
		||||
    bool visit(Class *symbol) override
 | 
			
		||||
    {
 | 
			
		||||
        addType(symbol->name());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(ForwardClassDeclaration *symbol)
 | 
			
		||||
    bool visit(ForwardClassDeclaration *symbol) override
 | 
			
		||||
    {
 | 
			
		||||
        addType(symbol->name());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Objective-C
 | 
			
		||||
    virtual bool visit(ObjCBaseClass *) { return true; }
 | 
			
		||||
    virtual bool visit(ObjCBaseProtocol *) { return true; }
 | 
			
		||||
    virtual bool visit(ObjCPropertyDeclaration *) { return true; }
 | 
			
		||||
    virtual bool visit(ObjCMethod *) { return true; }
 | 
			
		||||
    bool visit(ObjCBaseClass *) override { return true; }
 | 
			
		||||
    bool visit(ObjCBaseProtocol *) override { return true; }
 | 
			
		||||
    bool visit(ObjCPropertyDeclaration *) override { return true; }
 | 
			
		||||
    bool visit(ObjCMethod *) override { return true; }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(ObjCClass *symbol)
 | 
			
		||||
    bool visit(ObjCClass *symbol) override
 | 
			
		||||
    {
 | 
			
		||||
        addType(symbol->name());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(ObjCForwardClassDeclaration *symbol)
 | 
			
		||||
    bool visit(ObjCForwardClassDeclaration *symbol) override
 | 
			
		||||
    {
 | 
			
		||||
        addType(symbol->name());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(ObjCProtocol *symbol)
 | 
			
		||||
    bool visit(ObjCProtocol *symbol) override
 | 
			
		||||
    {
 | 
			
		||||
        addType(symbol->name());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(ObjCForwardProtocolDeclaration *symbol)
 | 
			
		||||
    bool visit(ObjCForwardProtocolDeclaration *symbol) override
 | 
			
		||||
    {
 | 
			
		||||
        addType(symbol->name());
 | 
			
		||||
        return true;
 | 
			
		||||
 
 | 
			
		||||
@@ -116,17 +116,17 @@ protected:
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(CaptureAST *ast)
 | 
			
		||||
    bool visit(CaptureAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        return checkLocalUse(ast->identifier, ast->firstToken());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(IdExpressionAST *ast)
 | 
			
		||||
    bool visit(IdExpressionAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        return checkLocalUse(ast->name, ast->firstToken());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(SizeofExpressionAST *ast)
 | 
			
		||||
    bool visit(SizeofExpressionAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->expression && ast->expression->asTypeId()) {
 | 
			
		||||
            TypeIdAST *typeId = ast->expression->asTypeId();
 | 
			
		||||
@@ -141,7 +141,7 @@ protected:
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(CastExpressionAST *ast)
 | 
			
		||||
    bool visit(CastExpressionAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->expression && ast->expression->asUnaryExpression()) {
 | 
			
		||||
            TypeIdAST *typeId = ast->type_id->asTypeId();
 | 
			
		||||
@@ -158,137 +158,137 @@ protected:
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(FunctionDefinitionAST *ast)
 | 
			
		||||
    bool visit(FunctionDefinitionAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            enterScope(ast->symbol);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual void endVisit(FunctionDefinitionAST *ast)
 | 
			
		||||
    void endVisit(FunctionDefinitionAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            _scopeStack.removeLast();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(LambdaExpressionAST *ast)
 | 
			
		||||
    bool visit(LambdaExpressionAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->lambda_declarator && ast->lambda_declarator->symbol)
 | 
			
		||||
            enterScope(ast->lambda_declarator->symbol);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual void endVisit(LambdaExpressionAST *ast)
 | 
			
		||||
    void endVisit(LambdaExpressionAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->lambda_declarator && ast->lambda_declarator->symbol)
 | 
			
		||||
            _scopeStack.removeLast();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(CompoundStatementAST *ast)
 | 
			
		||||
    bool visit(CompoundStatementAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            enterScope(ast->symbol);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual void endVisit(CompoundStatementAST *ast)
 | 
			
		||||
    void endVisit(CompoundStatementAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            _scopeStack.removeLast();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(IfStatementAST *ast)
 | 
			
		||||
    bool visit(IfStatementAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            enterScope(ast->symbol);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual void endVisit(IfStatementAST *ast)
 | 
			
		||||
    void endVisit(IfStatementAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            _scopeStack.removeLast();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(WhileStatementAST *ast)
 | 
			
		||||
    bool visit(WhileStatementAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            enterScope(ast->symbol);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual void endVisit(WhileStatementAST *ast)
 | 
			
		||||
    void endVisit(WhileStatementAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            _scopeStack.removeLast();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(ForStatementAST *ast)
 | 
			
		||||
    bool visit(ForStatementAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            enterScope(ast->symbol);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual void endVisit(ForStatementAST *ast)
 | 
			
		||||
    void endVisit(ForStatementAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            _scopeStack.removeLast();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(ForeachStatementAST *ast)
 | 
			
		||||
    bool visit(ForeachStatementAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            enterScope(ast->symbol);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual void endVisit(ForeachStatementAST *ast)
 | 
			
		||||
    void endVisit(ForeachStatementAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            _scopeStack.removeLast();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(RangeBasedForStatementAST *ast)
 | 
			
		||||
    bool visit(RangeBasedForStatementAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            enterScope(ast->symbol);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual void endVisit(RangeBasedForStatementAST *ast)
 | 
			
		||||
    void endVisit(RangeBasedForStatementAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            _scopeStack.removeLast();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(SwitchStatementAST *ast)
 | 
			
		||||
    bool visit(SwitchStatementAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            enterScope(ast->symbol);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual void endVisit(SwitchStatementAST *ast)
 | 
			
		||||
    void endVisit(SwitchStatementAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            _scopeStack.removeLast();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(CatchClauseAST *ast)
 | 
			
		||||
    bool visit(CatchClauseAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            enterScope(ast->symbol);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual void endVisit(CatchClauseAST *ast)
 | 
			
		||||
    void endVisit(CatchClauseAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        if (ast->symbol)
 | 
			
		||||
            _scopeStack.removeLast();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(ExpressionOrDeclarationStatementAST *ast)
 | 
			
		||||
    bool visit(ExpressionOrDeclarationStatementAST *ast) override
 | 
			
		||||
    {
 | 
			
		||||
        accept(ast->declaration);
 | 
			
		||||
        return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -49,9 +49,9 @@ public:
 | 
			
		||||
        , m_workingCopy(m_modelManager->workingCopy())
 | 
			
		||||
    {}
 | 
			
		||||
 | 
			
		||||
    virtual void indentSelection(const QTextCursor &selection,
 | 
			
		||||
                                 const QString &fileName,
 | 
			
		||||
                                 const TextEditor::TextDocument *textDocument) const
 | 
			
		||||
    void indentSelection(const QTextCursor &selection,
 | 
			
		||||
                         const QString &fileName,
 | 
			
		||||
                         const TextEditor::TextDocument *textDocument) const override
 | 
			
		||||
    {
 | 
			
		||||
        const TextEditor::TabSettings &tabSettings =
 | 
			
		||||
            ProjectExplorer::actualTabSettings(fileName, textDocument);
 | 
			
		||||
@@ -60,9 +60,9 @@ public:
 | 
			
		||||
        indenter.indent(selection.document(), selection, QChar::Null, tabSettings);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual void reindentSelection(const QTextCursor &selection,
 | 
			
		||||
                                   const QString &fileName,
 | 
			
		||||
                                   const TextEditor::TextDocument *textDocument) const
 | 
			
		||||
    void reindentSelection(const QTextCursor &selection,
 | 
			
		||||
                           const QString &fileName,
 | 
			
		||||
                           const TextEditor::TextDocument *textDocument) const override
 | 
			
		||||
    {
 | 
			
		||||
        const TextEditor::TabSettings &tabSettings =
 | 
			
		||||
            ProjectExplorer::actualTabSettings(fileName, textDocument);
 | 
			
		||||
@@ -71,7 +71,7 @@ public:
 | 
			
		||||
        indenter.reindent(selection.document(), selection, tabSettings);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual void fileChanged(const QString &fileName)
 | 
			
		||||
    void fileChanged(const QString &fileName) override
 | 
			
		||||
    {
 | 
			
		||||
        m_modelManager->updateSourceFiles(QSet<QString>() << fileName);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -58,7 +58,7 @@ public:
 | 
			
		||||
 | 
			
		||||
    public:
 | 
			
		||||
        GCRunner(StringTablePrivate &stringTable): m_stringTable(stringTable) {}
 | 
			
		||||
        virtual void run() { m_stringTable.GC(); }
 | 
			
		||||
        void run() override { m_stringTable.GC(); }
 | 
			
		||||
    } m_gcRunner;
 | 
			
		||||
 | 
			
		||||
    mutable QMutex m_lock;
 | 
			
		||||
 
 | 
			
		||||
@@ -64,7 +64,7 @@ public:
 | 
			
		||||
 | 
			
		||||
    using SymbolVisitor::visit;
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(Function *fun)
 | 
			
		||||
    bool visit(Function *fun) override
 | 
			
		||||
    {
 | 
			
		||||
        if (_oper) {
 | 
			
		||||
            if (const Name *name = fun->unqualifiedName()) {
 | 
			
		||||
@@ -79,7 +79,7 @@ public:
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(Block *)
 | 
			
		||||
    bool visit(Block *) override
 | 
			
		||||
    {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,7 @@ public:
 | 
			
		||||
 | 
			
		||||
    void execute(const CPlusPlus::Document::Ptr &doc, const CPlusPlus::Snapshot &snapshot);
 | 
			
		||||
 | 
			
		||||
    virtual bool visit(CPlusPlus::Class *);
 | 
			
		||||
    bool visit(CPlusPlus::Class *) override;
 | 
			
		||||
 | 
			
		||||
    const QList<CPlusPlus::Symbol *> &derived() { return _derived; }
 | 
			
		||||
    const QStringList otherBases() { return _otherBases; }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user