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
93698188
Commit
93698188
authored
Feb 09, 2009
by
Roberto Raggi
Browse files
Invalidate the documents in the snapshot that need to be reparsed.
parent
ea981d50
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/cpptools/cppmodelmanager.cpp
View file @
93698188
...
...
@@ -120,6 +120,9 @@ public:
void
run
(
QString
&
fileName
);
void
operator
()(
QString
&
fileName
);
public:
// attributes
Snapshot
snapshot
;
protected:
CPlusPlus
::
Document
::
Ptr
switchDocument
(
CPlusPlus
::
Document
::
Ptr
doc
);
...
...
@@ -141,7 +144,6 @@ protected:
private:
QPointer
<
CppModelManager
>
m_modelManager
;
Snapshot
m_snapshot
;
Environment
env
;
Preprocessor
m_proc
;
QStringList
m_includePaths
;
...
...
@@ -157,9 +159,9 @@ private:
}
// namespace CppTools
CppPreprocessor
::
CppPreprocessor
(
QPointer
<
CppModelManager
>
modelManager
)
:
m_modelManager
(
modelManager
),
m_snapshot
(
modelManager
->
snapshot
()
),
m_proc
(
this
,
env
)
:
snapshot
(
modelManager
->
snapshot
()
),
m_modelManager
(
modelManager
),
m_proc
(
this
,
env
)
{
}
void
CppPreprocessor
::
setWorkingCopy
(
const
QMap
<
QString
,
QByteArray
>
&
workingCopy
)
...
...
@@ -337,8 +339,13 @@ void CppPreprocessor::mergeEnvironment(Document::Ptr doc, QSet<QString> *process
processed
->
insert
(
fn
);
foreach
(
QString
includedFile
,
doc
->
includedFiles
())
{
mergeEnvironment
(
m_snapshot
.
value
(
includedFile
),
processed
);
foreach
(
Document
::
Include
incl
,
doc
->
includes
())
{
QString
includedFile
=
incl
.
fileName
();
if
(
Document
::
Ptr
includedDoc
=
snapshot
.
value
(
includedFile
))
mergeEnvironment
(
includedDoc
,
processed
);
else
run
(
includedFile
);
}
foreach
(
const
Macro
macro
,
doc
->
definedMacros
())
{
...
...
@@ -384,7 +391,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type,
}
if
(
!
contents
.
isEmpty
())
{
Document
::
Ptr
cachedDoc
=
m_
snapshot
.
value
(
fileName
);
Document
::
Ptr
cachedDoc
=
snapshot
.
value
(
fileName
);
if
(
cachedDoc
&&
m_currentDoc
)
{
mergeEnvironment
(
cachedDoc
);
}
else
{
...
...
@@ -393,8 +400,8 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type,
const
QByteArray
previousFile
=
env
.
currentFile
;
const
unsigned
previousLine
=
env
.
currentLine
;
env
.
currentFile
=
QByteArray
(
m_currentDoc
->
translationUnit
()
->
fileName
(),
m_currentDoc
->
translationU
nit
()
->
fileNameLength
());
TranslationUnit
*
unit
=
m_currentDoc
->
translationUnit
()
;
env
.
currentFile
=
QByteArray
(
unit
->
fileName
(),
u
nit
->
fileNameLength
());
QByteArray
preprocessedCode
;
m_proc
(
contents
,
&
preprocessedCode
);
...
...
@@ -775,7 +782,12 @@ void CppModelManager::parse(QFutureInterface<void> &future,
CppPreprocessor
*
preproc
,
QStringList
files
)
{
QTC_ASSERT
(
!
files
.
isEmpty
(),
return
);
if
(
files
.
isEmpty
())
return
;
foreach
(
QString
file
,
files
)
{
preproc
->
snapshot
.
remove
(
file
);
}
// Change the priority of the background parser thread to idle.
QThread
::
currentThread
()
->
setPriority
(
QThread
::
IdlePriority
);
...
...
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