summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/preprocessor.cpp
diff options
context:
space:
mode:
authorAurélien Brooke <aurelien@bahiasoft.fr>2025-07-18 16:07:14 +0200
committerAurélien Brooke <aurelien@bahiasoft.fr>2025-07-18 16:51:51 +0200
commita124591e21621f9ce1c908840e5c63589583ce08 (patch)
treeae0b3ac346507c980eafd9c26363879b645fe8ce /src/tools/moc/preprocessor.cpp
parentaf8e6f8f37b113965aa728ca63a528e5c786bf5c (diff)
moc: reserve() enough space for the SymbolStack
We know that the "symbols" stack will be at least of size one, and runtime analysis shows that it can grow up to 7: Max size Occurences 2 3778 3 5157 4 10920 5 6888 6 281 7 18 Call reserve() so that we never need to reallocate and move SafeSymbols structs, which are not trivial to move. Change-Id: I2c4a1f8637ff3636bc78b19e7bef61371f614944 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/tools/moc/preprocessor.cpp')
-rw-r--r--src/tools/moc/preprocessor.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index 721ee2bf519..8b329f8cff2 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -510,6 +510,7 @@ void Preprocessor::macroExpand(Symbols *into, Preprocessor *that, const Symbols
int lineNum, bool one, const QSet<QByteArray> &excludeSymbols)
{
SymbolStack symbols;
+ symbols.reserve(8);
SafeSymbols sf;
sf.symbols = toExpand;
sf.index = index;