Commit Graph

50 Commits

Author SHA1 Message Date
Eike Ziller
1ccde24c77 Merge remote-tracking branch 'origin/2.5' 2012-06-11 16:39:38 +02:00
Leandro Melo
a66e344b42 C++: Fix crash on invalid class name
Task-number: QTCREATORBUG-7462

Change-Id: Ic1df4b535c5a617efa707110138c76e6e7ef1e4b
Reviewed-by: Robert Löhning <robert.loehning@nokia.com>
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2012-06-11 09:14:59 +02:00
Leandro Melo
c95a0e40f3 C++: Break on newline when lexing char/string literals
Actually this behavior was already in the Lexer for regular string
literals (although erroneously not for wide ones) and was lost
in the recent commit 23c637c4f6.

Change-Id: I36609038ce22dc6389e9da5b078f7bf7f6c031be
Reviewed-by: hjk <qthjk@ovi.com>
2012-06-08 17:24:15 +02:00
Leandro Melo
23c637c4f6 C++: Introduce unicode char/strings support
Those are the types char16_t and char32_t along with the new
char/string literals u'', U'', u"", u8"", and U"".

This is particularly important for the use of QStringLiteral
since in some platforms it relies on expansion such as above.

Note: The string literals quickfixes still need some tunning.

Task-number: QTCREATORBUG-7449
Change-Id: Iebcfea15677dc8e0ebb6143def89a5477e1be7d4
Reviewed-by: hjk <qthjk@ovi.com>
2012-06-06 14:55:07 +02:00
Leandro Melo
b88a5f5d38 C++: Add Token::isStringLiteral and Token::isCharLiteral
It will be particularly handy when introducing the new C++11
string/char literals: U"abc", u"abc", u8"abc", U'a', u'a'.

Change-Id: Ic250f5a7b999da322debb24fc0171aaef333f356
Reviewed-by: hjk <qthjk@ovi.com>
2012-06-06 14:54:54 +02:00
Leandro Melo
809a4ed91a C++: Also parse static_assert as top-level declaration
Add some checks for C++11 flag as well.

Change-Id: Ic5ee81d72bc88a22e71b324ef01014791b833604
Reviewed-by: hjk <qthjk@ovi.com>
2012-06-05 15:03:01 +02:00
hjk
7eb84086d9 cplusplus: do not use out-of-line constructor and destructor for Token
Change-Id: I10320b01a567789585a6af111de4de3f95883bd1
Reviewed-by: hjk <qthjk@ovi.com>
2012-04-18 13:06:47 +02:00
Erik Verbruggen
275e207d26 Fix invalid decltype error recovery which resulted in crashes.
Task-number: QTCREATORBUG-7174

Change-Id: I653db71adc45586cd8518ffd96118425fd3763be
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-03-28 13:41:48 +02:00
Flex Ferrum
5be4214b28 C++: Fix lambda declarator processing
Now Qt Creator does not warn about lambda declaration with not empty
parameters list.

Task-number: QTCREATORBUG-6243
Change-Id: I07121a80fbca98c36820d1d8bb1be6e82ab96b12
Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com>
2012-03-20 13:47:45 +01:00
Erik Verbruggen
a621c99a0f [C++] Add error recovery for namespace declarations.
Change-Id: I884ff9901c95467524e5eba38e91f75992d30e14
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Reviewed-by: Flex Ferrum <flexferrum@gmail.com>
2012-02-28 10:22:31 +01:00
Erik Verbruggen
2153c22812 [C++11] Fixes semantics for trailing return types.
Now we can parse:
    auto foo()->int;
without getting semantic errors.

Change-Id: Id65c1198c20b2b0c7e8e4eee8ad176d0d66fc0d7
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-02-23 18:16:03 +01:00
Erik Verbruggen
3c635ef1d4 [C++] Correctly parse inline constructors for templates.
This failed for:
    template<class T> inline S<T>::S(nullptr_t):_p(0){}

Change-Id: Ibb48f403a66cb19567e65270aa166849ee81a162
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-02-23 18:15:46 +01:00
Erik Verbruggen
368d5926ca C++: handle destructor names with template parameters.
Change-Id: I74b4fd5e043db935abc18345b303d294b71e8fc2
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com>
2012-02-23 08:39:34 +01:00
Flex Ferrum
da2aa0df72 C++: Add support for C++11 range-based 'for' loops
Change-Id: I7eef048a7952a79f031ae3d0abba68e3c5ffbfb8
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-02-21 15:27:00 +01:00
Erik Verbruggen
3fa55b7ab9 Removed module names from #include directives.
Getting the #include directives ready for Qt5. This includes the
new-project wizards.

Change-Id: Ia9261f1e8faec06b9285b694d2b7e9a095978d2b
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
2012-02-15 16:24:46 +01:00
Erik Verbruggen
19e15d332a C++11: Add static_assert as block declaration.
Change-Id: I35c93b7a970a7b659a4bca7b680c2db776dc07ab
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-02-10 16:29:12 +01:00
Erik Verbruggen
3f5dc36a53 C++11: first set of changes for decltype.
Change-Id: I49d6ff7eb1805cd07bdfcb27bb37d4c6cadc9115
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-02-10 16:29:04 +01:00
David Schulz
6d85b53f9c Revert "Editor: Highlight background for whitespaces in strings and comments"
The change brokes the Lexer.
This reverts commit e46a5579d3.

Change-Id: I3363c6eff74b53a7f2d9f417941cde07aaa92619
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2012-02-03 11:52:01 +01:00
Erik Verbruggen
1d3dc30153 C++11: add support for static_assert.
Change-Id: I82d8d60acaa9265fd25e0a3734855b19bdef9c06
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-02-02 13:49:22 +01:00
Erik Verbruggen
dd4299073e C++11: handle noexcept specifications.
Change-Id: I7da3affea2758b2e01124105e2521e1f2c5f6678
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-02-02 12:22:20 +01:00
Erik Verbruggen
13dd213f60 C++11: handle inline namespaces.
Change-Id: Iafdcd5bc72d9724e217767ae9c216be4363cc0d3
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-02-02 11:07:20 +01:00
David Schulz
e46a5579d3 Editor: Highlight background for whitespaces in strings and comments
The whitespaces are now highlighted with the same backgroundcolor as the characters.
Also added a test for the Lexer.

Task-number: QTCREATORBUG-5802

Change-Id: Ic1bcd8cfe30d6b8a0281b7963eaab310f972b9d2
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-02-01 11:17:56 +01:00
Flex Ferrum
c6fc0be8ae C++: Type deduction for auto-declared variables implemented
Handled to major cases of 'auto' variable declaration:
1. auto var = someInitializer;
2. Q_FOREACH(auto item, collection) or foreach(auto item, collection)

In first case type deducted directly from initializer. If variable has no initializer then corresponded error reported. In second case type deducted from '*collection.begin()' expression.

Change-Id: Ie930add1648b99440281ae04d973fd6904bc9e46
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-01-31 10:03:36 +01:00
Christian Kamm
ae494b6e41 C++: Fix compilation of plain-cplusplus test on OSX.
Change-Id: I5a84a2f3d8157289eba60977a3c9d112e72e679a
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-11-29 11:12:03 +01:00
Leandro Melo
9caeccbb0d C++: Add names for tokens constexpr and nullptr
Actually, those should have gone in the previous corresponding
commits which introduced support for the keywords.

Change-Id: Ie95944899c426a2c2b03e60d1ad557e00bc3a82a
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-11-18 15:25:31 +01:00
Leandro Melo
057fad645b C++: Recognize C++11 nullptr
Change-Id: I5b7ac8f9b2137ffe9439ada4ec4aeb9cee8e249d
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-11-18 13:50:19 +01:00
Leandro Melo
9f73c5848b C++: Recognize C++11 constexpr
Change-Id: Iac8ba58404284f0d90fd5a3640eb9ccd7e98058d
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-11-18 12:14:10 +01:00
Christian Kamm
49fbe56def C++ parser: Don't fail on REVISION in Q_PROPERTY.
Change-Id: Ia7407969dc56308fe3eb843e97b93e65eb235186
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2011-10-25 14:30:03 +02:00
Christian Kamm
e4a7b0642b C++: Fix a crash in debug builds when rewriting functions.
Change-Id: I35266b69d1cc433c4d9176cc849efd03ea1cc1cd
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-10-25 11:32:18 +02:00
Leandro Melo
dc23698e3a C++: Fix arg. count for functions with function-try-blocks
Task-number: QTCREATORBUG-6343
Change-Id: I71575098c71611dc8514288f7938af4c409ebaa3
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-10-21 13:25:58 +02:00
Erik Verbruggen
29dff7221d Fixed stack-overflow when parsing insanely nested compound statements.
Thanks to Clang's parser_overflow.cpp which has >16000 nested compound
statements to check exactly the same.

Change-Id: I2b604f8ceb01115d7fe950994e0677a081e99481
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-10-17 11:17:46 +02:00
hjk
5295e05310 minor style
Change-Id: Id21e8a3962550a1c66d761e718b48a8fcf4053e7
Reviewed-on: http://codereview.qt-project.org/5122
Reviewed-by: hjk <qthjk@ovi.com>
2011-09-19 11:24:14 +02:00
Christian Kamm
70aac78582 C++: Always set source location of function symbols.
Change-Id: I83bcea6fcdbf113d541a962ac461aef1765d99fd
Reviewed-on: http://codereview.qt-project.org/4433
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-09-08 14:04:50 +02:00
Christian Kamm
107544bd7b C++: Set endOffset of Function symbols even if skipping bodies.
Fixes insert-definition-from-declaration when the source file was not
yet opened in an editor.

Change-Id: I4263113390ae4fbe9d4641104b5cb43373ddc5a4
Reviewed-on: http://codereview.qt-project.org/4394
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-08 10:05:22 +02:00
Christian Kamm
c074b18f8d C++: Improve Literal::hashCode.
This can have a dramatic impact on performance when a file contains lots
of unique literals.

Change-Id: I5309b28f704d7f53e164dc8084ae08354c09354b
Reviewed-on: http://codereview.qt.nokia.com/4312
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-09-07 09:32:24 +02:00
Erik Verbruggen
af48de18e7 C++: fixed potential crash for out of bounds access of token_names.
Cause: Q_PRIVATE_PROPERTY didn't have an entry in token_names, so if
Token::spell or Token::name was called on a T_Q_GADGET, an out-of-bounds
access would occur.

Change-Id: I1ec7b91a5d3def5508e21ad4f1863a52cb4ed540
Reviewed-on: http://codereview.qt.nokia.com/4207
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-09-05 15:32:09 +02:00
Christian Kamm
cf96bc10d2 Remove some dead stores pointed out by clang.
Change-Id: I919a2e98474fec42861391d11d2ba1225eb2adf9
Reviewed-on: http://codereview.qt.nokia.com/4083
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-02 10:37:31 +02:00
Roberto Raggi
c264f5b23c Regenerate the default AST visitors.
Change-Id: I429c9d454a1b896abf642225ef7b506481fac708
Reviewed-on: http://codereview.qt.nokia.com/3867
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-08-30 11:13:00 +02:00
Christian Kamm
142bce94fb C++: Store comment tokens in the translation unit.
Change-Id: I904123bdbbd675e9f018236c1fed13528d83f87f
Reviewed-on: http://codereview.qt.nokia.com/3481
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-08-25 13:20:19 +02:00
Eike Ziller
bf8cb5d4fc Merge remote-tracking branch 'origin/2.3'
Conflicts:
	qtcreator.pri

Change-Id: Iaca68084799ae9aec257742c395609d6e8aa72cd
2011-08-16 10:21:55 +02:00
Leandro Melo
cea012a152 C++: Fix BaseSpecifierAST::firstToken return
Change-Id: I105d94f543d22319571320cd88f791278aac3239
Reviewed-on: http://codereview.qt.nokia.com/2734
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-08-15 16:39:38 +02:00
Eike Ziller
99ba300ae3 Merge remote-tracking branch 'origin/2.3'
Conflicts:
	qtcreator.pri
	src/libs/libs.pro
	src/plugins/debugger/watchwindow.cpp
	src/plugins/remotelinux/maemopackagecreationstep.h

Change-Id: Ic67c46256d0060ee9845b92ef82539f6f8fbe639
2011-08-10 16:03:57 +02:00
Christian Kamm
01bb7443fd C++: Fix off-by-one in scopeAt.
The only Scope that set the end offset to *before* the last token
was ObjCClassDeclaration.

Change-Id: Icbdb5bcdd72d96087ac586ad51510fed74a633eb
Reviewed-on: http://codereview.qt.nokia.com/2820
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-08-10 14:37:17 +02:00
Leandro Melo
fb550c4ff1 C++: Fix crash when typing illegal class names
Such as class ~A {} or class operator+ {}.

Done by Roberto Raggi

Change-Id: I4fdad6d27aaa997e651f2d08de36fe675fc78814
Reviewed-on: http://codereview.qt.nokia.com/2778
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-08-09 14:11:28 +02:00
Leandro Melo
89ac110ab0 C++: Relax parsing for templateid in some cases
The correct parsing for certain templateids would require name
lookup. In order to avoid erroneous syntax errors detection (like
the one below ) we block the notification for such cases.

bool r = a < b ? c > d : false;

Task-number: QTCREATORBUG-5122
Change-Id: I9eb9ee89cd21bec3ed924982957f50f9346f90be
Reviewed-on: http://codereview.qt.nokia.com/1704
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-07-15 16:31:03 +02:00
Erik Verbruggen
b83932708c Fixed invalid parsing of boolean expression "x < y && z > this".
Task-number: QTCREATORBUG-4362
Reviewed-by: Roberto Raggi
2011-05-17 17:05:52 +02:00
Roberto Raggi
9608af7ad2 Added support to C++ symbols rewriting.
This should simplify full C++ template instantiations.

Reviewed-by: Christian Kamm
2011-05-17 11:45:47 +02:00
Roberto Raggi
cae8d4169b Fix the AST code generator 2011-05-16 12:48:05 +02:00
Oswald Buddenhagen
b342ad8cf4 remove nokia copyrights from roberto's code
they are lying. nokia has no copyright on this code. and the double
license in a single file looks weird. that's why we moved it to
3rdparty/, so it is clear it is not nokia's.

Approved-by: legal
2011-05-16 11:05:30 +02:00
Oswald Buddenhagen
67704b8b41 move src/shared/cplusplus/ -> src/libs/3rdparty/cplusplus/
Approved-by: legal
2011-05-16 11:05:30 +02:00