Instead, always write into a unique temporary directory in
QDir::tempPath().
Where applicable, read the test source from files instead of first
writing the file.
Some clean ups in test_codegen*.
Change-Id: Id48dc50c6ca16252edfd9fc8a86ba0de9f9be486
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
So far the pre-compiled headers were processed (thus defines from those
headers were visible), but the actual includes for the documents were
not added, which is necessary for lookup/completion.
Note that this will be only done if pre-compiled headers are not ignored
(Options > C++ > Code Model > [] Ignore pre-compiled headers).
Change-Id: I54a8e6b00597af164d958e3e9f2a1075ea187788
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
In most cases we need to work with the utf16 indices. Only in
cppfindreferences the byte interface is still needed since there we read
in files and work on a QByteArray to save memory.
Change-Id: I6ef6a93fc1875a8c9a305c075d51a9ca034c41bb
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* If the macro is defined before, track its reference
* Synchronize environment line before calling remove, which
currently sets incorrect line
* Set macro offset
Task-number: QTCREATORBUG-10454
Change-Id: I480d16423a976a025bb8c71046610a46f9d7b0fd
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
The following snippet demonstrates the problem:
--- snip ---
// comment \
#include <something.h>
...
class Foo
{
...
};
--- snap ---
If there are >=9 empty/preprocessor lines, the preprocessed source
becomes
// comment \
# 12 "file.cpp"
...
The lexer considers the line marker as a continued C++ comment, and
highlighting is broken
Change-Id: I30a2fc7d19b279316e9273697179c90d81099573
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Easier to compare when indentation is aligned
Change-Id: I216073dc167c0ed785616ae308b566db7f910592
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This takes too much memory. For qtcreator.pro the numbers are as
follows:
Patch applied: ~ 1600MB (RES)
Patch reverted: ~ 510MB (RES)
This reverts commit 4c2daa90ce.
Task-number: QTCREATORBUG-10973
Change-Id: I843bd7c1ea4a26a1ec55ddc14c2a34a98d040922
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This adds definitions for the macros __FILE__, __LINE__, __DATE__ and
__TIME__ on demand.
As a side effect, this also introduces highlighting for the uses of
these macros.
Task-number: QTCREATORBUG-8036
Change-Id: Ib7546c7d45d2eecbc50c7883fc684e3497154405
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
Breaks highlighting for macros using the predefined macros.
This reverts commit 1d834c1126.
Change-Id: Ic13c407e293a806a63ff30153864530df6a32e47
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Preprocessor variables __LINE__,__FILE__,__TIME__,__DATE__ where destroying
the following systems when affected variables were standing within the
same line with those variables:
* highlighting
* refactoring
* local renaming
Task-number: QTCREATORBUG-8036
Change-Id: I1a4b919d15812872ca5a8e63b1031ec1ab144c22
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Note: Since not all autotests are able to run from an installed location,
we need to be able to start them from the build directory, which
in turn forces us to set a destination directory for libraries and plugins,
so they will be found at run-time.
Change-Id: Idcf7e1333dfa6e9dbf745391b78c035f842ccc5a
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
For the quick fix AddIncludeForUndefinedIdentifier, if no class is found
via the locator, check the "Qt include paths" for a header file with the
same name as the class name.
Task-number: QTCREATORBUG-9538
Change-Id: I13c86844c2ff653fa479dc91eb109af2a6d76fae
Reviewed-by: Lorenz Haas <lykurg@gmail.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
By lexing the first token after a macro call (meaning: the token after
the closing parenthesis (which was passed to handleFunctionLikeMacro
which in turn pushed it back into the token buffer)), a token buffer
might be popped, which unblocks the macro that generated the actual
param pack. The effect was that if this happens in the expansion of a
recursive macro (with parameters!), the preprocessor ended up in an
infinite loop.
Task-number: QTCREATORBUG-9015
Task-number: QTCREATORBUG-9447
Change-Id: I0d83c59188ec15c4a948970e9fa944a17d765475
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
...by detecting include groups (separated by new lines, include types
and same dir prefix).
Task-number: QTCREATORBUG-9317
Change-Id: I73e80fdc715104901cb2d4f5b15b4cab5d04d305
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Doing so resulted in an incorrect position for the EOF token when the
preprocessed output would be parsed. That in turn leads to incorrect
insertion positions for refactoring actions.
This is especially true when a file contains only preprocessor
directives: the EOF token would point to line 1 column 1, which is
usually not the place where code should be inserted.
Change-Id: I7d359aa7a6c04bc52c8b873fd49ad6afc3a77319
Reviewed-by: hjk <hjk121@nokiamail.com>
Preprocessor did not correctly handle when variadic macro arguments were not
provided at all, if there were other arguments: macro was not expanded
in case only the non variadic arguments were given.
#define MACRO(...) used to work fine for 0 or more arguments.
#define MACRO(ARG0, ...) used to work only for 2 or more arguments, now fixed.
Change-Id: I64e9199ceccae05618a49931c2adad8e4f9471ba
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
... and adjust INCLUDEPATH accordingly.
while i'm at messing with include statements, also re-order the include
blocks according to policy and sort them within bigger blocks.
Change-Id: I7762abfd7c4ecf59432b99db2f424e4fa25733a5
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Track the typical #ifndef/#define/#endif usage in header files to see if
the macro is an include guard. If so, store it in the Document. No
behavioural change, just recording the name.
This can be used in the future to track if a file needs to be re-parsed
when a macro changes: if it was used in the file, and not defined in it
nor being the include-guard, a file should be re-preprocessed and
re-parsed.
It can also be used to check if two files have the same include guard.
Change-Id: I2715f529997a7b24a11bdbc6150652e2669f1a46
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
When in 'keep comments' mode, the preprocessor does not properly handle macro calls with
comments between the macro name and the opening parenthesis: "FOO /*something to say*/
(45)".
Change-Id: I6fe733242e4d2ccff2985d17399d0a084917415a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
For shadow builds some tests couldn't find their test data. Solved by
using the same pattern as in Qt tests: Inject $$PWD as SRCDIR via a
DEFINES statement.
Note: It was considered to use QFINDTESTDATA for Qt5, but this was
rejected due to:
1) It's Qt5 only (would mean to introduce some wrapper...)
2) As the doc states, it will not work with QTEST_APPLESS_MAIN tests.
Change-Id: Ie6cf59570fe61725b7f6f83b7da650331ddb38fc
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>