diff options
author | hjk <qtc-committer@nokia.com> | 2012-04-19 11:54:31 +0200 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-04-19 19:05:29 +0200 |
commit | 0362016f02c80c5e55a7d8e6bd482a4aeaaf7ac3 (patch) | |
tree | 32641988bc137a0d88482815fa4472cc8de633e5 /src/libs/cplusplus/pp-engine.cpp | |
parent | ef09a67c6b8b852aa6b8a7bfeea8561623a79048 (diff) | |
download | qt-creator-0362016f02c80c5e55a7d8e6bd482a4aeaaf7ac3.tar.gz |
preprocessor: inline state setup
Change-Id: Icc3ee542c8e8f95dfd48604144e3f4ab638fdcd4
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/libs/cplusplus/pp-engine.cpp')
-rw-r--r-- | src/libs/cplusplus/pp-engine.cpp | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 388fe1642e..7dca9a3497 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -624,28 +624,6 @@ void Preprocessor::setKeepComments(bool keepComments) m_keepComments = keepComments; } -Preprocessor::State Preprocessor::createStateFromSource(const QString &fileName, - const QByteArray &source, - QByteArray *result, - bool noLines, - bool markGeneratedTokens, - bool inCondition) const -{ - State state; - state.m_currentFileName = fileName; - state.m_source = source; - state.m_lexer = new Lexer(source.constBegin(), source.constEnd()); - state.m_lexer->setScanKeywords(false); - state.m_lexer->setScanAngleStringLiteralTokens(false); - if (m_keepComments) - state.m_lexer->setScanCommentTokens(true); - state.m_result = result; - state.m_noLines = noLines; - state.m_markGeneratedTokens = markGeneratedTokens; - state.m_inCondition = inCondition; - return state; -} - void Preprocessor::genLine(unsigned lineno, const QByteArray &fileName) const { startNewOutputLine(); @@ -927,7 +905,19 @@ void Preprocessor::preprocess(const QString &fileName, const QByteArray &source, return; const State savedState = m_state; - m_state = createStateFromSource(fileName, source, result, noLines, markGeneratedTokens, inCondition); + + m_state = State(); + m_state.m_currentFileName = fileName; + m_state.m_source = source; + m_state.m_lexer = new Lexer(source.constBegin(), source.constEnd()); + m_state.m_lexer->setScanKeywords(false); + m_state.m_lexer->setScanAngleStringLiteralTokens(false); + if (m_keepComments) + m_state.m_lexer->setScanCommentTokens(true); + m_state.m_result = result; + m_state.m_noLines = noLines; + m_state.m_markGeneratedTokens = markGeneratedTokens; + m_state.m_inCondition = inCondition; const QString previousFileName = m_env->currentFile; m_env->currentFile = fileName; |