summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus
Commit message (Collapse)AuthorAgeFilesLines
* C++: Limit number of nested class instantiationsNikolai Kosjar2017-08-081-0/+2
| | | | | | | | | ...to avoid out of memory crashes. Task-number: QTCREATORBUG-18649 Change-Id: I5e121bf4be0fd0c01a97a182ed07ee7552fb68ac Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* C++: Do not insert matching } within stringNikolai Kosjar2017-08-071-0/+5
| | | | | | | | | | | Regression from commit a6aa287720112c70c1363bcb46d55d438fe57eac C++: Fine-tune auto insertion of '}' Change-Id: I3ede8c7a1e3c73708d5d5a59c314e4b4596976b2 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* C++: Delete empty source fileOrgad Shaneh2017-07-261-1/+0
| | | | | Change-Id: Ib86e09d6d516b175e715725fa9b60d7ae2626ff8 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* C++: Fine-tune auto insertion of '}'Nikolai Kosjar2017-07-212-22/+211
| | | | | | | | | | | | | | Do not insert for these cases: * <Cursor>{ * namespace X <Cursor> * if the next block is indented, like e.g.: if (e) <Cursor> g(); * on empty line if text before looks like a finished statement or scope opening/end Change-Id: Id9decc1e964a775724a929c2a3e79b5283105560 Reviewed-by: David Schulz <david.schulz@qt.io>
* CppEditor: Avoid auto insertion of '}' in empty lineNikolai Kosjar2017-07-171-1/+5
| | | | | | | ...when typing '{'. Change-Id: Ia1d3bcd7440c96ed3c8c1479148dd74d3d291689 Reviewed-by: David Schulz <david.schulz@qt.io>
* Merge remote-tracking branch 'origin/4.3' into 4.4Eike Ziller2017-07-102-9/+14
|\ | | | | | | | | | | | | Conflicts: qtcreator.qbs Change-Id: Ic5e268326d93172208de291d31a716e437b9cedf
| * C++: Fix crash for invalid codeNikolai Kosjar2017-07-062-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...due to indirect recursion: ... CPlusPlus::ClassOrNamespace::lookupType LookupContext.cpp 833 0x7fffd6c954cc CPlusPlus::ClassOrNamespace::nestedType LookupContext.cpp 1364 0x7fffd6c94bc6 CPlusPlus::ClassOrNamespace::lookupType_helper LookupContext.cpp 955 0x7fffd6c9517f CPlusPlus::ClassOrNamespace::lookupType_helper LookupContext.cpp 983 0x7fffd6c952ad CPlusPlus::ClassOrNamespace::lookupType LookupContext.cpp 833 0x7fffd6c954cc CPlusPlus::ClassOrNamespace::nestedType LookupContext.cpp 1364 0x7fffd6c94bc6 CPlusPlus::ClassOrNamespace::lookupType_helper LookupContext.cpp 955 0x7fffd6c9517f CPlusPlus::ClassOrNamespace::lookupType_helper LookupContext.cpp 983 0x7fffd6c952ad CPlusPlus::ClassOrNamespace::lookupType LookupContext.cpp 833 0x7fffd6c954cc ... ClassOrNamespace::lookupType(const Name *) already guards with a list of entries already processed, but some calls deeper the list is not passed on and lookupType() starts again with an empty list. Handle that case, too. Task-number: QTCREATORBUG-18499 Change-Id: Iab8978f6ac1d0aea16f49b3547415f43de887b07 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* | C++: fix code completion of stl containers in internal code modelPrzemyslaw Gorszkowski2017-06-151-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fix makes some trick and replaces existing typedef of 'pointer' to the simplest one(only in class unique_ptr), e.g.: template <class _Tp> class unique_ptr { typedef some_strange_things pointer; pointer operator->(); } is replace with template <class _Tp> class unique_ptr { typedef _Tp* pointer; pointer operator->(); } In most of the implementation of unique_ptr it should work. Similar approach is done for std::list, std::vector, std::queue, std::set, std::multiset, std::unordered_set. It is done in this hacky way to omit problems with cyclic and complex resolving of typedefs. Change-Id: I1363dfc5e23d3cd2fa7af7fc27423bfbac2d894d Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | CPlusPlus: Add a property iconAlessandro Portale2017-06-137-0/+17
| | | | | | | | | | | | | | | | | | Properties have been so useful in Qt for Years, and they will continue being so. Properties deserve a proper icon. Change-Id: Ifd19c97470a48a033bbe4017855f7b150befb365 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* | C++: Fix uninitialized value warningsNikolai Kosjar2017-06-011-1/+1
| | | | | | | | | | | | | | ...from coverity scan. Change-Id: I44663354b3ee4854dd6335121a0160e35f14976c Reviewed-by: Robert Loehning <robert.loehning@qt.io>
* | C++: Handle curly braces like other brace typesNikolai Kosjar2017-05-231-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unless it balances the curly braces * typing '{' leads to auto insertion of '}'. * typing '}' skips already present '}'. * removing '{' leads to auto removal of '}'. This prevents unbalanced curly braces, which are problematic for clang. Concrete use cases are: typing of initializer lists, lambdas, function definitions. Task-number: QTCREATORBUG-15073 Change-Id: Iec8c6aa5aca054455c1e1bfde3a65c4fd1f579c3 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
* | Merge remote-tracking branch 'origin/4.3'Eike Ziller2017-05-151-1/+1
|\ \ | |/ | | | | | | | | | | | | Conflicts: qbs/modules/qtc/qtc.qbs qtcreator.pri Change-Id: I6d89ea588de955f5d878500b59285d3adde6c77d
| * C++: Fix invalid read in isQtReservedWord()Nikolai Kosjar2017-05-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The change CPlusPlus: Fix isQtReservedWord commit 7d76dd007954ee48182beb2adf17dab5df5fbea8 enabled the problematic code path. Change-Id: Ic89e3976b07ad55976c474f9c4b6d6f6cf64d29e Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* | C++: Use Utils::FileName for Usage::pathOrgad Shaneh2017-04-272-3/+4
| | | | | | | | | | Change-Id: I1d22333ad60d229202db5d372d00019b5870e60f Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | C++: Use direct member initialization in FindUsagesOrgad Shaneh2017-04-272-17/+9
| | | | | | | | | | Change-Id: Ibe717dc587d817d53356771507b4aa3072554cb1 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Remove workarounds for unsupported compilersOrgad Shaneh2017-04-261-6/+0
| | | | | | | | | | Change-Id: Ie28ff761b0bae13c6ebdf7dd649cfbba28e0fc2c Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Merge remote-tracking branch 'origin/4.3'Eike Ziller2017-04-213-8/+9
|\ \ | |/ | | | | Change-Id: I44511e06986b7df6007be7daf7051c895a10794b
| * Use qEnvironmentVariableIsEmpty or qEnvironmentVariableIsSet directlyMontel Laurent2017-04-192-2/+2
| | | | | | | | | | | | | | | | Change-Id: I4f2e61e4bade9e7b4518d144db8163e596ab6264 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
| * C++: Use Utils::transform() in BackwardsScannerOrgad Shaneh2017-04-191-6/+7
| | | | | | | | | | | | Change-Id: Iec2c2db7afd8e5fe463a32c6b5167592cdd7617c Reviewed-by: Laurent Montel <laurent.montel@kdab.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Use const'ref in theses methodsMontel Laurent2017-04-211-1/+1
|/ | | | | Change-Id: Idfa5ffdcf23d1ef80442276690b8082b8279dbfa Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Reserve some elementsMontel Laurent2017-04-141-0/+1
| | | | | Change-Id: Iceef4e9a6f213a747045db3b06a5608d77652f98 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* C++: De-slotOrgad Shaneh2017-03-201-2/+1
| | | | | Change-Id: If4562fff4271dd8be3ec2b3394fdcbe5a9cb4e50 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Merge remote-tracking branch 'origin/4.2'Eike Ziller2017-02-271-2/+37
|\ | | | | | | Change-Id: I9006dd493707ae626ae3502541599c8789e1aab0
| * C++: Avoid inline namespaces in generated codeNikolai Kosjar2017-02-231-2/+37
| | | | | | | | | | | | | | Task-number: QTCREATORBUG-16086 Change-Id: Ic2f3fd38ae6cc93725bc214c24320f40a0a519a8 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* | Remove spaces in initializer listsTim Jenssen2017-02-222-2/+2
| | | | | | | | | | | | | | Format initializer lists code style like. Change-Id: Ib82c235e4ba7dc75ee96a7abc0c47eff7b0a9013 Reviewed-by: hjk <hjk@qt.io>
* | C++: Do not add double quotes when splitting raw string litteralsDavid Schulz2017-02-222-5/+7
| | | | | | | | | | | | Task-number: QTCREATORBUG-17717 Change-Id: Iffb34a3d77ada624dc13b8ab050ac08731d25863 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Fix exports for shared librariesMarco Bubke2017-01-161-1/+1
| | | | | | | | | | | | | | | | We use "shared" to define a shared library and not dll. Change-Id: Ia97ebd0042a7ef0f33eadaa448d9a44b42331ad1 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Merge remote-tracking branch 'origin/4.2'Eike Ziller2017-01-113-6/+54
|\ \ | |/ | | | | | | | | | | | | Conflicts: src/plugins/android/androidbuildapkstep.cpp src/plugins/genericprojectmanager/genericproject.cpp Change-Id: I3484b668f9323ed0c05de99f8dfed07c9e65ab98
| * C++: Fix use-after-free crash when handling auto expressionsNikolai Kosjar2017-01-093-6/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | The Control of the Document "exprDoc" in ResolveExpression::visit( SimpleNameAST*ast) owns names that are passed on further as part of the LookupItems. However, the life time of that Document and thus the Control ends in that function. Fix by using the appropriate Control object. Task-number: QTCREATORBUG-16731 Change-Id: I5a7af0a67613fff79f7e07865801585c13bb9b45 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* | C++: Fix handling of Objective-C/C++Francois Ferrand2016-12-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | - Objective C/C++ was not enabled in highlighter. - QMake project part for Objective C/C++ did not have ObjectiveC extension enabled. - As languageFeatures.objCEnabled is a bitfield, it was actually always set to 0. - Highlight ObjC class & protocol declarations. - Highlight ObjC message passing. Change-Id: I64d12c9509058d05f7adce94598cb7ce91727ac8 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | CPlusPlus: Fix isQtReservedWordTobias Hunger2016-11-301-1/+1
|/ | | | | | | checking for size >= 4 masks Q_D and Q_Q. Change-Id: If9ab7d3b2c2c571e73b98e89908e492fc6241296 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* C++: Remove concurrent access to TemplateNameIdNikolai Kosjar2016-11-041-7/+8
| | | | | | | | | | | | | | | | | | | The modification of the TemplateNameId changed "global state" because the TemplateNameId is potentially accessed by multiple threads doing lookup (access to same document and thus same symbol names). Depending on the thread scheduling and access to ClassOrNamespace::_specializations, the changed TemplateNameId "suddenly" led to inconsistent results of TemplateNameId::Compare and thus broke the std::map assertions. Get rid of the const_cast, the setter and simply construct a temporary TemplateNameId with isSpecializaton = true. Task-number: QTCREATORBUG-14911 Change-Id: Ie381d132cc0d06af351ace4257773637d1ebee4e Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* CPlusPlus, Utils: Move namespace icon from CPlusPlus to UtilsAlessandro Portale2016-10-264-3/+1
| | | | | | | ...so that it can be used in the ScxmlEditor plugin Change-Id: I0e0ed050f7765bcc901db3bb2c3273456a228b5e Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* C++: Enable showEnclosingTemplate also for function typeOrgad Shaneh2016-09-061-17/+21
| | | | | | | Do not require directly passing the enclosing template. Change-Id: Ie03bc58338fe003677a5f5311d86d70f499373ee Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* C++: Disable C++ keywords in C filesFrancois Ferrand2016-08-231-0/+1
| | | | | | | | | | | | In some (legacy) C files, new and delete may be used for regular identifier. There are some limitations: * Header files have no 'implicit' type, and may be parsed as C++ or ObjC depending on the other files in the project. * QMakeProject use a single ProjectPart for C and C++ files, so there will still be the issue. Change-Id: Iec11687b35f7ccf1e7c0d091b143ae90d950e440 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* C++: Support pretty printing of template enclosing scopeOrgad Shaneh2016-08-193-2/+22
| | | | | Change-Id: Ib228184e1259585eeac61b9196195c39a9550cb9 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: Cancel parsing if editor is closedNikolai Kosjar2016-07-292-0/+14
| | | | | | | | | | | | The m_parserFuture.cancel() in ~BuiltinEditorDocumentProcessor() did not cancel anything. Thus, closing a document while the parser was running led to a blocking UI thread. Now it cancels at the next include directive it encounters. Change-Id: I092fddbbd747e0bc95265b6e9b4fcc26b3f76cb3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* C++: Add support of ref-qualifier for functions.Dmitry Ashkadov2016-06-222-0/+12
| | | | | | | | | | Now the ref-qualifier (& or &&) of the function declaration is propagated to GUI. For example, 'Refactor' -> 'Add Definition' preserves the ref-qualifier. Change-Id: I8ac4e1cad4e44985e94230aabbd9858a7e929fee Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Editor: Skip auto completed character only if it was recently inserted.David Schulz2016-06-212-10/+12
| | | | | | | | | | | | | | | | This means you can skip automatically inserted characters as long as you don't explicitly move the text cursor and the editor doesn't lose the focus. This will be visualized by highlighting the automatically inserted character as long as you can perform the skipping. This will reduce unexpected skipping in the case a cursor was explicitly placed before an closing brace and a closing brace is typed. Change-Id: I28e29e79ba10c9c48e8bc8817405fea630cca9bd Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
* qbs build: Final steps to support building plugins "out of source".Christian Kandeler2016-06-151-124/+132
| | | | | | | | | | | | | | | | | | | | | | | - Use the entire Export block when creating a module, not just the Depends items. Adapt references to the product source directory and the "share" directory so that they point to the respective locations in the install tree. - Install dev headers for some more plugins. - Bug fixes & polishing. Create a "dev installation" like this: $ qbs qtc.make_dev_package:true qbs.installRoot:<install root> Then build your plugin against it like this: $ qbs qtc.make_dev_package:true qbs.installRoot:<install root> project.qbsSearchPaths:<install root>/qbs-resources (Using qbs from 1.5 branch; 1.5.1 requires a trivial wrapper project.) That's all. Successfully tested with all commercial plugins on Linux. Change-Id: Ie39c4717dafcd431c533421a15f2f898783d8521 Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* CPP: Remove unused function.David Schulz2016-05-261-13/+0
| | | | | | Change-Id: Ib55fd0c059b2e5e117250eb4671b3352ab41b310 Reviewed-by: Nikita Baryshnikov <nib952051@gmail.com> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* C++: Improve automatic quoting magic.David Schulz2016-05-251-3/+16
| | | | | Change-Id: I5d3a15dc100ae9c03bbc49de99714da1c89cb0d8 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Editor: Separate auto insert brace and quote magic.David Schulz2016-05-252-24/+54
| | | | | | | To allow enabling/disabling both features separately. Change-Id: Ica154e3b400823de7cf22daf006958802d751c64 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* C++: optimize paragraph insertion.David Schulz2016-05-201-12/+2
| | | | | | | | | | Do not check tokens which are returning the default return value. Do not check for tokens when a previous condition excludes the other token types. Change-Id: Id97aed9d6342c6c12e9b26acdd0a8c4b0bca0868 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Remove duplicated code from c++ and glsl completer.David Schulz2016-05-202-8/+117
| | | | | Change-Id: Ibda04771fceffef6344f6a6128d77dd8192379ca Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppEditor: Simplify insert matching characters.David Schulz2016-05-201-59/+61
| | | | | Change-Id: Ib3a94d016b615d71b1635ebe13a87575b8dc12c5 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CPlusPlus: fix gcc warningNikita Baryshnikov2016-05-131-2/+2
| | | | | | | this 'if' clause does not guard Change-Id: I004cb72dff2213738c59701d99748d7338991105 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Merge remote-tracking branch 'origin/4.0'Eike Ziller2016-05-032-5/+20
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/debugger/debuggerruncontrol.cpp src/plugins/projectexplorer/projectwizardpage.cpp src/plugins/projectexplorer/xcodebuildparser.h src/plugins/qmldesigner/qmldesignerplugin.cpp src/tools/clangbackend/ipcsource/translationunits.cpp Change-Id: Ibf0857cf8dbf95fc9ac13d5c2112b3f4a2ca7de6
| * C++: Handle invalid indices in OverviewModelNikolai Kosjar2016-04-281-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the following ModelTests pass: ModelTest::nonDestructiveBasicTest() Q_ASSERT(model->data(QModelIndex()) == QVariant()); Qt::ItemFlags flags = model->flags(QModelIndex()); Q_ASSERT(flags == Qt::ItemIsDropEnabled || flags == 0); Task-number: QTCREATORBUG-13142 Change-Id: If639981079b79d8b5b3bed22fb47453650449706 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * C++: Guard against parent binding loopNikolai Kosjar2016-04-271-4/+14
| | | | | | | | | | | | Task-number: QTCREATORBUG-16146 Change-Id: Ib2a790954517859acd7ca5f16c7d889d28208fb0 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>