Commit Graph

271 Commits

Author SHA1 Message Date
Eike Ziller
0a1bdf4257 Merge remote-tracking branch 'origin/2.6'
Conflicts:
	share/share.qbs
	tests/auto/icheckbuild/icheckbuild.pro

Change-Id: I13bc737c981aaeb615ab1a3571cc8a18f60a7cd6
2012-10-25 10:45:58 +02:00
Nikolai Kosjar
6481deb8c8 C++: Fix crashes in tests with Qt5.
tst_Semantic and tst_CodeFormatter crash with QTEST_APPLESS_MAIN since
they need to access some font settings via QTextDocument /
Q*Application. Use QTEST_MAIN instead.

Change-Id: Id85228acb6006cfaee41c634c6a32b6c23a70105
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-10-23 14:07:35 +02:00
Nikolai Kosjar
5d730be06e C++: Compile fixes in tests and tools.
After some refactorings not all usages, especially in tests and tools,
were adapted.

Change-Id: I7ed24bb1c8e55e55ed74eda3a8fd7610e725f4cb
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-23 12:26:47 +02:00
Erik Verbruggen
e72be772c5 C++: added some notes regarding QTCREATORBUG-7968
Change-Id: Ia7a0e4b416ba6ef768d76595d8576262a828ae78
Reviewed-by: David Schulz <david.schulz@digia.com>
2012-10-11 08:53:51 +02:00
Eike Ziller
086dd684ab Merge remote-tracking branch 'origin/2.6'
Conflicts:
	src/plugins/coreplugin/fileiconprovider.cpp
	src/plugins/cppeditor/cppplugin.cpp
	tests/auto/qml/qmldesigner/coretests/coretests.pro

Change-Id: I0e83becf661ded9316ce6766786c9ef4c2f897a7
2012-10-09 14:27:29 +02:00
Eike Ziller
1504ca67fb More Nokia -> Digia/QtProject changes
Change-Id: If52505dbc95ee48ac3467cdfbbea91629c11089c
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2012-10-09 12:24:24 +02:00
Eike Ziller
6fd252b0a5 Merge remote-tracking branch 'origin/2.6'
Conflicts:
	share/qtcreator/qml/qmlpuppet/commands/endpuppetcommand.cpp
	share/qtcreator/qml/qmlpuppet/commands/endpuppetcommand.h
	src/plugins/debugger/qtmessageloghandler.cpp
	src/plugins/debugger/qtmessageloghandler.h
	src/plugins/debugger/qtmessagelogwindow.cpp
	src/plugins/madde/maemodeployconfigurationwidget.cpp
	src/plugins/madde/maemodeployconfigurationwidget.h
	src/plugins/remotelinux/deployablefilesperprofile.cpp
	src/plugins/remotelinux/deployablefilesperprofile.h
	src/plugins/remotelinux/deploymentinfo.cpp
	src/plugins/remotelinux/deploymentinfo.h
	src/plugins/remotelinux/deploymentsettingsassistant.cpp
	src/plugins/remotelinux/profilesupdatedialog.cpp
	src/plugins/remotelinux/remotelinuxdeploymentdatamodel.h
	tests/auto/icheckbuild/ichecklib.cpp
	tests/auto/icheckbuild/ichecklib_global.h
	tests/auto/icheckbuild/parsemanager.cpp
	tests/auto/icheckbuild/parsemanager.h
	tests/manual/ssh/tunnel/tunnel.h

Change-Id: I04d7761df6bd936ad00e0547974284c967d39580
2012-10-05 21:20:50 +02:00
hjk
386ca7c8dd Adjust license headers
Change-Id: Ice592c6de9951ee3b2c4cb52ed0bb3b6770e0825
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2012-10-05 17:12:56 +02:00
Christian Kamm
47d2558f6f C++11: Fix bug with parsing ctor initializers.
Task-number: QTCREATORBUG-7919

Change-Id: I12307c3fb6c20424c8b5aaf564a031924c755d25
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-25 11:03:18 +02:00
Christian Kamm
a81389356e C++11: Fix and add test for simple decltype uses.
Change-Id: I7f843fa96e33671ecb135b9db6f68d9f2cbf2fac
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-24 12:08:25 +02:00
Christian Kamm
aa645254a2 C++11: More (expression-list) or brace-init-list.
This time in the 'new' expression. Changed it to make
new C(1, abc...) and new C{1, abc}
work.

Change-Id: I7232798fd083b653ee04ef9ede386d6536133e16
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-19 12:23:18 +02:00
Christian Kamm
83da5f68be C++11: Allow for typename Foo<T>{}, Foo{} and int{}.
As a postfix expression.

Change-Id: I65cae0571080a9fb699af61c661328ef06f97890
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-19 12:21:31 +02:00
Christian Kamm
2aa27e6d22 C++11: Make expression-list expand to initializer-list.
This will fix a couple more places where brace-init-lists and
pack expansions are allowed but are not currently accepted by
the parser. For example:

foo(abc...);

now parses correctly.

Change-Id: I93710cef35154fea8437329f3174e4a2d56637b8
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-19 12:20:58 +02:00
Christian Kamm
0c3acb80c8 C++11: Allow brace-init-list in default argument declaration.
Change-Id: Iab707d855f98982697365f9a4cd7832877e64d17
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-19 12:20:15 +02:00
Christian Kamm
392c80c6e4 C++11: Fix use of >> in template arguments.
Change-Id: Ic99ca897e7a3b9c82cf8c5093a90bf9c88dbb0ed
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-19 11:58:34 +02:00
Christian Kamm
44c9cef30a C++11: Make 'enum struct', enum-base and opaque enum decls work.
For declarations like:
enum struct Foo : long int;

Change-Id: Id813efdbc31c8d70a4b40bb0101dc33a8dd2556a
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-19 11:57:23 +02:00
Christian Kamm
8711121197 C++11: Parse alias declarations.
The parser no longer fails declarations like:
using Foo = std::vector<int>::iterator;

Change-Id: Ib3a552ebbe0147fa138db6448a52cdba8f9b9207
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-19 11:56:33 +02:00
Christian Kamm
9bd86e7d68 C++11: Allow brace-init-list in range-for statement.
Also drop the unused 'initializer' member from
RangeBasedForStatementAST.

Change-Id: I078ebbc85cafa643af4bfe62d698bf7de71360e4
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-19 11:54:50 +02:00
Christian Kamm
ecd54059d3 C++11: Add alignof() expression.
Change-Id: Id3fb30b9a16ea724bab0d5b05e8cbddb0064e6eb
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-19 11:53:46 +02:00
Christian Kamm
1aed32d866 C++11: Fix indent of brace initializers in ctor lists.
Change-Id: Ib784df9e17ff2fe6bb249dcf8c2fee7310340f50
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-19 11:52:40 +02:00
Christian Kamm
8c1a45565c C++11: Accept ref-qualifiers in function declarators.
Means
void foo() const &; void bar() &&;
and the corresponding pointer-to-member declarators
now parse.

Change-Id: Idbf295bd4f51cd5d9e38efcac1940b8cc2e32fce
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-19 11:51:48 +02:00
Christian Kamm
b9f6f1bcf7 C++11: Allow uniform initialization in ctor init lists.
So
class C { C() : _x{12}, _y({12}) {} };
now parses correctly.

Change-Id: I4281dcb0541a86b550e74630cad6ae0a59fef1b4
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-19 11:47:49 +02:00
Christian Kamm
903ba378c2 C++11: Don't fail on = default and = delete initializers.
These are converted to IdExpr(SimpleName(token)) initializers.

Change-Id: I1e85c4b261ca028dc75ffe6c00e1090630c2957c
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-19 11:46:51 +02:00
Christian Kamm
0bdf1dc406 C++11: Allow brace initializers in return statements.
Like return {1, 2};

Change-Id: I7442da1866b0106bc075783653c95c16ebedb51a
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-19 11:46:09 +02:00
Christian Kamm
9b7d1901ba C++11: Allow brace initializers in assignment expressions.
Like:
var += {1, 2};
in a function context.

Change-Id: I3936c97c4fcb6b3dcac2979e0508d422d47fddfc
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-17 15:31:40 +02:00
Christian Kamm
342709a9cc C++11: Allow brace initializer lists in more places.
This allows them to be used in declarator initializers that expect
an expression list in parentheses. Like

T v({1, 2}, 3, 4);

Change-Id: I62e1ffd355ca88f7acbb8708c9b40c8310489ca3
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-17 15:16:56 +02:00
Christian Kamm
813846232b C++11: Allow for brace initializers like T v{1, 2}.
And add a basic test.

Change-Id: I3b8b87d51a9da154758d17380bba5922795f675c
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-17 14:47:14 +02:00
Leandro Melo
d1b65bbf83 C++: Discard comments in macro definitions
Task-number: QTCREATORBUG-7815

Change-Id: Id3e6b018bfd58b0f0072c637d69721a4bde1603a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
2012-09-05 16:35:33 +02:00
Leandro Melo
d87835cc90 C++: Always skip unknown preprocessor "directives"
Task-number: QTCREATORBUG-7780

Change-Id: Ie93704feff17ad8229e50fb1133048f2c7598dea
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: hjk <qthjk@ovi.com>
2012-08-29 16:07:40 +02:00
Leandro Melo
009d6b1e2f C++: Handle C++ style comments in macro expansion
Notice that a similar problem still exists for which we
need to fix the lexer when there's a C style commend which
 ends with a backslash-newline.

Task-number: QTCREATORBUG-7713

Change-Id: I0f6d561703984f917fa5ed29de020ad0bdc5aaf0
Reviewed-by: David Schulz <david.schulz@nokia.com>
Reviewed-by: hjk <qthjk@ovi.com>
2012-08-23 15:00:53 +02:00
Leandro Melo
b53d562816 C++: Take multiline strings into account when preprocessing
It was creating extra line(s)...

Change-Id: If28a9ccf16195c71747479db838a5589ea6683a0
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-08-23 14:35:53 +02:00
Christian Kamm
41e140da04 C++: Fix line number information after multiline comments.
Task-number: QTCREATORBUG-7702
Change-Id: I0ec2e1eb9bf1c556b0a426d4405df1c48b5653ed
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2012-08-07 11:31:06 +02:00
hjk
6a7cf405bd rename QtDebug to QDebug
More uniform.

Change-Id: I1c6057981f4c2b3170a4e69f0674fe4caf1143a2
Reviewed-by: Robert Loehning <robert.loehning@nokia.com>
2012-08-06 14:55:08 +02:00
Eike Ziller
e0e8cf3ada Contact -> qt-project.org
Change-Id: I7134d7de30bcf9f9dcfad42520dd45ee083a852d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-07-19 13:23:21 +02:00
Leandro Melo
d6ccffc06c C++: Core changes in preprocessing
Summary of most relevant items:

- Preprocessor output format change. No more gen true/false. Instead
  a more intuitive and natural expansion (like from a real compiler) is
  performed directly corresponding to the macro invocation. Notice that
  information about the generated tokens is not lost, because it's now
  embedded in the expansion section header (in terms of lines and columns
  as explained in the code). In addition the location on where the macro
  expansion happens is also documented for future use.

- Fix line control directives and associated token line numbers.
  This was not detected in tests cases because some of them were
  actually wrong: Within expansions the line information was being
  considered as originally computed in the macro definition, while
  the desired and expected for Creator's reporting mechanism (just
  like regular compilers) is the line from the expanded version
  of the tokens.

- Do not allow for eager expansion. This was previously being done
  inside define directives. However, it's not allowed and might
  lead to incorrect results, since the argument substitution should
  only happen upon the macro invocation (and following nested ones).
  At least GCC and clang are consistent with that. See test case
  tst_Preprocessor:dont_eagerly_expand for a detailed explanation.

- Revive the 'expanded' token flag. This is used to mark every token
  that originates from a macro expansion. Notice, however, that
  expanded tokens are not necessarily generated tokens (although
  every generated token is a expanded token). Expanded tokens that
  are not generated are those which are still considered by our
  code model features, since they are visible on the editor. The
  translation unit is smart enough to calculate line/column position
  for such tokens based on the information from the expansion section
  header.

- How expansions are tracked has also changed. Now, we simply add
  two surrounding marker tokens to each "top-level" expansion
  sequence. There is an enumeration that control expansion states.
  Also, no "previous" token is kept around.

- Preprocessor client methods suffered a change in signature so
  they now receive the line number of the action in question as
  a paramater. Previously such line could be retrieved by the client
  implementation by accessing the environment line. However, this
  is not reliable because we try to avoid synchronization of the
  output/environment lines in order to avoid unnecessary output,
  while expanding macros or handling preprocessor directives.

- Although macros are not expanded during define directives (as
  mentioned above) the preprocessor client is now "notified"
  when it sees a macro. This is to allow usage tracking.

- Other small stuff.

This is all in one patch because the fixes are a consequence
of the change in preprocessing control.

Change-Id: I8f4c6e6366f37756ec65d0a93b79f72a3ac4ed50
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-06-25 15:49:27 +02:00
Leandro Melo
9daa34003d Revert "C++: Re-enable macro definition line test"
This reverts commit 44d8e7bef7.

The original test case was actually right. I guess I was mislead
by the recently added preprocessor tests, which are the ones
that should be corrected (together with the preprocessor, which
seems to have issues with # lineno generation).

Conflicts:

	tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp

Change-Id: I47f82ed23a37086d0d81c4b3ea2cac48fb753451
Reviewed-by: hjk <qthjk@ovi.com>
Reviewed-by: Francois Ferrand <thetypz@gmail.com>
2012-06-19 12:47:52 +02:00
Leandro Melo
f978400ae5 C++: Better handling of arg count mismatch in macros
Do not expand function-like macros at all when there's a mismatch
in the parameter/argument count.

The report below raises the issue but its expected result is not
correct. This would be the more appropriate fix.

Task-number: QTCREATORBUG-7225
Change-Id: Ide8580faa7b724d3e8b396ec1f899cc5ca7f9e7e
Reviewed-by: hjk <qthjk@ovi.com>
2012-06-19 12:47:44 +02:00
Leandro Melo
2af60cb1bf C++: Track macro argument reference even when empty
Change-Id: I6d226b4e42f94ebee41d012050c5109895f0c432
Reviewed-by: hjk <qthjk@ovi.com>
2012-06-12 18:10:56 +02:00
Leandro Melo
d90264d6c2 C++: Also expand first token after macro define
It was previously beeing skipped.

Change-Id: Iadd9b03acbcf0ee0fb4db537b8597661cb93af3f
Reviewed-by: hjk <qthjk@ovi.com>
2012-06-05 15:05:19 +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
Leandro Melo
ca7ac8c035 C++: Fix macro uses line info
Make sure the environment line is consistent during preprocessor
directives and identifier handling so clients can rely on consistent
information. Particularly important for macro usages.

New tests also added.

Change-Id: I962a39a86cd17b8d945d2959c2c95e2d258ea3e6
Reviewed-by: hjk <qthjk@ovi.com>
2012-06-01 14:28:03 +02:00
Leandro Melo
44d8e7bef7 C++: Re-enable macro definition line test
I believe those were actually incorrect, since the # mark
from the generated tokens `int f` should be relative to <stdin>
on the line they are defined, which is 1.

Change-Id: I663ef49ad75eb8bb0a4a4b18d4899a952011536c
Reviewed-by: Francois Ferrand <thetypz@gmail.com>
Reviewed-by: hjk <qthjk@ovi.com>
2012-05-31 18:02:08 +02:00
hjk
6d04f3ce25 preprocessor: do not loop endlessly on incomplete expressions
An missing closing parantheses after "defined(..." caused an endless loop.

Change-Id: I19b17cebc1a56880216c3bfb67c9d296f80cc064
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2012-05-30 13:34:38 +02:00
hjk
b13519d547 preprocessor: add an example of a macro that generates code
Change-Id: I902ebd73e039b8c3f44eca456be87809d1e1d3a4
Reviewed-by: hjk <qthjk@ovi.com>
2012-05-15 18:19:54 +02:00
hjk
2521d7d6e4 preprocessor: add (failing) test for concatenation
Change-Id: I9d51798cb4d95141d30b0609d03cd1d199088f0a
Reviewed-by: hjk <qthjk@ovi.com>
2012-04-27 17:25:30 +02:00
hjk
051c33517f preprocessor test: code cosmetics
Change-Id: I67367e501c8f19cee9023e3782c6a9175b49c6c6
Reviewed-by: hjk <qthjk@ovi.com>
2012-04-27 17:25:00 +02:00
hjk
bc01283481 preprocessor: add test cases for <=, == and >=
Change-Id: I126143daeb572a555b73dc33ad7996b22c1387f8
Reviewed-by: hjk <qthjk@ovi.com>
2012-04-26 08:48:52 +02:00
hjk
feba990f6e preprocessor: swallow ) after defined(...
Task-number: QTCREATORBUG-7256
Change-Id: I6149e56e5f50f75c9e039be9c162036a3890e2d7
Reviewed-by: David Schulz <david.schulz@nokia.com>
Reviewed-by: hjk <qthjk@ovi.com>
2012-04-25 13:41:51 +02:00
hjk
7f1f282111 preprocessor: some code style in auto test
Change-Id: I1381ce17098a87dbc3924dc86902d7cc1b1eec76
Reviewed-by: hjk <qthjk@ovi.com>
2012-04-25 09:30:34 +02:00
Erik Verbruggen
bd47622183 Fix out-of-memory crash when indenting generated tokens.
Generated tokens do not have a position in any source file, so not try
to indent them. Previously, the 'source' used was the scratch buffer,
which would not contain newlines, so the indent depth would be the
length of the scratch buffer at that point.

Task-number: QTCREATORBUG-7262
Change-Id: If94213d6dffd13dd2b47c7038ec2398ad925d904
Reviewed-by: Yuchen Deng <loaden@gmail.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
2012-04-23 11:06:35 +02:00