diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index 388fe1642eed743e1694f1cf106880e0a871b731..7dca9a3497aa84df4b6514a501f818e9156b27f0 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;
diff --git a/src/libs/cplusplus/pp-engine.h b/src/libs/cplusplus/pp-engine.h
index 5213882b8e451d4bdc307a19c53a8ef2d0c39964..5fa9dfa547f15e50bab5d24dcfa107e11b2d9623 100644
--- a/src/libs/cplusplus/pp-engine.h
+++ b/src/libs/cplusplus/pp-engine.h
@@ -149,8 +149,6 @@ private:
 
     static bool isQtReservedWord(const ByteArrayRef &name);
 
-    State createStateFromSource(const QString &fileName, const QByteArray &source, QByteArray *result, bool noLines, bool markGeneratedTokens, bool inCondition) const;
-
     inline bool atStartOfOutputLine() const
     { return (m_state.m_result && !m_state.m_result->isEmpty()) ? m_state.m_result->end()[-1] == '\n' : true; }