diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2019-12-11 18:13:28 +0100 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2020-02-20 16:11:02 +0100 |
commit | 4dbac23e5354638224d8d99ba3342067c015a04b (patch) | |
tree | ac262e76f0e6b04378fb653192b216a6f8d1ef68 /src/tools/moc | |
parent | 33cd680ddbaccf6139e215d851a39e657ae36394 (diff) |
Normalize types at compile time
This also fix the normalization algorithm:
- Some 'const' after pointers were not removed as they should.
- No need to keep the space in '> >' and '< :' in C++11 anymore
- Fix normalization of 'long unsigned int' and similar
Change-Id: I2b72f0fede96c1063e7b155d9f25a85fccfc7bf9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/tools/moc')
-rw-r--r-- | src/tools/moc/moc.cpp | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 5e2e492f94..b37674320d 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -43,30 +43,9 @@ QT_BEGIN_NAMESPACE // only moc needs this function -static QByteArray normalizeType(const QByteArray &ba, bool fixScope = false) +static QByteArray normalizeType(const QByteArray &ba) { - const char *s = ba.constData(); - int len = ba.size(); - char stackbuf[64]; - char *buf = (len >= 64 ? new char[len + 1] : stackbuf); - char *d = buf; - char last = 0; - while(*s && is_space(*s)) - s++; - while (*s) { - while (*s && !is_space(*s)) - last = *d++ = *s++; - while (*s && is_space(*s)) - s++; - if (*s && ((is_ident_char(*s) && is_ident_char(last)) - || ((*s == ':') && (last == '<')))) { - last = *d++ = ' '; - } - } - *d = '\0'; - QByteArray result = normalizeTypeInternal(buf, d, fixScope); - if (buf != stackbuf) - delete [] buf; + QByteArray result = normalizeTypeInternal(ba.constBegin(), ba.constEnd()); return result; } |