Commit Graph

566 Commits

Author SHA1 Message Date
Erik Verbruggen
8e18adc70f C++: Fix crash in code completion.
Caused by a dangling pointer of a template instantiation which had been
cloned into the wrong control. The fix is to remove that control and
refer to the control of the bindings (which is the correct one).

Change-Id: I951a60f2e613aae1e4ac901ce99c820212018709
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-05-03 10:56:26 +02:00
Przemyslaw Gorszkowski
d14767a6af C++: fix highlighting type when there is using Namespace::Class
If type is not found we try to find 'using' declaration for this type.

Task-number: QTCREATORBUG-7903

Change-Id: I569db9e1a8504a5da3115ebbed2e823d5924f6ca
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-05-02 15:17:27 +02:00
Eike Ziller
bedc477943 Merge remote-tracking branch 'origin/2.7'
Conflicts:
	src/plugins/qmldesigner/components/formeditor/abstractcustomtool.cpp

Change-Id: I4e0a85795e7f4bfcdc21d106517517b527f85104
2013-04-30 11:43:33 +02:00
Francois Ferrand
4d18710f46 C++: fix handling of empty va_args macro arguments.
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>
2013-04-29 10:09:43 +02:00
Przemyslaw Gorszkowski
080bf4ecb8 C++: improve support for anonymous classes
Fix:
* highlighting
* find usages
* follow symbol
* code completion

Task-number: QTCREATORBUG-6497
Task-number: QTCREATORBUG-8963
Task-number: QTCREATORBUG-3610
Task-number: QTCREATORBUG-7579

Change-Id: I3dcaf1c515d0199c3e6bee72284fbb40064686ee
Reviewed-by: Petar Perisin <petar.perisin@gmail.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-04-19 12:14:56 +02:00
Erik Verbruggen
63a04e0c15 C++: replace Q_UNREACHABLE by QTest::qFail.
Q_UNREACHABLE was introduced in Qt5, so using it impossible to compile
the tests with Qt4.

Change-Id: I0ed23ad9390b1428513a7a0c975dd8fb72efb001
Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-04-18 15:50:00 +02:00
Erik Verbruggen
4b0f70f4c9 C++: highlighter clean-ups
- Moved TextEditor::SemanticHighlighter::Result to
  TextEditor::HighlightingResult
- Moved SemanticInfo::UseKind to CppHighlightingSupport::Kind

Change-Id: I14faab1891ca691a0691cfd9243edf19fcd3d3df
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-04-18 12:25:24 +02:00
Przemyslaw Gorszkowski
17cd161a9d C++: fix cloning of templates
Fix instantiation of templates(by cloning original symbols). Assigning of scope
for cloned symbol is taken from the symbol which is used to instantiate.

Task-number: QTCREATORBUG-9098
Change-Id: I066cc8b5f69333fabdaf2d4466b205baf08bd3f1
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-04-17 14:10:32 +02:00
Erik Verbruggen
3173f6fb3e C++: fix highlighting for template parameters for function calls.
Change-Id: Ie0133893d8b8d35ea2aa599cb8f7d5c2cc55271e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-04-16 12:05:06 +02:00
Eike Ziller
9ff8979da3 Merge remote-tracking branch 'origin/2.7'
Conflicts:
	src/plugins/cpptools/cppchecksymbols.h
	src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp

Change-Id: I887ba071fa637ad44e39bcae581738fa078a6612
2013-04-11 18:27:52 +02:00
Przemyslaw Gorszkowski
bde6667240 C++: name of function of class problem
It fixes:
* highlighing
* find usage
* follow symbol

when function of class has the same name as:
* local variable
* template parameter
* other struct/union/class/enum
* function argument

in function scope.

Task-number: QTCREATORBUG-8902
Change-Id: Iddc0f764af689babb40d39460d174bac7b919b31
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Sergey Shambir <sergey.shambir.auto@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-04-10 14:58:48 +02:00
Przemyslaw Gorszkowski
9c2a352027 C++: fixed operator arrow of nested class of enclosing template
Fixed:
* code completion
* highlighting
* find usage
* follow symbol

Task-number: QTCREATORBUG-9005
Change-Id: I3fcc2638482ca1071c1aa7b6aab0d4dd128595bb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-04-10 14:52:20 +02:00
Erik Verbruggen
82e347095c C++: Untangle include file resolving from loading.
Change-Id: Iacf8cb12dd623c908538d80ee2595297a9bdde71
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-04-09 11:56:02 +02:00
Erik Verbruggen
857457e057 C++: handle non-arguments in function parameter scope gracefuly
Task-number: QTCREATORBUG-8316
Change-Id: I8897f75f30d3aeaf049cc792060c582ab1e3343d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-04-09 11:49:00 +02:00
Sergey Shambir
2ead48fb26 CPlusPlus: fixed parsing function-try-catch with ctor-initializer
C++ standard defines that 'try' should be before optional ctor
initializer, so wrong order changed. Added documentation to
parseTryBlockStatement and new test.

Task-number: QTCREATORBUG-9064
Change-Id: Id19cdc53c034cb1232ae27e0bfe36d85b7ad0452
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-04-09 11:31:28 +02:00
Przemyslaw Gorszkowski
7c74482ad3 C++: fixed operator* for nested class of enclosing template class
Fixed:
* highlighting
* follow symbol
* find usage

Task-number: QTCREATORBUG-9006

Change-Id: I34a42f8665335857f41290217e7265e8a752455b
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Sergey Shambir <sergey.shambir.auto@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-04-09 11:23:14 +02:00
Oswald Buddenhagen
66a3553107 make library and plugin dependencies declarative
instead of directly including the respective pri files in
*_dependencies.pri, set variables and let qtcreator.pri resolve
them to includes.
this will allow us to re-use the dependency info elsewhere.

Change-Id: Iaa33924e428ac0409660f42df2f98a7978452d3e
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-04-03 14:37:45 +02:00
Oswald Buddenhagen
7923032022 fix include style relating to cplusplus libraries
... 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>
2013-04-03 13:40:39 +02:00
Oswald Buddenhagen
001a26a4bb include qttest.pri centrally
Change-Id: I05e85dac15e7de52ad04bde899dcc3cb8e603d3e
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2013-04-02 17:11:37 +02:00
Oswald Buddenhagen
5ad0908087 remove redundant cpptools.pri include
Change-Id: I09bc8a20a3608b52784de2b262b2f06ac7f217bf
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2013-04-02 17:11:02 +02:00
Oswald Buddenhagen
cf5937a8ef remove redundant INCLUDEPATHs
src/plugins and src/libs are included by qtcreator.pri

Change-Id: I15ec19856366661bfa74d00e6278f4eb3854acb2
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2013-04-02 17:10:07 +02:00
Nikolai Kosjar
e088541c0d C++: Temporary fix for dangling pointers in ResolveExpression
Task-number: QTCREATORBUG-8974

Change-Id: Iac114881741bdf8fd477541b28e4d31b7a1760f0
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-03-22 08:57:53 +01:00
Nikolai Kosjar
ceb314b3ec C++: Tests: More lexer tests for doxygen comments
Change-Id: Ib031eb791f0a089376d02cc75a62fcc7d1f859cb
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-03-12 09:04:07 +01:00
Nikolai Kosjar
47d60ae89a C++: Consider '^//[/!][^\n]*' as doxygen comment
Now everything following '///' or '//!' is a doxygen comment.

This simplification fixes also the bug ('\n' was considered as part of
the doxygen comment and led to strange highlighting).

Task-number: QTCREATORBUG-8921

Change-Id: I6dae3b80ec11400f2f623897257782a80860a7f3
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-03-12 08:31:05 +01:00
Nikolai Kosjar
29055f9f43 C++: Fix crash due to dangling pointer
ResolveExpression used the wrong Control object, which was deleted by
~LookupContext() in TypeOfExpression::operator()). ~Control() led to the
dangling pointer.

Task-number: QTCREATORBUG-8890
Done-with: Erik Verbruggen <erik.verbruggen@digia.com>

Change-Id: Ic07947ee54087446b730e4d3ec4bef29defa4495
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-03-12 08:29:48 +01:00
Erik Verbruggen
4cf1ccd161 C++: Fix semantic highlighter and tests.
Fixed the chunk size calculation, made the sorting more stable, and
fixed the tests.

Change-Id: I81fcffbf2ce9b63dd81f1a0e251200a31220db88
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-03-04 13:16:50 +01:00
Jan Kundrát
4250b86a73 Fix build error (missing Q_DECLARE_METATYPE)
Change-Id: Iaba3ebbb3960dc6fe07b8382be29071ce7af5bfb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-03-04 10:25:52 +01:00
Nikolai Kosjar
61460951ce C++: Fix highlighting of doxygen's "///"
The color scheme changed for "///\n" lines:

 "///\n"       - "Doxygen Comment" (was "Comment")
 "/// hello\n" - "Doxygen Comment" (as before)
 "////...\n"   - "Comment" (as before)

Change-Id: I6bdaf471760bb05547385fd4821eded6cefed4d7
Reviewed-by: Knut Petter Svendsen <knutpett@pvv.org>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-02-19 10:17:55 +01:00
Oswald Buddenhagen
1fda2111d4 Merge remote-tracking branch 'origin/2.6'
Conflicts:
	src/plugins/autotoolsprojectmanager/AutotoolsProjectManager.pluginspec.in
	src/plugins/debugger/qtmessageloghandler.cpp
	src/plugins/debugger/qtmessagelogwindow.cpp
	src/plugins/madde/maemodeployconfigurationwidget.cpp
	src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp
	src/plugins/qmldesigner/designercore/include/widgetqueryview.h
	src/plugins/qmldesigner/designercore/metainfo/metainfoparser.cpp
	src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp
	src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h
	src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp
	src/plugins/qnx/bardescriptormagicmatcher.h
	src/plugins/qt4projectmanager/profilekeywords.cpp
	src/plugins/remotelinux/deployablefilesperprofile.cpp
	src/plugins/remotelinux/deployablefilesperprofile.h
	src/plugins/remotelinux/deploymentinfo.cpp
	src/plugins/remotelinux/deploymentsettingsassistant.cpp
	src/plugins/remotelinux/profilesupdatedialog.cpp
	tests/auto/icheckbuild/ichecklib.cpp
	tests/auto/icheckbuild/parsemanager.cpp
	tests/auto/icheckbuild/parsemanager.h

Change-Id: Ie465a578446a089e1c502d1cb1096e84ca058104
2013-01-31 16:25:33 +01:00
Przemyslaw Gorszkowski
ffba28d26a C++: Fix code compl. for instantiation of template specialization
It works for full specialization. Instantiate of the partial
specialization has to be implemented(finding appropriate partial
specialization-on going)

Added unit test.

Change-Id: I8ef5ea963e7c665e0d67d390b3a833486773dab0
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-01-30 18:49:25 +01:00
Przemyslaw Gorszkowski
421ea2afa4 C++: Test for nested class of enclosing template
Added additional test for change:
23844410fd

Change-Id: I9ddd23b0e852bf88105fef87fae82620da29c0b6
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-01-30 08:09:21 +01:00
Przemyslaw Gorszkowski
7db3b660b6 C++ editor: Highlight member variable
Highlight member variable when there is also
enum value with the same name

Task-number: QTCREATORBUG-7525
Change-Id: I0990844a20fdf9e87a807fde10708344b9c3497b
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-01-29 17:33:42 +01:00
Robert Loehning
298531e370 Incremented year in copyright info
Change-Id: Ic6a9ff0359625021ebc061d22db6811814534205
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2013-01-29 16:27:03 +01:00
Przemyslaw Gorszkowski
7fcc52bf47 C++ editor: Highlighting static variables
Fix highlighting, find usages, marking for static variables.

Task-number: QTCREATORBUG-6822
Change-Id: I0c97c93c6c1024550907eec3820496df22a94e85
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-01-29 14:01:11 +01:00
Nikolai Kosjar
370acaf502 C++: Tests: Add basic tests for CheckSymbols
CheckSymbols is the "data provider" for the semantic highlighter which
does not have any tests yet.

Change-Id: I868aca32d44570457a984b8ce74695c381c58bed
Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-01-29 09:09:15 +01:00
Nikolai Kosjar
8c3794f9d1 C++: Add star binding to TypePrettyPrinter
Now we can specify if we want to print a whitespace before and/or after
'*'/'&' when printing pointer and reference types.

Task-number: QTCREATORBUG-6169

Change-Id: Ida1b035aa4fd79be9108934b75f236db9f7238af
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-01-23 14:30:39 +01:00
Przemyslaw Gorszkowski
23844410fd C++ editor: support nested class of enclosing template
Fixing:
* highlighting
* tooltips
* find usage
* selecting

Task-number: QTCREATORBUG-8245
Change-Id: I6e900799e43126706125b7e424567fca2b2c223e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-01-22 11:35:25 +01:00
Erik Verbruggen
dada2614d5 C++: add include-guard tracking.
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>
2013-01-18 14:58:07 +01:00
Francois Ferrand
4c43655cec C++: fix macro calls with comment before arguments
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>
2013-01-18 14:56:47 +01:00
Francois Ferrand
5e8c3f4be7 C++: fix constructor definition parsing.
When a constructor is defined with a single, unnamed argument of a custom type without
extra type specifiers (const...), then the constructor was not identified as such.
There was an heuristic in case the constructor was in the class definition, but not if the
the constructor was defined later.

Examples:

class Arg;
class Other;

class Foo {
  Foo(Arg /*arg*/);               // working
  Foo(const Arg /*arg*/);         // working
  Foo(int /*arg*/);               // working
  Foo(Other /*arg*/)         {}   // working
};

Foo::Foo(Arg /*arg*/)        {}   // used not to work, fixed
Foo::Foo(Arg arg){}               // working
Foo::Foo(const Arg /*arg*/)  {}   // working
Foo::Foo(int arg)            {}   // working

Change-Id: I741e4ba62672ddc99a837fdcdc27996fba5ae6c7
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 13:36:43 +01:00
Erik Verbruggen
cab6ed5e51 Fix: no scope walking for name resolving after MemAccess operator
Change-Id: Ic093079fa65d8d749911fd9f5b0f629e9fe68a1e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>

Conflicts:
	tests/auto/cplusplus/findusages/tst_findusages.cpp

Change-Id: I87d305e2d68582aa00b92f9599368615cd76ec74
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2012-11-22 16:39:47 +01:00
Erik Verbruggen
8cbf0e7045 Fix: no scope walking for name resolving after MemAccess operator
Change-Id: Ic093079fa65d8d749911fd9f5b0f629e9fe68a1e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2012-11-21 14:38:00 +01:00
Eike Ziller
fe74a9a722 Merge remote-tracking branch 'origin/2.6'
Conflicts:
	qtcreator.pri
	qtcreator.qbs
	src/plugins/fakevim/fakevimhandler.cpp
	src/plugins/qtsupport/baseqtversion.cpp
	tests/auto/cplusplus/cxx11/cxx11.pro
	tests/auto/cplusplus/cxx11/tst_cxx11.cpp
	tests/auto/icheckbuild/icheckbuild.pro

Change-Id: I3c8351ad35617f56d15b788c8a46d8a6f453ef70
2012-11-09 11:20:10 +01:00
Nikolai Kosjar
492ca1cbcf Tests: C++: Make tests run from shadow builds.
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>
2012-11-07 14:10:24 +01:00
Nikolai Kosjar
9f38f7bfbc C++: Store lambda captures in the code model.
Done-with: Erik Verbruggen
Task-number: QTCREATORBUG-7968
Task-number: QTCREATORBUG-7949

Change-Id: I0cf727052d0a3536ed96ee894b18768c9538c213
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-11-07 13:36:20 +01:00
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