Commit Graph

392 Commits

Author SHA1 Message Date
Orgad Shaneh
aeb2cfbc4f CppTools: Fix indentation for concatenated strings
Change-Id: I801a56804e7873be75a9ebc085dc3f4a2d64ea35
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-03-31 18:18:42 +02:00
Przemyslaw Gorszkowski
5416557a0b C++: fix findusage for member of typedefed anonymous struct
Task-number: QTCREATORBUG-11859
Task-number: QTCREATORBUG-11860
Change-Id: I7484b3b88daefbb3c76bb86a9b573e8291072872
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-03-31 18:16:52 +02:00
Przemyslaw Gorszkowski
6bf75acac7 C++: fix support for nested anonymous class
The case when anonymous class is inside function. Fixed:
* highlighting
* completion

Task-number: QTCREATORBUG-11711
Change-Id: Ic8fc5fdfb1aed62a74bf148ab7ed449d08214dda
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-03-26 09:56:54 +01:00
Przemyslaw Gorszkowski
e3f5977311 C++: nested class in function
Case when nested class declaration contains object name for this class.
Example:
void fun()
{
    struct S
    {
        int i;
    } s;
    s.i;
}

Fixes:
* highlighting
* completion
* tests

Task-number: QTCREATORBUG-11710
Change-Id: I32e234f57655c388a87a199edc8be750d7bf823f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-03-25 15:52:39 +01:00
Dave Lewis
a8c858acdd CppTools: Fix indent after ">>" in return type
Add case for ">>" token in declaration_start state to prevent
falling through to stream_op.

Task-number: QTCREATORBUG-9199
Change-Id: I53710be55eff4574de89f9159e95bbc1de2ba34e
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-03-25 15:33:32 +01:00
Dave Lewis
5510ec0552 CppTools: Fix indent after template params
Add case for ">>" token when in template_param state.

Task-number: QTCREATORBUG-9640
Change-Id: Icc5fc868202d6503d2afd954aa739cd2634cdff1
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-03-25 15:29:08 +01:00
Przemyslaw Gorszkowski
376f77952e C++: fix support for nested anonymous classes
A member of nested anonymous class should be visible as a member of
enclosing class(if there is no declaration of this nested anonymous
class).

Fix:
* marking
* find usage
* follow symbol
* completion

Task-number: QTCREATORBUG-10876
Task-number: QTCREATORBUG-11170
Change-Id: If5b4d198e9075f2a8aa899ae59190f2c05f7b1ff
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-03-12 14:07:58 +01:00
Orgad Shaneh
c6ca15dc15 C++: Record macro uses in #if defined(MACRO)
Change-Id: I4d99053f540073483c16ce842426bf8cd3def421
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-02-27 21:08:34 +01:00
Orgad Shaneh
5d2cd2e56d C++: Fix handling of #undef
* 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>
2014-02-27 16:13:51 +01:00
Erik Verbruggen
36dccb42fa C++: fix indentation for static var decls of anonymous classes.
Task-number: QTCREATORBUG-11392

Change-Id: Ie5dd9014383b639e63653e8abc856fea9e620e49
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-02-27 15:57:40 +01:00
Orgad Shaneh
24a5c3e913 Tests: Record macro definition check
Change-Id: Ia2151ead6ba4ad2e2a3598d05dfc24a10e6a7cdb
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-02-27 15:17:29 +01:00
Orgad Shaneh
67caa75c56 C++: Fix preprocessing of uncontinued line-escaping
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>
2014-02-24 21:56:52 +01:00
Orgad Shaneh
dabdb60299 C++: Preserve comments after preprocessor directives
Task-number: QTCREATORBUG-11216
Change-Id: Iac10e75f0f5c504b79e8466607dc1f478e578f99
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-02-24 21:56:40 +01:00
Orgad Shaneh
6133920bfe Preprocessor: Adjust lines also for multiline C++ comments
Change-Id: I87d6e76be3030e617603209c3a1b8b3c476cf1f6
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-02-24 21:56:23 +01:00
Nikolai Kosjar
c2803b00be CppTools: Avoid self-include
...in CPlusPlus::Document due to cyclic includes.

Task-number: QTCREATORBUG-11457
Change-Id: I1ca19c901c26d9984d795a61879dd6b41c57096c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-02-24 14:08:11 +01:00
Orgad Shaneh
7febebc294 C++: Fix indentation in preprocessor tests
Easier to compare when indentation is aligned

Change-Id: I216073dc167c0ed785616ae308b566db7f910592
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-02-04 11:34:03 +01:00
Orgad Shaneh
e600424648 C++: Fix support for incremental input with \n
Also fix false positive line continuation on blank line

e.g.
"foo \

bar"

Change-Id: Ic6d345a4b578c955411d119b8438c8dc5065c072
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-02-04 11:33:54 +01:00
Orgad Shaneh
0f4e3c356a C++: Support multiline strings and comments
Task-number: QTCREATORBUG-662
Change-Id: I0997fe2afaba71998d5da549b7141df0c023ff12
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-01-21 10:54:56 +01:00
Orgad Shaneh
06592b28ad C++: Consolidate with/without comments preprocessor tests
Change-Id: Ib08569d642da51f6d51bb0763fc95d5a5c13d28c
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-01-20 16:27:49 +01:00
Orgad Shaneh
0a817c4ef5 C++: Cleanup preprocessor tests
Change-Id: Ia1b7dee24a3d7e20440dca5040cf9ffdaaf066e2
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-01-20 16:27:34 +01:00
Orgad Shaneh
e51fbd2009 C++: Fix debugging of lexer test
spell() crashes if identifier is not properly created

Change-Id: I1c3949c3fed2282d893914fa2922f6c281d1f8cd
Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-01-20 12:30:29 +01:00
Orgad Shaneh
15680ebe0c C++: Minor cleanup in lexer tests
Use a typedef for the list

Change-Id: Ie921226f9b72fdbedd9926ae166979a4cd1ad540
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-01-20 12:30:17 +01:00
hjk
df2ecb4edd Move the textual simplification of container type to debugger again
This is the only user, and likely will stay so for a while, and
eases the linking of the debugger autotests.

Change-Id: I822fa892f105a5b7985370b26e50aa94cac74bb3
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-01-08 14:49:35 +01:00
Eike Ziller
236ea9efb9 Merge remote-tracking branch 'origin/3.0'
Conflicts:
	share/qtcreator/debugger/dumper.cpp
	share/qtcreator/debugger/dumper_p.h
	share/qtcreator/debugger/test/main.cpp
	src/plugins/debugger/gdb/classicgdbengine.cpp
	src/plugins/debugger/gdb/pythongdbengine.cpp
	src/plugins/debugger/lldblib/guest/lldbengineguest.cpp
	src/plugins/debugger/lldblib/guest/lldbengineguest.h
	src/plugins/debugger/lldblib/guest/main.cpp
	src/plugins/debugger/lldblib/ipcengineguest.cpp
	src/plugins/debugger/lldblib/ipcengineguest.h
	src/plugins/debugger/lldblib/ipcenginehost.cpp
	src/plugins/debugger/lldblib/ipcenginehost.h
	src/plugins/debugger/lldblib/lldbenginehost.cpp
	src/plugins/debugger/lldblib/lldboptionspage.cpp
	src/plugins/qbsprojectmanager/qbsstep.cpp
	src/plugins/qbsprojectmanager/qbsstep.h
	src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp
	src/plugins/qmlprofiler/canvas/qdeclarativecanvas_p.h
	src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp
	src/plugins/qmlprofiler/canvas/qdeclarativecontext2d_p.h
	src/plugins/qmlprofiler/canvas/qmlprofilercanvas.cpp
	src/plugins/qnx/blackberrycheckdevmodestep.cpp
	src/plugins/qtsupport/debugginghelper.cpp

Change-Id: Ie9fd0a885fb6264a6a8a72daee071b75bcbd2e9d
2014-01-08 11:01:06 +01:00
Robert Loehning
746c5d8863 Incremented year in copyright info
Change-Id: Ib5423fdd064e4546f848c0b640b0ed0514c26d3a
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2014-01-08 08:29:47 +01:00
Eike Ziller
e035ae6df1 Merge remote-tracking branch 'origin/3.0'
Conflicts:
	share/qtcreator/debugger/stdtypes.py
	src/plugins/qmlprofiler/qmlprofilereventsmodelproxy.cpp

Change-Id: I5d86746d58960e41e01e725ccb2a6c00890f0dfd
2013-12-18 11:02:16 +01:00
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