forked from qt-creator/qt-creator
C++: Cleanup: make the snapshot private in CppPreprocessor.
Change-Id: I69e892de34e06a0c95b3218abd8a0bb72966d875 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
committed by
Erik Verbruggen
parent
600f4438bb
commit
4e285a1186
@@ -36,7 +36,7 @@ static void parse(QFutureInterface<void> &future,
|
||||
foreach (const QString &file, files) {
|
||||
QFileInfo info(file);
|
||||
|
||||
preproc->m_snapshot.remove(file);
|
||||
preproc->removeFromCache(file);
|
||||
|
||||
if (suffixes.contains(info.suffix()))
|
||||
sources.append(file);
|
||||
|
||||
@@ -282,17 +282,14 @@ namespace {
|
||||
class Process: public std::unary_function<Document::Ptr, void>
|
||||
{
|
||||
QPointer<CppModelManager> _modelManager;
|
||||
Snapshot _snapshot;
|
||||
Document::Ptr _doc;
|
||||
Document::CheckMode _mode;
|
||||
|
||||
public:
|
||||
Process(QPointer<CppModelManager> modelManager,
|
||||
Document::Ptr doc,
|
||||
const Snapshot &snapshot,
|
||||
const CppModelManager::WorkingCopy &workingCopy)
|
||||
: _modelManager(modelManager),
|
||||
_snapshot(snapshot),
|
||||
_doc(doc),
|
||||
_mode(Document::FastCheck)
|
||||
{
|
||||
@@ -319,6 +316,11 @@ void CppPreprocessor::run(const QString &fileName)
|
||||
sourceNeeded(0, absoluteFilePath, IncludeGlobal);
|
||||
}
|
||||
|
||||
void CppPreprocessor::removeFromCache(const QString &fileName)
|
||||
{
|
||||
m_snapshot.remove(fileName);
|
||||
}
|
||||
|
||||
void CppPreprocessor::resetEnvironment()
|
||||
{
|
||||
m_env.reset();
|
||||
@@ -601,8 +603,7 @@ void CppPreprocessor::sourceNeeded(unsigned line, QString &fileName, IncludeType
|
||||
m_snapshot.insert(doc);
|
||||
m_todo.remove(fileName);
|
||||
|
||||
Process process(m_modelManager, doc, m_snapshot, m_workingCopy);
|
||||
|
||||
Process process(m_modelManager, doc, m_workingCopy);
|
||||
process();
|
||||
|
||||
(void) switchDocument(previousDoc);
|
||||
|
||||
@@ -250,6 +250,8 @@ private:
|
||||
|
||||
class CPPTOOLS_EXPORT CppPreprocessor: public CPlusPlus::Client
|
||||
{
|
||||
Q_DISABLE_COPY(CppPreprocessor)
|
||||
|
||||
public:
|
||||
CppPreprocessor(QPointer<CppModelManager> modelManager, bool dumpFileNameWhileParsing = false);
|
||||
virtual ~CppPreprocessor();
|
||||
@@ -263,6 +265,7 @@ public:
|
||||
void setTodo(const QStringList &files);
|
||||
|
||||
void run(const QString &fileName);
|
||||
void removeFromCache(const QString &fileName);
|
||||
|
||||
void resetEnvironment();
|
||||
static QString cleanPath(const QString &path);
|
||||
@@ -273,9 +276,6 @@ public:
|
||||
CppModelManager *modelManager() const
|
||||
{ return m_modelManager.data(); }
|
||||
|
||||
public: // attributes
|
||||
CPlusPlus::Snapshot m_snapshot;
|
||||
|
||||
protected:
|
||||
CPlusPlus::Document::Ptr switchDocument(CPlusPlus::Document::Ptr doc);
|
||||
|
||||
@@ -302,6 +302,7 @@ protected:
|
||||
virtual void sourceNeeded(unsigned line, QString &fileName, IncludeType type);
|
||||
|
||||
private:
|
||||
CPlusPlus::Snapshot m_snapshot;
|
||||
QPointer<CppModelManager> m_modelManager;
|
||||
bool m_dumpFileNameWhileParsing;
|
||||
CPlusPlus::Environment m_env;
|
||||
|
||||
Reference in New Issue
Block a user