Commit Graph

566 Commits

Author SHA1 Message Date
Nikolai Kosjar
3baa1b35e2 C++: Ensure test code is free of diagnostic messages in tst_checksymbols.cpp
Change-Id: I11b3caf354d57f08268cca7bc2944ca7ae386bfb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-12-16 10:32:12 +01:00
Nikolai Kosjar
af995ca1b8 Tests: Rename test function in tst_lexer.cpp
...to a more generic name since it is not any more limited to doxygen.

Change-Id: I0fca5dab9b5ab8850b2cfba5758b51f0451c199d
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-12-10 15:07:10 +01:00
Eike Ziller
920d524d38 Merge remote-tracking branch 'origin/3.0' 2013-12-03 12:46:39 +01:00
Nikolai Kosjar
223ecc70a2 C++: Compile fix for tst_lexer
The trigraph sequence somehow confused qmake. The moc file was not
generated.

Change-Id: I4016947b5c8efa350d1813737651143d8687d299
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-12-03 10:54:15 +01:00
Nikolai Kosjar
796fcaf1d2 Revert "C++: Fix highlighting for lines with predefined macros"
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>
2013-12-03 09:53:26 +01:00
Eike Ziller
f7397224ea Merge remote-tracking branch 'origin/3.0' 2013-11-29 16:36:13 +01:00
Nikolai Kosjar
4c2daa90ce C++: Fix highlighting for lines with predefined macros
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>
2013-11-29 15:11:27 +01:00
Nikolai Kosjar
4edfe87b58 Revert "Preprocessor Enginge: fix bug in pp-engine.cpp"
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>
2013-11-29 15:11:10 +01:00
Eike Ziller
0e4de8c108 Merge remote-tracking branch 'origin/3.0' 2013-11-29 11:50:41 +01:00
Simon Schäfer
1d834c1126 Preprocessor Enginge: fix bug in pp-engine.cpp
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>
2013-11-28 11:40:37 +01:00
hjk
5c5240815a CPlusPlus: Fix parsing of ??< ??> ??( ??) trigraphs
Almost most useful feature ever.

Task-number: QTCREATORBUG-2474
Change-Id: If1ad661fab58ffb4a0b9ddb8ba771f2fde3b54ec
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-11-27 16:24:30 +01:00
Orgad Shaneh
eac518aee6 C++: Support __thread and thread_local
Task-number: QTCREATORBUG-7679
Change-Id: I794f52b2bcfb6c78ceef86ec53b6ed32b3d53d9f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-11-26 09:46:10 +01:00
Nikolai Kosjar
8a1eed2c56 Compile fix for Windows of external cplusplus auto tests
Change-Id: I6636b6d753db6c80d219755032e6e3915b0dcd55
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2013-11-14 08:34:14 +01:00
Nikolai Kosjar
1a5c7d8ef5 C++: Safe accessing of elements of TranslationUnit::_tokens
Until now std::vector::at() was used to access the elements. This is
handy for debugging since an exception is thrown for invalid indices,
but it does not stop Qt Creator from crashing because exceptions are not
caught.

This is especially a problem for the parser, which has to look ahead via
LA(n), which accesses TranslationUnit::_tokens.

With this patch, explicit bounds checking is done before accessing the
elements and thus calls to

  std::vector::at() // bounds checking, throwing out_of_range

were replaced by calls to

  std::vector::operator[]() // no bounds checking, not throwing out_of_range

Measuring the parse time for the Qt Creator project shows that there is
no slowdown. In both cases, with and without the patch, about 15s are
needed on the authors machine.

Task-number: QTCREATORBUG-10453

Change-Id: I32b12a526ff7199bcadfc21a3deb5354063a3e3b
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-10-23 10:46:14 +02:00
Orgad Shaneh
4835469531 C++: Comment out debug log
Uncommented in e088541c0

Change-Id: Ia9685b815523ab61a8780e9f5686a5d713eec842
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-10-16 16:41:42 +02:00
hjk
2b532c73ee CPlusPlus: Make (sub-)languague selection more generic
Change-Id: I4e2df6992b446adec662ab07671acd41715e41fd
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-10-15 16:22:28 +02:00
Nikolai Kosjar
0e4deaba23 C++: Parse MEMBER in Q_PROPERTY()
MEMBER was added in Qt5.

Task-number: QTCREATORBUG-10068

Change-Id: Ic6c15a0e5ee8981ab98e4c12fc1521dc281b731f
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-10-09 15:13:31 +02:00
Christian Kandeler
698144e32e Add qbs project files for autotests.
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>
2013-09-09 12:16:09 +02:00
Nikolai Kosjar
551b18f304 C++: Tests: Fix tst_Semantic::lambda_2() test
Change-Id: Ie405a9339d13615efb1113614a7dcd7069849b4f
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-09-06 09:58:02 +02:00
Christian Kandeler
eecacbfbfe CPlusPlus: Some compile fixes for autotests.
Change-Id: Id2ced5e41686387e67a7bb8419fe1547b23779c7
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-08-26 17:45:54 +02:00
Nikolai Kosjar
2555c21158 C++: Tests: Reset diagnostic messages
...otherwise they add up and subsequent tests checking for the error count will
fail:

FAIL!  : tst_AST::objc_try_statement_1() Compared values are not the same
   Actual   (diag.errorCount): 5
   Expected (0): 0
   Loc: [/home/nikolai/dev/creator/qtcreator-master/tests/auto/cplusplus/ast/tst_ast.cpp(1400)]
...

Change-Id: I8b4356331e95dceb1e99bb26e6ebf4591d70a08c
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-08-22 10:10:15 +02:00
Erik Verbruggen
c2d2173934 C++: Add parser support for @throw statements.
Change-Id: I366733ec821ee264f182f4d4a3cf69cdada20cfc
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-08-21 15:33:39 +02:00
Oswald Buddenhagen
c2e90c360b Merge remote-tracking branch 'origin/2.8'
Conflicts:
	src/plugins/cpptools/cppcompletion_test.cpp
	src/plugins/cpptools/cpptoolsplugin.h
	src/plugins/projectexplorer/customtoolchain.cpp
	src/plugins/vcsbase/command.cpp

Change-Id: Ie7b3c9e136c0748b41320227c757471259339b48
2013-08-21 14:39:18 +02:00
Przemyslaw Gorszkowski
3256b7b2ef C++: fix matching type with using from other namespace
example code:
struct S { int s; };

namespace std
{
    template <typename T>
    struct shared_ptr
    {
        T* operator->();
    };
}

namespace NS
{
    using std::shared_ptr;
}

int main()
{
    NS::shared_ptr<S> p;// for this shared_ptr
    return 0;
}

Fixes:
* find usages
* follow symbol
* highlighting
* marking

Task-number: QTCREATORBUG-7978
Change-Id: I28994c960b87ddd400e1d7b860fca6c6683bbb5a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-08-20 14:13:19 +02:00
hjk
958a1d2d4e Debugger: Implement dumper for std::unordered_{set,map}
Task-number: QTCREATORBUG-9855

Change-Id: I985745530d93e1c191442431a7a9449a1c4c059a
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-08-16 11:11:21 +02:00
Erik Verbruggen
23085895d6 C++: handle @try statements in the parser.
No semantic analysis yet, but this prevents the parser from generating
bogus diagnostics.

Task-number: QTCREATORBUG-9309
Change-Id: I2ec575a8474cd51bfa97b17678d3da71ab8dcd7a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-07-19 14:49:38 +02:00
Erik Verbruggen
8828a2fa38 C++: add test for TranslationUnit::getPosition bug
This test is marked as failing, because the bug is still there. To be
fixed when we re-use the generated token stream of the preprocessor as
input for the parser.

Task-number: QTCREATORBUG-9799
Change-Id: I454a9939aa188a6ff934a11699232f39c828bc7b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-07-15 11:07:51 +02:00
Erik Verbruggen
fa1647d880 C++: add utility method to dump usages.
Change-Id: Icff6e9310a45e66b573fb2a6623a10e025c43539
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-07-11 14:09:03 +02:00
Erik Verbruggen
3563b4167f C++: Fix test failure after merging 2.8.
Change-Id: Iac4156b872fe81c1714857c24363bf171e7d61cd
Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-07-11 13:58:16 +02:00
Eike Ziller
79fbb0db04 Merge remote-tracking branch 'origin/2.8' into HEAD
Conflicts:
	src/libs/cplusplus/FindUsages.cpp
	tests/auto/cplusplus/findusages/tst_findusages.cpp
	tests/auto/debugger/tst_dumpers.cpp

Change-Id: I20e2002c7b25cc25d8120922fa9b52e59db498e3
2013-07-09 11:04:59 +02:00
Erik Verbruggen
d70a33c0d0 C++: fix scope matching for templates in FindUsages
When the cursor is on the name of declaration of a templated function,
then since f93758b8e1 the scope returned
by Document::findScopeAt is the scope of the template declaration.
Before it was the parent scope of the template declaration.

The check in FindUsages::checkCandidates did not check all combinations
of template(-child symbol) scopes for the searched symbol and its
occurrences.

Task-number: QTCREATORBUG-9749

Change-Id: Idc84a2ba718721ce54683a67635a93352784ddd1
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-07-08 15:05:10 +02:00
Eike Ziller
a98fe15fe5 Merge remote-tracking branch 'origin/2.8' into HEAD
Conflicts:
	qbs/pluginspec/pluginspec.qbs

Change-Id: Ic8e992623b9eda8913ee473c779a8df27643ccc9
2013-07-08 15:01:17 +02:00
hjk
d2469bc9e8 CppRewriter: Treat libc++'s std::__1:: as std:: for debugger display
Change-Id: Iabc1330633e5568b7c94059d4286c93adfecb1a2
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-07-08 11:07:42 +02:00
Eike Ziller
8685ff8a28 Merge remote-tracking branch 'origin/2.8' into HEAD
Conflicts:
	qtcreator.pri
	qtcreator.qbs

Change-Id: I5d2018d3437b99bcdffa92bf1a212f42923c4fad
2013-07-03 16:55:27 +02:00
Erik Verbruggen
a8a49c9851 CDB: fix breakpoint location in catch clauses.
Task-number: QTCREATORBUG-7336

Change-Id: I926e82499325e4fe38e25cc7a6158050f7fc0e82
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-07-02 11:40:23 +02:00
Eike Ziller
e8469a2bab Merge remote-tracking branch 'origin/2.8'
Conflicts:
	src/plugins/fakevim/fakevimhandler.cpp

Change-Id: I8101f18b87859924644471817d4f1408790d5628
2013-06-25 10:14:14 +02:00
Przemyslaw Gorszkowski
68d6a762d9 C++: add support for local types
This change addes support for class, enum definition inside blocks({}) or
functions, e.g.:
void f()
{
	struct S
	{
		int bar;
	};
	S s;
	s.bar;
}

It fixes:
* code completion
* highlighting
* follow symbol
* marking
* find usages

It fixes also problem with namespace aliases inside blocks or functions.

This change can have also impact on performance(there are additional processing)

Task-number: QTCREATORBUG-166 (namespace aliases inside function/block)
Task-number: QTCREATORBUG-3620
Task-number: QTCREATORBUG-6013
Task-number: QTCREATORBUG-8020
Change-Id: Iaea6c6dfe276f1d7b2279b50bdd2e68e375d31eb
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-06-18 10:09:51 +02:00
Przemyslaw Gorszkowski
94dd4e740a C++: fix 'find usages' for templates
Fix find usages for template class(class name and template parameters)
or template function(template parameters).

Fixed:
* marking
* find usages
* follow symbol

Change-Id: I22fdbc11260cbd8ee9aafdd76aaeee0f4f49f9fd
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-06-17 11:04:47 +02:00
Nikolai Kosjar
8180f695f1 CppEditor: Check <include path>/QSomething
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>
2013-06-17 08:16:43 +02:00
Erik Verbruggen
271c3f45a4 C++: Fix preprocessor blocked macro bug.
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>
2013-06-11 16:57:07 +02:00
Nikolai Kosjar
f3186690bd CppEditor: Improve finding position for new includes
...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>
2013-06-11 15:57:10 +02:00
Erik Verbruggen
e2a727c450 C++: add semantic support for C++11 alias decls.
Task-number: QTCREATORBUG-9386

Change-Id: Ia68f3866c122ca5261dd73b2c740b47fb15744fc
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-06-06 14:10:24 +02:00
Erik Verbruggen
ca291fbc7b C++: fix functionAt(), moved it, and added test.
Thanks to Jesper K. Pedersen for the fix!

Change-Id: Ie49c3352e26a9632b1500596b00d559bfe932dff
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-06-04 15:24:33 +02:00
Erik Verbruggen
6d544bc2ca C++: handle braced return statements in indenter.
Task-number: QTCREATORBUG-9314

Change-Id: I59c026cce02b85eeb54f4d10d5c9fb0c59bfe28a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-06-03 15:17:16 +02:00
Erik Verbruggen
f2631ad031 C++: do not strip trailing newlines in the preprocessor output.
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>
2013-05-30 16:42:29 +02:00
Przemyslaw Gorszkowski
f93758b8e1 C++: fix used template function parameters
It was missing colorizing and follow symbol template function parameters in case of:
* returning value
* use it as qualified name

Task-number: QTCREATORBUG-6861

Change-Id: I4226199e1f296cfe5a373783ebbc633e32fc9bcd
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-05-24 14:23:14 +02:00
Przemyslaw Gorszkowski
783ec18424 C++: instantiate template functions
Task-number: QTCREATORBUG-9170

Change-Id: I4cac9124558c1d4f0722192246f3fbeea61d3d7d
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-05-24 11:43:52 +02:00
Nikolai Kosjar
b4c3cef863 C++: Fix crash for nameless using declaration
Task-number: QTCREATORBUG-9323
Change-Id: I52dfe8c03da14fc08723c3878fec0f6e9150152c
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-05-24 09:38:57 +02:00
Erik Verbruggen
aa3aa7c455 C++: Fix unused field warnings in test.
Change-Id: I898668a91eb7d3fa18c0a8d3e7e7507f0fb5a917
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-05-15 12:35:59 +02:00
Oswald Buddenhagen
6fb94a7b10 Merge branch '2.7'
Conflicts:
	doc/src/qtquick/qtquick-components.qdoc
	doc/src/qtquick/qtquick-designer.qdoc
	qtcreator.pri
	qtcreator.qbs
	src/plugins/cppeditor/cppinsertdecldef.cpp
	src/plugins/qnx/qnxruncontrolfactory.cpp

Change-Id: I0a37a07c42719bc0d9ef5b3ac4641d01a63c0d88
2013-05-15 10:21:47 +02:00