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
Marco Bubke
flatpak-qt-creator
Commits
2780999d
Commit
2780999d
authored
Mar 09, 2009
by
Roberto Raggi
Browse files
Improved the way we merge environments.
parent
7a9536c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/cpptools/cppmodelmanager.cpp
View file @
2780999d
...
...
@@ -187,7 +187,6 @@ protected:
QByteArray
tryIncludeFile
(
QString
&
fileName
,
IncludeType
type
);
void
mergeEnvironment
(
CPlusPlus
::
Document
::
Ptr
doc
);
void
mergeEnvironment
(
CPlusPlus
::
Document
::
Ptr
doc
,
QSet
<
QString
>
*
processed
);
virtual
void
macroAdded
(
const
Macro
&
macro
);
virtual
void
startExpandingMacro
(
unsigned
offset
,
...
...
@@ -212,6 +211,7 @@ private:
QSet
<
QString
>
m_included
;
Document
::
Ptr
m_currentDoc
;
QSet
<
QString
>
m_todo
;
QSet
<
QString
>
m_processed
;
};
}
// namespace Internal
...
...
@@ -270,7 +270,10 @@ void CppPreprocessor::run(const QString &fileName)
}
void
CppPreprocessor
::
resetEnvironment
()
{
env
.
reset
();
}
{
env
.
reset
();
m_processed
.
clear
();
}
bool
CppPreprocessor
::
includeFile
(
const
QString
&
absoluteFilePath
,
QByteArray
*
result
)
{
...
...
@@ -413,28 +416,22 @@ void CppPreprocessor::stopExpandingMacro(unsigned, const Macro &)
}
void
CppPreprocessor
::
mergeEnvironment
(
Document
::
Ptr
doc
)
{
QSet
<
QString
>
processed
;
mergeEnvironment
(
doc
,
&
processed
);
}
void
CppPreprocessor
::
mergeEnvironment
(
Document
::
Ptr
doc
,
QSet
<
QString
>
*
processed
)
{
if
(
!
doc
)
return
;
const
QString
fn
=
doc
->
fileName
();
if
(
processed
->
contains
(
fn
))
if
(
m_
processed
.
contains
(
fn
))
return
;
processed
->
insert
(
fn
);
m_
processed
.
insert
(
fn
);
foreach
(
const
Document
::
Include
&
incl
,
doc
->
includes
())
{
QString
includedFile
=
incl
.
fileName
();
if
(
Document
::
Ptr
includedDoc
=
snapshot
.
value
(
includedFile
))
mergeEnvironment
(
includedDoc
,
processed
);
mergeEnvironment
(
includedDoc
);
else
run
(
includedFile
);
}
...
...
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