Commit Graph

24 Commits

Author SHA1 Message Date
Ivan Donchevskii
1b0cba38dd Clang: Fix access specifier for variables
Static members have a variable declaration kind so
we need to check their access specifiers in order to
provide proper information about tokens.

Fixes: QTCREATORBUG-22082
Change-Id: If455174bd346398a2df3499fa6cf1ea2b4e26965
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-03-12 14:19:48 +00:00
Marco Bubke
15df73a8ba Clang: Fix output arguments highlighting for constructor parameters
The are not any more shown but they are still not shown for constructor
arguments because libClang is providing the wrong argument count.

Task-number: QTCREATORBUG-21543
Change-Id: If9b6140ed4b2dedf71bd94aae0a97669cdd04e67
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-27 08:51:35 +00:00
Nikolai Kosjar
f56ec051b0 Clang: Fix TokenProcessor.Qt* tests
With the upgrade to clang 7 these started to fail on Linux.

Something changed in clang regarding the processing of our
wrappedQtHeaders/QtCore/qobjectdefs.h. Since we can't rely on the
include paths of Qt in the tests anyway, inline the relevant
preprocessor directives into the test file to make the tests
independent of that.

Change-Id: Iba5cdc5483c3007346346d294374598a75fcb5a1
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-27 07:34:10 +00:00
Ivan Donchevskii
50e5aacb02 Highlighting: Add highlighting style for punctuation
Currently only operators have their own style but not
punctuation tokens. Make possible to highlight both.

Task-number: QTCREATORBUG-20666
Change-Id: I9533e0f1bef65b86c4e4f5c9756571103584124b
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-13 11:15:05 +00:00
Ivan Donchevskii
e92b46073e Clang: Fix unit-test failures caused by Clang update
Failing tests:
TokenProcessor.TemplateFunctionCall
TokenProcessor.TemplateClassDeclaration

Do not introduce fatal error in test source file.
Otherwise template function is not recognized anymore.

Such template calls were also broken before but could
provide a valid Cursor kind. So it's a minor regression
in Clang but does not change anything for Qt Creator user.
Bug is reported: https://bugs.llvm.org/show_bug.cgi?id=37550

Change-Id: I788e8d9f88141cfefc6bbde77f36c459d91aff0b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-05-24 09:44:30 +00:00
Ivan Donchevskii
ce032552c0 Clang: Support old-style SIGNAL/SLOT macro
Color types and enable Ctrl+click for the functions
and types inside SIGNAL/SLOT macros.

Change-Id: Ic1c0b7372fe9a73c5607b1973d75a6656c75ef0e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-05-03 13:34:21 +00:00
Hugo Holgersson
142ae0cdf9 Clang: Add semantic C++ operator-token styling
We used to style overloaded operators in the same way
as C++'s built-in operators. There was no way to tell
if a + token would call a operator+() function or not.

Now, if an operator is overloaded (redefined),
we give it the "Overloaded Operator"-mixin so users
can style it differently.

Note: Calls to overloaded 'new' and 'delete' are not
highlighted by "Overloaded Operator". This is because
clang today always maps these to CXCursor_CXXNewExpr
and CXCursor_CXXDeleteExpr with cursor.spelling == ""
(empty string). So there is no (?) quick way for us
to tell if a new/delete-token was overloaded or not.

After follow-ups, follow symbol will work for operator
overload usages in current translation unit.
Commit is appended by Ivan Donchevskii.

Task-number: QTCREATORBUG-19659
Change-Id: I157855d482a61ad2059642a1ee982089fcb7d312
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-30 15:10:12 +00:00
Ivan Donchevskii
84b983617f Clang: Support anonymous types in tokens
Add extra data to Keyword tokens.
Does not affect highlighting.

Change-Id: I206499ea35ee4ece5fe442665c904090cf5d90fc
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-04-12 06:51:07 +00:00
Ivan Donchevskii
66c7629814 Clang: Properly handle Q_PROPERTY in TokenInfo
Transform Q_PROPERTY into unique AST node.
Mark different parts with types and search for parent
in FullTokenInfos.

Change-Id: Iaa1ec0c73d34773edf5605d3682bd6a290d195de
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-02-20 06:49:47 +00:00
Eike Ziller
5432dd1f5c Merge remote-tracking branch 'origin/4.6'
Conflicts:
	src/plugins/coreplugin/locator/locator.cpp
	src/plugins/imageviewer/imageviewerplugin.cpp
	src/plugins/remotelinux/remotelinuxplugin.cpp
	src/tools/clangbackend/source/tokeninfo.cpp
	tests/unit/unittest/data/highlightingmarks.cpp

Change-Id: I74cc3ba3a2836cb9d0e65d3380d8c4f88d720c67
2018-02-07 11:58:23 +01:00
Ivan Donchevskii
bdd5066665 Clang: introduce more data in TokenInfo
Data added:
- return type spelling for functions
- parent spelling
- access specifier for class fields and methods
- storage class

New highlighting types are added, therefore
types are now categorized by class, struct, etc.

Change-Id: I1739b94a6f777045fde655060d8b9a12b6e0889b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-02-02 07:01:28 +00:00
Nikolai Kosjar
4f20c0d4ed Clang: Highlight invalid declarations as text
...instead of the corresponding declaration color.

Task-number: QTCREATORBUG-18686
Change-Id: Ice4d84816351af79efa286f49516c392bd80da86
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-01 14:12:58 +00:00
Hugo Holgersson
bf3c67e0d0 TextEditor: Implement highlighting of function definitions
This allows users to style function names at their definitions.

Once set, the XML-style token "FunctionDefinition" will
highlight all function definitions: the style option is a
mixin to Function and Virtual Function.

TEST=Default themes and locally hacked themes that lack Function,
FunctionDefinition, Declaration-styling look as they did before
this patch.

Requires Clang.

Task-number: QTCREATORBUG-16625
Change-Id: I49d8e401211bdf28ff74699feac16fe98f6d64ce
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-11-28 12:54:29 +00:00
Nikolai Kosjar
c0364564a4 Clang: Fix highlighting of template function in using declaration
This completes

    commit a3a62e78f7
    Clang: Fix highlighting of function in using declaration

Change-Id: I3c163096374d7a1f45a590bb8ebfe5f5a1f8d417
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-08-14 12:46:43 +00:00
Marco Bubke
99af4ae8e6 Clang: Show all tokens of a getter as output argument
f(x.get()); -> x.get() should be shown as a output argument

Task-number: QTCREATORBUG-18591
Change-Id: I99f5637660bcd0a889338ebfa6737d79de226f87
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-07-24 14:31:23 +00:00
Marco Bubke
9b5d6546b8 Clang: Remove pointer arguments from output argument
Non constant pointers are used many times as non output arguments, so you
get misleading information.

Task-number: QTCREATORBUG-18591
Change-Id: Ic5f987db44ad63a0b1a38fd59cd807db5f2acc8f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-07-24 13:27:29 +00:00
Nikolai Kosjar
1623af0da5 Clang: Add a disabled test for highlighting
In the example below, "var" is highlighted as a function, but it should
be highlighted as a local variable.

  struct OtherOperator { void operator()(int); };
  void g(OtherOperator o, int var)
  {
      o(var);
  }

This is due to a libclang bug.

Change-Id: I7c9fcad6f16c25191d31fc330e969ebd282d4869
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-06-16 06:09:19 +00:00
Nikolai Kosjar
e6bf399003 Clang: Stop highlighting keywords in preprocessor directives
Task-number: QTCREATORBUG-15516
Change-Id: I30046ae7c1a73144985639800227012bf5a4e357
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-06-14 10:00:02 +00:00
Nikolai Kosjar
a3a62e78f7 Clang: Fix highlighting of function in using declaration
Change-Id: I0f646ce22cdc95e5932650a3fb2fe34b8d4a89a3
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-06-01 13:33:07 +00:00
Nikolai Kosjar
e6c8fbfd92 Clang: Fix highlighting for partial specialization
Change-Id: I53f6a87064d45a3a68394d1b3bc0d767b91a9d11
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-06-01 13:33:00 +00:00
Marco Bubke
9dfa210011 Clang: Partial fix for highlighting off output arguments
We get the source range for the parameter list and not the arguments
in the initializer list back. So we have to disable the test case.

Task-number: QTCREATORBUG-17101
Change-Id: I65ec6d111766b5728a951b024576cbf777c89728
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-11-24 16:54:01 +00:00
Marco Bubke
b196368785 Clang: Add disabled test case for HighlightingMarks
Constructors are not recognized by libClang as callable expressions.

Task-number: QTCREATORBUG-17101
Change-Id: I40eb46c07475e3b2e48bc8117de073732005f8b9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-11-23 14:47:33 +00:00
Marco Bubke
63ae993bf2 Clang: Add output argument highlighting
This adds a mix-in for writable functions arguments.

Change-Id: I758f7fef77d992ea25395db550571ccb081fd5fd
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-10-12 08:01:48 +00:00
Marco Bubke
2349b13ae5 Clang: Rename HighlightingInformation to HighlightingMark
Change-Id: I3954c7c9abe593ea04092337f48ac2b153e883ba
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-03-07 12:06:40 +00:00