Iterate only once over QJsonObject, create key list by
existing loop instead of create by QJsonObject::keys(),
which contains internal loop.
In common case if loop's statement is lightweight,
then effect of optimization is significant, and vice versa.
Also make addJsonArray() and addJsonObject() functions
more homogeneous.
Use reserve to optimize memory allocation.
Change-Id: Id122cd1becfd34bb06640876b1c79e1d396d2a6b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Java-style iterators are slower than STL-style ones, so
they should not be used in library code.
Replaced them with C++11 range-for, STL iterators or, in
one case, qDeleteAll().
In one case, avoid a double hash lookup by using erase(it)
instead of remove(it.key()), which we can now do without
detaching, due to the new erase() taking const_iterator.
Change-Id: I96174657fed70f76120b2c9d8190b4e70d5d8179
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
In VcprojGenerator::collectDependencies(), a temporary QLinkedList
is created, then iterated over. There's no reason to use a node-
based container here: no references are taken, no erases happen,
esp. not in the middle...
Port to QVector instead and reserve it, since the maximum size is
known ahead of time, and the lifetime of the container is very
short.
Since the loop iterating over the linked list needed touching
anyway, port directly to C++11 range-for.
Change-Id: Ic5dfeebcd9da37c214f54abc6025a0a2b8fa3b5d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
(or trivially marked const) ... by replacing them
with C++11 range-for loops.
Change-Id: I1522e220a57ecb1c5ee0d4281233b3c3931a2ff8
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... by replacing them with C++11 range-for loops.
To avoid detaches of these mutable Qt containers,
wrap the container in qAsConst().
Change-Id: If086bea06fe26232a7bb99fad8b09fce4dc74c27
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... by replacing them with C++11 range-for loops.
This is the simplest of the patch series: Q_FOREACH took a
copy, so we do, too. Except we don't, since we're just
catching the return value that comes out of the function
(RVO). We can't feed the rvalues into range-for, because
they are non-const and would thus detach.
Change-Id: I5834620bf82f3442da7b2838363d351a0fb960a0
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... by replacing them with C++11 range-for loops.
The functions QMakeProject::values(), QMakeMetaInfo::values()
and QHashIterator::value() all return by const-reference,
so they can be passed to range-for without further changes.
Change-Id: Ic3b39ed8ff8cd7a6f287f1aa9d61a1acd67d7aaa
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... iterate over the container itself instead. Avoids
temporary QList creation as well as the lookup cost
when actually calling value(key).
Change-Id: Icac867c30e63863cfa44a382eedd4d6df2070a59
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
I wrote a script to help find the files, but I reviewed the
contributions manually to be sure I wasn't claiming copyright for search
& replace, adding Q_DECL_NOTHROW or adding "We mean it" headers.
Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
QFileInfo::exists(f) is somewhat faster than the version which creates an temporary object.
Change-Id: I5f931a86d9dfad57d99efe04ca115422de43def9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When building QNX on MS-Windows, make magically adds the Msys root as
prefix to variables whose values look like paths; this applies to both
environment variables and variables given values on the command-line.
When we don't actually want to install under the Msys root, this is
unwelcome "help". So (for MinGW's make) support a magic prefix of our
own, @msyshack@, that'll make a path value for INSTALL_ROOT not look
like a path to make; we can then strip it off when we come to use it.
Change-Id: I951ad3c8fe3e5cfb49e6e361d7fff779f3a9d716
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some
exceptions, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/
Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one
(in those files which will be under GPL 3 with exceptions)
Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Having a precompiled header file without file extension (or without
common file extension) led to an incorrectly generated Visual
Studio project file. The custom build step for automatically
generating the corresponding source file was missing.
Remove the file extension check that apparently was yet another
feeble attempt of runtime optimization.
Task-number: QTBUG-50442
Change-Id: I0552f94be12cbb70e2f32c242c7364699979bd81
Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Previously the hardware and camera button handler were guarded inside a
Q_OS_WINPHONE which does not apply to Windows 10.
Instead use WINAPI_PARTITION_FAMILY like on other places, this covers
Windows Phone 8.1 as well as Windows 10.
To find windows.phone.ui.input.h at build time the Mobile Extension
directory needs to be added to the include paths inside qmake. On
runtime we need to check whether we have hardware buttons or not. In
case they exist, register the handlers, otherwise skip registration.
Skipping also helps to keep WACK succeeding.
Task-number: QTBUG-50427
Change-Id: Ibeae15dbde12553cebd2b73b1a40b754c014f426
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
... instead of using erase in a loop, with quadratic complexity.
Change-Id: I4ac03ac0e893fc5dbb5e45131fcbfe82f1564bee
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
the primary purpose is making env var prepend mode work for unset
variables on windows. this is achieved by using a conditional and delayed
variable expansion. however, the latter is disabled by default and can
be locally enabled only in batch files. therefore, write wrapper scripts
and substitute them for the actual commands. we do this also on unix,
both for consistency and simply because the commands look much less
confusing.
this change is slightly backwards-incompatible, as invoking
qtAddToolEnv() multiple times on the same command will now make a total
mess. also, invoking it on a command that contains 'make' macro
expansions isn't a good idea, so testcase.prf needed an adjustment. the
function is an undocumented internal, so Nobody Should Care (TM).
this also reverts 80ebedecf9, as it's obsolete now.
Change-Id: I8394b77868b495abcf27b688996ca74c40b80994
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
In 50bf54c invoking windeployqt was only required in release mode as
MDILXapCompile was not invoked for debug builds with Visual Studio 2013.
However, Visual Studio 2015 invokes MDILXapCompile for debug and
release. Hence we have to use this workaround unconditionally.
Also we cannot limit this to msvc2015 host specs only, as older projects
still might be loaded with Visual Studio 2015 causing the build to
break.
Task-number: QTBUG-49815
Change-Id: Ia120a392967319b945a9746ad489f2db0eed7156
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
while we evaluate the features themselves in precise mode (which is the
reason why they can error out), we do not want them to terminate
cumulative project evaluation.
Change-Id: I70f3e1bcb2ca04a70c74ff484749ca92c1cf6372
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
(cherry picked from qttools/90ee4094161b427c32581bca2f5286edb4fffdb1)
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
After 90e7cc172a, QStringList no longer
includes QDataStream.
This also reverts commit c1be0fbe7d, which
did the same in a worse way.
Change-Id: Ib10622b0da3b3450d29fc65dc5356fde75444a8f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
(cherry picked from qttools/376501ae5a86859821c0e89b2e8fbc9906d11e07)
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
As for the #include-parser, the moc-detector's minimal C preprocessor
could be confused by a raw string into ignoring large chunks of code.
Change-Id: Id688e9a1f04628ce75a51a7d15269078c734288e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
If a / wasn't part of a comment-start, it and the character after it
were none the less stepped over. If the character after started an
enclosure, this would duly be missed, leading to mis-parsing of the
subsequent text. As for similar bug recently fixed in findDeps().
Change-Id: Ie5329ec633c23a554b42a6351723c980e27fb9a9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
The C preprocessor allows backslash-newline anywhere and allows
comments anywhere it allows space. Testing wilfully perverse
applications of that revealed qmake's parsing of #include directives
wasn't very robust. So rework to actually follow the rules and add
those tests.
Change-Id: If5cc7bfb65f9994e9ab9ed216dd1ee7285c63934
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
The parser in QMakeSourceFileInfo::findDeps() would step over the
closing quote of a string, only to have a for loop then step over the
character just after that closing quote, which was thus never studied;
this could lead to problems in various ways. Fixed that and expanded
findDeps() test to catch regressions.
Task-number: QTBUG-17533
Change-Id: I7dec5222e38fa188495b39376ffee70bc7bbc87f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This information is outdated.
Change-Id: Ic2e10f7c858eed6f1b7c550995cb29004b4bd280
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Can't sensibly test unless the compiler does support raw strings,
since any test that would catch qmake's (prior) inability to parse raw
strings would necessarily confuse the C++ compiler in the same way.
This even applies (in test app code) to any #if-ery around the raw
string, since tokenization happens before preprocessor directives are
resolved. So the #if-ery on Q_COMPILER_RAW_STRINGS has to be in
tst_qmake.cpp, not the test app it builds.
Change-Id: I4a461f515adff288b54fb273fd9996f9b906d11c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
The Visual Studio registry keys are stored in the 32 bit view.
Extend qt_readRegistryKey with an option that enables the caller to
choose the 32 bit or 64 bit registry view.
We now read the Visual Studio registry keys from the 32 bit registry
view even in a 64 bit build.
Adding the next Visual Studio version will become a bit easier.
Change-Id: I7300b992be6058f30a422e3f1fe0bafade6eea54
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
For some reason, the solution generator was looking for the vcproj
files in the source tree. It should look for them in the output tree
instead (suggested by Joerg Bornemann). This should handle both
in-source and out-of-source builds, and the special-case code for
handling out-of-source builds (which had a bug) can be removed.
Task-number: QTBUG-49665
Change-Id: I40b5c5907c52ffb074ccb8f297bb5924eacc1cb0
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
We need to remember where the included file's name starts anyway; if
we move this to before the search for the end, we don't need a
separate variable to keep track of its length.
Change-Id: Ia8d72839ac3fa32f2e748a21ee70dcab614562f4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>