Skip to content
Snippets Groups Projects
  • Nikolai Kosjar's avatar
    d4bb5033
    CppTools: Remove separate indexing revision · d4bb5033
    Nikolai Kosjar authored
    
    For indexing we used a custom revision that was updated on each
    modelManager BuiltinIndexingSupport::refreshSourceFiles() call. This
    could lead to rejection of updated documents triggered by refactoring
    actions, like for the following case:
    
     1. Open a project containing a.h and a.cpp
     2. Open a.cpp, insert some new lines, save and close the document
     3. Open a.h and rename a function that is defined in a.cpp
        --> The refactoring action modifies a.h and a.cpp, so re-indexing
            of those is triggered. Since a.cpp has already a higher revision
            (step 2) than the updated document, the updated document is
            discarded. As a consequence find usages and follow symbol fails
            for the renamed function.
    
    Now the document call back provided to CppSourceProcessor is responsible
    for updating the document revision based on the latest revision in the
    global snapshot.
    
    Change-Id: I4dfa0a4d34991655acfa749109f00c47b0fbfdbe
    Reviewed-by: default avatarOrgad Shaneh <orgads@gmail.com>
    Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@theqtcompany.com>
    Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
    d4bb5033
    History
    CppTools: Remove separate indexing revision
    Nikolai Kosjar authored
    
    For indexing we used a custom revision that was updated on each
    modelManager BuiltinIndexingSupport::refreshSourceFiles() call. This
    could lead to rejection of updated documents triggered by refactoring
    actions, like for the following case:
    
     1. Open a project containing a.h and a.cpp
     2. Open a.cpp, insert some new lines, save and close the document
     3. Open a.h and rename a function that is defined in a.cpp
        --> The refactoring action modifies a.h and a.cpp, so re-indexing
            of those is triggered. Since a.cpp has already a higher revision
            (step 2) than the updated document, the updated document is
            discarded. As a consequence find usages and follow symbol fails
            for the renamed function.
    
    Now the document call back provided to CppSourceProcessor is responsible
    for updating the document revision based on the latest revision in the
    global snapshot.
    
    Change-Id: I4dfa0a4d34991655acfa749109f00c47b0fbfdbe
    Reviewed-by: default avatarOrgad Shaneh <orgads@gmail.com>
    Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@theqtcompany.com>
    Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
builtinindexingsupport.h 2.29 KiB
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company.  For licensing terms and
** conditions see http://www.qt.io/terms-conditions.  For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file.  Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights.  These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/

#ifndef BUILTININDEXINGSUPPORT_H
#define BUILTININDEXINGSUPPORT_H

#include "cppindexingsupport.h"
#include "cppmodelmanager.h"

#include <QFutureSynchronizer>

namespace CppTools {
namespace Internal {

class BuiltinIndexingSupport: public CppIndexingSupport {
public:
    BuiltinIndexingSupport();
    ~BuiltinIndexingSupport();

    virtual QFuture<void> refreshSourceFiles(const QSet<QString> &sourceFiles,
        CppModelManager::ProgressNotificationMode mode);
    virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters,
                                                 QSet<QString> fileNames);

public:
    static bool isFindErrorsIndexingActive();

private:
    QFutureSynchronizer<void> m_synchronizer;
};

} // namespace Internal
} // namespace CppTools

#endif // BUILTININDEXINGSUPPORT_H