Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
5b54d59d
Commit
5b54d59d
authored
Feb 24, 2009
by
Roberto Raggi
Browse files
Cleanup the indexer, and remove to old sequential stuff.
parent
bfe36575
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/cpptools/cppmodelmanager.cpp
View file @
5b54d59d
...
...
@@ -173,10 +173,11 @@ public:
void
setTodo
(
const
QStringList
&
files
);
void
run
(
const
QString
&
fileName
);
void
run_helper
(
const
QString
&
fileName
,
QList
<
Document
::
Ptr
>
*
documents
);
void
resetEnvironment
();
void
parseCollectedDocuments
();
const
QSet
<
QString
>
&
todo
()
const
{
return
m_todo
;
}
...
...
@@ -214,7 +215,7 @@ private:
QSet
<
QString
>
m_included
;
Document
::
Ptr
m_currentDoc
;
QSet
<
QString
>
m_todo
;
QList
<
Document
::
Ptr
>
*
m_documents
;
QList
<
Document
::
Ptr
>
m_documents
;
};
}
// namespace Internal
...
...
@@ -223,8 +224,7 @@ private:
CppPreprocessor
::
CppPreprocessor
(
QPointer
<
CppModelManager
>
modelManager
)
:
snapshot
(
modelManager
->
snapshot
()),
m_modelManager
(
modelManager
),
m_proc
(
this
,
env
),
m_documents
(
0
)
m_proc
(
this
,
env
)
{
}
void
CppPreprocessor
::
setWorkingCopy
(
const
QMap
<
QString
,
QByteArray
>
&
workingCopy
)
...
...
@@ -267,45 +267,24 @@ public:
}
// end of anonymous namespace
// #define QTCREATOR_WITH_PARALLEL_INDEXER
void
CppPreprocessor
::
run
(
const
QString
&
fileName
)
{
QList
<
Document
::
Ptr
>
documents
;
run_helper
(
fileName
,
&
documents
);
#ifdef QTCREATOR_WITH_PARALLEL_INDEXER
QFuture
<
void
>
future
=
QtConcurrent
::
map
(
documents
,
Process
(
m_modelManager
));
future
.
waitForFinished
();
#else
foreach
(
Document
::
Ptr
doc
,
documents
)
{
doc
->
parse
();
doc
->
check
();
doc
->
releaseTranslationUnit
();
if
(
m_modelManager
)
m_modelManager
->
emitDocumentUpdated
(
doc
);
// ### TODO: compress
}
#endif
}
void
CppPreprocessor
::
run_helper
(
const
QString
&
fileName
,
QList
<
Document
::
Ptr
>
*
documents
)
{
QList
<
Document
::
Ptr
>
*
previousDocuments
=
m_documents
;
m_documents
=
documents
;
QString
absoluteFilePath
=
fileName
;
sourceNeeded
(
absoluteFilePath
,
IncludeGlobal
,
/*line = */
0
);
m_documents
=
previousDocuments
;
if
(
m_documents
.
size
()
>=
8
)
parseCollectedDocuments
();
}
void
CppPreprocessor
::
resetEnvironment
()
{
env
.
reset
();
}
void
CppPreprocessor
::
parseCollectedDocuments
()
{
QtConcurrent
::
blockingMap
(
m_documents
,
Process
(
m_modelManager
));
m_documents
.
clear
();
}
bool
CppPreprocessor
::
includeFile
(
const
QString
&
absoluteFilePath
,
QByteArray
*
result
)
{
if
(
absoluteFilePath
.
isEmpty
()
||
m_included
.
contains
(
absoluteFilePath
))
{
...
...
@@ -538,7 +517,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type,
snapshot
.
insert
(
doc
->
fileName
(),
doc
);
m_documents
->
append
(
doc
);
m_documents
.
append
(
doc
);
(
void
)
switchDocument
(
previousDoc
);
...
...
@@ -1020,6 +999,8 @@ void CppModelManager::parse(QFutureInterface<void> &future,
#endif
}
preproc
->
parseCollectedDocuments
();
future
.
setProgressValue
(
files
.
size
());
// Restore the previous thread priority.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment