Commit Graph

22 Commits

Author SHA1 Message Date
Alexandru Croitor
bed88818ce C++: Implement context-aware expand / shrink selection actions.
Implement selection expanding / shrinking, that is aware of C++
semantics, thus giving smart selection changing.

Change-Id: I1386a20597fa6bb85c3aa0d8ddfb87cdb3fd7c38
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-02-29 08:15:03 +00:00
Nikolai Kosjar
6b6ad446eb CppTools: Make FollowSymbol respect projects
Finding the class definition for a forward declaration or finding the
function definition from its declaration is mostly determined by the
file iteration order. Documents with the most common path prefix are
checked first.

This works fine as long as the files of your project have a common
ancestor. If that's not the case, FollowSymbol might take you to the
definition within another project.

Fix that issue by considering the project part id when constructing the
file iteration order. Since the cached file iteration order now depends
on the projects, ensure to clear it if projects are added, changed or
removed.

Task-number: QTCREATORBUG-15116
Change-Id: I529166bac363959c9fee0b946747fd0370a88809
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-10-12 15:08:24 +00:00
Wang Hoi
c56b999fff C: Parser: Support parsing of c99 designated initializers
In case:

    int a[6] = { [4] = 29, [2] = 15 };
    struct point { int x, y; };
    struct point p = { .y = 3, .x = 2 };

Grammar change when c99 language feature is enabled:
old grammar:

    braced-init-list :: '{' initializer-list '}'

new grammar:

    braced-init-list :: '{' designated-initializer-list '}'
    designated-initializer-list :: designated-initializer (',' designated-initializer )*
    designated-initializer :: designator* initializer-clause
    designator :: '.' identifier
                | '[' constant-expression ']'

Task-number: QTCREATORBUG-1902
Change-Id: Ib99d6f553f8d0f50ba3eff86f3a2e86d73372426
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-06-17 16:23:23 +02:00
Nikolai Kosjar
70122b3061 C++: Support for UTF-8 in the lexer
This will save us toLatin1() conversations in CppTools (which already
holds UTF-8 encoded QByteArrays) and thus loss of information (see
QTCREATORBUG-7356). It also gives us support for non-latin1 identifiers.

API-wise the following functions are added to Token. In follow-up
patches these will become handy in combination with QStrings.
    utf16chars() - aequivalent of bytes()
    utf16charsBegin() - aequivalent of bytesBegin()
    utf16charsEnd() - aequivalent of bytesEnd()

Next steps:
 * Adapt functions from TranslationUnit. They should work with utf16
   chars in order to calculate lines and columns correctly also for
   UTF-8 multi-byte code points.
 * Adapt the higher level clients:
    * Cpp{Tools,Editor} should expect UTF-8 encoded Literals.
    * Cpp{Tools,Editor}: When dealing with identifiers on the
      QString/QTextDocument layer, code points
      represendet by two QChars need to be respected, too.
 * Ensure Macro::offsets() and Document::MacroUse::{begin,end}() report
   offsets usable in CppEditor/CppTools.

Addresses QTCREATORBUG-7356.

Change-Id: I0791b5236be8215d24fb8e38a1f7cb0d279454c0
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-05-23 14:23:15 +02:00
hjk
df2ecb4edd Move the textual simplification of container type to debugger again
This is the only user, and likely will stay so for a while, and
eases the linking of the debugger autotests.

Change-Id: I822fa892f105a5b7985370b26e50aa94cac74bb3
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-01-08 14:49:35 +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
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
Roberto Raggi
5fb624b1db Fix semantic of C++ 11 inline namespaces.
Add the declaring `inline' namespace to the `using list' of its
enclosing namespace symbol. This should be enough to ensure
the correct visibility of the symbols declarated in the inlined
namespace.

Change-Id: Id4de74577c498fe439a49709a306ef0deb145988
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2012-02-03 15:37:17 +01:00
Christian Kamm
bc1b724476 C++: Move codegen test into the CppTools plugin.
Change-Id: I4c70a9dbd5445188c3d202427da96e1c6ff90b63
Reviewed-by: Bill King <bill.king@nokia.com>
2011-11-15 15:37:29 +01:00
Erik Verbruggen
6d00ff37f3 Added tests for the DiagnosticClient. 2011-02-17 11:20:50 +01:00
Friedemann Kleint
2960c735df Debugger/CPP: Move helpers to simplify types to CPlusPlus-lib.
Make available for log simplification, etc.
Add autotest, fix broken std::set and MSVC.

Rubber-stamped-by: Christian Kamm <christian.d.kamm@nokia.com>
2010-11-25 13:51:54 +01:00
Bill King
eb498ee428 Tests: some cleanup of pro files, marking of tested components. 2010-09-06 14:19:32 +10:00
Bill King
5b2fb4bb67 Fixes: get tests compiling again that depend on the cpp library
Details:  This gets the tests running again, by statically linking
them. qmake doesn't have support for depending upon other projects
being built, so when the projects are built out of order, libCPlusPlusTest.so
wasn't being built before trying to be linked against.
2010-08-19 11:56:53 +10:00
Erik Verbruggen
a8179152c9 Added tests for the InsertionPointLocator and fixed bugs. 2010-07-28 12:10:11 +02:00
Christian Kamm
88f2e340bd C++: Introduce the new CodeFormatter.
Done-with: Erik Verbruggen
2010-07-02 16:13:12 +02:00
Christian Kamm
59778cafd5 CPlusPlus: Fix several issues in the TypePrettyPrinter.
* Fix cv qualifiers being placed incorrectly.
* Fix nested pointer to array to pointer being printed incorrectly.
* Add autotest.

Task-number: QTCREATORBUG-1037
2010-04-19 09:55:35 +02:00
Erik Verbruggen
d7994a886f Added tests for FindUsages in Objective-C code. 2010-02-11 10:02:00 +01:00
Roberto Raggi
f4e875b9bb Initial testing of the preprocessor. 2009-03-02 11:30:43 +01:00
Roberto Raggi
1f9bcd86e0 Added a simple auto test for the name lookup. 2009-02-09 10:21:29 +01:00
Roberto Raggi
3050034c2b Compile the semantic test suite. 2008-12-22 10:56:47 +01:00
Roberto Raggi
5dcd396254 Compile. 2008-12-15 11:41:01 +01:00
Roberto Raggi
fc28553573 Initial work on a test suite for our C++ engine. 2008-12-15 11:35:38 +01:00