diff options
| author | Eike Ziller <[email protected]> | 2019-09-04 08:59:07 +0200 |
|---|---|---|
| committer | Eike Ziller <[email protected]> | 2019-09-04 10:11:48 +0000 |
| commit | 8d85a7c2bc011a06dff3a85e47b6ecfa5cdaed24 (patch) | |
| tree | c3af2860f147d8f6574c0a88b46be8ffd1f88903 /src/libs/qmljs/qmljsdocument.cpp | |
| parent | 6ef98541f7fe61da239d01958d0f8ad81d8b1137 (diff) | |
QmlJS: Fix compiler warnings
Change-Id: I94fccd913a4a06fb55acee3df974859f9a163b4f
Reviewed-by: Ulf Hermann <[email protected]>
Diffstat (limited to 'src/libs/qmljs/qmljsdocument.cpp')
| -rw-r--r-- | src/libs/qmljs/qmljsdocument.cpp | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/src/libs/qmljs/qmljsdocument.cpp b/src/libs/qmljs/qmljsdocument.cpp index 2efa9c0334d..c848a78c537 100644 --- a/src/libs/qmljs/qmljsdocument.cpp +++ b/src/libs/qmljs/qmljsdocument.cpp @@ -39,6 +39,8 @@ #include <algorithm> +static constexpr int sizeofQChar = int(sizeof(QChar)); + using namespace QmlJS; using namespace QmlJS::AST; @@ -248,12 +250,6 @@ public: {} - void pragmaLibrary(int line, int column) - { - isLibrary = true; - addLocation(line, column); - } - void importFile(const QString &jsfile, const QString &module, int line, int column) override { @@ -306,12 +302,13 @@ bool Document::parse_helper(int startToken) _parsedCorrectly = parser.parse(); break; case QmlJSGrammar::T_FEED_JS_SCRIPT: - case QmlJSGrammar::T_FEED_JS_MODULE: + case QmlJSGrammar::T_FEED_JS_MODULE: { _parsedCorrectly = parser.parseProgram(); - for (const auto &d: directives.locations()) { + const QList<SourceLocation> locations = directives.locations(); + for (const auto &d : locations) { _jsdirectives << d; } - break; + } break; case QmlJSGrammar::T_FEED_JS_EXPRESSION: _parsedCorrectly = parser.parseExpression(); @@ -383,10 +380,6 @@ LibraryInfo::LibraryInfo(const QmlDirParser &parser, const QByteArray &fingerpri updateFingerprint(); } -LibraryInfo::~LibraryInfo() -{ -} - QByteArray LibraryInfo::calculateFingerprint() const { QCryptographicHash hash(QCryptographicHash::Sha1); @@ -396,12 +389,14 @@ QByteArray LibraryInfo::calculateFingerprint() const foreach (const QmlDirParser::Component &component, _components) { len = component.fileName.size(); hash.addData(reinterpret_cast<const char *>(&len), sizeof(len)); - hash.addData(reinterpret_cast<const char *>(component.fileName.constData()), len * sizeof(QChar)); + hash.addData(reinterpret_cast<const char *>(component.fileName.constData()), + len * sizeofQChar); hash.addData(reinterpret_cast<const char *>(&component.majorVersion), sizeof(component.majorVersion)); hash.addData(reinterpret_cast<const char *>(&component.minorVersion), sizeof(component.minorVersion)); len = component.typeName.size(); hash.addData(reinterpret_cast<const char *>(&len), sizeof(len)); - hash.addData(reinterpret_cast<const char *>(component.typeName.constData()), component.typeName.size() * sizeof(QChar)); + hash.addData(reinterpret_cast<const char *>(component.typeName.constData()), + component.typeName.size() * sizeofQChar); int flags = (component.singleton ? (1 << 0) : 0) + (component.internal ? (1 << 1) : 0); hash.addData(reinterpret_cast<const char *>(&flags), sizeof(flags)); } @@ -410,17 +405,18 @@ QByteArray LibraryInfo::calculateFingerprint() const foreach (const QmlDirParser::Plugin &plugin, _plugins) { len = plugin.path.size(); hash.addData(reinterpret_cast<const char *>(&len), sizeof(len)); - hash.addData(reinterpret_cast<const char *>(plugin.path.constData()), len * sizeof(QChar)); + hash.addData(reinterpret_cast<const char *>(plugin.path.constData()), len * sizeofQChar); len = plugin.name.size(); hash.addData(reinterpret_cast<const char *>(&len), sizeof(len)); - hash.addData(reinterpret_cast<const char *>(plugin.name.constData()), len * sizeof(QChar)); + hash.addData(reinterpret_cast<const char *>(plugin.name.constData()), len * sizeofQChar); } len = _typeinfos.size(); hash.addData(reinterpret_cast<const char *>(&len), sizeof(len)); foreach (const QmlDirParser::TypeInfo &typeinfo, _typeinfos) { len = typeinfo.fileName.size(); hash.addData(reinterpret_cast<const char *>(&len), sizeof(len)); - hash.addData(reinterpret_cast<const char *>(typeinfo.fileName.constData()), len * sizeof(QChar)); + hash.addData(reinterpret_cast<const char *>(typeinfo.fileName.constData()), + len * sizeofQChar); } len = _metaObjects.size(); hash.addData(reinterpret_cast<const char *>(&len), sizeof(len)); @@ -433,7 +429,7 @@ QByteArray LibraryInfo::calculateFingerprint() const hash.addData(reinterpret_cast<const char *>(&_dumpStatus), sizeof(_dumpStatus)); len = _dumpError.size(); // localization dependent (avoid?) hash.addData(reinterpret_cast<const char *>(&len), sizeof(len)); - hash.addData(reinterpret_cast<const char *>(_dumpError.constData()), len * sizeof(QChar)); + hash.addData(reinterpret_cast<const char *>(_dumpError.constData()), len * sizeofQChar); len = _moduleApis.size(); hash.addData(reinterpret_cast<const char *>(&len), sizeof(len)); @@ -623,9 +619,9 @@ void ModuleApiInfo::addToHash(QCryptographicHash &hash) const { int len = uri.length(); hash.addData(reinterpret_cast<const char *>(&len), sizeof(len)); - hash.addData(reinterpret_cast<const char *>(uri.constData()), len * sizeof(QChar)); + hash.addData(reinterpret_cast<const char *>(uri.constData()), len * sizeofQChar); version.addToHash(hash); len = cppName.length(); hash.addData(reinterpret_cast<const char *>(&len), sizeof(len)); - hash.addData(reinterpret_cast<const char *>(cppName.constData()), len * sizeof(QChar)); + hash.addData(reinterpret_cast<const char *>(cppName.constData()), len * sizeofQChar); } |
