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
2f649be1
Commit
2f649be1
authored
Jul 04, 2009
by
Roberto Raggi
Browse files
Disable macro expansion when preprocessing in fast-mode.
parent
93cdff18
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/FastPreprocessor.cpp
View file @
2f649be1
...
...
@@ -38,14 +38,14 @@ FastPreprocessor::FastPreprocessor(const Snapshot &snapshot)
QByteArray
FastPreprocessor
::
run
(
QString
fileName
,
const
QString
&
source
)
{
#ifdef QTCREATOR_WITH_MERGED_ENVIRONMENT
_preproc
.
setExpandMacros
(
false
);
if
(
Document
::
Ptr
doc
=
_snapshot
.
value
(
fileName
))
{
_merged
.
insert
(
fileName
);
foreach
(
const
Document
::
Include
&
i
,
doc
->
includes
())
mergeEnvironment
(
i
.
fileName
());
}
#endif
const
QByteArray
preprocessed
=
_preproc
(
fileName
,
source
);
return
preprocessed
;
...
...
src/libs/cplusplus/pp-engine.cpp
View file @
2f649be1
...
...
@@ -533,7 +533,8 @@ Preprocessor::Preprocessor(Client *client, Environment *env)
env
(
env
),
_expand
(
env
),
_result
(
0
),
_markGeneratedTokens
(
false
)
_markGeneratedTokens
(
false
),
_expandMacros
(
true
)
{
resetIfLevel
();
}
...
...
@@ -620,6 +621,16 @@ void Preprocessor::out(const char *s)
_result
->
append
(
s
);
}
bool
Preprocessor
::
expandMacros
()
const
{
return
_expandMacros
;
}
void
Preprocessor
::
setExpandMacros
(
bool
expandMacros
)
{
_expandMacros
=
expandMacros
;
}
Preprocessor
::
State
Preprocessor
::
createStateFromSource
(
const
QByteArray
&
source
)
const
{
State
state
;
...
...
@@ -806,8 +817,12 @@ void Preprocessor::preprocess(const QString &fileName, const QByteArray &source,
++
_dot
;
// skip T_IDENTIFIER
const
QByteArray
spell
=
tokenSpell
(
*
identifierToken
);
if
(
!
_expandMacros
)
{
out
(
spell
);
continue
;
}
if
(
env
->
isBuiltinMacro
(
spell
))
else
if
(
env
->
isBuiltinMacro
(
spell
))
expandBuiltinMacro
(
identifierToken
,
spell
);
else
{
...
...
src/libs/cplusplus/pp-engine.h
View file @
2f649be1
...
...
@@ -72,6 +72,9 @@ public:
const
QByteArray
&
source
,
QByteArray
*
result
);
bool
expandMacros
()
const
;
void
setExpandMacros
(
bool
expandMacros
);
private:
enum
{
MAX_LEVEL
=
512
};
...
...
@@ -188,6 +191,7 @@ private:
bool
_markGeneratedTokens
;
QString
_originalSource
;
bool
_expandMacros
;
};
}
// namespace CPlusPlus
...
...
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