summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus/ResolveExpression.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Braces cleanupOrgad Shaneh2013-11-141-2/+1
| | | | | Change-Id: I8413252c90a1487d291f15d92837c30ab697b245 Reviewed-by: hjk <hjk121@nokiamail.com>
* C++: Limit typedef resolving depthNikolai Kosjar2013-10-181-27/+6
| | | | | | | | | | | This reverts commit 5be56c0 except for its tests. While it fixed the problem described in the bug report, it also introduced regressions. For now, we use a hard limit. Change-Id: I19a85be454e3d7969371707e3eb1c3d42a16ecee Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: fix endless loop during template instantiationPrzemyslaw Gorszkowski2013-10-171-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | This is the first phase of fixing bug QTCREATORBUG-10320. This change resolves typedefs of template parameters(and resolves problem with endless loop). The next step will be matching appropriate template specialization (this is needed to solve problem with missing code completion). Missing matching: template specialization with the same parameters, e.g.: template <class T1, class T2, class T3> class T { }; template <class T1, class T2> class T<T1, T2, T2> { }; Task-number: QTCREATORBUG-10320 Change-Id: Icb6b539c021b2a67a66db9011a2e627f7d96526b Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* C++: fix ResolveExpression for string literalsJoerg Bornemann2013-09-171-2/+18
| | | | | | | | ResolveExpression now correctly handles wide and UTF-n string literals. Change-Id: Ide2373ffdc4c9e1e4b53236a8e2782653d15e687 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* Merge remote-tracking branch 'origin/2.8'Oswald Buddenhagen2013-08-211-1/+3
|\ | | | | | | | | | | | | | | | | | | 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
| * C++: Fix crash in typedef resolvingNikolai Kosjar2013-08-161-1/+3
| | | | | | | | | | | | | | | | Task-number: QTCREATORBUG-9990 Change-Id: I8153f18c8b7402c5cb3edbe41098792be183de44 Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* | C++: fix auto completion for template parametersPrzemyslaw Gorszkowski2013-08-051-31/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix auto completion for the case when template parameter should be found somewhere of scope of template instantiation declaration. Example: struct A { void foo(); struct B { int b; }; }; template<typename T> struct Template { T* get() { return 0; } T t; }; void A::foo() { Template<B> templ; templ.get()->//no autocompletion templ.t.//no autocompletion } Task-number: QTCREATORBUG-8852 Task-number: QTCREATORBUG-9169 Change-Id: I56b40776e66740f995ae6fc5d69e3c50139a3af2 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* | Fix coding style for else statementsOrgad Shaneh2013-07-171-4/+2
| | | | | | | | | | Change-Id: I1309db70e98d678e150388c76ce665e988fdf081 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
* | C++: code completion for lambda callsPrzemyslaw Gorszkowski2013-07-121-0/+17
|/ | | | | | | | | | | | | | support for lambdas, e.g.: struct S { int bar; }; []() { return new S; } ()->bar; [] { return new S; } ()->bar; []() ->S* { return new S(); } ()->bar; []() throw() { return new S(); } ()->bar; []() throw()->S* { return new S(); } ()->bar; Task-number: QTCREATORBUG-9523 Change-Id: I43fbf6f0ee0bb11411c53c984df75ef33a276466 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: Handle recursive auto declarationsNikolai Kosjar2013-06-111-4/+11
| | | | | | | | | | | Remember auto declarations we have already looked up and stop if we try it again. Task-number: QTCREATORBUG-9503 Change-Id: I989b11609c98bf197ce916d79c9d452294355053 Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: fix typedefed structPrzemyslaw Gorszkowski2013-05-241-17/+18
| | | | | | | | | | Fixed: * replacing dot with arrow * code completion Task-number: QTCREATORBUG-7373 Change-Id: I6bd3781e91876567ce6f0d4160373438c756c417 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: instantiate template functionsPrzemyslaw Gorszkowski2013-05-241-0/+8
| | | | | | | Task-number: QTCREATORBUG-9170 Change-Id: I4cac9124558c1d4f0722192246f3fbeea61d3d7d Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Revert "C++: fix support for typedef of templated typedefs"Nikolai Kosjar2013-04-231-9/+2
| | | | | | | | | | Still crashes when opening the Qt Creator project, g++ (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2 (Ubuntu 12.10). This reverts commit 564c9b2842663062658a0febdcc5787098d871b2. Change-Id: Ief5c0aad463d245f68805f747d277ac298796c3d Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* C++: fix support for typedef of templated typedefsPrzemyslaw Gorszkowski2013-04-221-2/+9
| | | | | | | | | | | | Fix: * code completion * follow symbols * find usages Task-number: QTCREATORBUG-8375 Change-Id: Ia40273fec3dead76acad4695b852a9e53065d8a7 Reviewed-by: Petar Perisin <petar.perisin@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Revert "C++: fix support for typedef of templated typedefs"Erik Verbruggen2013-04-191-9/+2
| | | | | | | | | | | | | | Infinite recursion in the lookup of: struct common_type { public: typedef typename common_type<typename common_type<_Tp, _Up>::type, V>::type type; }; This reverts commit 9a56ce4e85bec81c521258f44e9076d0bc9cce92 Change-Id: I675fe39018789cd04127d105eb983d2cb7798ca5 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: fix support for typedef of templated typedefsPrzemyslaw Gorszkowski2013-04-191-2/+9
| | | | | | | | | | | | Fix: * code completion * follow symbols * find usages Task-number: QTCREATORBUG-8375 Change-Id: I6f35e809ba15f224c5a6d9b2fcfc18dbfba55411 Reviewed-by: Sergey Shambir <sergey.shambir.auto@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* fix include style relating to cplusplus librariesOswald Buddenhagen2013-04-031-10/+12
| | | | | | | | | | | ... 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>
* C++: use argumentCount in loops in initializer.Erik Verbruggen2013-03-151-1/+1
| | | | | | | | argumentCount is a more expensive function, so try to call it only once, esp. in loops. Change-Id: I6f0d420352743ec444487ce3f506ef28e5282d1e Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* C++: Fix crash due to dangling pointerNikolai Kosjar2013-03-121-2/+3
| | | | | | | | | | | | 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>
* C++: fix 'using' for templates in typedefsPrzemyslaw Gorszkowski2013-02-211-2/+6
| | | | | | | | | | | | Fix resolving typedef of templates which is from different namespace and there was 'using' used for it. Examples are in tests. Another step to bring code completion for stl containters. Task-number: QTCREATORBUG-7978 Change-Id: I2e9e71b45d60536c1e25cf2d371c4719b15edf79 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: fix code completion for typedef of pointerPrzemyslaw Gorszkowski2013-02-111-8/+51
| | | | | | | | | | Fix code completion and highlighting member of typedefed pointers. It works when typedef is inside or outside of the function. Task-number: QTCREATORBUG-8671 Task-number: QTCREATORBUG-8672 Change-Id: I9cc87080bf443f7ffa6a90ef5ba582b87700f2db Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* C++: fix replacing dot(.) with arrow(->)Przemyslaw Gorszkowski2013-02-011-3/+16
| | | | | | | | | Fix replacing operator dot(.) with operator arrow(->) for typedef pointer. Task-number: QTCREATORBUG-8488 Change-Id: Ic4462bc437a4aa37adfed4fa50b32d9bc20fe194 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* Merge remote-tracking branch 'origin/2.6'Oswald Buddenhagen2013-01-311-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Incremented year in copyright infov2.6.2Robert Loehning2013-01-291-1/+1
| | | | | | | | | | Change-Id: Ic6a9ff0359625021ebc061d22db6811814534205 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
| * Fix: no scope walking for name resolving after MemAccess operatorErik Verbruggen2012-11-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* | C++: Fix possible null-pointer access.Erik Verbruggen2013-01-301-0/+2
| | | | | | | | | | Change-Id: Id42bb1cbf109cac8ab868ab7381a54d6be9a7697 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* | Remove braces for single lines of conditionsOrgad Shaneh2013-01-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #!/usr/bin/env ruby Dir.glob('**/*.cpp') { |file| # skip ast (excluding paste, astpath, and canv'ast'imer) next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i s = File.read(file) next if s.include?('qlalr') orig = s.dup s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m| res = $& if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces res else res.gsub!('} else', 'else') res.gsub!(/\n +} *\n/m, "\n") res.gsub(/ *{$/, '') end } s.gsub!(/ *$/, '') File.open(file, 'wb').write(s) if s != orig } Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc Reviewed-by: hjk <qthjk@ovi.com>
* | C++: fix code completion when pointer's type is a typedefPrzemyslaw Gorszkowski2012-12-291-2/+6
| | | | | | | | | | | | | | Task-number: QTCREATORBUG-8488 Change-Id: I6f11173452df3e1611fba1c04da17e7428f34e9e Reviewed-by: hjk <qthjk@ovi.com>
* | C++: Fix code completion for nested classesPrzemyslaw Gorszkowski2012-12-201-4/+11
| | | | | | | | | | | | | | | | | | | | Fix code completion for nested classes when enclosing is template class. Unit tests Task-number: QTCREATORBUG-8245 (only standalone) Change-Id: Ib31ad4b799db927b56debd4dc3e7403404c1839d Reviewed-by: hjk <qthjk@ovi.com>
* | C++: Fix code completion for operator ->Przemyslaw Gorszkowski2012-12-051-36/+68
| | | | | | | | | | | | | | | | | | | | | | Fix code completion for operator '->' when returned value is a pointer of typedef(e.g.:std::auto_ptr). Included unit test. Task-number: QTCREATORBUG-629 Change-Id: I36b53a3f80b3c99d52791e18ad1244923c1373f6 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* | CPlusPlus: Compile with QT_NO_CAST_FROM_ASCIIOrgad Shaneh2012-12-041-1/+1
| | | | | | | | | | | | Change-Id: I1cfb413b7e88e91e9c4719a8a7b81c752c40767e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* | Fix: no scope walking for name resolving after MemAccess operatorErik Verbruggen2012-11-211-1/+1
| | | | | | | | | | Change-Id: Ic093079fa65d8d749911fd9f5b0f629e9fe68a1e Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* | C++: Compile fixes in tests and tools.Nikolai Kosjar2012-10-231-2/+2
|/ | | | | | | | After some refactorings not all usages, especially in tests and tools, were adapted. Change-Id: I7ed24bb1c8e55e55ed74eda3a8fd7610e725f4cb Reviewed-by: hjk <qthjk@ovi.com>
* C++: Fix typedef resolving when templates are involved.Erik Verbruggen2012-10-191-7/+28
| | | | | | | | Task-number: QTCREATORBUG-7978 Change-Id: I27e6ebe56e410d509580a1e00f8986642cacc5ba Reviewed-by: David Schulz <david.schulz@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: Christian Stenger <christian.stenger@digia.com>
* Adjust license headershjk2012-10-051-21/+20
| | | | | Change-Id: Ice592c6de9951ee3b2c4cb52ed0bb3b6770e0825 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
* CPlusPlus: Avoid reversing results for call lookupOrgad Shaneh2012-09-241-5/+7
| | | | | | | Task-number: QTCREATORBUG-5876 Change-Id: Ia94f4aa67af2b79862acd7869a3952f6a44932cb Reviewed-by: hjk <qthjk@ovi.com>
* C++: Fix crash in auto deducing mechanismLeandro Melo2012-09-051-7/+48
| | | | | | | | | | | There was an inconsistency, since the AST used in ResolveExpression was not really the same previously computed. In the particular issue below a crash could occur, for example, when using auto in a for range loop. Task-number: QTCREATORBUG-7828 Change-Id: I02958f434c3cf3b50609546003fc141674ee78d5 Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
* C++: Fix crash when deducing auto (with invalid ids)Leandro Melo2012-09-041-5/+16
| | | | | | | Task-number: QTCREATORBUG-7801 Change-Id: I61436148ed1428a50a6840ba9109310a57dabaa4 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* rename QtDebug to QDebughjk2012-08-061-1/+1
| | | | | | | More uniform. Change-Id: I1c6057981f4c2b3170a4e69f0674fe4caf1143a2 Reviewed-by: Robert Loehning <robert.loehning@nokia.com>
* Contact -> qt-project.orgEike Ziller2012-07-191-3/+1
| | | | | Change-Id: I7134d7de30bcf9f9dcfad42520dd45ee083a852d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* C++: Introduce unicode char/strings supportLeandro Melo2012-06-061-4/+7
| | | | | | | | | | | | | | 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>
* Removed module names from #include directives.Erik Verbruggen2012-02-151-3/+3
| | | | | | | | Getting the #include directives ready for Qt5. This includes the new-project wizards. Change-Id: Ia9261f1e8faec06b9285b694d2b7e9a095978d2b Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
* C++: Type deduction for auto-declared variables implementedFlex Ferrum2012-01-311-4/+91
| | | | | | | | | | | 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>
* Long live the king!hjk2012-01-261-1/+1
| | | | | Change-Id: I2b72b34c0cfeafc8bdbaf49b83ff723544f2b6e2 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
* C++: Recognize C++11 nullptrLeandro Melo2011-11-181-0/+7
| | | | | Change-Id: I5b7ac8f9b2137ffe9439ada4ec4aeb9cee8e249d Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* C++: Better resolution for typedef when resolving expr.Leandro Melo2011-11-171-3/+41
| | | | | | | | | | | | Example: struct Bar { int m; }; typedef Bar *pBar; pBar b; b-> // completes correctly now Change-Id: I97cc67579b955fe47c68ab6c35be9a054b6d1be9 Done-by: ckamm Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* all: s/info@qt.nokia.com/qt-info@nokia.com/hjk2011-11-031-2/+2
| | | | | Change-Id: If18afb5d4665924e7d9250dccbc60a65e6daa75e Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
* C++: Fix completion for typedefs for templates in namespaces.Christian Kamm2011-08-191-1/+11
| | | | | | Change-Id: Ib96551388c94731d97eb8f9728613b120b0b86a9 Reviewed-on: http://codereview.qt.nokia.com/3262 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Fix/add copyright headersTobias Hunger2011-05-061-1/+1
| | | | Change-Id: I8b73d583be1ee7183f4074bce49d5390e38631a2
* Update license.hjk2011-04-131-14/+13
|