diff options
author | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-04-19 10:04:12 +0300 |
---|---|---|
committer | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-04-20 12:07:52 +0000 |
commit | bafe205d6a87c0672e1e6142160a60415c7f4533 (patch) | |
tree | f844b2e34bf09aee89ffb6260072509da53cbf38 /src/tools/moc/preprocessor.cpp | |
parent | 64df35c02d6a7bb13f7bf80f1e419a86eb100106 (diff) |
Moc: use QStringBuilder more
Adding strings in a single expression gets mediated
efficiently by QStringBuilder, where using += repeatedly
forces premature consolidation.
Change-Id: I6c1abb9c9801a016ce6c151cffdf8c7ac9502f4e
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/tools/moc/preprocessor.cpp')
-rw-r--r-- | src/tools/moc/preprocessor.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index ca5ee87cf1..59611ca597 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -207,10 +207,11 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso && !symbols.isEmpty() && symbols.constLast().token == STRING_LITERAL) { - QByteArray newString = symbols.constLast().unquotedLexem(); - newString += input.mid(lexem - begin + 1, data - lexem - 2); - newString.prepend('\"'); - newString.append('\"'); + const QByteArray newString + = '\"' + + symbols.constLast().unquotedLexem() + + input.mid(lexem - begin + 1, data - lexem - 2) + + '\"'; symbols.last() = Symbol(symbols.constLast().lineNum, STRING_LITERAL, newString); @@ -1034,9 +1035,8 @@ void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed) const int slashPos = include.indexOf('/'); if (slashPos == -1) continue; - QByteArray frameworkCandidate = include.left(slashPos); - frameworkCandidate.append(".framework/Headers/"); - fi.setFile(QString::fromLocal8Bit(QByteArray(p.path + '/' + frameworkCandidate).constData()), QString::fromLocal8Bit(include.mid(slashPos + 1).constData())); + fi.setFile(QString::fromLocal8Bit(p.path + '/' + include.left(slashPos) + ".framework/Headers/"), + QString::fromLocal8Bit(include.mid(slashPos + 1).constData())); } else { fi.setFile(QString::fromLocal8Bit(p.path.constData()), QString::fromLocal8Bit(include.constData())); } |