forked from qt-creator/qt-creator
		
	CppTools/Clang: Remove InMemoryInfo
...nowadays we only need the working copy. Change-Id: I30924b3c5dc68b428d6c10f6ba015b0640b476d2 Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
		@@ -32,7 +32,6 @@
 | 
			
		||||
#include "baseeditordocumentprocessor.h"
 | 
			
		||||
 | 
			
		||||
#include "cppmodelmanager.h"
 | 
			
		||||
#include "cpptoolsreuse.h"
 | 
			
		||||
#include "editordocumenthandle.h"
 | 
			
		||||
 | 
			
		||||
namespace CppTools {
 | 
			
		||||
@@ -82,10 +81,10 @@ void BaseEditorDocumentParser::setConfiguration(const Configuration &configurati
 | 
			
		||||
    m_configuration = configuration;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BaseEditorDocumentParser::update(const InMemoryInfo &info)
 | 
			
		||||
void BaseEditorDocumentParser::update(const WorkingCopy &workingCopy)
 | 
			
		||||
{
 | 
			
		||||
    QMutexLocker locker(&m_updateIsRunning);
 | 
			
		||||
    updateHelper(info);
 | 
			
		||||
    updateHelper(workingCopy);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BaseEditorDocumentParser::State BaseEditorDocumentParser::state() const
 | 
			
		||||
@@ -148,11 +147,4 @@ ProjectPart::Ptr BaseEditorDocumentParser::determineProjectPart(const QString &f
 | 
			
		||||
    return projectPart;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BaseEditorDocumentParser::InMemoryInfo::InMemoryInfo(bool withModifiedFiles)
 | 
			
		||||
    : workingCopy(CppTools::CppModelManager::instance()->workingCopy())
 | 
			
		||||
{
 | 
			
		||||
    if (withModifiedFiles)
 | 
			
		||||
        modifiedFiles = CppTools::modifiedFiles();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace CppTools
 | 
			
		||||
 
 | 
			
		||||
@@ -63,13 +63,7 @@ public:
 | 
			
		||||
    Configuration configuration() const;
 | 
			
		||||
    void setConfiguration(const Configuration &configuration);
 | 
			
		||||
 | 
			
		||||
    struct CPPTOOLS_EXPORT InMemoryInfo {
 | 
			
		||||
        InMemoryInfo(bool withModifiedFiles);
 | 
			
		||||
 | 
			
		||||
        WorkingCopy workingCopy;
 | 
			
		||||
        Utils::FileNameList modifiedFiles;
 | 
			
		||||
    };
 | 
			
		||||
    void update(const InMemoryInfo &info);
 | 
			
		||||
    void update(const WorkingCopy &workingCopy);
 | 
			
		||||
 | 
			
		||||
    ProjectPart::Ptr projectPart() const;
 | 
			
		||||
 | 
			
		||||
@@ -88,7 +82,7 @@ protected:
 | 
			
		||||
    mutable QMutex m_stateAndConfigurationMutex;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    virtual void updateHelper(const InMemoryInfo &inMemoryInfo) = 0;
 | 
			
		||||
    virtual void updateHelper(const WorkingCopy &workingCopy) = 0;
 | 
			
		||||
 | 
			
		||||
    const QString m_filePath;
 | 
			
		||||
    Configuration m_configuration;
 | 
			
		||||
 
 | 
			
		||||
@@ -76,7 +76,7 @@ BaseEditorDocumentProcessor *BaseEditorDocumentProcessor::get(const QString &fil
 | 
			
		||||
 | 
			
		||||
void BaseEditorDocumentProcessor::runParser(QFutureInterface<void> &future,
 | 
			
		||||
                                            BaseEditorDocumentParser::Ptr parser,
 | 
			
		||||
                                            BaseEditorDocumentParser::InMemoryInfo info)
 | 
			
		||||
                                            const WorkingCopy workingCopy)
 | 
			
		||||
{
 | 
			
		||||
    future.setProgressRange(0, 1);
 | 
			
		||||
    if (future.isCanceled()) {
 | 
			
		||||
@@ -84,7 +84,7 @@ void BaseEditorDocumentProcessor::runParser(QFutureInterface<void> &future,
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    parser->update(info);
 | 
			
		||||
    parser->update(workingCopy);
 | 
			
		||||
    CppModelManager::instance()
 | 
			
		||||
        ->finishedRefreshingSourceFiles(QSet<QString>() << parser->filePath());
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -89,7 +89,7 @@ signals:
 | 
			
		||||
protected:
 | 
			
		||||
    static void runParser(QFutureInterface<void> &future,
 | 
			
		||||
                          BaseEditorDocumentParser::Ptr parser,
 | 
			
		||||
                          BaseEditorDocumentParser::InMemoryInfo info);
 | 
			
		||||
                          const CppTools::WorkingCopy workingCopy);
 | 
			
		||||
 | 
			
		||||
    // Convenience
 | 
			
		||||
    QString filePath() const { return m_baseTextDocument->filePath().toString(); }
 | 
			
		||||
 
 | 
			
		||||
@@ -60,7 +60,7 @@ BuiltinEditorDocumentParser::BuiltinEditorDocumentParser(const QString &filePath
 | 
			
		||||
    qRegisterMetaType<CPlusPlus::Snapshot>("CPlusPlus::Snapshot");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BuiltinEditorDocumentParser::updateHelper(const InMemoryInfo &info)
 | 
			
		||||
void BuiltinEditorDocumentParser::updateHelper(const WorkingCopy &theWorkingCopy)
 | 
			
		||||
{
 | 
			
		||||
    if (filePath().isEmpty())
 | 
			
		||||
        return;
 | 
			
		||||
@@ -70,7 +70,7 @@ void BuiltinEditorDocumentParser::updateHelper(const InMemoryInfo &info)
 | 
			
		||||
 | 
			
		||||
    State baseState = state();
 | 
			
		||||
    ExtraState state = extraState();
 | 
			
		||||
    WorkingCopy workingCopy = info.workingCopy;
 | 
			
		||||
    WorkingCopy workingCopy = theWorkingCopy;
 | 
			
		||||
 | 
			
		||||
    bool invalidateSnapshot = false, invalidateConfig = false, editorDefinesChanged_ = false;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -64,7 +64,7 @@ public:
 | 
			
		||||
    static Ptr get(const QString &filePath);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    void updateHelper(const InMemoryInfo &info) override;
 | 
			
		||||
    void updateHelper(const WorkingCopy &workingCopy) override;
 | 
			
		||||
    void addFileAndDependencies(CPlusPlus::Snapshot *snapshot,
 | 
			
		||||
                                QSet<Utils::FileName> *toRemove,
 | 
			
		||||
                                const Utils::FileName &fileName) const;
 | 
			
		||||
 
 | 
			
		||||
@@ -210,7 +210,7 @@ void BuiltinEditorDocumentProcessor::run()
 | 
			
		||||
{
 | 
			
		||||
    m_parserFuture = QtConcurrent::run(&runParser,
 | 
			
		||||
                                       parser(),
 | 
			
		||||
                                       BuiltinEditorDocumentParser::InMemoryInfo(false));
 | 
			
		||||
                                       CppModelManager::instance()->workingCopy());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BaseEditorDocumentParser::Ptr BuiltinEditorDocumentProcessor::parser()
 | 
			
		||||
 
 | 
			
		||||
@@ -160,7 +160,7 @@ void indexFindErrors(QFutureInterface<void> &future, const ParseParams params)
 | 
			
		||||
        // Parse the file as precisely as possible
 | 
			
		||||
        BuiltinEditorDocumentParser parser(file);
 | 
			
		||||
        parser.setReleaseSourceAndAST(false);
 | 
			
		||||
        parser.update(BuiltinEditorDocumentParser::InMemoryInfo(false));
 | 
			
		||||
        parser.update(CppModelManager::instance()->workingCopy());
 | 
			
		||||
        CPlusPlus::Document::Ptr document = parser.document();
 | 
			
		||||
        QTC_ASSERT(document, return);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2188,7 +2188,7 @@ void CppCompletionAssistInterface::getCppSpecifics() const
 | 
			
		||||
    m_gotCppSpecifics = true;
 | 
			
		||||
 | 
			
		||||
    if (m_parser) {
 | 
			
		||||
        m_parser->update(BuiltinEditorDocumentParser::InMemoryInfo(false));
 | 
			
		||||
        m_parser->update(CppTools::CppModelManager::instance()->workingCopy());
 | 
			
		||||
        m_snapshot = m_parser->snapshot();
 | 
			
		||||
        m_headerPaths = m_parser->headerPaths();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -917,7 +917,7 @@ void CppToolsPlugin::test_modelmanager_precompiled_headers()
 | 
			
		||||
        BaseEditorDocumentParser::Configuration config = parser->configuration();
 | 
			
		||||
        config.usePrecompiledHeaders = true;
 | 
			
		||||
        parser->setConfiguration(config);
 | 
			
		||||
        parser->update(BuiltinEditorDocumentParser::InMemoryInfo(false));
 | 
			
		||||
        parser->update(CppModelManager::instance()->workingCopy());
 | 
			
		||||
 | 
			
		||||
        // Check if defines from pch are considered
 | 
			
		||||
        Document::Ptr document = mm->document(fileName);
 | 
			
		||||
@@ -1000,7 +1000,7 @@ void CppToolsPlugin::test_modelmanager_defines_per_editor()
 | 
			
		||||
        BaseEditorDocumentParser::Configuration config = parser->configuration();
 | 
			
		||||
        config.editorDefines = editorDefines.toUtf8();
 | 
			
		||||
        parser->setConfiguration(config);
 | 
			
		||||
        parser->update(BuiltinEditorDocumentParser::InMemoryInfo(false));
 | 
			
		||||
        parser->update(CppModelManager::instance()->workingCopy());
 | 
			
		||||
 | 
			
		||||
        Document::Ptr doc = mm->document(main1File);
 | 
			
		||||
        QCOMPARE(nameOfFirstDeclaration(doc), firstDeclarationName);
 | 
			
		||||
 
 | 
			
		||||
@@ -289,11 +289,4 @@ bool skipFileDueToSizeLimit(const QFileInfo &fileInfo, int limitInMB)
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Utils::FileNameList modifiedFiles()
 | 
			
		||||
{
 | 
			
		||||
    Utils::FileNameList files = Utils::transform(Core::DocumentManager::modifiedDocuments(),
 | 
			
		||||
                                                 [](Core::IDocument *d) -> Utils::FileName { return d->filePath(); });
 | 
			
		||||
    return Utils::filteredUnique(files);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // CppTools
 | 
			
		||||
 
 | 
			
		||||
@@ -37,8 +37,6 @@
 | 
			
		||||
 | 
			
		||||
#include <cplusplus/CppDocument.h>
 | 
			
		||||
 | 
			
		||||
#include <utils/fileutils.h>
 | 
			
		||||
 | 
			
		||||
QT_BEGIN_NAMESPACE
 | 
			
		||||
class QChar;
 | 
			
		||||
class QFileInfo;
 | 
			
		||||
@@ -54,8 +52,6 @@ class LookupContext;
 | 
			
		||||
 | 
			
		||||
namespace CppTools {
 | 
			
		||||
 | 
			
		||||
Utils::FileNameList CPPTOOLS_EXPORT modifiedFiles();
 | 
			
		||||
 | 
			
		||||
void CPPTOOLS_EXPORT moveCursorToEndOfIdentifier(QTextCursor *tc);
 | 
			
		||||
void CPPTOOLS_EXPORT moveCursorToStartOfIdentifier(QTextCursor *tc);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user