summaryrefslogtreecommitdiff
path: root/tests/auto/cplusplus
Commit message (Collapse)AuthorAgeFilesLines
...
| * CPlusPlus: Properly categorize usages in if statementsChristian Kandeler2020-11-041-3/+9
| | | | | | | | | | Change-Id: I5f6e5fa14ea51cd9e61a9e2e96c110ca618be429 Reviewed-by: André Hartmann <aha_1980@gmx.de>
| * CPlusPlus: Properly categorize usages in switch and case statementsChristian Kandeler2020-11-021-3/+18
| | | | | | | | | | Change-Id: Iafbbdcca23db38d82bbc5bb24a39dac2a6d0a764 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
| * Fix building tests with Qt6Eike Ziller2020-10-302-16/+11
| | | | | | | | | | | | Task-number: QTCREATORBUG-24098 Change-Id: I192245125f04f8350597bbe481d80d3f8ba0cae0 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | C++: Extend alias declaration support in built-in parserChristian Kandeler2020-11-091-0/+2
|/ | | | | | | | The type-id in an alias declaration can also define a new type. Change-Id: I65dc397d2526c56334676c6ab522564f6748d594 Task-number: QTCREATORBUG-24875 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppTools: Categorize the delete operator as a write accessChristian Kandeler2020-10-211-1/+3
| | | | | | | ... in the "Find Usages" results. Change-Id: Ib399bf762c717b7d4439be26b9180574aefce7e3 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Consider member initializationsChristian Kandeler2020-09-181-13/+27
| | | | | | | ... when checking usage types. Change-Id: Ic875f3bcae9cf045dbb062670e8cf941de533404 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Look at all overloadsChristian Kandeler2020-09-151-2/+7
| | | | | | | | | ... when trying to find out the usage type of a function argument. Otherwise, we potentially ignore functions which have additional overloads with a shorter parameter list than is required for the call. Change-Id: I02bf2cb359ea9d506e2644388234dc28fa072445 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Categorize "Find Usages" resultsChristian Kandeler2020-09-031-2/+312
| | | | | | | | | | | That is, find out whether a certain access was a read, a write, a declaration or something else, and report the result to upper layers. Follow-up patches can make this information visible to users. Task-number: QTCREATORBUG-12734 Task-number: QTCREATORBUG-19373 Change-Id: Iee79e39dd1eb5a986a7e27846991e0e01b2c3a2f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppTools: Fix CppSelectionChanger autotestChristian Kandeler2020-08-311-1/+1
| | | | | | | | | | | ... on Windows. We need to open the test file in text mode. Otherwise the raw string literal will contain carriage returns. As these get dropped by QTextDocument, the offsets will be inconsistent with the ones reported by the tokens, causing the test to fail. Change-Id: I161a3f5791c33416ff732f90fd615cf39d8152ce Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Merge remote-tracking branch 'origin/4.13' into masterEike Ziller2020-08-131-18/+19
|\ | | | | | | Change-Id: I1c426d95eedd82bd4470a64a9bafd734d23081ac
| * CPlusPlus: Fix expectations in preprocessor autotestChristian Kandeler2020-08-121-18/+19
| | | | | | | | | | | | | | | | ... regarding unfinished macro calls. Amends df0ffd8bb8. Change-Id: Ia7b8752860ac9207e702697cbee87f16a39dd1dd Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | CppTools: Fix formatting for lambdas with trailing return typeChristian Kandeler2020-07-311-0/+13
|/ | | | | | | | | After the arrow, the state is still the same, as now a type is expected. Only after the opening brace does the actual function start. Fixes: QTCREATORBUG-18497 Change-Id: I7bf18fbd6907d36f8869af3a78ad617cf0ee9dbb Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Tests: Fix deprecation warningChristian Kandeler2020-06-261-1/+1
| | | | | | Task-number: QTCREATORBUG-24098 Change-Id: Icea21e446173537d8fdb8113f1eff7d7176c34b3 Reviewed-by: hjk <hjk@qt.io>
* C++: Fix auto variable resolving for template class constructor callVolodymyr Zibarov2020-06-221-0/+108
| | | | | | | | | | | | | | | | | | | | Code snippet: template<class T> struct MyStruct { int value; }; int main() { auto s = MyStruct<int>(); s.value; // "value" is not found } This fixes find usages for unique_ptr declared as auto like this: auto ptr = std::unique_ptr<MyStruct>(new MyStruct()); ptr->value; Also fixes in-place constructors: std::unique_ptr<MyStruct>(new MyStruct())->value; Fixes: QTCREATORBUG-15364 Change-Id: I8d452a77fe85e63665ec8d4c4afbcf8aad063121 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CPlusPlus: Fix lexer crashChristian Kandeler2020-06-181-0/+15
| | | | | | | | | | | | | At some point in the preprocessing stage, some tokens get "squeezed", so their associated string no longer refers to the document content, but only to their own symbol. However, there is at least one context that operated under the assumption that the token's offset still pointed into the "global" string. As the token's offset is zero after parsing, this lead to the same piece of code being preprocessed in an infinite loop. Fixes: QTCREATORBUG-19525 Change-Id: I231ba51811cfa0b5c6dfe7f75fe0384472252c6f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* C++: Fix Find Usages false positive results for function argumentsVolodymyr Zibarov2020-06-151-0/+113
| | | | | | | | | | | | | Code snippet: void bar(); // call find usages for bar from here void foo(int bar); // bar from here should not be in results Add test for member function false positives, that is part of QTCREATORBUG-2176. That was already fixed before. Fixes: QTCREATORBUG-2176 Change-Id: I9a079caa83bbaea1edb7ba6aeb151d4d4c77952f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* C++: Fix find usage to see Catch test functions bodiesVolodymyr Zibarov2020-06-151-0/+40
| | | | | | | | | | | | Catch test functions defined with function-like macros. To speed-up semantic analysis, find usages does not expand function-like macros. Semantic fails with "expected a function declarator" on such functions and skips function body. To avoid that, we create dummy function type specifically for this case Change-Id: Ie2f2464ee57aa4dc86eed07b8b699458f95c0266 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* C++: Fix variable template parsing in expressionVolodymyr Zibarov2020-06-042-0/+58
| | | | | | | | | | | Fix parser to not fail on TemplateId without parentheses, for example: int i = foo<int> + foo<char>; This fixes std::pair structure parsing in MSVC headers and find Usages to work with pair->first and pair->second. Change-Id: Ic300ea99d44a749705430d5eb47b2744715af995 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CppTools: Fix formatting for new-style function declarationChristian Kandeler2020-06-041-0/+1
| | | | | | Fixes: QTCREATORBUG-23502 Change-Id: Ie80fe9aa77ffbf0b9ecc531841e78f2bd80de37e Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* C++: fix built-in code model to work with shared_ptr on MSVC 2017Volodymyr Zibarov2020-05-293-1/+554
| | | | | | | | | | | | | | | | | | | | | | | These changes target Find Usages feature to work with shared_ptr. Improve libs/3rdparty/cplusplus and plugins/cplusplus: parse __declspec() attribute, call to variadic function template without specified template arguments, if constexpr, c++11 attributes [[value]], function templates with default parameters, resolve order for function vs template with default parameter, template operator->() with default arguments, template specialization with numeric values, find best partial specialization, fix partial specialization for non-first specialized argument Fixes: QTCREATORBUG-7866 Fixes: QTCREATORBUG-20781 Fixes: QTCREATORBUG-22857 Fixes: QTCREATORBUG-17825 Change-Id: I31a080f7729edfb2ee9650f1aff48daeba5a673b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Nikolai Kosjar <pinaceae.pinus@gmail.com>
* Built-in lexer: Recognize also reserved user-defined literalsChristian Kandeler2020-05-282-1/+3
| | | | | | | | | | | Otherwise, we trip over uses of operators from the standard library such as std::chrono's operator"" ms(), potentially breaking basic code navigation. Amends 425811291d. Fixes: QTCREATORBUG-24067 Change-Id: I3b2863ce88ee3787414e7a1acdf25f368041cdb4 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* C++: Add tests for recent indentation fixesChristian Kandeler2020-05-271-0/+25
| | | | | Change-Id: I90ae2da3a82bff2e966c4327cf8e42f7ebbddd27 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Simplify RPATHs for qmake buildEike Ziller2019-11-041-1/+0
| | | | | | | | | | | | | | Use central rpath.pri for setting RPATHs and qttestrpath.pri for tests. Simplify install names of plugins and libraries on macOS to be just @rpath/libName, which follows convention better and makes setting up RPATHs easier. Preparation for moving tools one directory level down on macOS, to be able to add a qt.conf for the tools generically. Task-number: QTCREATORBUG-23120 Change-Id: I16625d48904abd3a7f4c2ad7bbba5916cdc400cd Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CMake Build: Use same Qt compiler defines for testsCristian Adam2019-09-102-6/+4
| | | | | | | Source code needed adjustments though. Change-Id: I78b4610a6bb895a385c7c30a6c92c97a276b89dd Reviewed-by: hjk <hjk@qt.io>
* Standardize on int for line and column valueshjk2019-07-2610-291/+291
| | | | | | | | | | | | | | | Recently tons of warnings show up for presumably "problematic" singned <-> unsigned and size conversions. The Qt side uses 'int', and that's the biggest 'integration surface' for us, so instead of establishing some internal boundary between signed and unsigned areas, push that boundary out of creator core code, and use 'int' everywhere. Because it reduces friction further, also do it in libcplusplus. Change-Id: I84f3b79852c8029713e7ea6f133ffb9ef7030a70 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Avoid warning on empty expressionshjk2019-07-233-9/+9
| | | | | | | | For some reason, Q_UNUSED includes already a semicolon, adding one on the user side creates an additional empty statement. Change-Id: I9c5e8fac381345a60792cb75e2938fd53958d3b0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* C++: Support single quote digit separator in integer literalsJoel Smith2019-07-091-1/+8
| | | | | | | | | | C++14 supports the use of single quotes inserted between integer digits as a separator. Updates the built-in C++ code model to recognize such quotes. This fixes highlighting and indentation issues. Change-Id: Ic35ce93060b96700a11d108dce1f3cf6c4543632 Fixes: QTCREATORBUG-14939 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang build: Fix compilation with MSVC2017v4.10.0-beta1Cristian Adam2019-06-171-1/+1
| | | | | Change-Id: I677614dc8f9de503131d8ac490a723c9fc5f7beb Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* CPlusPlus: Avoid a few deprecation warningshjk2019-06-055-9/+7
| | | | | | | The alternatives have been around since 2012. Change-Id: I0aa15d59efe8a547e2ad622ffda689746960d48c Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Qt Creator CMake portCristian Adam2019-05-1716-0/+75
| | | | | | | | | | | | | | Based on Tobias Hunger's work from a few months ago. The CMake configuration needs libclang and Qt paths specified as CMAKE_PREFIX_PATH. Auto tests are run with "ctest". At the moment the pass rate is 87%. Change-Id: Iba98e39bf22077d52706dce6c85986be67a6eab0 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* C++: fix StarBindFlags behaviorXiaofeng Wang2019-01-301-4/+8
| | | | | | | | Without Overview::BindToIdentifier, a space between return type(endsWithPtrOrRef) and identifier should be added. Change-Id: I3cd2d053bf137b35a58e7422f45cbd5b96eeb151 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CPlusPlus: Block function-like macro name for arguments expansionIvan Donchevskii2019-01-171-0/+57
| | | | | | | | | | | | | | Arguments of funstion-like macro may contain the name of this macro. The attempt to expand it results into infinite recursion. Patch solves that by saving the macro name until the arguments are collected to determine that it should not be expanded. Fixes: QTCREATORBUG-21642 Change-Id: Iafb404ecd3959a2f1011c12c1c3f1c0c54ed3547 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* C++: Fix parsing enum specifier IINikolai Kosjar2018-10-241-0/+9
| | | | | | | | | | | | This amends the obviously wrong de975aca4f08141b1c6475e58f5cfa316fdd1350, which did not honored nameless enum specifiers. This fixes e.g. "Find Usages" for declarations following "enum {};". Change-Id: Id98c074156f576b9a63e6c25dab38721ca34e496 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Add support for nested namespaces (C++17)Colin Duquesnoy2018-02-094-0/+10
| | | | | | Task-number: QTCREATORBUG-16774 Change-Id: I3de3ac65810213e21c9a3bafef2474d252e191f7 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* C++: Fix crash with invalid raw string literalNikolai Kosjar2017-09-202-0/+21
| | | | | | | | | | | | | | | | While parsing a document Bind::asStringLiteral() Token::spell() was called for a raw string literal token with a Token::literal nullptr. This is due scanRawStringLiteral() not properly aborting for invalid/incomplete code and that the code paths handling multi-line-raw-strings were not limited to the highlighting case. Address both cases. Task-number: QTCREATORBUG-18941 Change-Id: I489d288ccbd7b59be396dada846613ff555436cf Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Fix that raw string literals that close on same line were not terminatedEike Ziller2017-05-191-0/+16
| | | | | | | | With the built-in model, which affects basic highlighting. Task-number: QTCREATORBUG-17720 Change-Id: I7369d7288d9c2c8e5ef36fc27549121014527e58 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Merge remote-tracking branch 'origin/4.2'Eike Ziller2017-02-271-0/+46
|\ | | | | | | Change-Id: I9006dd493707ae626ae3502541599c8789e1aab0
| * C++: Avoid inline namespaces in generated codeNikolai Kosjar2017-02-231-0/+46
| | | | | | | | | | | | | | 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-224-4/+4
|/ | | | | | | Format initializer lists code style like. Change-Id: Ib82c235e4ba7dc75ee96a7abc0c47eff7b0a9013 Reviewed-by: hjk <hjk@qt.io>
* C++: Enable showEnclosingTemplate also for function typeOrgad Shaneh2016-09-061-1/+3
| | | | | | | 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-234-2/+12
| | | | | | | | | | | | 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-191-0/+26
| | | | | Change-Id: Ib228184e1259585eeac61b9196195c39a9550cb9 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* C++: Fix compilation of tst_lexer.cppNikolai Kosjar2016-06-271-1/+1
| | | | | | | | | | ...with MSVC2013. tst_lexer.cpp(406) : error C2398: Element '1': conversion from 'CPlusPlus::Kind' to 'unsigned int' requires a narrowing conversion Change-Id: I1c9415cb02d2f0fa85d48a1abbc688d8f53b5b43 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* C++: Add support of ref-qualifier for functions.Dmitry Ashkadov2016-06-222-0/+140
| | | | | | | | | | 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>
* C++: Fix lexing of >> / >>=Philip Lorenz2016-06-221-0/+79
| | | | | | | | The current code always ends up setting the token to T_GREATER_GREATER. Change-Id: If75ff1f5bccffd5918ec2bf491724cd0981220ae Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* CppTools: Separate highlighting for function declarations and callsOrgad Shaneh2016-06-201-63/+70
| | | | | | Task-number: QTCREATORBUG-15564 Change-Id: Iab1b60e19448202432f98295c89769cd376aa03f Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Merge remote-tracking branch 'origin/4.0'Eike Ziller2016-05-031-0/+36
|\ | | | | | | | | | | | | | | | | | | | | 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++: Guard against parent binding loopNikolai Kosjar2016-04-271-0/+36
| | | | | | | | | | | | Task-number: QTCREATORBUG-16146 Change-Id: Ib2a790954517859acd7ca5f16c7d889d28208fb0 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Merge remote-tracking branch 'origin/4.0'Eike Ziller2016-04-201-0/+29
|\ \ | |/ | | | | | | | | | | | | Conflicts: src/plugins/projectexplorer/session.cpp src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp Change-Id: I6946139f5e5fa3a9cdbb322fd50be248e2c0133f
| * C++: Fix accessing invalid file id of SymbolNikolai Kosjar2016-04-181-0/+29
| | | | | | | | | | | | | | | | | | | | | | Symbol::_fileId can be null if the Symbol was created with a null translation unit. That is the case for temporary symbols created for lookup purposes (CreateBindings has a _control with no translation unit and thus creates symbols with no fileId). Task-number: QTCREATORBUG-15967 Change-Id: Iee518b39ba3b636fe1658e74179db3aad054d6f2 Reviewed-by: Orgad Shaneh <orgads@gmail.com>