summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-11-15 18:00:28 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-18 12:13:26 +0100
commitf8a2a4f6bc74de33fedbebce3b072cdff41222c1 (patch)
treed44006507a5e7163426a4066b3db247a67087d63
parent5719eb31810c71ae653915d614ea7cb4ced081d3 (diff)
initialize/reset parser context properly
unconsumed context information may persist after finishing processing of top-level files and includes. this would confuse the include optimization, which would slow down lupdate by orders of magnitude for certain inputs. Task-number: QTBUG-27936 Change-Id: Ifcf6ddd1b54211434ffd8edfbec5e8960ac35f22 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
-rw-r--r--src/linguist/lupdate/cpp.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/linguist/lupdate/cpp.cpp b/src/linguist/lupdate/cpp.cpp
index 6e6bab121..d3a223561 100644
--- a/src/linguist/lupdate/cpp.cpp
+++ b/src/linguist/lupdate/cpp.cpp
@@ -1413,7 +1413,6 @@ void CppParser::processInclude(const QString &file, ConversionData &cd, const QS
parser.namespaces = namespaces;
parser.functionContext = functionContext;
parser.functionContextUnresolved = functionContextUnresolved;
- parser.pendingContext = pendingContext;
parser.setInput(ts, cleanFile);
parser.setTranslator(tor);
QStringList stack = includeStack;
@@ -1423,6 +1422,9 @@ void CppParser::processInclude(const QString &file, ConversionData &cd, const QS
CppFiles::setBlacklisted(cleanFile);
}
inclusions.remove(cleanFile);
+
+ prospectiveContext.clear();
+ pendingContext.clear();
}
/*
@@ -1610,6 +1612,9 @@ void CppParser::parseInternal(ConversionData &cd, const QStringList &includeStac
bool yyTokColonSeen = false; // Start of c'tor's initializer list
metaExpected = true;
+ prospectiveContext.clear();
+ pendingContext.clear();
+
yyWord.reserve(yyInStr.size()); // Rather insane. That's because we do no length checking.
yyInPtr = (const ushort *)yyInStr.unicode();
yyCh = getChar();